kbuild: Separate build directory
I have updated the patch to support separate build directory to kernel 2.5.53.
o Roman Zippel has updated and merged to chenges to kconfig, therefore this patch is rather small.
o Also introduced comments from Kai with respect to -I option handling for gcc.
o Introduced a Makefile for arch/i386/boot/tools to force the directory to be created by kbuild.
Has the side-effect that host-progs := .../... now adhere to normal kbuild rules, where a Makefile is always present. Furthermore allow host-progs to be used for composite objects in subdirectories now.
o Updated ppc and X86_64 to use a Makefile for their tools. ppc actually had a non-used Makefile.
A new script 'kbuild' is located in the top-level directory of the kernel srctree. To try out this patch just do
cd ~/build
../path/to/kernel/src/kbuild
This will locate all generated files, including
the kernel configuration, in ~/build.
One obvious usage for this is when you have several configs. One config in each build directory, and all src stored in a central place.
This patch has been tested with i386 and defconfig.
Kai, please apply and forward to Linus.
Sam
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[email protected], 2002-12-27 14:42:40+01:00, [email protected]
kbuild: Support for separate build directory
See usage description in the kbuild script located in the top-level kernel src directory. Utilising the VPATH feature of make, support for separate build directory is introduced. The -I options to gcc is preprocessed to point both to the kernel src and to the objtree where generated files lives.
the top-level Makefile is modified to locate values for srctree and objtree from the file kbuild.config (if present) - this file is generated by the kbuild script.
The kbuild scripts obtains the location of the kernel src tree from it's own location, and therefore cannot be moved somewhere else.
Based on concept by Kai Germaschewski, which has also made the preparations throughout the makefiles.
[email protected], 2002-12-25 21:15:27+01:00, [email protected]
kbuild: X86_64+ppc, Makefile for tools
Added (X86_64) and corrected (ppc) makefile for tools in arch specific directory. This makes all architectures compatible with change in semantic of host-progs.
[email protected], 2002-12-25 21:08:40+01:00, [email protected]
kbuild: host-progs specifying a subdirectory now assumes a Makefile
When including subdirectories in a host-progs line for example:
host-progs := tools/build
then adhere to nomal behaviour, and use a makefile present in that directory. Add makefile for build executable for i386
Makefile | 27 ++++++++++++++++------- arch/ppc/boot/utils/Makefile | 15 ++----------- arch/x86_64/boot/tools/Makefile | 4 +++ kbuild | 46 ++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.build | 30 +++++++++++++++++--------- 5 files changed, 92 insertions(+), 30 deletions(-)
Makefile +19 -8
@@ -136,13 +136,19 @@ export quiet Q KBUILD_VERBOSE # Paths to obj / src tree - -src := . -obj := . +ifneq ($(wildcard kbuild.config),) +include kbuild.config +src := $(srctree) +obj := . +VPATH := $(srctree) +else +src := . +obj := . srctree := . objtree := . +endif -export srctree objtree +export srctree objtree VPATH # Make variables (CC, etc...)
@@ -313,7 +319,7 @@ set -e $(if $(filter .tmp_kallsyms%,$^),, echo ' Generating build number' - . scripts/mkversion > .tmp_version + . $(src)/scripts/mkversion > .tmp_version mv -f .tmp_version .version $(Q)$(MAKE) -f scripts/Makefile.build obj=init )
@@ -329,7 +335,7 @@ ifdef CONFIG_SMP define rule_vmlinux $(rule_vmlinux_no_percpu) - $(AWK) -f scripts/per-cpu-check.awk < System.map + $(AWK) -f $(srctree)/scripts/per-cpu-check.awk < System.map endef else define rule_vmlinux
@@ -426,7 +432,11 @@ include/asm: @echo ' Making asm->asm-$(ARCH) symlink' +ifeq ($(srctree),$(objtree)) @ln -s asm-$(ARCH) $@ +else + @ln -s $(src)/include/asm-$(ARCH) $@ +endif # Split autoconf.h into include/linux/config/*
@@ -451,6 +461,7 @@ uts_len := 64 include/linux/version.h: Makefile + @mkdir -p $(dir $@) @if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ exit 1; \
@@ -619,7 +630,7 @@ tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \ rm $(KERNELPATH) ; \ cd $(TOPDIR) ; \ - . scripts/mkversion > .version ; \ + $(CONFIG_SHELL) $(srctree)/scripts/mkversion > .version ; \ rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ rm $(TOPDIR)/../$(KERNELPATH).tar.gz
@@ -706,7 +717,7 @@ include/asm \ .hdepend include/linux/modversions.h \ tags TAGS kernel.spec \ - .tmp* + .tmp* kbuild.config # Directories removed with 'make mrproper' MRPROPER_DIRS += \
arch/ppc/boot/utils/Makefile +3 -12
@@ -5,16 +5,7 @@ # License. See the file "COPYING" in the main directory of this archive # for more details. -HOSTCFLAGS += -I$(TOPDIR)/arch/$(ARCH)/boot/include +host-progs := addnote hack-coff mkprep mknote mkbugboot mktree \ + addSystemMap addRamdDisk -all: FORCE - -# Simple programs with 1 file and no extra CFLAGS -UTILS = addnote hack-coff mkprep mknote mkbugboot mktree \ - addSystemMap addRamdDisk - -$(UTILS): - $(HOSTCC) $(HOSTCFLAGS) -o $@ [email protected] - -clean: - rm -f $(UTILS) +build-targets := $(host-progs)
arch/x86_64/boot/tools/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# Makefile for X86_64 tools + +host-progs := build +build-targets := $(host-progs)
kbuild new file +46 -0
46 lines not on this page · raw message
scripts/Makefile.build +20 -10
@@ -86,26 +86,36 @@ $(multi-objs-y:.o=.s) : modname = $(modname-multi) $(multi-objs-y:.o=.lst) : modname = $(modname-multi) +# With separate build tree, gcc -I option needs to be preprocessed. +# This allows .h files to be located both in objtree and in srctree. +# Additional -I options added to support generated .c and .h files +ifeq ($(srctree),$(objtree)) +flags = $($(1)) +else +flags = -I$(obj) -I$(srctree)/$(obj) $(foreach o,$($(1)),$(o) \ + $(if $(filter -I%,$(o)),$(patsubst -I%,-I$(srctree)/%,$(o)))) +endif + quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ -cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< +cmd_cc_s_c = $(CC) $(call flags,c_flags) -S -o $@ $< %.s: %.c FORCE $(call if_changed_dep,cc_s_c) quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@ -cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< +cmd_cc_i_c = $(CPP) $(call flags,c_flags) -o $@ $< %.i: %.c FORCE $(call if_changed_dep,cc_i_c) quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ -cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +cmd_cc_o_c = $(CC) $(call flags,c_flags) -c -o $@ $< %.o: %.c FORCE $(call if_changed_dep,cc_o_c) quiet_cmd_cc_lst_c = MKLST $@ - cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ + cmd_cc_lst_c = $(CC) $(call flags,c_flags) -g -c -o $*.o $< && \ $(CONFIG_SHELL) $(src)/scripts/makelst $*.o \ System.map $(OBJDUMP) > $@
@@ -121,13 +131,13 @@ $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ -cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< +cmd_as_s_S = $(CPP) $(call flags,a_flags) -o $@ $< %.s: %.S FORCE $(call if_changed_dep,as_s_S) quiet_cmd_as_o_S = AS $(quiet_modtag) $@ -cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< +cmd_as_o_S = $(CC) $(call flags,a_flags) -c -o $@ $< %.o: %.S FORCE $(call if_changed_dep,as_o_S)
@@ -226,7 +236,7 @@ # Create executable from a single .c file # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $< + cmd_host-csingle = $(HOSTCC) $(call flags,hostc_flags) $(HOST_LOADLIBES) -o $@ $< $(host-csingle): %: %.c FORCE $(call if_changed_dep,host-csingle)
@@ -242,7 +252,7 @@ # Create .o file from a single .c file # host-cobjs -> .o quiet_cmd_host-cobjs = HOSTCC $@ - cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< + cmd_host-cobjs = $(HOSTCC) $(call flags,hostc_flags) -c -o $@ $< $(host-cobjs): %.o: %.c FORCE $(call if_changed_dep,host-cobjs)
@@ -258,14 +268,14 @@ # Create .o file from a single .cc (C++) file quiet_cmd_host-cxxobjs = HOSTCXX $@ - cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< + cmd_host-cxxobjs = $(HOSTCXX) $(call flags,hostcxx_flags) -c -o $@ $< $(host-cxxobjs): %.o: %.cc FORCE $(call if_changed_dep,host-cxxobjs) # Compile .c file, create position independent .o file # host-cshobjs -> .o quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< + cmd_host-cshobjs = $(HOSTCC) $(call flags,hostc_flags) -fPIC -c -o $@ $< $(host-cshobjs): %.o: %.c FORCE $(call if_changed_dep,host-cshobjs)
===================================================================
This BitKeeper patch contains the following changesets:
1.952..1.954
## Wrapped with gzip_uu ##
begin 664 bkpatch10561 M'XL(`'Q9##X``^T;:W/:QO:S]2NV-FU-PD,K"2&<NN/$SH.;-/$8I\E,TW$6 M:3$J0J):R8\9?GS/V94R8!-8N9VYE['B4#:/7O>3V6/?!0\/M@1;*SMD3>1 M2YVQBP6C9A=A?THOFS`7WAR%D7PI#F,QKP):YLB=IN!'Z8WS1&/0QXT^Z.F MX).H_U?=U&#]*4O<(;GBL3C8H0US=B>YG?"#G;.7KS^^>WZF:8>'Y'C(PDO> MXPDY/-22*+YB@2>.6#(,HK"1Q"P48YZPAAN-I[.E4T/7#?C3HFU3;]E3:NM6 M>^I2CU)F4>[IAN78UAP:HKT6%C4,2V\9NDFGEDYI6SLAM-%I&40WFM1H&BUB MT/=.;#TISI\T[email protected]\A3D]1U[05Y7#*.-9>,^JD?>=D"!*J3^+H4AQ MX:X_N/7#2\*(2/N>'W,73KXE871-F!#IFMX]!L;\8$?<("OY^&/"1^Z:I MASL7]OFPV@]AP\(9(&).!E%,^T;3P)^!6'A\<JE1()H2.WB6('3F#7G, MX0D@,F8!Z?,AN_*C-*X1%GHD%1P.&6=8D4G,!0\3/#H9LH3,R&@O.>>-U^) M>,B#!ONI@GK9S=]T[&UMZ1E=/2V=CK7**V^X8^FZ4S7?ETNW:EP8W^2B&;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