Skip to content

Commit 3204a7f

Browse files
committed
kbuild: prefix $(srctree)/ to some included Makefiles
VPATH is used in Kbuild to make pattern rules search for prerequisites in both $(objtree) and $(srctree). Some of *.c, *.S files are not real sources, but generated by tools such as flex, bison, perl. In contrast, I doubt the benefit of --include-dir=$(abs_srctree) because it is always clear which Makefiles are real sources, and which are not. So, my hope is to add $(srctree)/ prefix to all check-in Makefiles, then remove --include-dir=$(abs_srctree) flag in the future. I am touching only some Kbuild core parts for now. Treewide fixes will be needed to achieve this goal. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 1e28eed commit 3204a7f

9 files changed

Lines changed: 17 additions & 17 deletions

‎Makefile‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,14 @@ __build_one_by_one:
339339

340340
else # !mixed-build
341341

342-
include scripts/Kbuild.include
342+
include $(srctree)/scripts/Kbuild.include
343343

344344
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
345345
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
346346
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
347347
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
348348

349-
include scripts/subarch.include
349+
include $(srctree)/scripts/subarch.include
350350

351351
# Cross compiling and selecting different set of gcc/bin-utils
352352
# ---------------------------------------------------------------------------
@@ -592,7 +592,7 @@ ifdef config-build
592592
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
593593
# KBUILD_DEFCONFIG may point out an alternative default configuration
594594
# used for 'make defconfig'
595-
include arch/$(SRCARCH)/Makefile
595+
include $(srctree)/arch/$(SRCARCH)/Makefile
596596
export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
597597

598598
config: outputmakefile scripts_basic FORCE
@@ -679,7 +679,7 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc
679679
export RETPOLINE_CFLAGS
680680
export RETPOLINE_VDSO_CFLAGS
681681

682-
include arch/$(SRCARCH)/Makefile
682+
include $(srctree)/arch/$(SRCARCH)/Makefile
683683

684684
ifdef need-config
685685
ifdef may-sync-config

‎scripts/Makefile.asm-generic‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ src := $(subst /generated,,$(obj))
1414

1515
# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
1616
ifneq ($(SRCARCH),um)
17-
include $(generic)/Kbuild
17+
include $(srctree)/$(generic)/Kbuild
1818
endif
1919

20-
include scripts/Kbuild.include
20+
include $(srctree)/scripts/Kbuild.include
2121

2222
redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
2323
redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))

‎scripts/Makefile.build‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ subdir-ccflags-y :=
3535
# Read auto.conf if it exists, otherwise ignore
3636
-include include/config/auto.conf
3737

38-
include scripts/Kbuild.include
38+
include $(srctree)/scripts/Kbuild.include
3939

4040
# The filename Kbuild has precedence over Makefile
4141
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
4242
kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
4343
include $(kbuild-file)
4444

45-
include scripts/Makefile.lib
45+
include $(srctree)/scripts/Makefile.lib
4646

4747
# Do not include hostprogs rules unless needed.
4848
# $(sort ...) is used here to remove duplicated words and excessive spaces.
4949
hostprogs := $(sort $(hostprogs))
5050
ifneq ($(hostprogs),)
51-
include scripts/Makefile.host
51+
include $(srctree)/scripts/Makefile.host
5252
endif
5353

5454
# Do not include userprogs rules unless needed.
5555
# $(sort ...) is used here to remove duplicated words and excessive spaces.
5656
userprogs := $(sort $(userprogs))
5757
ifneq ($(userprogs),)
58-
include scripts/Makefile.userprogs
58+
include $(srctree)/scripts/Makefile.userprogs
5959
endif
6060

6161
ifndef obj

‎scripts/Makefile.clean‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ src := $(obj)
88
PHONY := __clean
99
__clean:
1010

11-
include scripts/Kbuild.include
11+
include $(srctree)/scripts/Kbuild.include
1212

1313
# The filename Kbuild has precedence over Makefile
1414
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))

‎scripts/Makefile.dtbinst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PHONY := __dtbs_install
1414
__dtbs_install:
1515

1616
include include/config/auto.conf
17-
include scripts/Kbuild.include
17+
include $(srctree)/scripts/Kbuild.include
1818
include $(src)/Makefile
1919

2020
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))

‎scripts/Makefile.headersinst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
PHONY := __headers
1313
__headers:
1414

15-
include scripts/Kbuild.include
15+
include $(srctree)/scripts/Kbuild.include
1616

1717
src := $(srctree)/$(obj)
1818
gen := $(objtree)/$(subst include/,include/generated/,$(obj))

‎scripts/Makefile.modinst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
PHONY := __modinst
77
__modinst:
88

9-
include scripts/Kbuild.include
9+
include $(srctree)/scripts/Kbuild.include
1010

1111
modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order))
1212

‎scripts/Makefile.modpost‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ PHONY := __modpost
4141
__modpost:
4242

4343
include include/config/auto.conf
44-
include scripts/Kbuild.include
44+
include $(srctree)/scripts/Kbuild.include
4545

4646
# for ld_flags
47-
include scripts/Makefile.lib
47+
include $(srctree)/scripts/Makefile.lib
4848

4949
MODPOST = scripts/mod/modpost \
5050
$(if $(CONFIG_MODVERSIONS),-m) \

‎scripts/Makefile.modsign‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
PHONY := __modsign
77
__modsign:
88

9-
include scripts/Kbuild.include
9+
include $(srctree)/scripts/Kbuild.include
1010

1111
modules := $(sort $(shell cat modules.order))
1212

0 commit comments

Comments
 (0)