Skip to content

Commit bad6beb

Browse files
committed
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 <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
1 parent 13b2548 commit bad6beb

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

Makefile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,10 +1122,6 @@ export MODLIB
11221122

11231123
PHONY += prepare0
11241124

1125-
export extmod_prefix =
1126-
export MODORDER := $(extmod_prefix)modules.order
1127-
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
1128-
11291125
ifeq ($(KBUILD_EXTMOD),)
11301126

11311127
build-dir := .
@@ -1876,7 +1872,7 @@ endif
18761872

18771873
ifdef CONFIG_MODULES
18781874

1879-
$(MODORDER): $(build-dir)
1875+
modules.order: $(build-dir)
18801876
@:
18811877

18821878
# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
@@ -1887,7 +1883,7 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
18871883
endif
18881884

18891885
PHONY += modules_check
1890-
modules_check: $(MODORDER)
1886+
modules_check: modules.order
18911887
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
18921888

18931889
else # CONFIG_MODULES
@@ -1928,15 +1924,15 @@ $(single-ko): single_modules
19281924
$(single-no-ko): $(build-dir)
19291925
@:
19301926

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.
19321928
PHONY += single_modules
19331929
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
19351931
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
19361932
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
19371933
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
19381934
endif
1939-
$(Q)rm -f $(MODORDER)
1935+
$(Q)rm -f modules.order
19401936

19411937
single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
19421938

@@ -2013,20 +2009,20 @@ nsdeps: modules
20132009
quiet_cmd_gen_compile_commands = GEN $@
20142010
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
20152011

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 \
20172013
$(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \
2018-
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
2014+
$(if $(CONFIG_MODULES), modules.order) FORCE
20192015
$(call if_changed,gen_compile_commands)
20202016

2021-
targets += $(extmod_prefix)compile_commands.json
2017+
targets += compile_commands.json
20222018

20232019
PHONY += clang-tidy clang-analyzer
20242020

20252021
ifdef CONFIG_CC_IS_CLANG
20262022
quiet_cmd_clang_tools = CHECK $<
20272023
cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
20282024

2029-
clang-tidy clang-analyzer: $(extmod_prefix)compile_commands.json
2025+
clang-tidy clang-analyzer: compile_commands.json
20302026
$(call cmd,clang_tools)
20312027
else
20322028
clang-tidy clang-analyzer:

scripts/Makefile.modfinal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include $(srctree)/scripts/Kbuild.include
1313
include $(srctree)/scripts/Makefile.lib
1414

1515
# find all modules listed in modules.order
16-
modules := $(call read-file, $(MODORDER))
16+
modules := $(call read-file, modules.order)
1717

1818
__modfinal: $(modules:%.o=%.ko)
1919
@:
@@ -30,7 +30,7 @@ quiet_cmd_cc_o_c = CC [M] $@
3030
%.mod.o: %.mod.c FORCE
3131
$(call if_changed_dep,cc_o_c)
3232

33-
$(extmod_prefix).module-common.o: $(srctree)/scripts/module-common.c FORCE
33+
.module-common.o: $(srctree)/scripts/module-common.c FORCE
3434
$(call if_changed_dep,cc_o_c)
3535

3636
quiet_cmd_ld_ko_o = LD [M] $@
@@ -57,13 +57,13 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
5757
printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
5858

5959
# 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
6161
+$(call if_changed_except,ld_ko_o,$(objtree)/vmlinux)
6262
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
6363
+$(if $(newer-prereqs),$(call cmd,btf_ko))
6464
endif
6565

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
6767

6868
# Add FORCE to the prerequisites of a target to force it to be always rebuilt.
6969
# ---------------------------------------------------------------------------

scripts/Makefile.modinst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo modules.builtin.
4040

4141
endif
4242

43-
modules := $(call read-file, $(MODORDER))
43+
modules := $(call read-file, modules.order)
4444

4545
ifeq ($(KBUILD_EXTMOD),)
4646
dst := $(MODLIB)/kernel
@@ -59,7 +59,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
5959
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
6060
endif
6161

62-
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
62+
modules := $(patsubst %.o, $(dst)/%.ko$(suffix-y), $(modules))
6363
install-$(CONFIG_MODULES) += $(modules)
6464

6565
__modinst: $(install-y)
@@ -119,7 +119,7 @@ endif
119119
# Create necessary directories
120120
$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
121121

122-
$(dst)/%.ko: $(extmod_prefix)%.ko FORCE
122+
$(dst)/%.ko: %.ko FORCE
123123
$(call cmd,install)
124124
$(call cmd,strip)
125125
$(call cmd,sign)

scripts/Makefile.modpost

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ modpost-args = \
4646
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
4747
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
4848
$(if $(KBUILD_MODPOST_WARN),-w) \
49-
$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \
49+
$(if $(KBUILD_NSDEPS),-d modules.nsdeps) \
5050
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
5151
$(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \
5252
-o $@
@@ -61,8 +61,8 @@ endif
6161
# Read out modules.order to pass in modpost.
6262
# Otherwise, allmodconfig would fail with "Argument list too long".
6363
ifdef KBUILD_MODULES
64-
modpost-args += -T $(MODORDER)
65-
modpost-deps += $(MODORDER)
64+
modpost-args += -T modules.order
65+
modpost-deps += modules.order
6666
endif
6767

6868
ifeq ($(KBUILD_EXTMOD),)

scripts/nsdeps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ generate_deps() {
5151
while read line
5252
do
5353
generate_deps $line
54-
done < $MODULES_NSDEPS
54+
done < modules.nsdeps

0 commit comments

Comments
 (0)