surtur
b14600c352
All checks were successful
continuous-integration/drone/push Build is passing
* clean now just removes the object files, dwo debugging objects, .cmake and intermediary .bin files but keeps CMakeCache and similar * a new target - distclean - is introduced to do what was previously done by "clean", essentially: completely remove the build folders
70 lines
2.0 KiB
Makefile
70 lines
2.0 KiB
Makefile
cppch = cppcheck
|
|
cppch_args = --language=c++ --std=c++20 --enable=all --verbose --suppress=unmatchedSuppression --suppress=missingIncludeSystem ./*.{cpp,h}
|
|
cpp_flags = CMAKE_CXX_FLAGS=
|
|
c = cmake
|
|
c_args = -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=
|
|
n = ninja
|
|
n_args = -C
|
|
d_folder = cmake-build-debug
|
|
r_folder = cmake-build-release
|
|
s_folder = cmake-build-san
|
|
s_tru = SANITIZE_PLS=true
|
|
v = valgrind
|
|
v_env = VALGRIND=
|
|
v_db = $(d_folder)_valgr
|
|
v_rl = $(r_folder)_valgr
|
|
|
|
.PHONY: check tidy build debug release valgrind san test clean distclean
|
|
|
|
debug:
|
|
if [ ! -d "$(d_folder)" ]; then mkdir -pv $(d_folder); fi
|
|
$(v_env)false $(c) $(c_args)Debug -B $(d_folder) -D$(cpp_flags) && \
|
|
$(n) $(n_args) $(d_folder)
|
|
@echo fortuna \(debug\) has been built inside $(d_folder)
|
|
|
|
release:
|
|
if [ ! -d "$(r_folder)" ]; then mkdir -pv $(r_folder); fi
|
|
$(v_env)false $(c) $(c_args)Release -B $(r_folder) -D$(cpp_flags) && \
|
|
$(n) $(n_args) $(r_folder)
|
|
@echo fortuna \(release\) has been built inside $(r_folder)
|
|
|
|
check:
|
|
$(cppch) $(cppch_args)
|
|
make tidy
|
|
|
|
san:
|
|
if [ ! -d "$(s_folder)" ]; then mkdir -pv $(s_folder); fi
|
|
$(v_env)false $(s_tru) $(c) $(c_args)Debug -B $(s_folder) -D$(cpp_flags) \
|
|
&& $(n) $(n_args) $(s_folder)
|
|
|
|
|
|
tidy:
|
|
env TIDY=1 make debug
|
|
|
|
valgrind: valgrind-debug
|
|
|
|
valgrind-debug:
|
|
if [ ! -d "$(v_db)" ]; then mkdir -pv "$(v_db)"; fi
|
|
$(v_env)true $(c) $(c_args)Debug -B "$(v_db)" -D$(cpp_flags) && \
|
|
$(n) $(n_args) "$(v_db)"
|
|
$(v) --leak-check=full ./$(v_db)/fortuna
|
|
@echo fortuna \(debug\) has been built and checked using valgrind
|
|
|
|
valgrind-release:
|
|
if [ ! -d "$(v_rl)" ]; then mkdir -pv "$(v_rl)"; fi
|
|
$(v_env)true $(c) $(c_args)Release -B "$(v_rl)" -D$(cpp_flags) && \
|
|
$(n) $(n_args) "$(v_rl)"
|
|
$(v) ./$(v_rl)/fortuna
|
|
@echo fortuna \(release\) has been built and checked using valgrind
|
|
|
|
build: debug
|
|
|
|
test: check build
|
|
|
|
clean:
|
|
@find . -regextype posix-egrep -regex ".*\.(o|dwo|out|bin|cmake)" -delete
|
|
|
|
distclean:
|
|
@find . -iwholename '*cmake*' -not -name CMakeLists.txt -delete
|
|
|