From 867b20837f8107689996e7e278878e012acc23cc Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 4 Sep 2017 13:17:32 +1000 Subject: [PATCH] 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. --- make/project.mk | 19 ++++++++++++++----- tools/ci/build_examples.sh | 7 ++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/make/project.mk b/make/project.mk index 195147bd86..d22a1b1dd0 100644 --- a/make/project.mk +++ b/make/project.mk @@ -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. diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index ec7ff16eb0..c22aaf4bd0 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -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 }