Skip to content

Commit

Permalink
treewide: prefix header search paths with $(srctree)/
Browse files Browse the repository at this point in the history
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 48f6e3c
("kbuild: do not drop -I without parameter").

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

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed May 18, 2019
1 parent 14340de commit 9cc342f
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion arch/mips/pnx833x/Platform
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/boot/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/intel-ish-hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion drivers/net/ethernet/chelsio/libcxgb/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4
ccflags-y := -I $(srctree)/$(src)/../cxgb4

obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o

Expand Down
6 changes: 3 additions & 3 deletions drivers/target/iscsi/cxgbit/Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/storage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions fs/ocfs2/dlm/Makefile
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion fs/ocfs2/dlmfs/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ccflags-y := -I$(src)/..
ccflags-y := -I $(srctree)/$(src)/..

obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o

Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion net/bpfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions scripts/dtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand All @@ -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
4 changes: 2 additions & 2 deletions scripts/genksyms/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions scripts/kconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9cc342f

Please sign in to comment.