Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH] kbuild: reduce output spam when building out of tree
@ 2026-03-05 12:04 Thomas Weißschuh
  2026-03-10  1:07 ` Nathan Chancellor
  2026-03-18 20:08 ` Nicolas Schier
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2026-03-05 12:04 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Thomas Weißschuh

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-18 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-03-18 20:08 ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox