Skip to content

Commit ebd191b

Browse files
committed
kbuild: add cmd_and_savecmd macro
Separate out the command execution part of if_changed, as we did for if_changed_dep. This allows us to reuse it in if_changed_rule. define rule_foo $(call cmd_and_savecmd,foo) $(call cmd,bar) endef Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Kees Cook <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Tested-by: Sedat Dilek <[email protected]> # LLVM-14 (x86-64)
1 parent c6031b1 commit ebd191b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/Kbuild.include

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequisite is missing)
142142
if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE)
143143

144144
# Execute command if command has changed or prerequisite(s) are updated.
145-
if_changed = $(if $(if-changed-cond), \
145+
if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:)
146+
147+
cmd_and_savecmd = \
146148
$(cmd); \
147-
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
149+
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd
148150

149151
# Execute the command and also postprocess generated .d dependencies file.
150152
if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:)

0 commit comments

Comments
 (0)