From: Nathan Chancellor <nathan@kernel.org>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Nicolas Schier <nsc@kernel.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kbuild: reduce output spam when building out of tree
Date: Mon, 9 Mar 2026 18:07:16 -0700 [thread overview]
Message-ID: <20260310010716.GA1656066@ax162> (raw)
In-Reply-To: <20260305-kbuild-makefile-spam-v1-1-910f6cf218a1@linutronix.de>
On Thu, Mar 05, 2026 at 01:04:07PM +0100, Thomas Weißschuh wrote:
> The execution of $(call cmd,makefile) will print 'GEN Makefile' on each
> build, even if the Makefile is not effectively changed.
>
> Use a filechk command instead, so a message is only printed on changes.
>
> The Makefile is now created even if the build is aborted due to an
> unclean working tree. That should not make a difference in practice.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Makefile | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index e944c6e71e81..fae52ab03525 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -676,14 +676,19 @@ print_env_for_makefile = \
> echo "export KBUILD_OUTPUT = $(CURDIR)"
> endif
>
> -quiet_cmd_makefile = GEN Makefile
> - cmd_makefile = { \
> +filechk_makefile = { \
> echo "\# Automatically generated by $(abs_srctree)/Makefile: don't edit"; \
> $(print_env_for_makefile); \
> echo "include $(abs_srctree)/Makefile"; \
> - } > Makefile
> + }
>
> -outputmakefile:
> +$(objtree)/Makefile: FORCE
> + $(call filechk,makefile)
> +
> +# Prevent $(srcroot)/Makefile from inhibiting the rule to run.
> +PHONY += $(objtree)/Makefile
> +
> +outputmakefile: $(objtree)/Makefile
> ifeq ($(KBUILD_EXTMOD),)
> @if [ -f $(srctree)/.config -o \
> -d $(srctree)/include/config -o \
> @@ -704,7 +709,6 @@ else
> fi
> endif
> $(Q)ln -fsn $(srcroot) source
> - $(call cmd,makefile)
> $(Q)test -e .gitignore || \
> { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
> endif
>
> ---
> base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
> change-id: 20260213-kbuild-makefile-spam-4e72f6792dfa
>
> Best regards,
> --
> Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>
next prev parent reply other threads:[~2026-03-10 1:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 12:04 [PATCH] kbuild: reduce output spam when building out of tree Thomas Weißschuh
2026-03-10 1:07 ` Nathan Chancellor [this message]
2026-03-18 20:08 ` Nicolas Schier
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=20260310010716.GA1656066@ax162 \
--to=nathan@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsc@kernel.org \
--cc=thomas.weissschuh@linutronix.de \
/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