Re: [PATCH 1/2] kbuild: rename cmd_$@ to savedcmd_$@ in *.cmd files

From: Nicolas Schier
Date: Thu Dec 29 2022 - 09:11:59 EST


On Thu, Dec 29, 2022 at 06:15:00PM +0900 Masahiro Yamada wrote:
> 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@xxxxxxxxxx>
> ---
>
> scripts/Kbuild.include | 8 ++++----
> scripts/Makefile.modfinal | 2 +-
> scripts/basic/fixdep.c | 4 ++--
> scripts/clang-tools/gen_compile_commands.py | 2 +-
> 4 files changed, 8 insertions(+), 8 deletions(-)
>

Thanks for fixing this, I wasn't aware of that at all.

Reviewed-by: Nicolas Schier <nicolas@xxxxxxxxx>

--
epost|xmpp: nicolas@xxxxxxxxx irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --

Attachment: signature.asc
Description: PGP signature