Skip to content

Commit fa1b423

Browse files
committed
kbuild: add cmd_and_savecmd macro
JIRA: https://issues.redhat.com/browse/RHEL-2773 commit ebd191b Author: Masahiro Yamada <masahiroy@kernel.org> Date: Fri May 27 19:01:54 2022 +0900 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 <masahiroy@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64) Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
1 parent 426fb6c commit fa1b423

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
@@ -154,9 +154,11 @@ check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequisite is missing)
154154
if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE)
155155

156156
# Execute command if command has changed or prerequisite(s) are updated.
157-
if_changed = $(if $(if-changed-cond), \
157+
if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:)
158+
159+
cmd_and_savecmd = \
158160
$(cmd); \
159-
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
161+
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd
160162

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

0 commit comments

Comments
 (0)