Compare commits

..

No commits in common. "574ce6eab3b65e05888adad95a0211f532dd1125" and "60fa8c11c2673a10f8afbe37bcea13c9be3317b8" have entirely different histories.

6 changed files with 101 additions and 108 deletions

View File

@ -1,95 +1,91 @@
######################################
###### Build tasks #######
######################################
all: build_exec_dbg
# creates executable using profiling info generated by profile
build_exec: 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
# creates shared library
build_shared_lib:
@cbuild/call_task.sh build_shared_lib 2>&1 | tee make_raw.log
# creates shared library with debug symbols and no optimizations
build_shared_lib_dbg:
@cbuild/call_task.sh build_shared_lib_dbg 2>&1 | tee make_raw.log
# creates static library
build_static_lib:
@cbuild/call_task.sh build_static_lib 2>&1 | tee make_raw.log
# creates static library with debug symbols and no optimizations
build_static_lib_dbg:
@cbuild/call_task.sh build_static_lib_dbg 2>&1 | tee make_raw.log
######################################
###### Rebuild dependencies #######
######################################
# recompile libsome.a in the next build task
#rebuild_some_dep:
# @cbuild/rebuild_dep.sh libsome.a 2>&1 | tee make_raw.log
#rebuild_all: rebuild_some_dep
######################################
###### 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
######################################
###### Build tasks #######
######################################
all: build_exec_dbg
# creates executable using profiling info generated by profile
build_exec: 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
# creates shared library
build_shared_lib:
@cbuild/call_task.sh build_shared_lib 2>&1 | tee make_raw.log
# creates shared library with debug symbols and no optimizations
build_shared_lib_dbg:
@cbuild/call_task.sh build_shared_lib_dbg 2>&1 | tee make_raw.log
# creates static library
build_static_lib:
@cbuild/call_task.sh build_static_lib 2>&1 | tee make_raw.log
# creates static library with debug symbols and no optimizations
build_static_lib_dbg:
@cbuild/call_task.sh build_static_lib_dbg 2>&1 | tee make_raw.log
# recompile libsome_dep.a in the next build task
#rebuild_some_dep:
# @cbuild/rebuild_dep.sh libsome_dep.a 2>&1 | tee make_raw.log
#rebuild_all: rebuild_some_dep
######################################
###### 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 rezults 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

View File

@ -151,7 +151,7 @@ case "$TASK" in
# 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
# P.S. detailed rezults can be viewed in KCacheGrind
callgrind)
OUTDIR="$OUTDIR/callgrind"
# -pg adds code to executable, that generates file containing function call info (gmon.out)

View File

@ -12,14 +12,12 @@ done
set +e
OLDIFS="$IFS"
IFS=$'\n'
cd "$DEPS_BASEDIR"
for dep in $DEPS; do
dep_dir=$(echo ${dep/=*/} | tr -d '[:blank:]')
myprint "${CYAN}--------------[$dep_dir]--------------"
cd "$dep_dir"
cd "$DEPS_BASEDIR/$dep_dir"
make clean
cd ..
done
IFS="$OLDIFS"
cd ..
set -e
set -e

View File

@ -2,10 +2,10 @@
source cbuild/colors.sh
uname_result="$(uname -o)"
myprint "${GRAY}uname result: '$uname_result'"
uname_rezult="$(uname -o)"
myprint "${GRAY}uname rezult: '$uname_rezult'"
case "$uname_result" in
case "$uname_rezult" in
Msys | Cygwin | "MS/Windows")
OS=WINDOWS
;;
@ -19,7 +19,7 @@ case "$uname_result" in
OS=MACOS
;;
*)
error "unknown operating system: $uname_result"
error "unknown operating system: $uname_rezult"
;;
esac

View File

@ -97,12 +97,11 @@ function handle_static_dependency {
[[ -z "$lib_build_task" ]] && error "lib_build_task is empty"
myprint "${BLUE}making $lib_file by task $lib_build_task"
local proj_root_dir="$(pwd)"
cd "$deps_basedir/$lib_project_dir"
if ! make "$lib_build_task"; then
exit 1
fi
cd "$proj_root_dir"
cd ..
cp "$deps_basedir/$lib_project_dir/$lib_build_dir/$lib_file" "$OBJDIR/libs/"
myprint "${GREEN}copied ${CYAN}$lib_file to $OBJDIR/libs/"
@ -113,7 +112,7 @@ function handle_static_dependency {
function resolve_dependencies {
deps_basedir=$1
deps=$2
[[ -z "$deps_basedir" ]] && deps_basedir="."
[[ -z "$deps_basedir" ]] && deps_basedir=.
OLDIFS="$IFS"
IFS=$'\n'
# Evalueting dependency expressions.

View File

@ -3,5 +3,5 @@ source "cbuild/init.sh"
target_file="$1"
touch ".rebuild_$target_file.tmp"
rm -fv "$OBJDIR/libs/$target_file"
rm -fv "$OBJDIR/libs/$target_file.a"
myprint "${YELLOW}dependency ${WHITE}$target_file ${YELLOW}will be rebuilt with the next build task"