Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

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

authored by

Masahiro Yamada and committed by
Michal Marek
a436bb7b 7aacad53

+16 -18
+10 -12
Makefile
··· 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 ··· 345 344 export COMPILER 346 345 endif 347 346 348 - # Look for make include files relative to root of kernel src 349 - MAKEFLAGS += --include-dir=$(srctree) 350 - 351 347 # We need some generic definitions (do not try to remake the file). 352 - $(srctree)/scripts/Kbuild.include: ; 353 - include $(srctree)/scripts/Kbuild.include 348 + scripts/Kbuild.include: ; 349 + include scripts/Kbuild.include 354 350 355 351 # Make variables (CC, etc...) 356 352 AS = $(CROSS_COMPILE)as ··· 531 533 # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. 532 534 # KBUILD_DEFCONFIG may point out an alternative default configuration 533 535 # used for 'make defconfig' 534 - include $(srctree)/arch/$(SRCARCH)/Makefile 536 + include arch/$(SRCARCH)/Makefile 535 537 export KBUILD_DEFCONFIG KBUILD_KCONFIG 536 538 537 539 config: scripts_basic outputmakefile FORCE ··· 607 609 # Defaults to vmlinux, but the arch makefile usually adds further targets 608 610 all: vmlinux 609 611 610 - include $(srctree)/arch/$(SRCARCH)/Makefile 612 + include arch/$(SRCARCH)/Makefile 611 613 612 614 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) 613 615 ··· 779 781 KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO 780 782 endif 781 783 782 - include $(srctree)/scripts/Makefile.kasan 783 - include $(srctree)/scripts/Makefile.extrawarn 784 + include scripts/Makefile.kasan 785 + include scripts/Makefile.extrawarn 784 786 785 787 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 786 788 KBUILD_CPPFLAGS += $(KCPPFLAGS)
+1 -1
arch/mips/Makefile
··· 225 225 # 226 226 # Board-dependent options and extra files 227 227 # 228 - include $(srctree)/arch/mips/Kbuild.platforms 228 + include arch/mips/Kbuild.platforms 229 229 230 230 ifdef CONFIG_PHYSICAL_START 231 231 load-y = $(CONFIG_PHYSICAL_START)
+3 -3
arch/um/Makefile
··· 43 43 44 44 HOST_DIR := arch/$(HEADER_ARCH) 45 45 46 - include $(srctree)/$(ARCH_DIR)/Makefile-skas 47 - include $(srctree)/$(HOST_DIR)/Makefile.um 46 + include $(ARCH_DIR)/Makefile-skas 47 + include $(HOST_DIR)/Makefile.um 48 48 49 49 core-y += $(HOST_DIR)/um/ 50 50 ··· 73 73 $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include 74 74 75 75 #This will adjust *FLAGS accordingly to the platform. 76 - include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) 76 + include $(ARCH_DIR)/Makefile-os-$(OS) 77 77 78 78 KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \ 79 79 -I$(srctree)/$(HOST_DIR)/include/uapi \
+1 -1
arch/x86/Makefile
··· 63 63 $(call cc-option,-fno-unit-at-a-time)) 64 64 65 65 # CPU-specific tuning. Anything which can be shared with UML should go here. 66 - include $(srctree)/arch/x86/Makefile_32.cpu 66 + include arch/x86/Makefile_32.cpu 67 67 KBUILD_CFLAGS += $(cflags-y) 68 68 69 69 # temporary until string.h is fixed
+1 -1
arch/x86/Makefile.um
··· 18 18 export LDS_EXTRA 19 19 20 20 # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. 21 - include $(srctree)/arch/x86/Makefile_32.cpu 21 + include arch/x86/Makefile_32.cpu 22 22 23 23 # prevent gcc from keeping the stack 16 byte aligned. Taken from i386. 24 24 cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)