All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	llvm@lists.linux.dev, Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <n.schier@avm.de>,
	Sedat Dilek <sedat.dilek@gmail.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>
Subject: [PATCH v7 7/8] kbuild: add cmd_and_savecmd macro
Date: Fri, 27 May 2022 19:01:54 +0900	[thread overview]
Message-ID: <20220527100155.1996314-8-masahiroy@kernel.org> (raw)
In-Reply-To: <20220527100155.1996314-1-masahiroy@kernel.org>

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)
---

(no changes since v4)

Changes in v4:
  - New.
    Resent of my previous submission.
    https://lore.kernel.org/all/20210831074004.3195284-10-masahiroy@kernel.org/

 scripts/Kbuild.include | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 455a0a6ce12d..ece44b735061 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -142,9 +142,11 @@ check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequisite is missing)
 if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE)
 
 # Execute command if command has changed or prerequisite(s) are updated.
-if_changed = $(if $(if-changed-cond),                                        \
+if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:)
+
+cmd_and_savecmd =                                                            \
 	$(cmd);                                                              \
-	printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
+	printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd
 
 # Execute the command and also postprocess generated .d dependencies file.
 if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:)
-- 
2.32.0


  parent reply	other threads:[~2022-05-27 10:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 10:01 [PATCH v7 0/8] kbuild: yet another series of cleanups Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 1/8] kbuild: replace $(linked-object) with CONFIG options Masahiro Yamada
2022-05-27 15:00   ` Josh Poimboeuf
2022-05-27 17:32   ` Nick Desaulniers
2022-05-28  2:32   ` Sedat Dilek
2022-05-28  7:10     ` Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 2/8] kbuild: do not create *.prelink.o for Clang LTO or IBT Masahiro Yamada
2022-05-27 15:31   ` Josh Poimboeuf
2022-05-27 10:01 ` [PATCH v7 3/8] parisc: fix the exit status of arch/parisc/nm Masahiro Yamada
2022-05-27 13:57   ` Helge Deller
2022-05-27 14:21     ` Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 4/8] kbuild: check static EXPORT_SYMBOL* by script instead of modpost Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 5/8] kbuild: make built-in.a rule robust against too long argument error Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 6/8] kbuild: make *.mod " Masahiro Yamada
2022-05-27 10:01 ` Masahiro Yamada [this message]
2022-05-27 10:01 ` [PATCH v7 8/8] kbuild: rebuild multi-object modules when objtool is updated Masahiro Yamada
2022-05-27 15:50   ` Josh Poimboeuf
2022-05-27 17:41     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527100155.1996314-8-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=deller@gmx.de \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=michal.lkml@markovi.net \
    --cc=n.schier@avm.de \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=sedat.dilek@gmail.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.