From owner-freebsd-arch@FreeBSD.ORG Mon Jan 12 00:44:43 2009 Return-Path: Delivered-To: arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C662106564A; Mon, 12 Jan 2009 00:44:43 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id D4D2E8FC16; Mon, 12 Jan 2009 00:44:42 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n0C0h6pe052972; Sun, 11 Jan 2009 17:43:06 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 11 Jan 2009 17:43:27 -0700 (MST) Message-Id: <20090111.174327.-942991712.imp@bsdimp.com> To: das@FreeBSD.ORG From: "M. Warner Losh" In-Reply-To: <20090111191251.GA74450@zim.MIT.EDU> References: <20090111.095109.-1112748421.imp@bsdimp.com> <20090111172427.GD89178@hoeg.nl> <20090111191251.GA74450@zim.MIT.EDU> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: ed@80386.nl, arch@FreeBSD.ORG Subject: Re: Quick hack to make fast kernel builds easier X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2009 00:44:43 -0000 In message: <20090111191251.GA74450@zim.MIT.EDU> David Schultz writes: : On Sun, Jan 11, 2009, Ed Schouten wrote: : > I often just run `make' in /usr/obj/..., : > which also saves some typing, but unfortunately that doesn't work when : > cross compiling. : : Also, as far as I know, there's no convenient way to rebuild a : single module for another architecture. I use the following script : called 'arch' to set the appropriate environment variables, so if : I've already run 'make universe' and I want to rebuild libc for : sparc64, I say: : : cd /usr/src/lib/libc && arch sparc64 make : : It would be nice if there were a better mechanism for this that's : integrated into the build system. : : #!/bin/sh : : arch=$1 : basepath=/usr/src : : export __MAKE_CONF=/dev/null : export MAKEOBJDIRPREFIX=/usr/obj/${arch} : export MACHINE_ARCH=${arch} : export MACHINE=${arch} : export CPUTYPE= : export GROFF_BIN_PATH=/usr/obj/${arch}${basepath}/tmp/legacy/usr/bin : export GROFF_FONT_PATH=/usr/obj/${arch}${basepath}/tmp/legacy/usr/share/groff_font : export GROFF_TMAC_PATH=/usr/obj/${arch}${basepath}/tmp/legacy/usr/share/tmac : export _SHLIBDIRPREFIX=/usr/obj/${arch}${basepath}/tmp : export INSTALL="sh /usr/src/tools/install.sh" : export PATH=/usr/obj/${arch}${basepath}/tmp/legacy/usr/sbin:/usr/obj/${arch}${basepath}/tmp/legacy/usr/bin:/usr/obj/${arch}${basepath}/legacy/usr/games:/usr/obj/${arch}${basepath}/tmp/usr/sbin:/usr/obj/${arch}${basepath}/tmp/usr/bin:/usr/obj/${arch}${basepath}/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin : DESTDIR=/usr/obj/${arch}${basepath}/tmp : : shift : $* Also, the following is similar to what I've used in the past. I think it is a lot simpler and should be functionally equivalent. The key part is to have make tell you what env vars you need to export... #!/bin/sh # fxmake arch subdir make-target arch=$1 dir=$2 shift shift target=${*:-all} makevars=`env TARGET=$arch MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX:-/usr/obj} make buildenvvars` cd $2 && sh -c "${makevars}" make $target Warner