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 <john@phrozen.org>
This commit is contained in:
John Crispin committed 2026-09-22 18:18:58 +02:00
1 parent d8442d2876
commit af60df881d
1 file changed
+12 -1
+12 -1
View File
@@ -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