From dc482cffff32ccd3f33da86e8babbb6a64896984 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Wed, 14 Jul 2021 01:08:21 +0200 Subject: [PATCH] makefiles/kconfig.mk: force SHOULD_USE_KCONFIG if config file is present Co-authored-by: Leandro Lanzieri --- makefiles/kconfig.mk | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/makefiles/kconfig.mk b/makefiles/kconfig.mk index 401b8a88e8..d61e115218 100644 --- a/makefiles/kconfig.mk +++ b/makefiles/kconfig.mk @@ -70,11 +70,14 @@ $(GENERATED_DIR): $(if $(MAKE_RESTARTS),,$(CLEAN)) # During migration this checks if Kconfig should run. It will run if any of # the following is true: -# - A file with '.config' extension is present in the application directory -# - A 'Kconfig' file is present in the application directory # - A previous configuration file is present (e.g. from a previous call to # menuconfig) # - menuconfig is being called +# - SHOULD_RUN_KCONFIG or TEST_KCONFIG is set +# +# By default SHOULD_RUN_KCONFIG is set if any of the following is true: +# - A file with '.config' extension is present in the application directory +# - A 'Kconfig' file is present in the application directory # # NOTE: This assumes that Kconfig will not generate any default configurations # just from the Kconfig files outside the application folder (i.e. module @@ -82,13 +85,22 @@ $(GENERATED_DIR): $(if $(MAKE_RESTARTS),,$(CLEAN)) # check would not longer be valid, and Kconfig would have to run on every # build. SHOULD_RUN_KCONFIG ?= $(or $(wildcard $(APPDIR)/*.config), \ - $(wildcard $(APPDIR)/Kconfig), \ - $(if $(CLEAN),,$(wildcard $(KCONFIG_OUT_CONFIG)))) + $(wildcard $(APPDIR)/Kconfig)) ifneq (,$(filter menuconfig, $(MAKECMDGOALS))) SHOULD_RUN_KCONFIG := 1 endif +ifneq (,$(if $(CLEAN),,$(wildcard $(KCONFIG_OUT_CONFIG)))) + ifeq (,$(SHOULD_RUN_KCONFIG)) + WARNING_MSG := Warning! SHOULD_RUN_KCONFIG is not set but a previous \ + configuration file was detected (did you run \ + `make menuconfig`?). Kconfig will run regardless. + $(warning $(WARNING_MSG)) + endif + SHOULD_RUN_KCONFIG := 1 +endif + # When testing Kconfig we should always run it ifeq (1,$(TEST_KCONFIG)) SHOULD_RUN_KCONFIG := 1