Commit 4d713be1397ed03b405ad37830208d5ab21268cb

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent ba84de9f13

kbuild: use relative path more to include Makefile

Prior to this commit, it was impossible to use relative path to
include Makefiles from the top level Makefile because the option
"--include-dir=$(srctree)" becomes effective when Make enters into
sub Makefiles.

To use relative path in any places, this commit moves the option
above the "sub-make" target.

This was imported from Linux (commit a436bb7b8063) and adjusted for
U-Boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 1 changed file with 9 additions and 11 deletions Side-by-side Diff

... ... @@ -10,9 +10,10 @@
10 10 # Comments in this file are targeted only to the developer, do not
11 11 # expect to learn how to build the kernel reading this file.
12 12  
13   -# Do not use make's built-in rules and variables
14   -# (this increases performance and avoids hard-to-debug behaviour);
15   -MAKEFLAGS += -rR
  13 +# o Do not use make's built-in rules and variables
  14 +# (this increases performance and avoids hard-to-debug behaviour);
  15 +# o Look for make include files relative to root of kernel src
  16 +MAKEFLAGS += -rR --include-dir=$(CURDIR)
16 17  
17 18 # Avoid funny character set dependencies
18 19 unexport LC_ALL
19 20  
... ... @@ -319,12 +320,9 @@
319 320 export KBUILD_MODULES KBUILD_BUILTIN
320 321 export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
321 322  
322   -# Look for make include files relative to root of kernel src
323   -MAKEFLAGS += --include-dir=$(srctree)
324   -
325 323 # We need some generic definitions (do not try to remake the file).
326   -$(srctree)/scripts/Kbuild.include: ;
327   -include $(srctree)/scripts/Kbuild.include
  324 +scripts/Kbuild.include: ;
  325 +include scripts/Kbuild.include
328 326  
329 327 # Make variables (CC, etc...)
330 328  
... ... @@ -518,8 +516,8 @@
518 516 autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer \
519 517 include/config/auto.conf)
520 518 ifeq ($(autoconf_is_old),)
521   -include $(srctree)/config.mk
522   -include $(srctree)/arch/$(ARCH)/Makefile
  519 +include config.mk
  520 +include arch/$(ARCH)/Makefile
523 521 endif
524 522 endif
525 523 endif
... ... @@ -595,7 +593,7 @@
595 593  
596 594 export CONFIG_SYS_TEXT_BASE
597 595  
598   -include $(srctree)/scripts/Makefile.extrawarn
  596 +include scripts/Makefile.extrawarn
599 597  
600 598 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
601 599 KBUILD_CPPFLAGS += $(KCPPFLAGS)