mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									1e28eed176
								
							
						
					
					
						commit
						3204a7fb98
					
				
					 9 changed files with 17 additions and 17 deletions
				
			
		
							
								
								
									
										8
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Makefile
									
									
									
									
									
								
							|  | @ -339,14 +339,14 @@ __build_one_by_one: | ||||||
| 
 | 
 | ||||||
| else # !mixed-build
 | else # !mixed-build
 | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| # Read KERNELRELEASE from include/config/kernel.release (if it exists)
 | # Read KERNELRELEASE from include/config/kernel.release (if it exists)
 | ||||||
| KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | ||||||
| KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | ||||||
| export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | ||||||
| 
 | 
 | ||||||
| include scripts/subarch.include | include $(srctree)/scripts/subarch.include | ||||||
| 
 | 
 | ||||||
| # Cross compiling and selecting different set of gcc/bin-utils
 | # Cross compiling and selecting different set of gcc/bin-utils
 | ||||||
| # ---------------------------------------------------------------------------
 | # ---------------------------------------------------------------------------
 | ||||||
|  | @ -592,7 +592,7 @@ ifdef config-build | ||||||
| # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
 | # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
 | ||||||
| # KBUILD_DEFCONFIG may point out an alternative default configuration
 | # KBUILD_DEFCONFIG may point out an alternative default configuration
 | ||||||
| # used for 'make defconfig'
 | # used for 'make defconfig'
 | ||||||
| include arch/$(SRCARCH)/Makefile | include $(srctree)/arch/$(SRCARCH)/Makefile | ||||||
| export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT | export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT | ||||||
| 
 | 
 | ||||||
| config: outputmakefile scripts_basic FORCE | config: outputmakefile scripts_basic FORCE | ||||||
|  | @ -679,7 +679,7 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc | ||||||
| export RETPOLINE_CFLAGS | export RETPOLINE_CFLAGS | ||||||
| export RETPOLINE_VDSO_CFLAGS | export RETPOLINE_VDSO_CFLAGS | ||||||
| 
 | 
 | ||||||
| include arch/$(SRCARCH)/Makefile | include $(srctree)/arch/$(SRCARCH)/Makefile | ||||||
| 
 | 
 | ||||||
| ifdef need-config | ifdef need-config | ||||||
| ifdef may-sync-config | ifdef may-sync-config | ||||||
|  |  | ||||||
|  | @ -14,10 +14,10 @@ src := $(subst /generated,,$(obj)) | ||||||
| 
 | 
 | ||||||
| # $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case. | # $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case. | ||||||
| ifneq ($(SRCARCH),um) | ifneq ($(SRCARCH),um) | ||||||
| include $(generic)/Kbuild | include $(srctree)/$(generic)/Kbuild | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) | redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) | ||||||
| redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f))) | redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f))) | ||||||
|  |  | ||||||
|  | @ -35,27 +35,27 @@ subdir-ccflags-y := | ||||||
| # Read auto.conf if it exists, otherwise ignore | # Read auto.conf if it exists, otherwise ignore | ||||||
| -include include/config/auto.conf | -include include/config/auto.conf | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| # The filename Kbuild has precedence over Makefile | # The filename Kbuild has precedence over Makefile | ||||||
| kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | ||||||
| kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) | kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) | ||||||
| include $(kbuild-file) | include $(kbuild-file) | ||||||
| 
 | 
 | ||||||
| include scripts/Makefile.lib | include $(srctree)/scripts/Makefile.lib | ||||||
| 
 | 
 | ||||||
| # Do not include hostprogs rules unless needed. | # Do not include hostprogs rules unless needed. | ||||||
| # $(sort ...) is used here to remove duplicated words and excessive spaces. | # $(sort ...) is used here to remove duplicated words and excessive spaces. | ||||||
| hostprogs := $(sort $(hostprogs)) | hostprogs := $(sort $(hostprogs)) | ||||||
| ifneq ($(hostprogs),) | ifneq ($(hostprogs),) | ||||||
| include scripts/Makefile.host | include $(srctree)/scripts/Makefile.host | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| # Do not include userprogs rules unless needed. | # Do not include userprogs rules unless needed. | ||||||
| # $(sort ...) is used here to remove duplicated words and excessive spaces. | # $(sort ...) is used here to remove duplicated words and excessive spaces. | ||||||
| userprogs := $(sort $(userprogs)) | userprogs := $(sort $(userprogs)) | ||||||
| ifneq ($(userprogs),) | ifneq ($(userprogs),) | ||||||
| include scripts/Makefile.userprogs | include $(srctree)/scripts/Makefile.userprogs | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| ifndef obj | ifndef obj | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ src := $(obj) | ||||||
| PHONY := __clean | PHONY := __clean | ||||||
| __clean: | __clean: | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| # The filename Kbuild has precedence over Makefile | # The filename Kbuild has precedence over Makefile | ||||||
| kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ PHONY := __dtbs_install | ||||||
| __dtbs_install: | __dtbs_install: | ||||||
| 
 | 
 | ||||||
| include include/config/auto.conf | include include/config/auto.conf | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| include $(src)/Makefile | include $(src)/Makefile | ||||||
| 
 | 
 | ||||||
| dtbs    := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) | dtbs    := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ | ||||||
| PHONY := __headers | PHONY := __headers | ||||||
| __headers: | __headers: | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| src := $(srctree)/$(obj) | src := $(srctree)/$(obj) | ||||||
| gen := $(objtree)/$(subst include/,include/generated/,$(obj)) | gen := $(objtree)/$(subst include/,include/generated/,$(obj)) | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| PHONY := __modinst | PHONY := __modinst | ||||||
| __modinst: | __modinst: | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) | modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -41,10 +41,10 @@ PHONY := __modpost | ||||||
| __modpost: | __modpost: | ||||||
| 
 | 
 | ||||||
| include include/config/auto.conf | include include/config/auto.conf | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| # for ld_flags | # for ld_flags | ||||||
| include scripts/Makefile.lib | include $(srctree)/scripts/Makefile.lib | ||||||
| 
 | 
 | ||||||
| MODPOST = scripts/mod/modpost								\ | MODPOST = scripts/mod/modpost								\ | ||||||
| 	$(if $(CONFIG_MODVERSIONS),-m)							\ | 	$(if $(CONFIG_MODVERSIONS),-m)							\ | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| PHONY := __modsign | PHONY := __modsign | ||||||
| __modsign: | __modsign: | ||||||
| 
 | 
 | ||||||
| include scripts/Kbuild.include | include $(srctree)/scripts/Kbuild.include | ||||||
| 
 | 
 | ||||||
| modules := $(sort $(shell cat modules.order)) | modules := $(sort $(shell cat modules.order)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Masahiro Yamada
						Masahiro Yamada