]> granicus.if.org Git - esp-idf/blobdiff - make/project_config.mk
Add some comments in pcnt.h.
[esp-idf] / make / project_config.mk
index 3537f786ba1cac27a5bc7979b5bd66e7704165f5..8f0006c7950a81098575bcfcd8b6979ade04e0f1 100644 (file)
@@ -15,15 +15,19 @@ SDKCONFIG ?= $(PROJECT_PATH)/sdkconfig
 # overrides (usually used for esp-idf examples)
 SDKCONFIG_DEFAULTS ?= $(PROJECT_PATH)/sdkconfig.defaults
 
+# Workaround to run make parallel (-j). mconf and conf cannot be made simultaneously
+$(KCONFIG_TOOL_DIR)/mconf: $(KCONFIG_TOOL_DIR)/conf
+
 # reset MAKEFLAGS as the menuconfig makefile uses implicit compile rules
-$(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
-       MAKEFLAGS=$(ORIGINAL_MAKEFLAGS) CC=$(HOSTCC) LD=$(HOSTLD) \
+$(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf: $(wildcard $(KCONFIG_TOOL_DIR)/*.c)
+       MAKEFLAGS="" CC=$(HOSTCC) LD=$(HOSTLD) \
        $(MAKE) -C $(KCONFIG_TOOL_DIR)
 
 ifeq ("$(wildcard $(SDKCONFIG))","")
-ifeq ("$(filter defconfig, $(MAKECMDGOALS))","")
-# if no configuration file is present and defconfig is not a named
-# target, run defconfig then menuconfig to get the initial config
+# if no configuration file is present we need a rule for it
+ifeq ("$(filter $(NON_INTERACTIVE_TARGET), $(MAKECMDGOALS))","")
+# if special non-interactive item is not a named target (eg. 'defconfig', 'clean')
+# run defconfig then menuconfig to get the initial config
 $(SDKCONFIG): menuconfig
 menuconfig: defconfig
 else
@@ -42,7 +46,7 @@ define RunConf
        $(KCONFIG_TOOL_DIR)/$1 $(IDF_PATH)/Kconfig
 endef
 
-ifeq ("$(MAKE_RESTARTS)","")
+ifndef MAKE_RESTARTS
 # menuconfig, defconfig and "GENCONFIG" configuration generation only
 # ever run on the first make pass, subsequent passes don't run these
 # (make often wants to re-run them as the conf tool can regenerate the
@@ -56,7 +60,15 @@ ifeq ("$(MAKE_RESTARTS)","")
 
 menuconfig: $(KCONFIG_TOOL_DIR)/mconf
        $(summary) MENUCONFIG
+ifdef BATCH_BUILD
+       @echo "Can't run interactive configuration inside non-interactive build process."
+       @echo ""
+       @echo "Open a command line terminal and run 'make menuconfig' from there."
+       @echo "See esp-idf documentation for more details."
+       @exit 1
+else
        $(call RunConf,mconf)
+endif
 
 # defconfig creates a default config, based on SDKCONFIG_DEFAULTS if present
 defconfig: $(KCONFIG_TOOL_DIR)/conf
@@ -70,6 +82,9 @@ endif
 # ensure generated config files are up to date
 $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h: $(KCONFIG_TOOL_DIR)/conf $(SDKCONFIG) $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD) | $(call prereq_if_explicit,defconfig) $(call prereq_if_explicit,menuconfig)
        $(summary) GENCONFIG
+ifdef BATCH_BUILD  # can't prompt for new config values like on terminal
+       $(call RunConf,conf --olddefconfig)
+endif
        $(call RunConf,conf --silentoldconfig)
        touch $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h  # ensure newer than sdkconfig
 
@@ -81,6 +96,6 @@ endif
 
 .PHONY: config-clean defconfig menuconfig
 config-clean:
-       $(summary RM CONFIG)
-       $(MAKE) -C $(KCONFIG_TOOL_DIR) clean
+       $(summary) RM CONFIG
+       MAKEFLAGS="" $(MAKE) -C $(KCONFIG_TOOL_DIR) clean
        rm -rf $(BUILD_DIR_BASE)/include/config $(BUILD_DIR_BASE)/include/sdkconfig.h