treewide: prefix header search paths with $(srctree)/

Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5b
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2019-05-13 15:22:16 +09:00
parent 14340de506
commit 9cc342f6c4
17 changed files with 25 additions and 26 deletions

View File

@ -1,5 +1,5 @@
# NXP STB225 # NXP STB225
platform-$(CONFIG_SOC_PNX833X) += pnx833x/ platform-$(CONFIG_SOC_PNX833X) += pnx833x/
cflags-$(CONFIG_SOC_PNX833X) += -Iarch/mips/include/asm/mach-pnx833x cflags-$(CONFIG_SOC_PNX833X) += -I $(srctree)/arch/mips/include/asm/mach-pnx833x
load-$(CONFIG_NXP_STB220) += 0xffffffff80001000 load-$(CONFIG_NXP_STB220) += 0xffffffff80001000
load-$(CONFIG_NXP_STB225) += 0xffffffff80001000 load-$(CONFIG_NXP_STB225) += 0xffffffff80001000

View File

@ -211,7 +211,7 @@ endif
asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)
KBUILD_AFLAGS += $(AFLAGS-y) KBUILD_AFLAGS += $(AFLAGS-y)
KBUILD_CFLAGS += $(call cc-option,-msoft-float) KBUILD_CFLAGS += $(call cc-option,-msoft-float)
KBUILD_CFLAGS += -pipe $(CFLAGS-y) KBUILD_CFLAGS += -pipe $(CFLAGS-y)

View File

@ -191,8 +191,8 @@ cpuincdir-y += cpu-common # Must be last
drivers-y += arch/sh/drivers/ drivers-y += arch/sh/drivers/
drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/ drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
cflags-y += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \ cflags-y += $(foreach d, $(cpuincdir-y), -I $(srctree)/arch/sh/include/$(d)) \
$(foreach d, $(machdir-y), -Iarch/sh/include/$(d)) $(foreach d, $(machdir-y), -I $(srctree)/arch/sh/include/$(d))
KBUILD_CFLAGS += -pipe $(cflags-y) KBUILD_CFLAGS += -pipe $(cflags-y)
KBUILD_CPPFLAGS += $(cflags-y) KBUILD_CPPFLAGS += $(cflags-y)

View File

@ -42,7 +42,7 @@ endif
# non-deterministic coverage. # non-deterministic coverage.
KCOV_INSTRUMENT := n KCOV_INSTRUMENT := n
CFLAGS_irq.o := -I$(src)/../include/asm/trace CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace
obj-y := process_$(BITS).o signal.o obj-y := process_$(BITS).o signal.o
obj-$(CONFIG_COMPAT) += signal_compat.o obj-$(CONFIG_COMPAT) += signal_compat.o

View File

@ -21,7 +21,7 @@ CFLAGS_physaddr.o := $(nostackp)
CFLAGS_setup_nx.o := $(nostackp) CFLAGS_setup_nx.o := $(nostackp)
CFLAGS_mem_encrypt_identity.o := $(nostackp) CFLAGS_mem_encrypt_identity.o := $(nostackp)
CFLAGS_fault.o := -I$(src)/../include/asm/trace CFLAGS_fault.o := -I $(srctree)/$(src)/../include/asm/trace
obj-$(CONFIG_X86_PAT) += pat_rbtree.o obj-$(CONFIG_X86_PAT) += pat_rbtree.o

View File

@ -7,7 +7,7 @@ zlib := inffast.c inflate.c inftrees.c
lib-y += $(zlib:.c=.o) zmem.o lib-y += $(zlib:.c=.o) zmem.o
ccflags-y := -Ilib/zlib_inflate ccflags-y := -I $(srctree)/lib/zlib_inflate
ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FUNCTION_TRACER
CFLAGS_REMOVE_inflate.o = -pg CFLAGS_REMOVE_inflate.o = -pg
CFLAGS_REMOVE_zmem.o = -pg CFLAGS_REMOVE_zmem.o = -pg

View File

@ -23,4 +23,4 @@ intel-ishtp-hid-objs += ishtp-hid-client.o
obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o
intel-ishtp-loader-objs += ishtp-fw-loader.o intel-ishtp-loader-objs += ishtp-fw-loader.o
ccflags-y += -Idrivers/hid/intel-ish-hid/ishtp ccflags-y += -I $(srctree)/$(src)/ishtp

View File

