OSDN Git Service

kbuild: rename cmd_$@ to savedcmd_$@ in *.cmd files
authorMasahiro Yamada <masahiroy@kernel.org>
Thu, 29 Dec 2022 09:15:00 +0000 (18:15 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 22 Jan 2023 14:43:33 +0000 (23:43 +0900)
commit92215e7a801da7b89037a185c98f5ebb86a415b9
tree3c1547bd8226598cc84cbeaa351f84d86ef6badf
parent91ecf7ff1b036f3fe1183809661119b1ee109b19
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>
scripts/Kbuild.include
scripts/Makefile.modfinal
scripts/basic/fixdep.c
scripts/clang-tools/gen_compile_commands.py