History

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.

Masahiro Yamada committed 2 years ago

Commit bad6beb1 parent 13b25485 files · +20 −24Browse files

Unified · Split

5 files
  1. Makefile +9 −13
  2. scripts/Makefile.modfinal +4 −4
  3. scripts/Makefile.modinst +3 −3
  4. scripts/Makefile.modpost +3 −3
  5. scripts/nsdeps +1 −1
Makefile+9−13
@@ -1122,10 +1122,6 @@ export MODLIB · 1121 unmodified lines
1122 1122
1123PHONY += prepare01123PHONY += prepare0
1124 1124
1125export extmod_prefix =
1126export MODORDER := $(extmod_prefix)modules.order
1127export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
1128
1129ifeq ($(KBUILD_EXTMOD),)1125ifeq ($(KBUILD_EXTMOD),)
1130 1126
1131build-dir := .1127build-dir := .
@@ -1876,7 +1872,7 @@ endif · 744 unmodified lines
1876 1872
1877ifdef CONFIG_MODULES1873ifdef CONFIG_MODULES
1878 1874
1879$(MODORDER): $(build-dir)1875modules.order: $(build-dir)
1880 @:1876 @:
1881 1877
1882# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.1878# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
@@ -1887,7 +1883,7 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1) · 4 unmodified lines
1887endif1883endif
1888 1884
1889PHONY += modules_check1885PHONY += modules_check
1890modules_check: $(MODORDER)1886modules_check: modules.order
1891 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<1887 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
1892 1888
1893else # CONFIG_MODULES1889else # CONFIG_MODULES
@@ -1928,15 +1924,15 @@ $(single-ko): single_modules · 34 unmodified lines
1928$(single-no-ko): $(build-dir)1924$(single-no-ko): $(build-dir)
1929 @:1925 @:
1930 1926
1931# Remove MODORDER when done because it is not the real one.1927# Remove modules.order when done because it is not the real one.
1932PHONY += single_modules1928PHONY += single_modules
1933single_modules: $(single-no-ko) modules_prepare1929single_modules: $(single-no-ko) modules_prepare
1934 $(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$(m:%.ko=%.o);) } > $(MODORDER)1930 $(Q){ $(foreach m, $(single-ko), echo $(m:%.ko=%.o);) } > modules.order
1935 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost1931 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1936ifneq ($(KBUILD_MODPOST_NOFINAL),1)1932ifneq ($(KBUILD_MODPOST_NOFINAL),1)
1937 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal1933 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
1938endif1934endif
1939 $(Q)rm -f $(MODORDER)1935 $(Q)rm -f modules.order
1940 1936
1941single-goals := $(addprefix $(build-dir)/, $(single-no-ko))1937single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
1942 1938
@@ -2013,12 +2009,12 @@ nsdeps: modules · 70 unmodified lines
2013quiet_cmd_gen_compile_commands = GEN $@2009quiet_cmd_gen_compile_commands = GEN $@
2014 cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))2010 cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
2015 2011
2016$(extmod_prefix)compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \2012compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
2017 $(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \2013 $(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
2018 $(if $(CONFIG_MODULES), $(MODORDER)) FORCE2014 $(if $(CONFIG_MODULES), modules.order) FORCE
2019 $(call if_changed,gen_compile_commands)2015 $(call if_changed,gen_compile_commands)
2020 2016
2021targets += $(extmod_prefix)compile_commands.json2017targets += compile_commands.json
2022 2018
2023PHONY += clang-tidy clang-analyzer2019PHONY += clang-tidy clang-analyzer
2024 2020
@@ -2026,7 +2022,7 @@ ifdef CONFIG_CC_IS_CLANG · 1 unmodified line
2026quiet_cmd_clang_tools = CHECK $<2022quiet_cmd_clang_tools = CHECK $<
2027 cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<2023 cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
2028 2024
2029clang-tidy clang-analyzer: $(extmod_prefix)compile_commands.json2025clang-tidy clang-analyzer: compile_commands.json
2030 $(call cmd,clang_tools)2026 $(call cmd,clang_tools)
2031else2027else
2032clang-tidy clang-analyzer:2028clang-tidy clang-analyzer:
scripts/Makefile.modfinal+4−4
@@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include · 12 unmodified lines
13include $(srctree)/scripts/Makefile.lib13include $(srctree)/scripts/Makefile.lib
14 14
15# find all modules listed in modules.order15# find all modules listed in modules.order
16modules := $(call read-file, $(MODORDER))16modules := $(call read-file, modules.order)
17 17
18__modfinal: $(modules:%.o=%.ko)18__modfinal: $(modules:%.o=%.ko)
19 @:19 @:
@@ -30,7 +30,7 @@ quiet_cmd_cc_o_c = CC [M] $@ · 10 unmodified lines
30%.mod.o: %.mod.c FORCE30%.mod.o: %.mod.c FORCE
31 $(call if_changed_dep,cc_o_c)31 $(call if_changed_dep,cc_o_c)
32 32
33$(extmod_prefix).module-common.o: $(srctree)/scripts/module-common.c FORCE33.module-common.o: $(srctree)/scripts/module-common.c FORCE
34 $(call if_changed_dep,cc_o_c)34 $(call if_changed_dep,cc_o_c)
35 35
36quiet_cmd_ld_ko_o = LD [M] $@36quiet_cmd_ld_ko_o = LD [M] $@
@@ -57,13 +57,13 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \ · 20 unmodified lines
57 printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)57 printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
58 58
59# Re-generate module BTFs if either module's .ko or vmlinux changed59# Re-generate module BTFs if either module's .ko or vmlinux changed
60%.ko: %.o %.mod.o $(extmod_prefix).module-common.o $(objtree)/scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),$(objtree)/vmlinux) FORCE60%.ko: %.o %.mod.o .module-common.o $(objtree)/scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),$(objtree)/vmlinux) FORCE
61 +$(call if_changed_except,ld_ko_o,$(objtree)/vmlinux)61 +$(call if_changed_except,ld_ko_o,$(objtree)/vmlinux)
62ifdef CONFIG_DEBUG_INFO_BTF_MODULES62ifdef CONFIG_DEBUG_INFO_BTF_MODULES
63 +$(if $(newer-prereqs),$(call cmd,btf_ko))63 +$(if $(newer-prereqs),$(call cmd,btf_ko))
64endif64endif
65 65
66targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) $(extmod_prefix).module-common.o66targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) .module-common.o
67 67
68# Add FORCE to the prerequisites of a target to force it to be always rebuilt.68# Add FORCE to the prerequisites of a target to force it to be always rebuilt.
69# ---------------------------------------------------------------------------69# ---------------------------------------------------------------------------
scripts/Makefile.modinst+3−3
@@ -40,7 +40,7 @@ $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo modules.builtin. · 39 unmodified lines
40 40
41endif41endif
42 42
43modules := $(call read-file, $(MODORDER))43modules := $(call read-file, modules.order)
44 44
45ifeq ($(KBUILD_EXTMOD),)45ifeq ($(KBUILD_EXTMOD),)
46dst := $(MODLIB)/kernel46dst := $(MODLIB)/kernel
@@ -59,7 +59,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz · 12 unmodified lines
59suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst59suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
60endif60endif
61 61
62modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))62modules := $(patsubst %.o, $(dst)/%.ko$(suffix-y), $(modules))
63install-$(CONFIG_MODULES) += $(modules)63install-$(CONFIG_MODULES) += $(modules)
64 64
65__modinst: $(install-y)65__modinst: $(install-y)
@@ -119,7 +119,7 @@ endif · 53 unmodified lines
119# Create necessary directories119# Create necessary directories
120$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))120$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
121 121
122$(dst)/%.ko: $(extmod_prefix)%.ko FORCE122$(dst)/%.ko: %.ko FORCE
123 $(call cmd,install)123 $(call cmd,install)
124 $(call cmd,strip)124 $(call cmd,strip)
125 $(call cmd,sign)125 $(call cmd,sign)
scripts/Makefile.modpost+3−3
@@ -46,7 +46,7 @@ modpost-args = \ · 45 unmodified lines
46 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \46 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
47 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \47 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
48 $(if $(KBUILD_MODPOST_WARN),-w) \48 $(if $(KBUILD_MODPOST_WARN),-w) \
49 $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \49 $(if $(KBUILD_NSDEPS),-d modules.nsdeps) \
50 $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \50 $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
51 $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \51 $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \
52 -o $@52 -o $@
@@ -61,8 +61,8 @@ endif · 8 unmodified lines
61# Read out modules.order to pass in modpost.61# Read out modules.order to pass in modpost.
62# Otherwise, allmodconfig would fail with "Argument list too long".62# Otherwise, allmodconfig would fail with "Argument list too long".
63ifdef KBUILD_MODULES63ifdef KBUILD_MODULES
64modpost-args += -T $(MODORDER)64modpost-args += -T modules.order
65modpost-deps += $(MODORDER)65modpost-deps += modules.order
66endif66endif
67 67
68ifeq ($(KBUILD_EXTMOD),)68ifeq ($(KBUILD_EXTMOD),)
scripts/nsdeps+1−1
@@ -51,4 +51,4 @@ generate_deps() { · 50 unmodified lines
51while read line51while read line
52do52do
53 generate_deps $line53 generate_deps $line
54done < $MODULES_NSDEPS54done < modules.nsdeps