164c7f48eSWill Gardner# -*- Mode: makefile -*-
2bfa24765SWill Gardner
364c7f48eSWill GardnerCMAKE=cmake
464c7f48eSWill GardnerMAKETYPE=NMake Makefiles
564c7f48eSWill GardnerEXTRA_CMAKE_OPTIONS=
664c7f48eSWill GardnerCMAKE_ARGS=$(EXTRA_CMAKE_OPTIONS)
764c7f48eSWill Gardner
85c73097bSWill Gardnerall: property-benchmark property-examples property-coverage test
964c7f48eSWill Gardner
1019b3272fSWill Gardnercovered: property-coverage test
1119b3272fSWill Gardner
1219b3272fSWill Gardnerthread-sanitizer: property-tsan test
1319b3272fSWill Gardner
1419b3272fSWill Gardneraddress-sanitizer: property-asan test
1519b3272fSWill Gardner
1619b3272fSWill Gardnerbenchmark: property-benchmark test
1764c7f48eSWill Gardner
18a171df0cSchippiewillcoverage-report: covered
19a171df0cSchippiewill	@-mkdir coverage
20e20dfde4SWill Gardner	gcovr --root . --html --html-details -o coverage/index.html --exclude="thirdparty*" --exclude="tests*"
21a171df0cSchippiewill	open coverage/index.html
22a171df0cSchippiewill
2364c7f48eSWill Gardnerbuild/Makefile:
2464c7f48eSWill Gardner	@-mkdir build
2564c7f48eSWill Gardner	(cd build && $(CMAKE) $(CMAKE_ARGS) ..)
2664c7f48eSWill Gardner
2764c7f48eSWill Gardnercompile: build/Makefile
281211f8a6SWill Gardner	(cd build && $(CMAKE) --build .)
2964c7f48eSWill Gardner
3019b3272fSWill Gardnerproperty-coverage:
31a171df0cSchippiewill	find . -name *.gcda -exec rm {} \;
3264c7f48eSWill Gardner	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DCB_CODE_COVERAGE=ON)
3364c7f48eSWill Gardner
3419b3272fSWill Gardnerproperty-tsan:
3519b3272fSWill Gardner	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DCB_THREADSANITIZER=ON)
3619b3272fSWill Gardner
3719b3272fSWill Gardnerproperty-asan:
3819b3272fSWill Gardner	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DCB_ADDRESSSANITIZER=ON)
3919b3272fSWill Gardner
4019b3272fSWill Gardnerproperty-benchmark:
4119b3272fSWill Gardner	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DPHOSPHOR_ENABLE_BENCHMARKING=1)
4219b3272fSWill Gardner
435c73097bSWill Gardnerproperty-examples:
445c73097bSWill Gardner	$(eval EXTRA_CMAKE_OPTIONS:=$(EXTRA_CMAKE_OPTIONS) -DPHOSPHOR_BUILD_EXAMPLES=1)
455c73097bSWill Gardner
4664c7f48eSWill Gardnercoveralls:
4764c7f48eSWill Gardner	coveralls
4864c7f48eSWill Gardner
4964c7f48eSWill Gardnertest: compile
50ca6dbd74Schippiewill	(cd build && ctest --output-on-failure)
51bfa24765SWill Gardner
52bfa24765SWill Gardnerdocs:
5364c7f48eSWill Gardner	doxygen > /dev/null
5464c7f48eSWill Gardner
5564c7f48eSWill Gardnerclean:
5664c7f48eSWill Gardner	rm -rf build
57ad27b80dSWill Gardner
58ad27b80dSWill Gardnerformat:
59ad27b80dSWill Gardner	clang-format -style=file -i $$(git ls-files | grep -v thirdparty | grep -v dyn_array.h | grep -E "\.cc|\.h");
60