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