mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Rikard Falkeborn <rikard.falkeborn@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>, Will Deacon <will@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Subject: [RFC PATCH v2 2/2] kbuild: call check-atomics.sh only if prerequisites change
Date: Sat,  7 May 2022 22:11:45 +0900	[thread overview]
Message-ID: <20220507131146.834810-3-mailhol.vincent@wanadoo.fr> (raw)
In-Reply-To: <20220507131146.834810-1-mailhol.vincent@wanadoo.fr>

check-atomics.sh is executed unconditionally. Most developers will not
modify the files being checked by this script and thus do not need to
execute it again for each iterative make.

We first add an additional dependency to include/linux/atomic/* to
make sure that the script gets executed again if the headers are
modified. We then use the if_change macro instead of cmd. c.f. [1] and
create the dot file scripts/atomic/.check-atomics which is used for
the target timestamp. Finally, the dot file is added to the
CLEAN_FILES target.

[1] https://www.kernel.org/doc/html/latest/kbuild/makefiles.html#command-change-detection

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 Kbuild   | 7 ++++---
 Makefile | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Kbuild b/Kbuild
index fa441b98c9f6..c3cb76ebcbaf 100644
--- a/Kbuild
+++ b/Kbuild
@@ -50,10 +50,11 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
 #####
 # Check atomic headers are up-to-date
 
-always-y += old-atomics
+always-y += scripts/atomic/.check-atomics
 
 quiet_cmd_atomics = CALL    $<
       cmd_atomics = $(CONFIG_SHELL) $<
 
-old-atomics: scripts/atomic/check-atomics.sh FORCE
-	$(call cmd,atomics)
+scripts/atomic/.check-atomics: scripts/atomic/check-atomics.sh $(wildcard include/linux/atomic/*) FORCE
+	$(call if_changed,atomics)
+	@touch $@
diff --git a/Makefile b/Makefile
index 9a820c525b86..9e815c8bb0b6 100644
--- a/Makefile
+++ b/Makefile
@@ -1483,7 +1483,8 @@ endif # CONFIG_MODULES
 # Directories & files removed with 'make clean'
 CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
 	       modules.builtin modules.builtin.modinfo modules.nsdeps \
-	       compile_commands.json .thinlto-cache
+	       compile_commands.json .thinlto-cache \
+	       scripts/atomic/.check-atomics
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_FILES += include/config include/generated          \
-- 
2.35.1


  parent reply	other threads:[~2022-05-07 13:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 15:52 [RFC PATCH] kbuild: call checksyscalls.sh and " Vincent Mailhol
2022-04-29 17:11 ` Masahiro Yamada
2022-05-07 11:43   ` Vincent MAILHOL
2022-05-07 13:11 ` [RFC PATCH v2 0/2] call " Vincent Mailhol
2022-05-07 13:11   ` [RFC PATCH v2 1/2] check-atomiscs: stop build if CONFIG_WERROR=y Vincent Mailhol
2022-05-07 13:11   ` Vincent Mailhol [this message]
2022-05-13 19:01     ` [RFC PATCH v2 2/2] kbuild: call check-atomics.sh only if prerequisites change Masahiro Yamada
2022-05-14  3:21       ` Vincent MAILHOL
2022-05-14 13:14       ` Peter Zijlstra
2022-05-14 14:55         ` Peter Zijlstra
2022-05-14 16:26           ` Masahiro Yamada
2022-05-16  8:02             ` Peter Zijlstra
2022-05-14 16:07         ` Masahiro Yamada
2022-05-16  7:59           ` Peter Zijlstra

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=20220507131146.834810-3-mailhol.vincent@wanadoo.fr \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=akpm@linux-foundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=rikard.falkeborn@gmail.com \
    --cc=will@kernel.org \
    --cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®