[klibc] [PATCH 03/16] Allow override of klibc .config location

Mike Waychison mikew at google.com
Mon Mar 1 23:45:44 PST 2010


Parameterize the location of the .config file so that it can be placed
elsewhere for builds that require a pristine source tree.

Signed-off-by: Mike Waychison <mikew at google.com>
---
 Makefile             |   11 ++++++-----
 scripts/Kbuild.klibc |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 4380727..dcee00e 100644
--- a/Makefile
+++ b/Makefile
@@ -42,7 +42,8 @@ export INSTALLROOT =
 
 # Create a fake .config as present in the kernel tree
 # But if it exists leave it alone
-$(if $(wildcard $(objtree)/.config),,$(shell cp defconfig .config))
+$(if $(wildcard $(objtree)/.config),,\
+  $(shell cp $(srctree)/defconfig $(objtree)/.config))
 
 # Prefix Make commands with $(Q) to silence them
 # Use quiet_cmd_xxx, cmd_xxx to create nice output
@@ -84,7 +85,7 @@ klibc := -f $(srctree)/scripts/Kbuild.klibc obj
 .PHONY: all klcc klibc
 all: klcc klibc
 
-.config: defconfig $(KLIBCKERNELSRC)
+$(objtree)/.config: $(srctree)/defconfig $(KLIBCKERNELOBJ)
 	@echo "defconfig has changed, please remove or edit .config"
 	@false
 
@@ -101,10 +102,10 @@ klibc.spec: klibc.spec.in $(KLIBCSRC)/version
 	sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
 
 # Build klcc - it is the first target
-klcc: .config
+klcc: $(objtree)/.config
 	$(Q)$(MAKE) $(klibc)=klcc
 
-klibc: .config
+klibc: $(objtree)/.config
 	$(Q)$(MAKE) $(klibc)=.
 
 test: klibc
@@ -137,7 +138,7 @@ clean:
 		   -name '.*.d' -o -name '.*.tmp' \) \
 		-type f -print | xargs rm -f
 
-rm-files := .config linux
+rm-files := $(objtree)/.config linux
 distclean mrproper: clean
 	 $(Q)find . $(FIND_IGNORE) \
 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 1ab71fc..78bc665 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -58,7 +58,7 @@ targets :=
 __build:
 
 # Read .config if it exist, otherwise ignore
--include .config
+-include $(objtree)/.config
 
 # Generic Kbuild routines
 include $(srctree)/scripts/Kbuild.include



More information about the klibc mailing list