This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
fortuna/Makefile

45 lines
1014 B
Makefile
Raw Normal View History

2021-10-24 21:39:12 +02:00
cppch = cppcheck
cppch_args = --language=c++ --std=c++20 --enable=all --verbose ./*.{cpp,h}
cpp_flags =
2021-10-24 21:39:12 +02:00
c = cmake
2021-10-30 20:20:30 +02:00
c_args = -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=
2021-10-24 21:39:12 +02:00
n = ninja
n_args = -C
d_folder = cmake-build-debug
r_folder = cmake-build-release
2021-10-30 20:20:30 +02:00
t = clang-tidy
t_args = --config="" --format-style=google --checks="clang-diagnostic-*,clang-analyzer-*,google-*" --use-color=true -p $(d_folder) ./*.{cpp,h}
2021-10-24 21:39:12 +02:00
v = valgrind
2021-10-30 20:20:30 +02:00
.PHONY: check tidy build debug release valgrind test
2021-10-24 21:39:12 +02:00
debug:
if [ ! -d "$(d_folder)" ]; then mkdir -pv $(d_folder); fi
$(c) $(c_args)Debug -B $(d_folder) $(cpp_flags) && \
$(n) $(n_args) $(d_folder)
release:
if [ ! -d "$(r_folder)" ]; then mkdir -pv $(r_folder); fi
2021-10-24 21:39:12 +02:00
$(c) $(c_args)Release -B $(r_folder) $(cpp_flags) && \
$(n) $(n_args) $(r_folder)
check:
$(cppch) $(cppch_args)
2021-10-30 20:20:30 +02:00
make tidy
tidy:
$(t) $(t_args)
2021-10-24 21:39:12 +02:00
valgrind: valgrind-debug
valgrind-debug:
$(v) ./$(d_folder)/fortuna
valgrind-release:
$(v) ./$(r_folder)/fortuna
build: debug
test: check build
2021-10-24 21:39:12 +02:00