Commit a436bb7b authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Michal Marek

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 7aacad53
...@@ -10,9 +10,10 @@ NAME = Hurr durr I'ma sheep ...@@ -10,9 +10,10 @@ NAME = Hurr durr I'ma sheep
# Comments in this file are targeted only to the developer, do not # Comments in this file are targeted only to the developer, do not
# expect to learn how to build the kernel reading this file. # expect to learn how to build the kernel reading this file.
# Do not use make's built-in rules and variables # o Do not use make's built-in rules and variables
# (this increases performance and avoids hard-to-debug behaviour); # (this increases performance and avoids hard-to-debug behaviour);
MAKEFLAGS += -rR # o Look for make include files relative to root of kernel src
MAKEFLAGS += -rR --include-dir=$(CURDIR)
# Avoid funny character set dependencies # Avoid funny character set dependencies
unexport LC_ALL unexport LC_ALL
...@@ -344,12 +345,9 @@ endif ...@@ -344,12 +345,9 @@ endif
export COMPILER export COMPILER
endif endif
# Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree)
# We need some generic definitions (do not try to remake the file). # We need some generic definitions (do not try to remake the file).
$(srctree)/scripts/Kbuild.include: ; scripts/Kbuild.include: ;
include $(srctree)/scripts/Kbuild.include include scripts/Kbuild.include
# Make variables (CC, etc...) # Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as AS = $(CROSS_COMPILE)as
...@@ -533,7 +531,7 @@ ifeq ($(config-targets),1) ...@@ -533,7 +531,7 @@ ifeq ($(config-targets),1)
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
# KBUILD_DEFCONFIG may point out an alternative default configuration # KBUILD_DEFCONFIG may point out an alternative default configuration
# used for 'make defconfig' # used for 'make defconfig'
include $(srctree)/arch/$(SRCARCH)/Makefile include arch/$(SRCARCH)/Makefile
export KBUILD_DEFCONFIG KBUILD_KCONFIG export KBUILD_DEFCONFIG KBUILD_KCONFIG
config: scripts_basic outputmakefile FORCE config: scripts_basic outputmakefile FORCE
...@@ -609,7 +607,7 @@ endif # $(dot-config) ...@@ -609,7 +607,7 @@ endif # $(dot-config)
# Defaults to vmlinux, but the arch makefile usually adds further targets # Defaults to vmlinux, but the arch makefile usually adds further targets
all: vmlinux all: vmlinux
include $(srctree)/arch/$(SRCARCH)/Makefile include arch/$(SRCARCH)/Makefile
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
...@@ -781,8 +779,8 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) ...@@ -781,8 +779,8 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
endif endif
include $(srctree)/scripts/Makefile.kasan include scripts/Makefile.kasan
include $(srctree)/scripts/Makefile.extrawarn include scripts/Makefile.extrawarn
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
KBUILD_CPPFLAGS += $(KCPPFLAGS) KBUILD_CPPFLAGS += $(KCPPFLAGS)
......
...@@ -225,7 +225,7 @@ endif ...@@ -225,7 +225,7 @@ endif
# #
# Board-dependent options and extra files # Board-dependent options and extra files
# #
include $(srctree)/arch/mips/Kbuild.platforms include arch/mips/Kbuild.platforms
ifdef CONFIG_PHYSICAL_START ifdef CONFIG_PHYSICAL_START
load-y = $(CONFIG_PHYSICAL_START) load-y = $(CONFIG_PHYSICAL_START)
......
...@@ -43,8 +43,8 @@ endif ...@@ -43,8 +43,8 @@ endif
HOST_DIR := arch/$(HEADER_ARCH) HOST_DIR := arch/$(HEADER_ARCH)
include $(srctree)/$(ARCH_DIR)/Makefile-skas include $(ARCH_DIR)/Makefile-skas
include $(srctree)/$(HOST_DIR)/Makefile.um include $(HOST_DIR)/Makefile.um
core-y += $(HOST_DIR)/um/ core-y += $(HOST_DIR)/um/
...@@ -73,7 +73,7 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ ...@@ -73,7 +73,7 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
$(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include
#This will adjust *FLAGS accordingly to the platform. #This will adjust *FLAGS accordingly to the platform.
include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) include $(ARCH_DIR)/Makefile-os-$(OS)
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \ KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
-I$(srctree)/$(HOST_DIR)/include/uapi \ -I$(srctree)/$(HOST_DIR)/include/uapi \
......
...@@ -63,7 +63,7 @@ ifeq ($(CONFIG_X86_32),y) ...@@ -63,7 +63,7 @@ ifeq ($(CONFIG_X86_32),y)
$(call cc-option,-fno-unit-at-a-time)) $(call cc-option,-fno-unit-at-a-time))
# CPU-specific tuning. Anything which can be shared with UML should go here. # CPU-specific tuning. Anything which can be shared with UML should go here.
include $(srctree)/arch/x86/Makefile_32.cpu include arch/x86/Makefile_32.cpu
KBUILD_CFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y)
# temporary until string.h is fixed # temporary until string.h is fixed
......
...@@ -18,7 +18,7 @@ LDS_EXTRA := -Ui386 ...@@ -18,7 +18,7 @@ LDS_EXTRA := -Ui386
export LDS_EXTRA export LDS_EXTRA
# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
include $(srctree)/arch/x86/Makefile_32.cpu include arch/x86/Makefile_32.cpu
# prevent gcc from keeping the stack 16 byte aligned. Taken from i386. # prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment