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