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.
Showing the changes to scripts (8 of 9 files). Show all
Unified · Split
| @@ -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. |
| 16 | ifneq ($(SRCARCH),um) | 16 | ifneq ($(SRCARCH),um) |
| 17 | include $(generic)/Kbuild | 17 | include $(srctree)/$(generic)/Kbuild |
| 18 | endif | 18 | endif |
| 19 | 19 | ||
| 20 | include scripts/Kbuild.include | 20 | include $(srctree)/scripts/Kbuild.include |
| 21 | 21 | ||
| 22 | redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) | 22 | redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) |
| 23 | redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f))) | 23 | redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f))) |
| @@ -35,27 +35,27 @@ subdir-ccflags-y := · 34 unmodified lines | |||
| 35 | # Read auto.conf if it exists, otherwise ignore | 35 | # Read auto.conf if it exists, otherwise ignore |
| 36 | -include include/config/auto.conf | 36 | -include include/config/auto.conf |
| 37 | 37 | ||
| 38 | include scripts/Kbuild.include | 38 | include $(srctree)/scripts/Kbuild.include |
| 39 | 39 | ||
| 40 | # The filename Kbuild has precedence over Makefile | 40 | # The filename Kbuild has precedence over Makefile |
| 41 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 41 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
| 42 | kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) | 42 | kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) |
| 43 | include $(kbuild-file) | 43 | include $(kbuild-file) |
| 44 | 44 | ||
| 45 | include scripts/Makefile.lib | 45 | include $(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. |
| 49 | hostprogs := $(sort $(hostprogs)) | 49 | hostprogs := $(sort $(hostprogs)) |
| 50 | ifneq ($(hostprogs),) | 50 | ifneq ($(hostprogs),) |
| 51 | include scripts/Makefile.host | 51 | include $(srctree)/scripts/Makefile.host |
| 52 | endif | 52 | endif |
| 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. |
| 56 | userprogs := $(sort $(userprogs)) | 56 | userprogs := $(sort $(userprogs)) |
| 57 | ifneq ($(userprogs),) | 57 | ifneq ($(userprogs),) |
| 58 | include scripts/Makefile.userprogs | 58 | include $(srctree)/scripts/Makefile.userprogs |
| 59 | endif | 59 | endif |
| 60 | 60 | ||
| 61 | ifndef obj | 61 | ifndef obj |
| @@ -8,7 +8,7 @@ src := $(obj) · 7 unmodified lines | |||
| 8 | PHONY := __clean | 8 | PHONY := __clean |
| 9 | __clean: | 9 | __clean: |
| 10 | 10 | ||
| 11 | include scripts/Kbuild.include | 11 | include $(srctree)/scripts/Kbuild.include |
| 12 | 12 | ||
| 13 | # The filename Kbuild has precedence over Makefile | 13 | # The filename Kbuild has precedence over Makefile |
| 14 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 14 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
| @@ -14,7 +14,7 @@ PHONY := __dtbs_install · 13 unmodified lines | |||
| 14 | __dtbs_install: | 14 | __dtbs_install: |
| 15 | 15 | ||
| 16 | include include/config/auto.conf | 16 | include include/config/auto.conf |
| 17 | include scripts/Kbuild.include | 17 | include $(srctree)/scripts/Kbuild.include |
| 18 | include $(src)/Makefile | 18 | include $(src)/Makefile |
| 19 | 19 | ||
| 20 | dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) | 20 | dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | |||
| 12 | PHONY := __headers | 12 | PHONY := __headers |
| 13 | __headers: | 13 | __headers: |
| 14 | 14 | ||
| 15 | include scripts/Kbuild.include | 15 | include $(srctree)/scripts/Kbuild.include |
| 16 | 16 | ||
| 17 | src := $(srctree)/$(obj) | 17 | src := $(srctree)/$(obj) |
| 18 | gen := $(objtree)/$(subst include/,include/generated/,$(obj)) | 18 | gen := $(objtree)/$(subst include/,include/generated/,$(obj)) |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | PHONY := __modinst | 6 | PHONY := __modinst |
| 7 | __modinst: | 7 | __modinst: |
| 8 | 8 | ||
| 9 | include scripts/Kbuild.include | 9 | include $(srctree)/scripts/Kbuild.include |
| 10 | 10 | ||
| 11 | modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) | 11 | modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) |
| 12 | 12 | ||
| @@ -41,10 +41,10 @@ PHONY := __modpost · 40 unmodified lines | |||
| 41 | __modpost: | 41 | __modpost: |
| 42 | 42 | ||
| 43 | include include/config/auto.conf | 43 | include include/config/auto.conf |
| 44 | include scripts/Kbuild.include | 44 | include $(srctree)/scripts/Kbuild.include |
| 45 | 45 | ||
| 46 | # for ld_flags | 46 | # for ld_flags |
| 47 | include scripts/Makefile.lib | 47 | include $(srctree)/scripts/Makefile.lib |
| 48 | 48 | ||
| 49 | MODPOST = scripts/mod/modpost \ | 49 | MODPOST = scripts/mod/modpost \ |
| 50 | $(if $(CONFIG_MODVERSIONS),-m) \ | 50 | $(if $(CONFIG_MODVERSIONS),-m) \ |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | PHONY := __modsign | 6 | PHONY := __modsign |
| 7 | __modsign: | 7 | __modsign: |
| 8 | 8 | ||
| 9 | include scripts/Kbuild.include | 9 | include $(srctree)/scripts/Kbuild.include |
| 10 | 10 | ||
| 11 | modules := $(sort $(shell cat modules.order)) | 11 | modules := $(sort $(shell cat modules.order)) |
| 12 | 12 | ||