Skip to content

Commit cb8c583

Browse files
authored
Merge pull request #904 from antmicro/fix-parallel-build
odin: makefile: fix parallel build
2 parents 827f8f1 + 907424f commit cb8c583

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

ODIN_II/Makefile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,23 @@ help:
3636
large_test run the complete battery of test before merging changes\n\
3737
"
3838

39-
_init:
39+
_init: clean
4040
mkdir -p $(ODIN_BUILD_DIR)
4141

4242
clean:
4343
$(RM) -f $(ODIN_BUILD_DIR)/.*.build
4444
$(RM) -Rf $(BUILD_DIR)/CMakeCache.txt
4545
$(RM) -Rf $(BUILD_DIR)/ODIN_II
4646

47-
_build_it:
47+
define _build_it_gen
48+
_build_it_$(1): _set_$(1)
4849
cd $(BUILD_DIR) &&\
4950
$(BUILDER)
5051

51-
$(ODIN_BUILD_DIR)/.%.build: clean _init
52+
$(1): _build_it_$(1)
53+
endef
54+
55+
$(ODIN_BUILD_DIR)/.%.build: _init
5256
touch $@
5357

5458
_set_build: $(ODIN_BUILD_DIR)/.regular.build
@@ -71,15 +75,8 @@ _set_clang_tidy: $(ODIN_BUILD_DIR)/.tidy.build
7175
cd $(BUILD_DIR) &&\
7276
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) -DODIN_TIDY=on ..
7377

74-
build: _set_build _build_it
75-
76-
debug: _set_debug _build_it
77-
78-
warn: _set_warn _build_it
79-
80-
gcov: _set_gcov _build_it
81-
82-
clang_tidy: _set_clang_tidy _build_it
78+
BUILD_IT_TARGETS = build debug warn gcov clang_tidy
79+
$(foreach t,$(BUILD_IT_TARGETS), $(eval $(call _build_it_gen,$(t))))
8380

8481
scrub:
8582
find SRC/ -type f \( -iname \*.gcno -or -iname \*.gcda -or -iname \*.gcov \) -exec rm -f {} \;

0 commit comments

Comments
 (0)