2016-08-17 15:08:22 +00:00
|
|
|
# Makefile support for the menuconfig system
|
|
|
|
|
|
|
|
#Find all Kconfig files for all components
|
|
|
|
COMPONENT_KCONFIGS := $(foreach component,$(COMPONENT_PATHS),$(wildcard $(component)/Kconfig))
|
|
|
|
COMPONENT_KCONFIGS_PROJBUILD := $(foreach component,$(COMPONENT_PATHS),$(wildcard $(component)/Kconfig.projbuild))
|
|
|
|
|
|
|
|
#For doing make menuconfig etc
|
2016-08-19 06:32:35 +00:00
|
|
|
KCONFIG_TOOL_DIR=$(IDF_PATH)/tools/kconfig
|
2016-08-17 15:08:22 +00:00
|
|
|
|
|
|
|
# clear MAKEFLAGS as the menuconfig makefile uses implicit compile rules
|
|
|
|
$(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
|
|
|
|
MAKEFLAGS="" \
|
|
|
|
CFLAGS="" \
|
|
|
|
LDFLAGS="" \
|
2016-08-18 04:36:15 +00:00
|
|
|
CC=$(HOSTCC) LD=$(HOSTLD) \
|
2016-08-17 15:08:22 +00:00
|
|
|
$(MAKE) -C $(KCONFIG_TOOL_DIR)
|
|
|
|
|
2016-08-19 06:32:35 +00:00
|
|
|
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
|
2016-08-24 05:02:24 +00:00
|
|
|
$(summary) MENUCONFIG
|
2016-08-17 15:08:22 +00:00
|
|
|
$(Q) KCONFIG_AUTOHEADER=$(PROJECT_PATH)/build/include/sdkconfig.h \
|
|
|
|
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
|
|
|
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
|
|
|
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
2016-08-19 06:32:35 +00:00
|
|
|
$(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
|
2016-08-17 15:08:22 +00:00
|
|
|
|
|
|
|
ifeq ("$(wildcard $(PROJECT_PATH)/sdkconfig)","")
|
|
|
|
#No sdkconfig found. Need to run menuconfig to make this if we need it.
|
|
|
|
$(PROJECT_PATH)/sdkconfig: menuconfig
|
|
|
|
endif
|
|
|
|
|
2016-08-23 08:18:36 +00:00
|
|
|
defconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
|
2016-08-24 05:02:24 +00:00
|
|
|
$(summary) DEFCONFIG
|
2016-08-23 08:18:36 +00:00
|
|
|
$(Q) mkdir -p $(PROJECT_PATH)/build/include/config
|
|
|
|
$(Q) KCONFIG_AUTOHEADER=$(PROJECT_PATH)/build/include/sdkconfig.h \
|
|
|
|
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
|
|
|
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
|
|
|
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
|
|
|
$(KCONFIG_TOOL_DIR)/conf --olddefconfig $(IDF_PATH)/Kconfig
|
2016-08-17 15:08:22 +00:00
|
|
|
|
|
|
|
# Work out of whether we have to build the Kconfig makefile
|
|
|
|
# (auto.conf), or if we're in a situation where we don't need it
|
2016-08-23 08:18:36 +00:00
|
|
|
NON_CONFIG_TARGETS := clean %-clean get_variable help menuconfig defconfig
|
2016-08-17 15:08:22 +00:00
|
|
|
AUTO_CONF_REGEN_TARGET := $(PROJECT_PATH)/build/include/config/auto.conf
|
|
|
|
|
|
|
|
# disable AUTO_CONF_REGEN_TARGET if all targets are non-config targets
|
|
|
|
# (and not building default target)
|
|
|
|
ifneq ("$(MAKECMDGOALS)","")
|
|
|
|
ifeq ($(filter $(NON_CONFIG_TARGETS), $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
|
|
AUTO_CONF_REGEN_TARGET :=
|
|
|
|
# dummy target
|
|
|
|
$(PROJECT_PATH)/build/include/config/auto.conf:
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(AUTO_CONF_REGEN_TARGET) $(PROJECT_PATH)/build/include/sdkconfig.h: $(PROJECT_PATH)/sdkconfig $(KCONFIG_TOOL_DIR)/conf $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD)
|
2016-08-24 05:02:24 +00:00
|
|
|
$(summary) GENCONFIG
|
2016-08-17 15:08:22 +00:00
|
|
|
$(Q) mkdir -p $(PROJECT_PATH)/build/include/config
|
|
|
|
$(Q) cd build; KCONFIG_AUTOHEADER="$(PROJECT_PATH)/build/include/sdkconfig.h" \
|
|
|
|
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
|
|
|
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
|
|
|
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
2016-08-19 06:32:35 +00:00
|
|
|
$(KCONFIG_TOOL_DIR)/conf --silentoldconfig $(IDF_PATH)/Kconfig
|
2016-08-17 15:08:22 +00:00
|
|
|
$(Q) touch $(AUTO_CONF_REGEN_TARGET) $(PROJECT_PATH)/build/include/sdkconfig.h
|
|
|
|
# touch to ensure both output files are newer - as 'conf' can also update sdkconfig (a dependency). Without this,
|
|
|
|
# sometimes you can get an infinite make loop on Windows where sdkconfig always gets regenerated newer
|
|
|
|
# than the target(!)
|
|
|
|
|
|
|
|
clean: config-clean
|
|
|
|
.PHONY: config-clean
|
|
|
|
config-clean:
|
2016-08-24 05:02:24 +00:00
|
|
|
$(summary RM CONFIG)
|
2016-08-17 15:08:22 +00:00
|
|
|
$(MAKE) -C $(KCONFIG_TOOL_DIR) clean
|
2016-08-18 09:11:27 +00:00
|
|
|
$(Q) rm -rf $(PROJECT_PATH)/build/include/config $(PROJECT_PATH)/build/include/sdkconfig.h
|