This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.rules
176 lines (130 loc) · 6.03 KB
/
Makefile.rules
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
SHELL := /bin/bash
################################################################################
# ElibTargets
################################################################################
ElibTargets := all everything e elib elib_static libs clean configure redep distclean \
install check check-ctest
.PHONY: $(ElibTargets)
################################################################################
all:
ifeq ($(wildcard build/Makefile),)
$(error make configure must be run)
else
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build libs
endif
################################################################################
everything:
$(CMD_VERB) $(MAKE) $(NOPRINTD) distclean
$(CMD_VERB) $(MAKE) $(NOPRINTD) configure
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build
$(CMD_VERB) $(MAKE) $(NOPRINTD) check
################################################################################
e:
$(CMD_VERB) $(MAKE) $(NOPRINTD) everything
################################################################################
elib:
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build elib
elib_static:
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build elib_static
libs:
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build libs
################################################################################
clean:
$(CMD_VERB) if [ -f build/Makefile ]; \
then $(MAKE) $(NOPRINTD) -C build clean ; \
fi
$(CMD_VERB) if [ -d src/filesystem/unit_tests/dynamic_test_env/ ]; \
then chmod -R ug+rwx src/filesystem/unit_tests/dynamic_test_env/ ;\
rm -rf src/filesystem/unit_tests/dynamic_test_env/ ;\
fi
rm -rf header_tests/elib/
################################################################################
configure:
$(CMD_VERB) rm -rf ./build/ ; mkdir -p build/
$(CMD_VERB) cd build/ ; cmake $(INTERNAL_CMAKE_OPTIONS) .. ; cd ..
################################################################################
redep:
$(CMD_VERB) cd build/ ; cmake .. ; cd ..
################################################################################
distclean:
$(CMD_VERB) $(MAKE) $(NOPRINTD) clean
$(CMD_VERB) rm -rf ./build ./bin ./test_coverage ./cov-int ./cov-int.tar.gz
################################################################################
install:
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build install
################################################################################
check-ctest:
$(CMD_VERB) echo === Building tests ===
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build
$(CMD_VERB) echo
$(CMD_VERB) echo === Running tests ===
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build test
check:
$(CMD_VERB) $(MAKE) $(NOPRINTD) check-lit
verbose-check:
$(CMD_VERB) $(MAKE) $(NOPRINTD) VERBOSE=1 check-lit
test:
$(CMD_VERB) echo === Running CTest tests ===
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build test
################################################################################
# ElibToolTargets
################################################################################
ElibToolTargets := valgrind-check \
scan scan-test scan-build coverage \
batch-build-command batch-build batch-check \
.PHONY: $(ElibToolTargets)
valgrind-check:
$(CMD_VERB) echo === Building tests ===
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build elib elib_static
$(CMD_VERB) echo
$(CMD_VERB) echo === Running tests ===
$(CMD_VERB) python packages/lit/lit.py -sv --vg --vg-leak --vg-arg=--trace-children-skip=*python* ./build/src
################################################################################
scan:
$(CMD_VERB) $(MAKE) $(NOPRINTD) distclean
$(CMD_VERB) rm -rf cov-int
$(CMD_VERB) rm -rf build/ ; mkdir -p build/ ; cd build/ ; cmake -DCONFIG_COVERITY_SCAN=ON -DCONFIG_ALL_WARNINGS=OFF .. ; cd ..
$(CMD_VERB) cov-build --dir cov-int $(MAKE) $(NOPRINTD) -C build all
$(CMD_VERB) tar -zcvf cov-int.tar.gz cov-int/
################################################################################
scan-test:
$(CMD_VERB) $(MAKE) $(NOPRINTD) distclean
$(CMD_VERB) rm -rf build/ ; mkdir -p build/ ; cd build/ ; cmake -DCONFIG_COVERITY_SCAN=ON .. ; cd ..
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build all
################################################################################
scan-build:
$(CMD_VERB) rm -rf build/ ; mkdir -p build ; cd build/ ; cmake $(INTERNAL_CMAKE_OPTIONS) .. ; scan-build make $(NOPRINTD) all; cd ..
################################################################################
coverage:
$(CMD_VERB) $(MAKE) $(NOPRINTD) distclean
$(CMD_VERB) rm -rf build/ ; mkdir -p build/ ; cd build/ ; \
cmake -DCMAKE_BUILD_TYPE=TEST $(INTERNAL_CMAKE_OPTIONS) .. ; \
cd ..
$(CMD_VERB) $(MAKE) $(NOPRINTD) -C build all
$(CMD_VERB) rm -rf test_coverage ; mkdir -p test_coverage
cd build/src ; \
lcov --zerocounters --directory . ; \
lcov --capture --initial --directory . --output-file test_coverage ; \
$(MAKE) -C .. test;\
lcov --no-checksum --directory . --capture --output-file test_coverage.info ;\
lcov --remove test_coverage.info '/usr/include/*' '/opt/*' 'src/*/unit_tests/*' 'packages/*' --output-file test_coverage.info ;\
genhtml --demangle-cpp test_coverage.info -o ../../test_coverage
$(CMD_VERB) find test_coverage/ -type d -exec chmod 750 {} \;
$(CMD_VERB) find test_coverage/ -type f -exec chmod 640 {} \;
################################################################################
batch-build-command:
ifdef BATCH_VERBOSE
$(CMD_VERB) $(MAKE) $(NOPRINTD) -j$(DEFAULT_THREADS) -C build elib
else
$(CMD_VERB) $(MAKE) $(NOPRINTD) -j$(DEFAULT_THREADS) -C build elib 1> /dev/null
endif
batch-check:
$(CMD_VERB) $(MAKE) $(NOPRINTD) LIT_INTERNAL_ARGS="--no-progress-bar --threads=$(DEFAULT_THREADS)" check-lit
batch-check-all:
$(CMD_VERB) $(MAKE) $(NOPRINTD) LIT_DEFAULT_ARGS="-v" LIT_INTERNAL_ARGS=" --show-unsupported --no-progress-bar --threads=$(DEFAULT_THREADS)" check-all
################################################################################
batch-build:
$(CMD_VERB) $(MAKE) $(NOPRINTD) distclean
$(CMD_VERB) $(MAKE) $(NOPRINTD) configure
$(CMD_VERB) $(MAKE) $(NOPRINTD) batch-build-command
$(CMD_VERB) $(MAKE) $(NOPRINTD) batch-check