treewide: prefix header search paths with $(srctree)/
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 13 May 2019 06:22:16 +0000 (15:22 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 18 May 2019 02:49:57 +0000 (11:49 +0900)
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 48f6e3cf5bc6
("kbuild: do not drop -I without parameter").

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

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
17 files changed:
arch/mips/pnx833x/Platform
arch/powerpc/Makefile
arch/sh/Makefile
arch/x86/kernel/Makefile
arch/x86/mm/Makefile
arch/xtensa/boot/lib/Makefile
drivers/hid/intel-ish-hid/Makefile
drivers/net/ethernet/chelsio/libcxgb/Makefile
drivers/target/iscsi/cxgbit/Makefile
drivers/usb/storage/Makefile
fs/ocfs2/dlm/Makefile
fs/ocfs2/dlmfs/Makefile
fs/xfs/Makefile
net/bpfilter/Makefile
scripts/dtc/Makefile
scripts/genksyms/Makefile
scripts/kconfig/Makefile

index 794526caab125e0592796e81164f2fc82c3a5d2d..6b1a847d593f70e5970bf1cc2954729c788746da 100644 (file)
@@ -1,5 +1,5 @@
 # NXP STB225
 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_STB225)      += 0xffffffff80001000
index 258ea6b2f2e75d1f09179f6a4fefbf378fb34fb2..c345b79414a96f07b9abae13eae09735cfa2dcdc 100644 (file)
@@ -211,7 +211,7 @@ endif
 
 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_CFLAGS  += $(call cc-option,-msoft-float)
 KBUILD_CFLAGS  += -pipe $(CFLAGS-y)
index 4009bef62fe97360bd0141fe5b9189ec32817b68..b4a86f27e048336e49e5019acc8a7ae7db737f8b 100644 (file)
@@ -191,8 +191,8 @@ cpuincdir-y                 += cpu-common   # Must be last
 drivers-y                      += arch/sh/drivers/
 drivers-$(CONFIG_OPROFILE)     += arch/sh/oprofile/
 
-cflags-y       += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \
-                  $(foreach d, $(machdir-y), -Iarch/sh/include/$(d))
+cflags-y       += $(foreach d, $(cpuincdir-y), -I $(srctree)/arch/sh/include/$(d)) \
+                  $(foreach d, $(machdir-y), -I $(srctree)/arch/sh/include/$(d))
 
 KBUILD_CFLAGS          += -pipe $(cflags-y)
 KBUILD_CPPFLAGS                += $(cflags-y)
index 00b7e27bc2b7d84cda40669323f02cf057365185..ce1b5cc360a27ba13160856ddeffd4040ebeffca 100644 (file)
@@ -42,7 +42,7 @@ endif
 # non-deterministic coverage.
 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-$(CONFIG_COMPAT)   += signal_compat.o
index 4b101dd6e52f3f714bc16b15d25191f3486f1548..84373dc9b341e6541647eebcbf2194c771ace8f2 100644 (file)
@@ -21,7 +21,7 @@ CFLAGS_physaddr.o             := $(nostackp)
 CFLAGS_setup_nx.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
 
index 355127faade17462ea3dea5b0fd70d2364b83392..e3d717c7bfa1f6f5a0d4c0725aef0b8749a55dcd 100644 (file)
@@ -7,7 +7,7 @@ zlib    := inffast.c inflate.c inftrees.c
 
 lib-y  += $(zlib:.c=.o) zmem.o
 
-ccflags-y      := -Ilib/zlib_inflate
+ccflags-y      := -I $(srctree)/lib/zlib_inflate
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_inflate.o = -pg
 CFLAGS_REMOVE_zmem.o = -pg
index 2de97e4b7740aa100fb9d6b3ec48a2c5d0cfbcfa..f0a82b1c7cb932e14e0c76151099d0619266bfca 100644 (file)
@@ -23,4 +23,4 @@ intel-ishtp-hid-objs += ishtp-hid-client.o
 obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o
 intel-ishtp-loader-objs += ishtp-fw-loader.o
 
-ccflags-y += -Idrivers/hid/intel-ish-hid/ishtp
+ccflags-y += -I $(srctree)/$(src)/ishtp
index 2534e30a156039259873c1b95297000a37e404a7..441913b5221ebb5d42962f09616f552bfc2b9c8a 100644 (file)
@@ -1,4 +1,4 @@
-ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4
+ccflags-y := -I $(srctree)/$(src)/../cxgb4
 
 obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o
 
