Removing build of multiple identical jerry-libc and plugins libraries copies. Fixing parallel build / precommit invocation without using the workaround.

This commit is contained in:
Ruben Ayrapetyan
2015-03-19 17:12:14 +03:00
parent 79695bf3cd
commit d83d8e0b36
4 changed files with 105 additions and 79 deletions
+50 -4
View File
@@ -15,7 +15,7 @@
#
# Target naming scheme
#
# Main targets: {debug,release}.{linux,stm32f{4}}[.{check,flash}]
# Main targets: {debug,release}.{linux,stm32f{4}}[.flash]
#
# Target mode part (before dot):
# debug: - JERRY_NDEBUG; - optimizations; + debug symbols; + -Werror | debug build
@@ -23,7 +23,7 @@
#
# Target system and modifiers part (after first dot):
# linux - target system is linux
# stm32f{4} - target is STM32F{4} board
# mcu_stm32f{3,4} - target is STM32F{3,4} board
#
# Modifiers can be added after '-' sign.
# For list of modifiers for PC target - see TARGET_PC_MODS, for MCU target - TARGET_MCU_MODS.
@@ -33,6 +33,12 @@
#
# Unit test target: unittests_run
#
# Parallel run
# To build all targets in parallel, please, use make build -j
# To run precommit in parallel mode, please, use make precommit -j
#
# Parallel build of several selected targets started manually is not supported.
#
# Options
# Valgrind
@@ -70,7 +76,7 @@ export JERRY_STM32F3_TARGETS = $(foreach __MODE,$(TARGET_RELEASE_MODES),$(foreac
export JERRY_STM32F4_TARGETS = $(foreach __MODE,$(TARGET_DEBUG_MODES),$(foreach __SYSTEM,$(TARGET_STM32F4_MODS),$(__MODE).$(__SYSTEM))) \
$(foreach __MODE,$(TARGET_RELEASE_MODES),$(foreach __SYSTEM,$(TARGET_STM32F4_MODS),$(__MODE).$(__SYSTEM)))
export JERRY_TARGETS = $(JERRY_LINUX_TARGETS) $(JERRY_STM32F3_TARGETS) $(JERRY_STM32F4_TARGETS)
export JERRY_TARGETS = $(JERRY_LINUX_TARGETS) $(JERRY_STM32F3_TARGETS) $(JERRY_STM32F4_TARGETS) unittests
export CHECK_TARGETS = $(foreach __TARGET,$(JERRY_LINUX_TARGETS),$(__TARGET).check)
export FLASH_TARGETS = $(foreach __TARGET,$(JERRY_STM32F3_TARGETS) $(JERRY_STM32F4_TARGETS),$(__TARGET).flash)
@@ -105,6 +111,9 @@ export SHELL=/bin/bash
# Current
BUILD_DIR := ./build/obj$(OPTIONS_STRING)
# "Build all" targets prefix
BUILD_ALL := build_all
all: precommit
$(BUILD_DIRS_NATIVE):
@@ -146,6 +155,15 @@ unittests: $(BUILD_DIR)/native
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ cp $(BUILD_DIR)/native/unit_test_* $(OUT_DIR)/$@
$(BUILD_ALL)_native: $(BUILD_DIRS_NATIVE)
@ mkdir -p $(OUT_DIR)/$@
@ $(MAKE) -C $(BUILD_DIR)/native jerry-libc-all VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ $(MAKE) -C $(BUILD_DIR)/native plugins-all VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ $(MAKE) -C $(BUILD_DIR)/native $(JERRY_LINUX_TARGETS) unittests VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
$(JERRY_STM32F3_TARGETS): $(BUILD_DIR)/stm32f3
@ mkdir -p $(OUT_DIR)/$@
@ [ "$(STATIC_CHECK)" = "OFF" ] || $(MAKE) -C $(BUILD_DIR)/stm32f3 VERBOSE=1 cppcheck.$@ &>$(OUT_DIR)/$@/cppcheck.log || \
@@ -155,6 +173,15 @@ $(JERRY_STM32F3_TARGETS): $(BUILD_DIR)/stm32f3
@ cp $(BUILD_DIR)/stm32f3/$@ $(OUT_DIR)/$@/jerry
@ cp $(BUILD_DIR)/stm32f3/$@.bin $(OUT_DIR)/$@/jerry.bin
$(BUILD_ALL)_stm32f3: $(BUILD_DIRS_STM32F3)
@ mkdir -p $(OUT_DIR)/$@
@ $(MAKE) -C $(BUILD_DIR)/stm32f3 jerry-libc-all VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ $(MAKE) -C $(BUILD_DIR)/stm32f3 plugins-all VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ $(MAKE) -C $(BUILD_DIR)/stm32f3 $(JERRY_STM32F3_TARGETS) VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
$(JERRY_STM32F4_TARGETS): $(BUILD_DIR)/stm32f4
@ mkdir -p $(OUT_DIR)/$@
@ [ "$(STATIC_CHECK)" = "OFF" ] || $(MAKE) -C $(BUILD_DIR)/stm32f4 VERBOSE=1 cppcheck.$@ &>$(OUT_DIR)/$@/cppcheck.log || \
@@ -164,7 +191,26 @@ $(JERRY_STM32F4_TARGETS): $(BUILD_DIR)/stm32f4
@ cp $(BUILD_DIR)/stm32f4/$@ $(OUT_DIR)/$@/jerry
@ cp $(BUILD_DIR)/stm32f4/$@.bin $(OUT_DIR)/$@/jerry.bin
build: $(JERRY_TARGETS) unittests
$(BUILD_ALL)_stm32f4: $(BUILD_DIRS_STM32F4)
@ mkdir -p $(OUT_DIR)/$@
@ $(MAKE) -C $(BUILD_DIR)/stm32f4 jerry-libc-all VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ $(MAKE) -C $(BUILD_DIR)/stm32f4 plugins-all VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ $(MAKE) -C $(BUILD_DIR)/stm32f4 $(JERRY_STM32F4_TARGETS) VERBOSE=1 &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
build_all: $(BUILD_ALL)_native $(BUILD_ALL)_stm32f3 $(BUILD_ALL)_stm32f4
#
# build - build_all, then run cppcheck and copy output to OUT_DIR
# Prebuild is needed to avoid race conditions between make instances running in parallel
#
build: $(BUILD_ALL)
@ mkdir -p $(OUT_DIR)/$@
@ $(MAKE) VERBOSE=1 $(JERRY_TARGETS) &>$(OUT_DIR)/$@/make.log || \
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
@ rm -rf $(OUT_DIR)/$(BUILD_ALL)* $(OUT_DIR)/$@
$(FLASH_TARGETS): $(BUILD_DIR)/mcu
@$(MAKE) -C $(BUILD_DIR)/mcu VERBOSE=1 $@ 1>/dev/null