From af60df881d1e5e221ecdf1e64444366c9ae9f603 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 20 Sep 2026 18:28:44 +0200 Subject: [PATCH] build: run diffconfig only when the configuration changed diffconfig.sh runs the configuration parser over the whole tree twice, which takes 2 s of every build, and buildinfo runs it on each build. The result depends only on .config and the Kconfig files. Skip it while neither is newer than the file it wrote last time. include/toplevel.mk guards the sync check of .config the same way. This alone changes nothing on a parallel build, because buildinfo runs beside the compile stamps. It pays once the other phases become shorter. Signed-off-by: John Crispin --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 86c5f5a29ab..02bfa514096 100644 --- a/Makefile +++ b/Makefile @@ -120,9 +120,20 @@ buildversion: FORCE feedsversion: FORCE $(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo +# diffconfig.sh runs the config parser over the whole tree twice, which takes +# two seconds of every build. Skip it while neither .config nor a Kconfig file +# is newer than the file it wrote last time. include/toplevel.mk guards the +# sync check of .config the same way. +DIFFCONFIG_FILES:=.config Config.in config target toolchain package feeds \ + tmp/.config-package.in tmp/.config-target.in tmp/.config-feeds.in scripts/config/conf + diffconfig: FORCE mkdir -p $(BIN_DIR) - $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo + @[ -f $(BIN_DIR)/config.buildinfo ] && \ + [ -z "$$(find $(DIFFCONFIG_FILES) -newer $(BIN_DIR)/config.buildinfo \ + \( -name .config -o -name conf -o -name '*.in' -o -name 'Config.*' \) \ + -print -quit 2>/dev/null)" ] || \ + $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo buildinfo: FORCE $(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion