Просмотр исходного кода

Menuconfig: Don't ask to save configuration when nothing has changed

Closes https://github.com/espressif/esp-idf/issues/4303
Roland Dobai 6 лет назад
Родитель
Сommit
97488fe806

+ 9 - 8
make/project_config.mk

@@ -29,7 +29,7 @@ SDKCONFIG_DEFAULTS ?= $(PROJECT_PATH)/sdkconfig.defaults
 $(KCONFIG_TOOL_DIR)/mconf-idf: $(KCONFIG_TOOL_DIR)/conf-idf
 
 # reset MAKEFLAGS as the menuconfig makefile uses implicit compile rules
-$(KCONFIG_TOOL_DIR)/mconf-idf $(KCONFIG_TOOL_DIR)/conf-idf: $(wildcard $(KCONFIG_TOOL_DIR)/*.c)
+$(KCONFIG_TOOL_DIR)/mconf-idf $(KCONFIG_TOOL_DIR)/conf-idf: $(wildcard $(KCONFIG_TOOL_DIR)/*.c) $(wildcard $(KCONFIG_TOOL_DIR)/*.y)
 	MAKEFLAGS="" CC=$(HOSTCC) LD=$(HOSTLD) \
 	$(MAKE) -C $(KCONFIG_TOOL_DIR)
 
@@ -70,7 +70,8 @@ define RunConfGen
 		$(DEFAULTS_ARG) \
 		--output config ${SDKCONFIG} \
 		--output makefile $(SDKCONFIG_MAKEFILE) \
-		--output header $(BUILD_DIR_BASE)/include/sdkconfig.h
+		--output header $(BUILD_DIR_BASE)/include/sdkconfig.h \
+		$1
 endef
 
 # macro for the commands to run kconfig tools conf-idf or mconf-idf.
@@ -107,23 +108,23 @@ ifdef BATCH_BUILD
 	@echo "See esp-idf documentation for more details."
 	@exit 1
 else
-	$(call RunConfGen)
-	# RunConfGen before mconf-idf ensures that deprecated options won't be ignored (they've got renamed)
+	$(call RunConfGen,--dont-write-deprecated)
+	# RunConfGen before menuconfig ensures that deprecated options won't be ignored (they've got renamed)
 	$(call RunConf,mconf-idf)
-	# RunConfGen after mconf-idf ensures that deprecated options are appended to $(SDKCONFIG) for backward compatibility
-	$(call RunConfGen)
+	# RunConfGen after menuconfig ensures that deprecated options are appended to $(SDKCONFIG) for backward compatibility
+	$(call RunConfGen,)
 endif
 
 # defconfig creates a default config, based on SDKCONFIG_DEFAULTS if present
 defconfig: | check_python_dependencies
 	$(summary) DEFCONFIG
-	$(call RunConfGen)
+	$(call RunConfGen,)
 
 # if neither defconfig or menuconfig are requested, use the GENCONFIG rule to
 # ensure generated config files are up to date
 $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h: $(SDKCONFIG) $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD) | check_python_dependencies $(call prereq_if_explicit,defconfig) $(call prereq_if_explicit,menuconfig)
 	$(summary) GENCONFIG
-	$(call RunConfGen)
+	$(call RunConfGen,)
 	touch $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h  # ensure newer than sdkconfig
 
 else  # "$(MAKE_RESTARTS)" != ""

+ 4 - 1
tools/cmake/kconfig.cmake

@@ -240,7 +240,10 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
     add_custom_target(menuconfig
         ${menuconfig_depends}
         # create any missing config file, with defaults if necessary
-        COMMAND ${confgen_basecommand} --env "IDF_TARGET=${idf_target}" --output config ${sdkconfig}
+        COMMAND ${confgen_basecommand}
+        --env "IDF_TARGET=${idf_target}"
+        --dont-write-deprecated
+        --output config ${sdkconfig}
         COMMAND ${CMAKE_COMMAND} -E env
         "COMPONENT_KCONFIGS=${kconfigs}"
         "COMPONENT_KCONFIGS_PROJBUILD=${kconfig_projbuilds}"

+ 1 - 1
tools/kconfig/Makefile

@@ -311,7 +311,7 @@ ifeq ($(MAKECMDGOALS),gconfig)
 	fi
 endif
 
-zconf.tab.o: zconf.lex.c zconf.hash.c
+zconf.tab.o: zconf.lex.c zconf.hash.c zconf.tab.c
 
 qconf.o: qconf.moc
 

+ 2 - 0
tools/kconfig/mconf.c

@@ -1042,6 +1042,8 @@ int main(int ac, char **av)
 		return 1;
 	}
 
+	sym_set_change_count(0);
+
 	set_config_filename(conf_get_configname());
 	conf_set_message_callback(conf_message_callback);
 	do {

+ 9 - 0
tools/kconfig_new/confgen.py

@@ -191,6 +191,10 @@ def main():
                         help='File with deprecated Kconfig options',
                         required=False)
 
+    parser.add_argument('--dont-write-deprecated',
+                        help='Do not write compatibility statements for deprecated values',
+                        action='store_true')
+
     parser.add_argument('--output', nargs=2, action='append',
                         help='Write output file (format and output filename)',
                         metavar=('FORMAT', 'FILENAME'),
@@ -264,6 +268,11 @@ def main():
             except OSError:
                 pass
 
+    if args.dont_write_deprecated:
+        # The deprecated object was useful until now for replacements. Now it will be redefined with no configurations
+        # and as the consequence, it won't generate output with deprecated statements.
+        deprecated_options = DeprecatedOptions('', path_rename_files=[])
+
     # Output the files specified in the arguments
     for output_type, filename in args.output:
         with tempfile.NamedTemporaryFile(prefix="confgen_tmp", delete=False) as f: