2016-08-17 11:08:22 -04:00
|
|
|
# Functionality common to both top-level project makefile
|
|
|
|
# and component makefiles
|
|
|
|
#
|
|
|
|
|
|
|
|
# Include project config file, if it exists.
|
|
|
|
#
|
|
|
|
# (Note that we only rebuild auto.conf automatically for some targets,
|
|
|
|
# see project_config.mk for details.)
|
2016-10-04 00:03:48 -04:00
|
|
|
-include $(BUILD_DIR_BASE)/include/config/auto.conf
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
#Handling of V=1/VERBOSE=1 flag
|
2016-08-24 01:02:24 -04:00
|
|
|
#
|
|
|
|
# if V=1, $(summary) does nothing and $(details) will echo extra details
|
|
|
|
# if V is unset or not 1, $(summary) echoes a summary and $(details) does nothing
|
2016-08-17 11:08:22 -04:00
|
|
|
V ?= $(VERBOSE)
|
|
|
|
ifeq ("$(V)","1")
|
|
|
|
Q :=
|
2016-08-24 01:02:24 -04:00
|
|
|
summary := @true
|
|
|
|
details := @echo
|
2016-08-17 11:08:22 -04:00
|
|
|
else
|
|
|
|
Q := @
|
2016-08-24 01:02:24 -04:00
|
|
|
summary := @echo
|
|
|
|
details := @true
|
2016-08-17 11:08:22 -04:00
|
|
|
endif
|
|
|
|
|
2016-10-04 01:33:18 -04:00
|
|
|
# Pseudo-target to check a git submodule has been properly initialised
|
2016-09-12 03:48:40 -04:00
|
|
|
#
|
2016-10-04 01:33:18 -04:00
|
|
|
# $(eval $(call SubmoduleCheck,FILENAMES,SUBMODULE_PATH)) to create a target that
|
|
|
|
# automatically runs 'git submodule update --init SUBMODULE_PATH' if any of
|
|
|
|
# the files in FILENAMES are missing, and fails if this is not possible.
|
|
|
|
#
|
|
|
|
# Will also print a WARNING if the submodule at SUBMODULE_PATH appears
|
|
|
|
# to require an update.
|
|
|
|
define SubmoduleCheck
|
2016-09-12 03:48:40 -04:00
|
|
|
$(1):
|
2016-10-04 01:33:18 -04:00
|
|
|
@echo "WARNING: Missing submodule $(2) for $$@..."
|
2016-09-12 03:48:40 -04:00
|
|
|
$(Q) [ -d ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1)
|
|
|
|
$(Q) [ -x $(which git) ] || ( echo "ERROR: Need to run 'git submodule --init' in esp-idf root directory."; exit 1)
|
|
|
|
@echo "Attempting 'git submodule update --init' in esp-idf root directory..."
|
2016-10-04 01:33:18 -04:00
|
|
|
cd ${IDF_PATH} && git submodule update --init $(2)
|
|
|
|
|
|
|
|
# Parse 'git submodule status' output for out-of-date submodule.
|
|
|
|
# Status output prefixes status line with '+' if the submodule commit doesn't match
|
|
|
|
ifneq ("$(shell cd ${IDF_PATH} && git submodule status $(2) | grep '^+')","")
|
|
|
|
$$(info WARNING: git submodule $2 may be out of date. Run 'git submodule update' to update.)
|
|
|
|
endif
|
2016-09-12 03:48:40 -04:00
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
# General make utilities
|
|
|
|
|
|
|
|
# convenience variable for printing an 80 asterisk wide separator line
|
|
|
|
SEPARATOR:="*******************************************************************************"
|
|
|
|
|
|
|
|
# macro to remove quotes from an argument, ie $(call dequote (CONFIG_BLAH))
|
|
|
|
define dequote
|
|
|
|
$(subst ",,$(1))
|
|
|
|
endef
|
|
|
|
# " comment kept here to keep syntax highlighting happy
|