@ -1,4 +1,4 @@
ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4 ccflags-y := -I $(srctree)/$(src)/../cxgb4
obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4 ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4
ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb ccflags-y += -I $(srctree)/drivers/net/ethernet/chelsio/libcxgb
ccflags-y += -Idrivers/target/iscsi ccflags-y += -I $(srctree)/drivers/target/iscsi
obj-$(CONFIG_ISCSI_TARGET_CXGB4) += cxgbit.o obj-$(CONFIG_ISCSI_TARGET_CXGB4) += cxgbit.o

View File

@ -6,7 +6,7 @@
# Rewritten to use lists instead of if-statements. # Rewritten to use lists instead of if-statements.
# #
ccflags-y := -Idrivers/scsi ccflags-y := -I $(srctree)/drivers/scsi
obj-$(CONFIG_USB_UAS) += uas.o obj-$(CONFIG_USB_UAS) += uas.o
obj-$(CONFIG_USB_STORAGE) += usb-storage.o obj-$(CONFIG_USB_STORAGE) += usb-storage.o

View File

@ -1,7 +1,6 @@
ccflags-y := -I$(src)/.. ccflags-y := -I $(srctree)/$(src)/..
obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o
ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \ ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \
dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o

View File

@ -1,4 +1,4 @@
ccflags-y := -I$(src)/.. ccflags-y := -I $(srctree)/$(src)/..
obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o

View File

@ -4,8 +4,8 @@
# All Rights Reserved. # All Rights Reserved.
# #
ccflags-y += -I$(src) # needed for trace events ccflags-y += -I $(srctree)/$(src) # needed for trace events
ccflags-y += -I$(src)/libxfs ccflags-y += -I $(srctree)/$(src)/libxfs
ccflags-$(CONFIG_XFS_DEBUG) += -g ccflags-$(CONFIG_XFS_DEBUG) += -g

View File

@ -5,7 +5,7 @@
hostprogs-y := bpfilter_umh hostprogs-y := bpfilter_umh
bpfilter_umh-objs := main.o bpfilter_umh-objs := main.o
KBUILD_HOSTCFLAGS += -Itools/include/ -Itools/include/uapi KBUILD_HOSTCFLAGS += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi
HOSTCC := $(CC) HOSTCC := $(CC)
ifeq ($(CONFIG_BPFILTER_UMH), y) ifeq ($(CONFIG_BPFILTER_UMH), y)

View File

@ -9,7 +9,7 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
# Source files need to get at the userspace version of libfdt_env.h to compile # Source files need to get at the userspace version of libfdt_env.h to compile
HOST_EXTRACFLAGS := -I$(src)/libfdt HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
ifeq ($(wildcard /usr/include/yaml.h),) ifeq ($(wildcard /usr/include/yaml.h),)
ifneq ($(CHECK_DTBS),) ifneq ($(CHECK_DTBS),)
@ -23,8 +23,8 @@ HOSTLDLIBS_dtc := -lyaml
endif endif
# Generated files need one more search path to include headers in source tree # Generated files need one more search path to include headers in source tree
HOSTCFLAGS_dtc-lexer.lex.o := -I$(src) HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
HOSTCFLAGS_dtc-parser.tab.o := -I$(src) HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h

View File

@ -31,8 +31,8 @@ $(obj)/parse.tab.h: $(src)/parse.y FORCE
endif endif
# -I needed for generated C source (shipped source) # -I needed for generated C source (shipped source)
HOSTCFLAGS_parse.tab.o := -I$(src) HOSTCFLAGS_parse.tab.o := -I $(srctree)/$(src)
HOSTCFLAGS_lex.lex.o := -I$(src) HOSTCFLAGS_lex.lex.o := -I $(srctree)/$(src)
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
$(obj)/lex.lex.o: $(obj)/parse.tab.h $(obj)/lex.lex.o: $(obj)/parse.tab.h

View File

@ -147,8 +147,8 @@ common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
symbol.o symbol.o
$(obj)/lexer.lex.o: $(obj)/parser.tab.h $(obj)/lexer.lex.o: $(obj)/parser.tab.h
HOSTCFLAGS_lexer.lex.o := -I$(src) HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
HOSTCFLAGS_parser.tab.o := -I$(src) HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
# conf: Used for defconfig, oldconfig and related targets # conf: Used for defconfig, oldconfig and related targets
hostprogs-y += conf hostprogs-y += conf