From e7d105af30a79f55da5a41315943b2c1d12878f9 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 18 Sep 2026 19:57:48 +0200 Subject: [PATCH] build: skip the .config sync check if nothing changed Every build runs conf --defconfig on a copy of .config to warn if the configuration is out of sync. This takes about a second before the build starts. Skip the check if the last one passed, and neither .config nor a Kconfig file, the generated Kconfig files or conf changed since then. If the check fails, it runs and warns again on every build, as before. Signed-off-by: John Crispin --- include/toplevel.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/toplevel.mk b/include/toplevel.mk index a2902592adb..003a2182da1 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -239,13 +239,25 @@ ifeq ($(SDK),1) else +# The check if .config is in sync takes about a second. Skip it if the last +# check passed, and neither .config nor a Kconfig file changed since then. +CONFIG_CHECK_STAMP:=tmp/.config-check +CONFIG_CHECK_FILES:=.config Config.in config target toolchain package feeds \ + tmp/.config-package.in tmp/.config-target.in tmp/.config-feeds.in scripts/config/conf + %:: @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq @( \ + [ -f $(CONFIG_CHECK_STAMP) ] && [ -z "$$(find $(CONFIG_CHECK_FILES) -newer $(CONFIG_CHECK_STAMP) \ + \( -name .config -o -name conf -o -name '*.in' -o -name 'Config.*' \) -print -quit 2>/dev/null)" ] && exit 0; \ + touch $(CONFIG_CHECK_STAMP).new; \ cp .config tmp/.config; \ ./scripts/config/conf $(KCONF_FLAGS) --defconfig=tmp/.config -w tmp/.config Config.in > /dev/null 2>&1; \ if ./scripts/kconfig.pl '>' .config tmp/.config | grep -q CONFIG; then \ + rm -f $(CONFIG_CHECK_STAMP) $(CONFIG_CHECK_STAMP).new; \ printf "$(_R)WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!$(_N)\n" >&2; \ + else \ + mv $(CONFIG_CHECK_STAMP).new $(CONFIG_CHECK_STAMP); \ fi \ ) @+$(ULIMIT_FIX) $(SUBMAKE) -r $@ $(if $(WARN_PARALLEL_ERROR), || { \