build: clean previous compiled files after menuconfig updates

Fixes #16151. Compares .config state before and after kconfig-mconf and triggers 'make clean' if the configuration was modified to prevent orphaned object files.

Signed-off-by: Agnimitra sasaru <158492301+HyphenAlpha456@users.noreply.github.com>
This commit is contained in:
Agnimitra sasaru
2026-04-29 14:47:31 +00:00
committed by Xiang Xiao
parent f8289b2e29
commit 7a04cddb78
+13 -1
View File
@@ -747,22 +747,34 @@ olddefconfig:
menuconfig:
$(Q) $(MAKE) clean_context
$(Q) $(MAKE) apps_preconfig
$(Q) cp .config .config.tmp 2>/dev/null || true
$(Q) ${KCONFIG_ENV} ${KCONFIG_MENUCONFIG}
$(Q) cmp -s .config .config.tmp || $(MAKE) clean
$(Q) rm -f .config.tmp
nconfig: apps_preconfig
$(Q) $(MAKE) clean_context
$(Q) $(MAKE) apps_preconfig
$(Q) cp .config .config.tmp
$(Q) ${KCONFIG_ENV} ${KCONFIG_NCONFIG}
$(Q) cmp -s .config .config.tmp || $(MAKE) clean
$(Q) rm -f .config.tmp
qconfig: apps_preconfig
$(Q) $(MAKE) clean_context
$(Q) $(MAKE) apps_preconfig
$(Q) cp .config .config.tmp
$(Q) ${KCONFIG_ENV} ${KCONFIG_QCONFIG}
$(Q) cmp -s .config .config.tmp || $(MAKE) clean
$(Q) rm -f .config.tmp
gconfig: apps_preconfig
$(Q) $(MAKE) clean_context
$(Q) $(MAKE) clean_context1
$(Q) $(MAKE) apps_preconfig
$(Q) cp .config .config.tmp
$(Q) ${KCONFIG_ENV} ${KCONFIG_GCONFIG}
$(Q) cmp -s .config .config.tmp || $(MAKE) clean
$(Q) rm -f .config.tmp
savedefconfig: apps_preconfig
$(Q) ${KCONFIG_ENV} ${KCONFIG_SAVEDEFCONFIG}