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.
Unified · Split
| @@ -1122,10 +1122,6 @@ export MODLIB · 1121 unmodified lines | |||
| 1122 | 1122 | ||
| 1123 | PHONY += prepare0 | 1123 | PHONY += prepare0 |
| 1124 | 1124 | ||
| 1125 | export extmod_prefix = | ||
| 1126 | export MODORDER := $(extmod_prefix)modules.order | ||
| 1127 | export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps | ||
| 1128 | |||
| 1129 | ifeq ($(KBUILD_EXTMOD),) | 1125 | ifeq ($(KBUILD_EXTMOD),) |
| 1130 | 1126 | ||
| 1131 | build-dir := . | 1127 | build-dir := . |
| @@ -1876,7 +1872,7 @@ endif · 744 unmodified lines | |||
| 1876 | 1872 | ||
| 1877 | ifdef CONFIG_MODULES | 1873 | ifdef CONFIG_MODULES |
| 1878 | 1874 | ||
| 1879 | $(MODORDER): $(build-dir) | 1875 | modules.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 | |||
| 1887 | endif | 1883 | endif |
| 1888 | 1884 | ||
| 1889 | PHONY += modules_check | 1885 | PHONY += modules_check |
| 1890 | modules_check: $(MODORDER) | 1886 | modules_check: modules.order |
| 1891 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $< | 1887 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $< |
| 1892 | 1888 | ||
| 1893 | else # CONFIG_MODULES | 1889 | else # 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. |
| 1932 | PHONY += single_modules | 1928 | PHONY += single_modules |
| 1933 | single_modules: $(single-no-ko) modules_prepare | 1929 | single_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.modpost | 1931 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| 1936 | ifneq ($(KBUILD_MODPOST_NOFINAL),1) | 1932 | ifneq ($(KBUILD_MODPOST_NOFINAL),1) |
| 1937 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal | 1933 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal |
| 1938 | endif | 1934 | endif |
| 1939 | $(Q)rm -f $(MODORDER) | 1935 | $(Q)rm -f modules.order |
| 1940 | 1936 | ||
| 1941 | single-goals := $(addprefix $(build-dir)/, $(single-no-ko)) | 1937 | single-goals := $(addprefix $(build-dir)/, $(single-no-ko)) |
| 1942 | 1938 | ||
| @@ -2013,12 +2009,12 @@ nsdeps: modules · 70 unmodified lines | |||
| 2013 | quiet_cmd_gen_compile_commands = GEN $@ | 2009 | quiet_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 \ | 2012 | compile_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)) FORCE | 2014 | $(if $(CONFIG_MODULES), modules.order) FORCE |
| 2019 | $(call if_changed,gen_compile_commands) | 2015 | $(call if_changed,gen_compile_commands) |
| 2020 | 2016 | ||
| 2021 | targets += $(extmod_prefix)compile_commands.json | 2017 | targets += compile_commands.json |
| 2022 | 2018 | ||
| 2023 | PHONY += clang-tidy clang-analyzer | 2019 | PHONY += clang-tidy clang-analyzer |
| 2024 | 2020 | ||
| @@ -2026,7 +2022,7 @@ ifdef CONFIG_CC_IS_CLANG · 1 unmodified line | |||
| 2026 | quiet_cmd_clang_tools = CHECK $< | 2022 | quiet_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 | ||
| 2029 | clang-tidy clang-analyzer: $(extmod_prefix)compile_commands.json | 2025 | clang-tidy clang-analyzer: compile_commands.json |
| 2030 | $(call cmd,clang_tools) | 2026 | $(call cmd,clang_tools) |
| 2031 | else | 2027 | else |
| 2032 | clang-tidy clang-analyzer: | 2028 | clang-tidy clang-analyzer: |
| @@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include · 12 unmodified lines | |||
| 13 | include $(srctree)/scripts/Makefile.lib | 13 | include $(srctree)/scripts/Makefile.lib |
| 14 | 14 | ||
| 15 | # find all modules listed in modules.order | 15 | # find all modules listed in modules.order |
| 16 | modules := $(call read-file, $(MODORDER)) | 16 | modules := $(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 FORCE | 30 | %.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 FORCE | 33 | .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 | ||
| 36 | quiet_cmd_ld_ko_o = LD [M] $@ | 36 | quiet_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 changed | 59 | # 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) FORCE | 60 | %.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) |
| 62 | ifdef CONFIG_DEBUG_INFO_BTF_MODULES | 62 | ifdef CONFIG_DEBUG_INFO_BTF_MODULES |
| 63 | +$(if $(newer-prereqs),$(call cmd,btf_ko)) | 63 | +$(if $(newer-prereqs),$(call cmd,btf_ko)) |
| 64 | endif | 64 | endif |
| 65 | 65 | ||
| 66 | targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) $(extmod_prefix).module-common.o | 66 | targets += $(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 | # --------------------------------------------------------------------------- |
| @@ -40,7 +40,7 @@ $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo modules.builtin. · 39 unmodified lines | |||
| 40 | 40 | ||
| 41 | endif | 41 | endif |
| 42 | 42 | ||
| 43 | modules := $(call read-file, $(MODORDER)) | 43 | modules := $(call read-file, modules.order) |
| 44 | 44 | ||
| 45 | ifeq ($(KBUILD_EXTMOD),) | 45 | ifeq ($(KBUILD_EXTMOD),) |
| 46 | dst := $(MODLIB)/kernel | 46 | dst := $(MODLIB)/kernel |
| @@ -59,7 +59,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz · 12 unmodified lines | |||
| 59 | suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst | 59 | suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst |
| 60 | endif | 60 | endif |
| 61 | 61 | ||
| 62 | modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules)) | 62 | modules := $(patsubst %.o, $(dst)/%.ko$(suffix-y), $(modules)) |
| 63 | install-$(CONFIG_MODULES) += $(modules) | 63 | install-$(CONFIG_MODULES) += $(modules) |
| 64 | 64 | ||
| 65 | __modinst: $(install-y) | 65 | __modinst: $(install-y) |
| @@ -119,7 +119,7 @@ endif · 53 unmodified lines | |||
| 119 | # Create necessary directories | 119 | # 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 FORCE | 122 | $(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) |
| @@ -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". |
| 63 | ifdef KBUILD_MODULES | 63 | ifdef KBUILD_MODULES |
| 64 | modpost-args += -T $(MODORDER) | 64 | modpost-args += -T modules.order |
| 65 | modpost-deps += $(MODORDER) | 65 | modpost-deps += modules.order |
| 66 | endif | 66 | endif |
| 67 | 67 | ||
| 68 | ifeq ($(KBUILD_EXTMOD),) | 68 | ifeq ($(KBUILD_EXTMOD),) |
| @@ -51,4 +51,4 @@ generate_deps() { · 50 unmodified lines | |||
| 51 | while read line | 51 | while read line |
| 52 | do | 52 | do |
| 53 | generate_deps $line | 53 | generate_deps $line |
| 54 | done < $MODULES_NSDEPS | 54 | done < modules.nsdeps |