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/
Unified · Split
| @@ -1,5 +1,5 @@ | |||
| 1 | # NXP STB225 | 1 | # NXP STB225 |
| 2 | platform-$(CONFIG_SOC_PNX833X) += pnx833x/ | 2 | platform-$(CONFIG_SOC_PNX833X) += pnx833x/ |
| 3 | cflags-$(CONFIG_SOC_PNX833X) += -Iarch/mips/include/asm/mach-pnx833x | 3 | cflags-$(CONFIG_SOC_PNX833X) += -I $(srctree)/arch/mips/include/asm/mach-pnx833x |
| 4 | load-$(CONFIG_NXP_STB220) += 0xffffffff80001000 | 4 | load-$(CONFIG_NXP_STB220) += 0xffffffff80001000 |
| 5 | load-$(CONFIG_NXP_STB225) += 0xffffffff80001000 | 5 | load-$(CONFIG_NXP_STB225) += 0xffffffff80001000 |
| @@ -211,7 +211,7 @@ endif · 210 unmodified lines | |||
| 211 | 211 | ||
| 212 | asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) | 212 | asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) |
| 213 | 213 | ||
| 214 | KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) | 214 | KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr) |
| 215 | KBUILD_AFLAGS += $(AFLAGS-y) | 215 | KBUILD_AFLAGS += $(AFLAGS-y) |
| 216 | KBUILD_CFLAGS += $(call cc-option,-msoft-float) | 216 | KBUILD_CFLAGS += $(call cc-option,-msoft-float) |
| 217 | KBUILD_CFLAGS += -pipe $(CFLAGS-y) | 217 | KBUILD_CFLAGS += -pipe $(CFLAGS-y) |
| @@ -191,8 +191,8 @@ cpuincdir-y += cpu-common # Must be last · 190 unmodified lines | |||
| 191 | drivers-y += arch/sh/drivers/ | 191 | drivers-y += arch/sh/drivers/ |
| 192 | drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/ | 192 | drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/ |
| 193 | 193 | ||
| 194 | cflags-y += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \ | 194 | cflags-y += $(foreach d, $(cpuincdir-y), -I $(srctree)/arch/sh/include/$(d)) \ |
| 195 | $(foreach d, $(machdir-y), -Iarch/sh/include/$(d)) | 195 | $(foreach d, $(machdir-y), -I $(srctree)/arch/sh/include/$(d)) |
| 196 | 196 | ||
| 197 | KBUILD_CFLAGS += -pipe $(cflags-y) | 197 | KBUILD_CFLAGS += -pipe $(cflags-y) |
| 198 | KBUILD_CPPFLAGS += $(cflags-y) | 198 | KBUILD_CPPFLAGS += $(cflags-y) |
| @@ -42,7 +42,7 @@ endif · 41 unmodified lines | |||
| 42 | # non-deterministic coverage. | 42 | # non-deterministic coverage. |
| 43 | KCOV_INSTRUMENT := n | 43 | KCOV_INSTRUMENT := n |
| 44 | 44 | ||
| 45 | CFLAGS_irq.o := -I$(src)/../include/asm/trace | 45 | CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace |
| 46 | 46 | ||
| 47 | obj-y := process_$(BITS).o signal.o | 47 | obj-y := process_$(BITS).o signal.o |
| 48 | obj-$(CONFIG_COMPAT) += signal_compat.o | 48 | obj-$(CONFIG_COMPAT) += signal_compat.o |
| @@ -21,7 +21,7 @@ CFLAGS_physaddr.o := $(nostackp) · 20 unmodified lines | |||
| 21 | CFLAGS_setup_nx.o := $(nostackp) | 21 | CFLAGS_setup_nx.o := $(nostackp) |
| 22 | CFLAGS_mem_encrypt_identity.o := $(nostackp) | 22 | CFLAGS_mem_encrypt_identity.o := $(nostackp) |
| 23 | 23 | ||
| 24 | CFLAGS_fault.o := -I$(src)/../include/asm/trace | 24 | CFLAGS_fault.o := -I $(srctree)/$(src)/../include/asm/trace |
| 25 | 25 | ||
| 26 | obj-$(CONFIG_X86_PAT) += pat_rbtree.o | 26 | obj-$(CONFIG_X86_PAT) += pat_rbtree.o |
| 27 | 27 | ||
| @@ -7,7 +7,7 @@ zlib := inffast.c inflate.c inftrees.c · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | lib-y += $(zlib:.c=.o) zmem.o | 8 | lib-y += $(zlib:.c=.o) zmem.o |
| 9 | 9 | ||
| 10 | ccflags-y := -Ilib/zlib_inflate | 10 | ccflags-y := -I $(srctree)/lib/zlib_inflate |
| 11 | ifdef CONFIG_FUNCTION_TRACER | 11 | ifdef CONFIG_FUNCTION_TRACER |
| 12 | CFLAGS_REMOVE_inflate.o = -pg | 12 | CFLAGS_REMOVE_inflate.o = -pg |
| 13 | CFLAGS_REMOVE_zmem.o = -pg | 13 | CFLAGS_REMOVE_zmem.o = -pg |
| @@ -23,4 +23,4 @@ intel-ishtp-hid-objs += ishtp-hid-client.o · 22 unmodified lines | |||
| 23 | obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o | 23 | obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o |
| 24 | intel-ishtp-loader-objs += ishtp-fw-loader.o | 24 | intel-ishtp-loader-objs += ishtp-fw-loader.o |
| 25 | 25 | ||
| 26 | ccflags-y += -Idrivers/hid/intel-ish-hid/ishtp | 26 | ccflags-y += -I $(srctree)/$(src)/ishtp |
| @@ -1,4 +1,4 @@ | |||
| 1 | ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4 | 1 | ccflags-y := -I $(srctree)/$(src)/../cxgb4 |
| 2 | 2 | ||
| 3 | obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o | 3 | obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o |
| 4 | 4 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4 | 2 | ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4 |
| 3 | ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb | 3 | ccflags-y += -I $(srctree)/drivers/net/ethernet/chelsio/libcxgb |
| 4 | ccflags-y += -Idrivers/target/iscsi | 4 | ccflags-y += -I $(srctree)/drivers/target/iscsi |
| 5 | 5 | ||
| 6 | obj-$(CONFIG_ISCSI_TARGET_CXGB4) += cxgbit.o | 6 | obj-$(CONFIG_ISCSI_TARGET_CXGB4) += cxgbit.o |
| 7 | 7 | ||
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | # Rewritten to use lists instead of if-statements. | 6 | # Rewritten to use lists instead of if-statements. |
| 7 | # | 7 | # |
| 8 | 8 | ||
| 9 | ccflags-y := -Idrivers/scsi | 9 | ccflags-y := -I $(srctree)/drivers/scsi |
| 10 | 10 | ||
| 11 | obj-$(CONFIG_USB_UAS) += uas.o | 11 | obj-$(CONFIG_USB_UAS) += uas.o |
| 12 | obj-$(CONFIG_USB_STORAGE) += usb-storage.o | 12 | obj-$(CONFIG_USB_STORAGE) += usb-storage.o |
| @@ -1,7 +1,6 @@ | |||
| 1 | ccflags-y := -I$(src)/.. | 1 | ccflags-y := -I $(srctree)/$(src)/.. |
| 2 | 2 | ||
| 3 | obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o | 3 | obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o |
| 4 | 4 | ||
| 5 | ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \ | 5 | ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \ |
| 6 | dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o | 6 | dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o |
| 7 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ccflags-y := -I$(src)/.. | 1 | ccflags-y := -I $(srctree)/$(src)/.. |
| 2 | 2 | ||
| 3 | obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o | 3 | obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o |
| 4 | 4 | ||
| @@ -4,8 +4,8 @@ · 3 unmodified lines | |||
| 4 | # All Rights Reserved. | 4 | # All Rights Reserved. |
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | ccflags-y += -I$(src) # needed for trace events | 7 | ccflags-y += -I $(srctree)/$(src) # needed for trace events |
| 8 | ccflags-y += -I$(src)/libxfs | 8 | ccflags-y += -I $(srctree)/$(src)/libxfs |
| 9 | 9 | ||
| 10 | ccflags-$(CONFIG_XFS_DEBUG) += -g | 10 | ccflags-$(CONFIG_XFS_DEBUG) += -g |
| 11 | 11 | ||
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | hostprogs-y := bpfilter_umh | 6 | hostprogs-y := bpfilter_umh |
| 7 | bpfilter_umh-objs := main.o | 7 | bpfilter_umh-objs := main.o |
| 8 | KBUILD_HOSTCFLAGS += -Itools/include/ -Itools/include/uapi | 8 | KBUILD_HOSTCFLAGS += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi |
| 9 | HOSTCC := $(CC) | 9 | HOSTCC := $(CC) |
| 10 | 10 | ||
| 11 | ifeq ($(CONFIG_BPFILTER_UMH), y) | 11 | ifeq ($(CONFIG_BPFILTER_UMH), y) |
| @@ -9,7 +9,7 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ · 8 unmodified lines | |||
| 9 | dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o | 9 | dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o |
| 10 | 10 | ||
| 11 | # Source files need to get at the userspace version of libfdt_env.h to compile | 11 | # Source files need to get at the userspace version of libfdt_env.h to compile |
| 12 | HOST_EXTRACFLAGS := -I$(src)/libfdt | 12 | HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt |
| 13 | 13 | ||
| 14 | ifeq ($(wildcard /usr/include/yaml.h),) | 14 | ifeq ($(wildcard /usr/include/yaml.h),) |
| 15 | ifneq ($(CHECK_DTBS),) | 15 | ifneq ($(CHECK_DTBS),) |
| @@ -23,8 +23,8 @@ HOSTLDLIBS_dtc := -lyaml · 7 unmodified lines | |||
| 23 | endif | 23 | endif |
| 24 | 24 | ||
| 25 | # Generated files need one more search path to include headers in source tree | 25 | # Generated files need one more search path to include headers in source tree |
| 26 | HOSTCFLAGS_dtc-lexer.lex.o := -I$(src) | 26 | HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src) |
| 27 | HOSTCFLAGS_dtc-parser.tab.o := -I$(src) | 27 | HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src) |
| 28 | 28 | ||
| 29 | # dependencies on generated files need to be listed explicitly | 29 | # dependencies on generated files need to be listed explicitly |
| 30 | $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h | 30 | $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h |
| @@ -31,8 +31,8 @@ $(obj)/parse.tab.h: $(src)/parse.y FORCE · 30 unmodified lines | |||
| 31 | endif | 31 | endif |
| 32 | 32 | ||
| 33 | # -I needed for generated C source (shipped source) | 33 | # -I needed for generated C source (shipped source) |
| 34 | HOSTCFLAGS_parse.tab.o := -I$(src) | 34 | HOSTCFLAGS_parse.tab.o := -I $(srctree)/$(src) |
| 35 | HOSTCFLAGS_lex.lex.o := -I$(src) | 35 | HOSTCFLAGS_lex.lex.o := -I $(srctree)/$(src) |
| 36 | 36 | ||
| 37 | # dependencies on generated files need to be listed explicitly | 37 | # dependencies on generated files need to be listed explicitly |
| 38 | $(obj)/lex.lex.o: $(obj)/parse.tab.h | 38 | $(obj)/lex.lex.o: $(obj)/parse.tab.h |
| @@ -147,8 +147,8 @@ common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \ · 146 unmodified lines | |||
| 147 | symbol.o | 147 | symbol.o |
| 148 | 148 | ||
| 149 | $(obj)/lexer.lex.o: $(obj)/parser.tab.h | 149 | $(obj)/lexer.lex.o: $(obj)/parser.tab.h |
| 150 | HOSTCFLAGS_lexer.lex.o := -I$(src) | 150 | HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) |
| 151 | HOSTCFLAGS_parser.tab.o := -I$(src) | 151 | HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) |
| 152 | 152 | ||
| 153 | # conf: Used for defconfig, oldconfig and related targets | 153 | # conf: Used for defconfig, oldconfig and related targets |
| 154 | hostprogs-y += conf | 154 | hostprogs-y += conf |