build system: Explicitly disallow 'clean' along with non-cleaning targets

Too hard to stage the dependencies so that all clean steps complete before any build steps begin. Also, using and then
deleting and then regenerating SDKCONFIG_MAKEFILE in one pass is really hard to manage successfully.
This commit is contained in:
Angus Gratton 2017-09-04 13:17:32 +10:00 committed by Angus Gratton
parent 97efaab27b
commit 867b20837f
2 changed files with 18 additions and 8 deletions

View File

@ -45,10 +45,18 @@ help:
# dependency checks
ifndef MAKE_RESTARTS
ifeq ("$(filter 4.% 3.81 3.82,$(MAKE_VERSION))","")
$(warning "esp-idf build system only supports GNU Make versions 3.81 or newer. You may see unexpected results with other Makes.")
$(warning esp-idf build system only supports GNU Make versions 3.81 or newer. You may see unexpected results with other Makes.)
endif
endif
# can't run 'clean' along with any non-clean targets
ifneq ("$(filter clean% %clean,$(MAKECMDGOALS))" ,"")
ifneq ("$(filter-out clean% %clean,$(MAKECMDGOALS))", "")
$(error esp-idf build system doesn't support running 'clean' targets along with any others. Run 'make clean' and then run other targets separately.)
endif
endif
# make IDF_PATH a "real" absolute path
# * works around the case where a shell character is embedded in the environment variable value.
# * changes Windows-style C:/blah/ paths to MSYS/Cygwin style /c/blah
@ -404,10 +412,11 @@ size-files: $(APP_ELF)
size-components: $(APP_ELF)
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --archives $(APP_MAP)
# NB: this ordering is deliberate (app-clean before config-clean),
# so config remains valid during all component clean targets
config-clean: app-clean $(call prereq_if_explicit,bootloader-clean)
clean: config-clean
# NB: this ordering is deliberate (app-clean & bootloader-clean before
# _config-clean), so config remains valid during all component clean
# targets
config-clean: app-clean bootloader-clean
clean: app-clean bootloader-clean config-clean
# phony target to check if any git submodule listed in COMPONENT_SUBMODULES are missing
# or out of date, and exit if so. Components can add paths to this variable.

View File

@ -116,9 +116,10 @@ build_example () {
# build non-verbose first
local BUILDLOG=${PWD}/examplebuild.${ID}.log
(
make MAKEFLAGS= clean defconfig &> >(tee -a "${BUILDLOG}") &&
make all &> >(tee -a "${BUILDLOG}")
) || {
make MAKEFLAGS= clean &&
make MAKEFLAGS= defconfig &&
make all
) &> >(tee -a "${BUILDLOG}") || {
RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}"
make MAKEFLAGS= V=1 clean defconfig && make V=1 # verbose output for errors
}