]> granicus.if.org Git - esp-idf/commitdiff
build system: Run parallel builds without warnings
authorAngus Gratton <angus@espressif.com>
Thu, 6 Oct 2016 07:29:34 +0000 (18:29 +1100)
committerAngus Gratton <angus@espressif.com>
Thu, 6 Oct 2016 07:29:34 +0000 (18:29 +1100)
Ref github #38

components/bootloader/Makefile.projbuild
make/project.mk
make/project_config.mk
make/test_build_system.sh

index 02135e1c64c66e18aa867d3b603fc7c7ef6f2707..91be3a6d6e4682ca978dde993b1f08b04585ac86 100644 (file)
@@ -16,8 +16,8 @@ BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
 BOOTLOADER_SDKCONFIG=$(BOOTLOADER_BUILD_DIR)/sdkconfig
 
 # Custom recursive make for bootloader sub-project
-BOOTLOADER_MAKE=$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src \
-       MAKEFLAGS= V=$(V) SDKCONFIG=$(BOOTLOADER_SDKCONFIG) \
+BOOTLOADER_MAKE=+$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src \
+       V=$(V) SDKCONFIG=$(BOOTLOADER_SDKCONFIG) \
        BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
 
 .PHONY: bootloader-clean bootloader-flash bootloader $(BOOTLOADER_BIN)
index c4bf68db636f1bcbfc83d1f93fc56c9942c39fe6..5797889868c0946ad8110302cecd93aaa0346c51 100644 (file)
@@ -37,6 +37,7 @@ help:
        @echo "'make partition_table', etc, etc."
 
 # disable built-in make rules, makes debugging saner
+MAKEFLAGS_OLD := $(MAKEFLAGS)
 MAKEFLAGS +=-rR
 
 # Figure out PROJECT_PATH if not set
@@ -231,7 +232,7 @@ define GenerateComponentPhonyTarget
 # $(2) - target to generate (build, clean)
 .PHONY: $(notdir $(1))-$(2)
 $(notdir $(1))-$(2): | $(BUILD_DIR_BASE)/$(notdir $(1))
-       @+$(MAKE) -C $(BUILD_DIR_BASE)/$(notdir $(1)) -f $(1)/component.mk COMPONENT_BUILD_DIR=$(BUILD_DIR_BASE)/$(notdir $(1)) $(2)
+       $(Q) +$(MAKE) -C $(BUILD_DIR_BASE)/$(notdir $(1)) -f $(1)/component.mk COMPONENT_BUILD_DIR=$(BUILD_DIR_BASE)/$(notdir $(1)) $(2)
 endef
 
 define GenerateComponentTargets
index 00452dda4d97e7d87429f9c66ea7d6eaa07a584a..7ca83ce5af85c26664374fa494b71ef70702d80c 100644 (file)
@@ -11,10 +11,9 @@ KCONFIG_TOOL_DIR=$(IDF_PATH)/tools/kconfig
 # unless it's overriden (happens for bootloader)
 SDKCONFIG ?= $(PROJECT_PATH)/sdkconfig
 
-# clear MAKEFLAGS as the menuconfig makefile uses implicit compile rules
+# reset MAKEFLAGS as the menuconfig makefile uses implicit compile rules
 $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
-       MAKEFLAGS="" \
-       CC=$(HOSTCC) LD=$(HOSTLD) \
+       MAKEFLAGS=$(ORIGINAL_MAKEFLAGS) CC=$(HOSTCC) LD=$(HOSTLD) \
        $(MAKE) -C $(KCONFIG_TOOL_DIR)
 
 # use a wrapper environment for where we run Kconfig tools
index f721588383e2c76d5a5dcc8ed53ad7afcb884c1f..c6e54d9222bae9a02c4edb232ba1f90b9970f4f1 100755 (executable)
@@ -92,7 +92,7 @@ function run_tests()
     fi
 
     print_status "Moving BUILD_DIR_BASE out of tree"
-    rm -rf --preserve-root ${BUILD}/*
+    clean_build_dir
     OUTOFTREE_BUILD=${TESTDIR}/alt_build
     make BUILD_DIR_BASE=${OUTOFTREE_BUILD} || failure "Failed to build with BUILD_DIR_BASE overriden"
     NEW_BUILD_FILES=$(find ${OUTOFREE_BUILD} -type f)
@@ -105,13 +105,20 @@ function run_tests()
     fi
 
     print_status "BUILD_DIR_BASE inside default build directory"
-    rm -rf --preserve-root ${BUILD}/*
+    clean_build_dir
     make BUILD_DIR_BASE=build/subdirectory || failure "Failed to build with BUILD_DIR_BASE as subdir"
     NEW_BUILD_FILES=$(find ${BUILD}/subdirectory -type f)
     if [ -z "${NEW_BUILD_FILES}" ]; then
         failure "No files found in new build directory!"
     fi
 
+    print_status "Parallel builds should work OK"
+    clean_build_dir
+    (make -j5 2>&1 | tee ${TESTDIR}/parallel_build.log) || failure "Failed to build in parallel"
+    if grep -q "warning: jobserver unavailable" ${TESTDIR}/parallel_build.log; then
+        failure "Parallel build prints 'warning: jobserver unavailable' errors"
+    fi
+
     print_status "Can still clean build if all text files are CRLFs"
     make clean || failure "Unexpected failure to make clean"
     find . -exec unix2dos {} \; # CRLFify template dir
@@ -222,5 +229,11 @@ function assert_not_rebuilt()
     done
 }
 
+# do a "clean" that doesn't depend on 'make clean'
+function clean_build_dir()
+{
+    rm -rf --preserve-root ${BUILD}/*
+}
+
 cd ${TESTDIR}
 run_tests