mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 01:02:08 +00:00
kbuild: remove extmod_prefix, MODORDER, MODULES_NSDEPS variables
With the previous changes, $(extmod_prefix), $(MODORDER), and $(MODULES_NSDEPS) are constant. (empty, modules.order, and modules.nsdeps, respectively). Remove these variables and hard-code their values. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
This commit is contained in:
parent
13b25489b6
commit
bad6beb2c0
22
Makefile
22
Makefile
@ -1122,10 +1122,6 @@ export MODLIB
|
|||||||
|
|
||||||
PHONY += prepare0
|
PHONY += prepare0
|
||||||
|
|
||||||
export extmod_prefix =
|
|
||||||
export MODORDER := $(extmod_prefix)modules.order
|
|
||||||
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
|
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
|
|
||||||
build-dir := .
|
build-dir := .
|
||||||
@ -1876,7 +1872,7 @@ endif
|
|||||||
|
|
||||||
ifdef CONFIG_MODULES
|
ifdef CONFIG_MODULES
|
||||||
|
|
||||||
$(MODORDER): $(build-dir)
|
modules.order: $(build-dir)
|
||||||
@:
|
@:
|
||||||
|
|
||||||
# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
|
# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
|
||||||
@ -1887,7 +1883,7 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
PHONY += modules_check
|
PHONY += modules_check
|
||||||
modules_check: $(MODORDER)
|
modules_check: modules.order
|
||||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
|
||||||
|
|
||||||
else # CONFIG_MODULES
|
else # CONFIG_MODULES
|
||||||
@ -1928,15 +1924,15 @@ $(single-ko): single_modules
|
|||||||
$(single-no-ko): $(build-dir)
|
$(single-no-ko): $(build-dir)
|
||||||
@:
|
@:
|
||||||
|
|
||||||
# Remove MODORDER when done because it is not the real one.
|
# Remove modules.order when done because it is not the real one.
|
||||||
PHONY += single_modules
|
PHONY += single_modules
|
||||||
single_modules: $(single-no-ko) modules_prepare
|
single_modules: $(single-no-ko) modules_prepare
|
||||||
$(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$(m:%.ko=%.o);) } > $(MODORDER)
|
$(Q){ $(foreach m, $(single-ko), echo $(m:%.ko=%.o);) } > modules.order
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||||
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
|
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
|
||||||
endif
|
endif
|
||||||
$(Q)rm -f $(MODORDER)
|
$(Q)rm -f modules.order
|
||||||
|
|
||||||
single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
|
single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
|
||||||
|
|
||||||
@ -2013,12 +2009,12 @@ nsdeps: modules
|
|||||||
quiet_cmd_gen_compile_commands = GEN $@
|
quiet_cmd_gen_compile_commands = GEN $@
|
||||||
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
|
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
|
||||||
|
|
||||||
$(extmod_prefix)compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
|
compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
|
||||||
$(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
|
$(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
|
||||||
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
|
$(if $(CONFIG_MODULES), modules.order) FORCE
|
||||||
$(call if_changed,gen_compile_commands)
|
$(call if_changed,gen_compile_commands)
|
||||||
|
|
||||||
targets += $(extmod_prefix)compile_commands.json
|
targets += compile_commands.json
|
||||||
|
|
||||||
PHONY += clang-tidy clang-analyzer
|
PHONY += clang-tidy clang-analyzer
|
||||||
|
|
||||||
@ -2026,7 +2022,7 @@ ifdef CONFIG_CC_IS_CLANG
|
|||||||
quiet_cmd_clang_tools = CHECK $<
|
quiet_cmd_clang_tools = CHECK $<
|
||||||
cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
|
cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
|
||||||
|
|
||||||
clang-tidy clang-analyzer: $(extmod_prefix)compile_commands.json
|
clang-tidy clang-analyzer: compile_commands.json
|
||||||
$(call cmd,clang_tools)
|
$(call cmd,clang_tools)
|
||||||
else
|
else
|
||||||
clang-tidy clang-analyzer:
|
clang-tidy clang-analyzer:
|
||||||
|
@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include
|
|||||||
include $(srctree)/scripts/Makefile.lib
|
include $(srctree)/scripts/Makefile.lib
|
||||||
|
|
||||||
# find all modules listed in modules.order
|
# find all modules listed in modules.order
|
||||||
modules := $(call read-file, $(MODORDER))
|
modules := $(call read-file, modules.order)
|
||||||
|
|
||||||
__modfinal: $(modules:%.o=%.ko)
|
__modfinal: $(modules:%.o=%.ko)
|
||||||
@:
|
@:
|
||||||
@ -30,7 +30,7 @@ quiet_cmd_cc_o_c = CC [M] $@
|
|||||||
%.mod.o: %.mod.c FORCE
|
%.mod.o: %.mod.c FORCE
|
||||||
$(call if_changed_dep,cc_o_c)
|
$(call if_changed_dep,cc_o_c)
|
||||||
|
|
||||||
$(extmod_prefix).module-common.o: $(srctree)/scripts/module-common.c FORCE
|
.module-common.o: $(srctree)/scripts/module-common.c FORCE
|
||||||
$(call if_changed_dep,cc_o_c)
|
$(call if_changed_dep,cc_o_c)
|
||||||
|
|
||||||
quiet_cmd_ld_ko_o = LD [M] $@
|
quiet_cmd_ld_ko_o = LD [M] $@
|
||||||
@ -57,13 +57,13 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
|
|||||||
printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
||||||
|
|
||||||
# Re-generate module BTFs if either module's .ko or vmlinux changed
|
# Re-generate module BTFs if either module's .ko or vmlinux changed
|
||||||
%.ko: %.o %.mod.o $(extmod_prefix).module-common.o $(objtree)/scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),$(objtree)/vmlinux) FORCE
|
%.ko: %.o %.mod.o .module-common.o $(objtree)/scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),$(objtree)/vmlinux) FORCE
|
||||||
+$(call if_changed_except,ld_ko_o,$(objtree)/vmlinux)
|
+$(call if_changed_except,ld_ko_o,$(objtree)/vmlinux)
|
||||||
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
|
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
|
||||||
+$(if $(newer-prereqs),$(call cmd,btf_ko))
|
+$(if $(newer-prereqs),$(call cmd,btf_ko))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) $(extmod_prefix).module-common.o
|
targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) .module-common.o
|
||||||
|
|
||||||
# Add FORCE to the prerequisites of a target to force it to be always rebuilt.
|
# Add FORCE to the prerequisites of a target to force it to be always rebuilt.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
@ -40,7 +40,7 @@ $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo modules.builtin.
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
modules := $(call read-file, $(MODORDER))
|
modules := $(call read-file, modules.order)
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
dst := $(MODLIB)/kernel
|
dst := $(MODLIB)/kernel
|
||||||
@ -59,7 +59,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
|
|||||||
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
|
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
|
||||||
endif
|
endif
|
||||||
|
|
||||||
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
|
modules := $(patsubst %.o, $(dst)/%.ko$(suffix-y), $(modules))
|
||||||
install-$(CONFIG_MODULES) += $(modules)
|
install-$(CONFIG_MODULES) += $(modules)
|
||||||
|
|
||||||
__modinst: $(install-y)
|
__modinst: $(install-y)
|
||||||
@ -119,7 +119,7 @@ endif
|
|||||||
# Create necessary directories
|
# Create necessary directories
|
||||||
$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
|
$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
|
||||||
|
|
||||||
$(dst)/%.ko: $(extmod_prefix)%.ko FORCE
|
$(dst)/%.ko: %.ko FORCE
|
||||||
$(call cmd,install)
|
$(call cmd,install)
|
||||||
$(call cmd,strip)
|
$(call cmd,strip)
|
||||||
$(call cmd,sign)
|
$(call cmd,sign)
|
||||||
|
@ -46,7 +46,7 @@ modpost-args = \
|
|||||||
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
|
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
|
||||||
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
|
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
|
||||||
$(if $(KBUILD_MODPOST_WARN),-w) \
|
$(if $(KBUILD_MODPOST_WARN),-w) \
|
||||||
$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \
|
$(if $(KBUILD_NSDEPS),-d modules.nsdeps) \
|
||||||
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
|
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
|
||||||
$(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \
|
$(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \
|
||||||
-o $@
|
-o $@
|
||||||
@ -61,8 +61,8 @@ endif
|
|||||||
# Read out modules.order to pass in modpost.
|
# Read out modules.order to pass in modpost.
|
||||||
# Otherwise, allmodconfig would fail with "Argument list too long".
|
# Otherwise, allmodconfig would fail with "Argument list too long".
|
||||||
ifdef KBUILD_MODULES
|
ifdef KBUILD_MODULES
|
||||||
modpost-args += -T $(MODORDER)
|
modpost-args += -T modules.order
|
||||||
modpost-deps += $(MODORDER)
|
modpost-deps += modules.order
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
|
@ -51,4 +51,4 @@ generate_deps() {
|
|||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
generate_deps $line
|
generate_deps $line
|
||||||
done < $MODULES_NSDEPS
|
done < modules.nsdeps
|
||||||
|
Loading…
Reference in New Issue
Block a user