[Buildroot] Out of tree builds (was Re: svn commit: trunk/buildroot)
Peter Korsgaard
jacmet at uclibc.org
Mon Jun 23 13:58:14 UTC 2008
>>>>> "jacmet" == jacmet <jacmet at uclibc.org> writes:
Hi,
jacmet> Author: jacmet
jacmet> Date: 2008-06-23 06:47:37 -0700 (Mon, 23 Jun 2008)
jacmet> New Revision: 22481
jacmet> Log:
jacmet> Makefile: don't include .config from TOPDIR
jacmet> If we ever want to support building out of tree, having the
jacmet> .config in the tree is probably not what we want.
Do we want to support out of tree builds? The toplevel Makefile has
had a TOPDIR variable since forever, but it'll take a bit of work to
get it running.
The basics are easy to do, E.G.:
diff --git a/Makefile b/Makefile
index 73d9208..b81d330 100644
--- a/Makefile
+++ b/Makefile
@@ -21,10 +21,17 @@
# Just run 'make menuconfig', configure stuff, then run 'make'.
# You shouldn't need to mess with anything beyond this point...
#--------------------------------------------------------------
-TOPDIR=./
-CONFIG_CONFIG_IN=Config.in
-CONFIG_DEFCONFIG=.defconfig
+
+# buildroot sources are in same directory as Makefile
+TOPDIR:=$(dir $(firstword $(MAKEFILE_LIST)))
+
+# for kbuild
+srctree:=$(TOPDIR)
+export srctree
+
+CONFIG_CONFIG_IN=$(TOPDIR)/Config.in
+CONFIG_DEFCONFIG=$(TOPDIR)/.defconfig
-CONFIG=package/config
+CONFIG=$(TOPDIR)/package/config
DATE:=$(shell date +%Y%m%d)
noconfig_targets:=menuconfig config oldconfig randconfig \
But the big issue is everywhere we expect to be in the source
directory, so we'll need to prepend $(TOPDIR)/ to every include line
(make -I doesn't work for wildcards), patch-kernel.sh calls and so on.
With all that in place it should be possible to do:
% mkdir build && cd build
% make -f /path/to/buildroot/Makefile menuconfig
% make -f /path/to/buildroot/Makefile
What do you say?
--
Bye, Peter Korsgaard
More information about the buildroot
mailing list