| 1 |
|
| 2 |
# Whether to turn compiler warnings into errors |
| 3 |
export WERROR ?= true |
| 4 |
export BUILD_DIR ?= cmake-build |
| 5 |
|
| 6 |
default: release |
| 7 |
|
| 8 |
release: |
| 9 |
mkdir -p ./$(BUILD_DIR) && cd ./$(BUILD_DIR) && cmake ../ -DCMAKE_BUILD_TYPE=Release -DWERROR=$(WERROR) && VERBOSE=1 cmake --build . |
| 10 |
|
| 11 |
debug: |
| 12 |
mkdir -p ./$(BUILD_DIR) && cd ./$(BUILD_DIR) && cmake ../ -DCMAKE_BUILD_TYPE=Debug -DWERROR=$(WERROR) && VERBOSE=1 cmake --build . |
| 13 |
|
| 14 |
test: |
| 15 |
@if [ -f ./$(BUILD_DIR)/unit-tests ]; then ./$(BUILD_DIR)/unit-tests; else echo "Please run 'make release' or 'make debug' first" && exit 1; fi |
| 16 |
|
| 17 |
bench: |
| 18 |
@if [ -f ./$(BUILD_DIR)/bench-tests ]; then ./$(BUILD_DIR)/bench-tests; else echo "Please run 'make release' or 'make debug' first" && exit 1; fi |
| 19 |
|
| 20 |
tidy: |
| 21 |
./scripts/clang-tidy.sh |
| 22 |
|
| 23 |
coverage: |
| 24 |
./scripts/coverage.sh |
| 25 |
|
| 26 |
clean: |
| 27 |
rm -rf ./$(BUILD_DIR) |
| 28 |
rm -f *.profraw |
| 29 |
rm -f *.profdata |
| 30 |
@echo "run 'make distclean' to also clear mason_packages, .mason, and .toolchain directories" |
| 31 |
|
| 32 |
distclean: clean |
| 33 |
rm -rf mason_packages |
| 34 |
rm -rf .mason |
| 35 |
rm -rf .toolchain |
| 36 |
rm -f local.env |
| 37 |
|
| 38 |
format: |
| 39 |
./scripts/format.sh |
| 40 |
|
| 41 |
.PHONY: test bench |