History

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.

Masahiro Yamada committed 5 years ago

Commit 3204a7f1 parent 1e28eed9 files · +17 −17Browse files

Unified · Split

9 files
  1. Makefile +4 −4
  2. scripts/Makefile.asm-generic +2 −2
  3. scripts/Makefile.build +4 −4
  4. scripts/Makefile.clean +1 −1
  5. scripts/Makefile.dtbinst +1 −1
  6. scripts/Makefile.headersinst +1 −1
  7. scripts/Makefile.modinst +1 −1
  8. scripts/Makefile.modpost +2 −2
  9. scripts/Makefile.modsign +1 −1
Makefile+4−4
@@ -339,14 +339,14 @@ __build_one_by_one: · 338 unmodified lines
339 339
340else # !mixed-build340else # !mixed-build
341 341
342include scripts/Kbuild.include342include $(srctree)/scripts/Kbuild.include
343 343
344# Read KERNELRELEASE from include/config/kernel.release (if it exists)344# Read KERNELRELEASE from include/config/kernel.release (if it exists)
345KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)345KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
346KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)346KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
347export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION347export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
348 348
349include scripts/subarch.include349include $(srctree)/scripts/subarch.include
350 350
351# Cross compiling and selecting different set of gcc/bin-utils351# Cross compiling and selecting different set of gcc/bin-utils
352# ---------------------------------------------------------------------------352# ---------------------------------------------------------------------------
@@ -592,7 +592,7 @@ ifdef config-build · 239 unmodified lines
592# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.592# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
593# KBUILD_DEFCONFIG may point out an alternative default configuration593# KBUILD_DEFCONFIG may point out an alternative default configuration
594# used for 'make defconfig'594# used for 'make defconfig'
595include arch/$(SRCARCH)/Makefile595include $(srctree)/arch/$(SRCARCH)/Makefile
596export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT596export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
597 597
598config: outputmakefile scripts_basic FORCE598config: outputmakefile scripts_basic FORCE
@@ -679,7 +679,7 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc · 80 unmodified lines
679export RETPOLINE_CFLAGS679export RETPOLINE_CFLAGS
680export RETPOLINE_VDSO_CFLAGS680export RETPOLINE_VDSO_CFLAGS
681 681
682include arch/$(SRCARCH)/Makefile682include $(srctree)/arch/$(SRCARCH)/Makefile
683 683
684ifdef need-config684ifdef need-config
685ifdef may-sync-config685ifdef may-sync-config
scripts/Makefile.asm-generic+2−2
@@ -14,10 +14,10 @@ src := $(subst /generated,,$(obj)) · 13 unmodified lines
14 14
15# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.15# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
16ifneq ($(SRCARCH),um)16ifneq ($(SRCARCH),um)
17include $(generic)/Kbuild17include $(srctree)/$(generic)/Kbuild
18endif18endif
19 19
20include scripts/Kbuild.include20include $(srctree)/scripts/Kbuild.include
21 21
22redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))22redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
23redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))23redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
scripts/Makefile.build+4−4
@@ -35,27 +35,27 @@ subdir-ccflags-y := · 34 unmodified lines
35# Read auto.conf if it exists, otherwise ignore35# Read auto.conf if it exists, otherwise ignore
36-include include/config/auto.conf36-include include/config/auto.conf
37 37
38include scripts/Kbuild.include38include $(srctree)/scripts/Kbuild.include
39 39
40# The filename Kbuild has precedence over Makefile40# The filename Kbuild has precedence over Makefile
41kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))41kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
42kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)42kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
43include $(kbuild-file)43include $(kbuild-file)
44 44
45include scripts/Makefile.lib45include $(srctree)/scripts/Makefile.lib
46 46
47# Do not include hostprogs rules unless needed.47# Do not include hostprogs rules unless needed.
48# $(sort ...) is used here to remove duplicated words and excessive spaces.48# $(sort ...) is used here to remove duplicated words and excessive spaces.
49hostprogs := $(sort $(hostprogs))49hostprogs := $(sort $(hostprogs))
50ifneq ($(hostprogs),)50ifneq ($(hostprogs),)
51include scripts/Makefile.host51include $(srctree)/scripts/Makefile.host
52endif52endif
53 53
54# Do not include userprogs rules unless needed.54# Do not include userprogs rules unless needed.
55# $(sort ...) is used here to remove duplicated words and excessive spaces.55# $(sort ...) is used here to remove duplicated words and excessive spaces.
56userprogs := $(sort $(userprogs))56userprogs := $(sort $(userprogs))
57ifneq ($(userprogs),)57ifneq ($(userprogs),)
58include scripts/Makefile.userprogs58include $(srctree)/scripts/Makefile.userprogs
59endif59endif
60 60
61ifndef obj61ifndef obj
scripts/Makefile.clean+1−1
@@ -8,7 +8,7 @@ src := $(obj) · 7 unmodified lines
8PHONY := __clean8PHONY := __clean
9__clean:9__clean:
10 10
11include scripts/Kbuild.include11include $(srctree)/scripts/Kbuild.include
12 12
13# The filename Kbuild has precedence over Makefile13# The filename Kbuild has precedence over Makefile
14kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))14kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
scripts/Makefile.dtbinst+1−1
@@ -14,7 +14,7 @@ PHONY := __dtbs_install · 13 unmodified lines
14__dtbs_install:14__dtbs_install:
15 15
16include include/config/auto.conf16include include/config/auto.conf
17include scripts/Kbuild.include17include $(srctree)/scripts/Kbuild.include
18include $(src)/Makefile18include $(src)/Makefile
19 19
20dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))20dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
scripts/Makefile.headersinst+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
12PHONY := __headers12PHONY := __headers
13__headers:13__headers:
14 14
15include scripts/Kbuild.include15include $(srctree)/scripts/Kbuild.include
16 16
17src := $(srctree)/$(obj)17src := $(srctree)/$(obj)
18gen := $(objtree)/$(subst include/,include/generated/,$(obj))18gen := $(objtree)/$(subst include/,include/generated/,$(obj))
scripts/Makefile.modinst+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
6PHONY := __modinst6PHONY := __modinst
7__modinst:7__modinst:
8 8
9include scripts/Kbuild.include9include $(srctree)/scripts/Kbuild.include
10 10
11modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order))11modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order))
12 12
scripts/Makefile.modpost+2−2
@@ -41,10 +41,10 @@ PHONY := __modpost · 40 unmodified lines
41__modpost:41__modpost:
42 42
43include include/config/auto.conf43include include/config/auto.conf
44include scripts/Kbuild.include44include $(srctree)/scripts/Kbuild.include
45 45
46# for ld_flags46# for ld_flags
47include scripts/Makefile.lib47include $(srctree)/scripts/Makefile.lib
48 48
49MODPOST = scripts/mod/modpost \49MODPOST = scripts/mod/modpost \
50 $(if $(CONFIG_MODVERSIONS),-m) \50 $(if $(CONFIG_MODVERSIONS),-m) \
scripts/Makefile.modsign+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
6PHONY := __modsign6PHONY := __modsign
7__modsign:7__modsign:
8 8
9include scripts/Kbuild.include9include $(srctree)/scripts/Kbuild.include
10 10
11modules := $(sort $(shell cat modules.order))11modules := $(sort $(shell cat modules.order))
12 12