index d16aaae7ba2acba5e2d7b324c28847cac78b0633..0dcaf2006f7838d63191b7f7246cfa8b8f70b019 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4
-ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb
-ccflags-y += -Idrivers/target/iscsi
+ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4
+ccflags-y += -I $(srctree)/drivers/net/ethernet/chelsio/libcxgb
+ccflags-y += -I $(srctree)/drivers/target/iscsi
 
 obj-$(CONFIG_ISCSI_TARGET_CXGB4)  += cxgbit.o
 
index c5126a4cd95411574668a30dd87b9385b7c96f2a..a67ddcbb4e24902e28b04c5b3bba54e14bda67ad 100644 (file)
@@ -6,7 +6,7 @@
 # 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_STORAGE)      += usb-storage.o
index ef2854422a6e16f203ad3ba198b8b5316b20237f..3d4041f0431e6f7bc5c77c8c8e618e09262d080d 100644 (file)
@@ -1,7 +1,6 @@
-ccflags-y := -I$(src)/..
+ccflags-y := -I $(srctree)/$(src)/..
 
 obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o
 
 ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \
        dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o
-
index 33431a0296a32b4d98c09a224ccebe0001fba656..0a0b93d940fe9e11004bfd88520fa2b5c92ef4b9 100644 (file)
@@ -1,4 +1,4 @@
-ccflags-y := -I$(src)/..
+ccflags-y := -I $(srctree)/$(src)/..
 
 obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o
 
index 1dfc6df2e2bd850e1b0cc02c544abbf5ef114182..91831975363b927687acab64d73b3f76f10e81b2 100644 (file)
@@ -4,8 +4,8 @@
 # All Rights Reserved.
 #
 
-ccflags-y += -I$(src)                  # needed for trace events
-ccflags-y += -I$(src)/libxfs
+ccflags-y += -I $(srctree)/$(src)              # needed for trace events
+ccflags-y += -I $(srctree)/$(src)/libxfs
 
 ccflags-$(CONFIG_XFS_DEBUG) += -g
 
index 854395fb98cd1257c0097b2fe10cb157f552dffc..aa945ab5b655893e4f9e409b1a2b010bfcaa47f3 100644 (file)
@@ -5,7 +5,7 @@
 
 hostprogs-y := bpfilter_umh
 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)
 
 ifeq ($(CONFIG_BPFILTER_UMH), y)
index 5f227d8d39d8144a0988ab23b7dbc1f201195787..82160808765c3ea475b30c41887810e44154a962 100644 (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
 
 # 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),)
 ifneq ($(CHECK_DTBS),)
@@ -23,8 +23,8 @@ HOSTLDLIBS_dtc        := -lyaml
 endif
 
 # Generated files need one more search path to include headers in source tree
-HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
-HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
+HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
+HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
 
 # dependencies on generated files need to be listed explicitly
 $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
index 03b7ce97de146c8e694e3fc3c49660498372f0ce..66c314bc5933ed00b3caee1bec83bd157feddc76 100644 (file)
@@ -31,8 +31,8 @@ $(obj)/parse.tab.h: $(src)/parse.y FORCE
 endif
 
 # -I needed for generated C source (shipped source)
-HOSTCFLAGS_parse.tab.o := -I$(src)
-HOSTCFLAGS_lex.lex.o := -I$(src)
+HOSTCFLAGS_parse.tab.o := -I $(srctree)/$(src)
+HOSTCFLAGS_lex.lex.o := -I $(srctree)/$(src)
 
 # dependencies on generated files need to be listed explicitly
 $(obj)/lex.lex.o: $(obj)/parse.tab.h
index 7c5dc31c1d95d5ff0efa106ab38351d929c0ae08..5e0cd86cb4a7226e2ebea10937203115b19e6118 100644 (file)
@@ -147,8 +147,8 @@ common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
                   symbol.o
 
 $(obj)/lexer.lex.o: $(obj)/parser.tab.h
-HOSTCFLAGS_lexer.lex.o := -I$(src)
-HOSTCFLAGS_parser.tab.o        := -I$(src)
+HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
+HOSTCFLAGS_parser.tab.o        := -I $(srctree)/$(src)
 
 # conf: Used for defconfig, oldconfig and related targets
 hostprogs-y    += conf