GraphC/Makefile
2024-02-22 01:15:34 +06:00

95 lines
3.0 KiB
Makefile

######################################
###### Build tasks #######
######################################
default: build_exec_dbg
# creates executable using profile info generated by profile
build_exec: rebuild_all # profile
@cbuild/call_task.sh build_exec 2>&1 | tee -a make_raw.log
# creates executable with debug info and no optimizations
build_exec_dbg:
@cbuild/call_task.sh build_exec_dbg 2>&1 | tee make_raw.log
######################################
###### Rebuild dependencies #######
######################################
# recompile kerep.a in the next build task
rebuild_kerep:
@cbuild/rebuild_dep.sh libkerep.a 2>&1 | tee make_raw.log
# recompile imgui.a in the next build task
rebuild_imgui:
@cbuild/rebuild_dep.sh libimgui.a 2>&1 | tee make_raw.log
rebuild_imgui_node_editor:
@cbuild/rebuild_dep.sh libimgui-node-editor.a 2>&1 | tee make_raw.log
rebuild_imnodes:
@cbuild/rebuild_dep.sh libimnodes.a 2>&1 | tee make_raw.log
# writes ttf fonts fron ./fonts/ to C compressed arrays in C source files
# builds static library from font arrays definitions
embed_fonts:
@cbuild/call_task.sh embed_fonts
rebuild_all: rebuild_kerep rebuild_imgui rebuild_imgui_node_editor rebuild_imnodes embed_fonts
######################################
###### Launch tasks #######
######################################
# executes $EXEC_FILE
exec: build_exec
@cbuild/call_task.sh exec 2>&1 | tee -a make_raw.log
# executes $EXEC_FILE
exec_dbg: build_exec_dbg
@cbuild/call_task.sh exec 2>&1 | tee -a make_raw.log
# executes $EXEC_FILE with valgrind memory checker
valgrind: build_exec_dbg
@cbuild/call_task.sh valgrind 2>&1 | tee -a make_raw.log
# generates profiling info
profile:
@cbuild/call_task.sh profile 2>&1 | tee make_raw.log
# compiles program with -pg and runs it with gprof
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
# requires graphviz (https://www.graphviz.org/download/source/)
gprof:
@cbuild/call_task.sh gprof 2>&1 | tee make_raw.log
# compiles program and runs it with callgrind (part of valgrind)
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
# requires graphviz (https://www.graphviz.org/download/source/)
# P.S. detailed results can be viewed in KCacheGrind
callgrind:
@cbuild/call_task.sh callgrind 2>&1 | tee make_raw.log
# compiles executable with sanitizers and executes it to find errors and warnings
sanitize:
@cbuild/call_task.sh sanitize 2>&1 | tee make_raw.log
######################################
###### Other tasks #######
######################################
# deletes generated files
clean:
@cbuild/call_task.sh clean 2>&1 | tee make_raw.log
# removes all unreadable characters copied from stdio
fix_log:
sed 's/[^[:blank:][:print:]]//g' make_raw.log \
| sed 's/\[0;[0-9][0-9]m//g' \
| sed 's/\[0;[0-9]m//g' \
| sed 's/\[[0-9][0-9]m//g' \
| sed 's/\[[0-9]m//g' \
| sed 's/ H //g' \
| sed 's/\[3gH //g' \
> make_fixed.log