From 2c01d3c6aa8731f9825d20c4d37a43bc43f6033f Mon Sep 17 00:00:00 2001 From: surtur Date: Sun, 24 Oct 2021 21:39:12 +0200 Subject: [PATCH] add Makefile --- Makefile | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3f1eaca --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +cppch = cppcheck +cppch_args = --enable=all ./*.cpp ./*.h +cpp_flags = -DCMAKE_CXX_FLAGS=-Wall -Werror -Wextra +c = cmake +c_args = -G Ninja -DCMAKE_BUILD_TYPE= +n = ninja +n_args = -C +d_folder = cmake-build-debug +r_folder = cmake-build-release +v = valgrind + +.PHONY: check build debug release valgrind test + +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 "$(d_folder)" ]; then mkdir -pv $(d_folder); fi + $(c) $(c_args)Release -B $(r_folder) $(cpp_flags) && \ + $(n) $(n_args) $(r_folder) + +check: + $(cppch) $(cppch_args) + +valgrind: valgrind-debug + +valgrind-debug: + $(v) ./$(d_folder)/fortuna + +valgrind-release: + $(v) ./$(r_folder)/fortuna + +build: debug + +test: check build valgrind +