diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-12-29 18:15:00 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-01-22 23:43:33 +0900 |
commit | 92215e7a801da7b89037a185c98f5ebb86a415b9 (patch) | |
tree | 3c1547bd8226598cc84cbeaa351f84d86ef6badf /scripts/Makefile.modfinal | |
parent | 91ecf7ff1b036f3fe1183809661119b1ee109b19 (diff) |
kbuild: rename cmd_$@ to savedcmd_$@ in *.cmd files
The cmd-check macro compares $(cmd_$@) and $(cmd_$1), but a pitfall is
that you cannot use cmd_<target> as the variable name for the command.
For example, the following code will not work in the top Makefile
or ./Kbuild.
quiet_cmd_foo = GEN $@
cmd_foo = touch $@
targets += foo
foo: FORCE
$(call if_changed,foo)
In this case, both $@ and $1 are expanded to 'foo', so $(cmd_check)
is always empty.
We do not need to use the same prefix for cmd_$@ and cmd_$1.
Rename the former to savedcmd_$@.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/Makefile.modfinal')
-rw-r--r-- | scripts/Makefile.modfinal | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index a30d5b08eee9..4703f652c009 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -54,7 +54,7 @@ newer_prereqs_except = $(filter-out $(PHONY) $(1),$?) # Same as if_changed, but allows to exclude specified extra dependencies if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \ $(cmd); \ - printf '%s\n' 'cmd_$@ := $(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 %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE |