kbuild: add kbuild-file macro
While building, installing, cleaning, Kbuild visits sub-directories and includes 'Kbuild' or 'Makefile' that exists there. Add 'kbuild-file' macro, and reuse it from scripts/Makefie.* Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Reviewed-by: Alexander Lobakin <alobakin@pm.me> Tested-by: Alexander Lobakin <alobakin@pm.me>
This commit is contained in:
parent
5724ac5589
commit
a2430b25c3
|
@ -40,6 +40,11 @@ escsq = $(subst $(squote),'\$(squote)',$1)
|
||||||
# Quote a string to pass it to C files. foo => '"foo"'
|
# Quote a string to pass it to C files. foo => '"foo"'
|
||||||
stringify = $(squote)$(quote)$1$(quote)$(squote)
|
stringify = $(squote)$(quote)$1$(quote)$(squote)
|
||||||
|
|
||||||
|
###
|
||||||
|
# The path to Kbuild or Makefile. Kbuild has precedence over Makefile.
|
||||||
|
kbuild-dir = $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
||||||
|
kbuild-file = $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
|
||||||
|
|
||||||
###
|
###
|
||||||
# Easy method for doing a status message
|
# Easy method for doing a status message
|
||||||
kecho := :
|
kecho := :
|
||||||
|
|
|
@ -10,15 +10,15 @@ PHONY := all
|
||||||
all:
|
all:
|
||||||
|
|
||||||
src := $(subst /generated,,$(obj))
|
src := $(subst /generated,,$(obj))
|
||||||
-include $(src)/Kbuild
|
|
||||||
|
include $(srctree)/scripts/Kbuild.include
|
||||||
|
-include $(kbuild-file)
|
||||||
|
|
||||||
# $(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 $(srctree)/$(generic)/Kbuild
|
include $(srctree)/$(generic)/Kbuild
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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)))
|
||||||
redundant := $(sort $(redundant))
|
redundant := $(sort $(redundant))
|
||||||
|
|
|
@ -38,11 +38,7 @@ subdir-ccflags-y :=
|
||||||
|
|
||||||
include $(srctree)/scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
include $(srctree)/scripts/Makefile.compiler
|
include $(srctree)/scripts/Makefile.compiler
|
||||||
|
include $(kbuild-file)
|
||||||
# The filename Kbuild has precedence over Makefile
|
|
||||||
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
|
||||||
include $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
|
|
||||||
|
|
||||||
include $(srctree)/scripts/Makefile.lib
|
include $(srctree)/scripts/Makefile.lib
|
||||||
|
|
||||||
# Do not include hostprogs rules unless needed.
|
# Do not include hostprogs rules unless needed.
|
||||||
|
|
|
@ -9,10 +9,7 @@ PHONY := __clean
|
||||||
__clean:
|
__clean:
|
||||||
|
|
||||||
include $(srctree)/scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
|
include $(kbuild-file)
|
||||||
# The filename Kbuild has precedence over Makefile
|
|
||||||
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
|
||||||
include $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
|
|
||||||
|
|
||||||
# Figure out what we need to build from the various variables
|
# Figure out what we need to build from the various variables
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
|
@ -15,7 +15,7 @@ __dtbs_install:
|
||||||
|
|
||||||
include include/config/auto.conf
|
include include/config/auto.conf
|
||||||
include $(srctree)/scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
include $(src)/Makefile
|
include $(kbuild-file)
|
||||||
|
|
||||||
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
||||||
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
|
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
|
||||||
|
|
|
@ -93,7 +93,7 @@ obj := $(KBUILD_EXTMOD)
|
||||||
src := $(obj)
|
src := $(obj)
|
||||||
|
|
||||||
# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
|
# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
|
||||||
include $(or $(wildcard $(src)/Kbuild), $(src)/Makefile)
|
include $(kbuild-file)
|
||||||
|
|
||||||
module.symvers-if-present := $(wildcard Module.symvers)
|
module.symvers-if-present := $(wildcard Module.symvers)
|
||||||
output-symdump := $(KBUILD_EXTMOD)/Module.symvers
|
output-symdump := $(KBUILD_EXTMOD)/Module.symvers
|
||||||
|
|
Loading…
Reference in New Issue