From 9e4140329ee9a787d0f96ac2829d618d47f7973f Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 4 Feb 2014 17:24:24 +0900 Subject: kbuild: change out-of-tree build This commit changes the working directory where the build process occurs. Before this commit, build process occurred under the source tree for both in-tree and out-of-tree build. That's why we needed to add $(obj) prefix to all generated files in makefiles like follows: $(obj)u-boot.bin: $(obj)u-boot Here, $(obj) is empty for in-tree build, whereas it points to the output directory for out-of-tree build. And our old build system changes the current working directory with "make -C " syntax when descending into the sub-directories. On the other hand, Kbuild uses a different idea to handle out-of-tree build and directory descending. The build process of Kbuild always occurs under the output tree. When "O=dir/to/store/output/files" is given, the build system changes the current working directory to that directory and restarts the make. Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=" syntax for descending into sub-directories. (We can write it like "make $(obj)=" with a shorthand.) This means the current working directory is always the top of the output directory. Signed-off-by: Masahiro Yamada Tested-by: Gerhard Sittig --- config.mk | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) (limited to 'config.mk') diff --git a/config.mk b/config.mk index ed1a51972f..0fa316743c 100644 --- a/config.mk +++ b/config.mk @@ -6,42 +6,6 @@ # ######################################################################### -ifeq ($(CURDIR),$(SRCTREE)) -dir := -else -dir := $(subst $(SRCTREE)/,,$(CURDIR)) -endif - -ifneq ($(OBJTREE),$(SRCTREE)) -# Create object files for SPL in a separate directory -ifeq ($(CONFIG_SPL_BUILD),y) -ifeq ($(CONFIG_TPL_BUILD),y) -obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/) -else -obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/) -endif -else -obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/) -endif -src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/) - -$(shell mkdir -p $(obj)) -else -# Create object files for SPL in a separate directory -ifeq ($(CONFIG_SPL_BUILD),y) -ifeq ($(CONFIG_TPL_BUILD),y) -obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/) -else -obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/) - -endif -$(shell mkdir -p $(obj)) -else -obj := -endif -src := -endif - # clean the slate ... PLATFORM_RELFLAGS = PLATFORM_CPPFLAGS = @@ -52,14 +16,14 @@ PLATFORM_LDFLAGS = # Load generated board configuration ifeq ($(CONFIG_TPL_BUILD),y) # Include TPL autoconf -sinclude $(OBJTREE)/include/tpl-autoconf.mk +sinclude include/tpl-autoconf.mk else ifeq ($(CONFIG_SPL_BUILD),y) # Include SPL autoconf -sinclude $(OBJTREE)/include/spl-autoconf.mk +sinclude include/spl-autoconf.mk else # Include normal autoconf -sinclude $(OBJTREE)/include/autoconf.mk +sinclude include/autoconf.mk endif endif sinclude $(OBJTREE)/include/config.mk -- cgit v1.2.3