-
Notifications
You must be signed in to change notification settings - Fork 408
/
Copy pathMakefile
131 lines (107 loc) · 3.94 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
ODIN_ROOT=$(PWD)
NB_OF_PROCESS ?= $(shell /usr/bin/env python3 -c "import multiprocessing; print(multiprocessing.cpu_count())")
################
# build with ninja when doable
################
ifneq ($(shell which ninja | grep -v "not found"),)
BUILDER := ninja
CMAKE_GEN_ARGS := -GNinja
else
BUILDER := make -j$(NB_OF_PROCESS)
CMAKE_GEN_ARGS := -G'Unix Makefiles'
endif
#Default build type
# Possible values:
# release
# debug
BUILD_TYPE ?= release
MAKEFLAGS := -s
CMAKE_ARGS = -DVTR_IPO_BUILD=off -DWITH_ODIN=on $(CMAKE_PARAMS)
BUILD_DIR=../build
ODIN_BUILD_DIR=$(BUILD_DIR)/odin_ii
.PHONY: help build debug test large_test
help:
@echo -e "\n\
The Following options are available\n\n\
build build using the VTR_ROOT makefile \n\
debug build using the VTR_ROOT makefile with debug flags and extra warning flags for ODIN only\n\
clean remove the build file for ODIN only\n\
test run the complete battery of test before commiting changes or to assert functionality\n\
large_test run the complete battery of test before merging changes\n\
"
_init: clean
mkdir -p $(ODIN_BUILD_DIR)
clean:
$(RM) -f $(ODIN_BUILD_DIR)/.*.build
$(RM) -Rf $(BUILD_DIR)/CMakeCache.txt
$(RM) -Rf $(BUILD_DIR)/odin_ii
define _build_it_gen
_build_it_$(1): _set_$(1)
cd $(BUILD_DIR) &&\
echo "Building with $(NB_OF_PROCESS) threads" &&\
$(BUILDER)
$(1): _build_it_$(1)
endef
$(ODIN_BUILD_DIR)/.%.build: _init
touch $@
_set_build: $(ODIN_BUILD_DIR)/.regular.build
cd $(BUILD_DIR) &&\
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) ..
_set_debug: $(ODIN_BUILD_DIR)/.debug.build
cd $(BUILD_DIR) &&\
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) -DODIN_DEBUG=on ..
_set_warn: $(ODIN_BUILD_DIR)/.warn.build
cd $(BUILD_DIR) &&\
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) -DODIN_WARN=on ..
_set_gcov: $(ODIN_BUILD_DIR)/.gcov.build
cd $(BUILD_DIR) &&\
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) -DODIN_COVERAGE=on ..
_set_clang_tidy: $(ODIN_BUILD_DIR)/.tidy.build
cd $(BUILD_DIR) &&\
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) -DODIN_TIDY=on ..
_set_sanitize: $(ODIN_BUILD_DIR)/.sanitize.build
cd $(BUILD_DIR) &&\
cmake $(CMAKE_GEN_ARGS) $(CMAKE_ARGS) -DODIN_SANITIZE=on ..
BUILD_IT_TARGETS = build debug warn gcov clang_tidy sanitize
$(foreach t,$(BUILD_IT_TARGETS), $(eval $(call _build_it_gen,$(t))))
scrub:
find SRC/ -type f \( -iname \*.gcno -or -iname \*.gcda -or -iname \*.gcov \) -exec rm -f {} \;
./verify_odin.sh --clean
gcovr:
find $(BUILD_DIR)/odin_ii/CMakeFiles/libodin_ii.dir -type f \( -iname \*.gcno -or -iname \*.gcda -or -iname \*.gcov \) -exec cp {} SRC/ \;
gcovr --html -s -o coverage_report.html -r .;
find SRC/ -type f \( -iname \*.gcno -or -iname \*.gcda -or -iname \*.gcov \) -exec rm -f {} \;
cppcheck:
cppcheck . 1> /dev/null
test_coverage:
$(MAKE) gcov
./verify_odin.sh -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/light_suite
$(MAKE) gcovr
test:
$(MAKE) sanitize \
&& ./verify_odin.sh --no_report -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/light_suite \
-t regression_test/benchmark/suite/vtr_light_suite; \
$(MAKE) build \
&& ./verify_odin.sh --no_report --continue -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/heavy_suite; \
./verify_odin.sh --status_only
generate_expectation:
$(MAKE) sanitize \
&& ./verify_odin.sh --$@ --no_report -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/light_suite \
-t regression_test/benchmark/suite/vtr_light_suite; \
$(MAKE) build \
&& ./verify_odin.sh --$@ --no_report --continue -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/heavy_suite; \
./verify_odin.sh --status_only
regenerate_expectation:
$(MAKE) sanitize \
&& ./verify_odin.sh --$@ --no_report -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/light_suite \
-t regression_test/benchmark/suite/vtr_light_suite; \
$(MAKE) build \
&& ./verify_odin.sh --$@ --no_report --continue -j $(NB_OF_PROCESS) \
-t regression_test/benchmark/suite/heavy_suite; \
./verify_odin.sh --status_only