1# -*- Mode: makefile -*-
2
3CMAKE=cmake
4MAKETYPE=NMake Makefiles
5EXTRA_CMAKE_OPTIONS=
6CMAKE_ARGS=$(EXTRA_CMAKE_OPTIONS)
7
8all: property-benchmark property-examples property-coverage test
9
10covered: property-coverage test
11
12thread-sanitizer: property-tsan test
13
14address-sanitizer: property-asan test
15
16benchmark: property-benchmark test
17
18coverage-report: covered
19	@-mkdir coverage
20	gcovr --root . --html --html-details -o coverage/index.html --exclude="thirdparty*" --exclude="tests*"
21	open coverage/index.html
22
23build/Makefile:
24	@-mkdir build
25	(cd build && $(CMAKE) $(CMAKE_ARGS) ..)
26
27compile: build/Makefile
28	(cd build && $(CMAKE) --build .)
29
30property-coverage:
31	find . -name *.gcda -exec rm {} \;
32	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DCB_CODE_COVERAGE=ON)
33
34property-tsan:
35	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DCB_THREADSANITIZER=ON)
36
37property-asan:
38	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DCB_ADDRESSSANITIZER=ON)
39
40property-benchmark:
41	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DPHOSPHOR_ENABLE_BENCHMARKING=1)
42
43property-examples:
44	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DPHOSPHOR_BUILD_EXAMPLES=1)
45
46coveralls:
47	coveralls
48
49test: compile
50	(cd build && ctest --output-on-failure)
51
52docs:
53	doxygen > /dev/null
54
55clean:
56	rm -rf build
57
58format:
59	clang-format -style=file -i $$(git ls-files | grep -v thirdparty | grep -v dyn_array.h | grep -E "\.cc|\.h");
60