cbuild
This commit is contained in:
parent
e9ffff6e9e
commit
7b9672c9d6
21
Makefile
21
Makefile
@ -4,12 +4,8 @@
|
|||||||
|
|
||||||
all: build_exec_dbg
|
all: build_exec_dbg
|
||||||
|
|
||||||
# generates different profile info
|
# creates executable using profiling info generated by profile
|
||||||
build_profile:
|
build_exec: profile
|
||||||
@cbuild/call_task.sh build_profile 2>&1 | tee make_raw.log
|
|
||||||
|
|
||||||
# creates executable using profile info generated by build_profile
|
|
||||||
build_exec: build_profile
|
|
||||||
@cbuild/call_task.sh build_exec 2>&1 | tee -a make_raw.log
|
@cbuild/call_task.sh build_exec 2>&1 | tee -a make_raw.log
|
||||||
|
|
||||||
# creates executable with debug info and no optimizations
|
# creates executable with debug info and no optimizations
|
||||||
@ -32,6 +28,19 @@ exec_dbg: build_exec_dbg
|
|||||||
valgrind: build_exec_dbg
|
valgrind: build_exec_dbg
|
||||||
@cbuild/call_task.sh valgrind 2>&1 | tee -a make_raw.log
|
@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
|
||||||
|
gprof:
|
||||||
|
@cbuild/call_task.sh gprof 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 #######
|
###### Other tasks #######
|
||||||
######################################
|
######################################
|
||||||
|
|||||||
2
cbuild
2
cbuild
@ -1 +1 @@
|
|||||||
Subproject commit 9f04507bd880343b5a99194d5c744879cdb9efe4
|
Subproject commit ca58141d881482a26e12a390f050570061ab7731
|
||||||
@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
CBUILD_VERSION=5
|
CBUILD_VERSION=6
|
||||||
CONFIG_VERSION=6
|
CONFIG_VERSION=7
|
||||||
|
|
||||||
PROJECT=cobek
|
PROJECT=cobek
|
||||||
CMP_C=gcc
|
CMP_C=gcc
|
||||||
CMP_CPP=g++
|
CMP_CPP=g++
|
||||||
STD_C=c11
|
STD_C=c11
|
||||||
STD_CPP=c++17
|
STD_CPP=c++11
|
||||||
WARN_C="-Wall -Wno-discarded-qualifiers"
|
WARN_C="-Wall -Wno-discarded-qualifiers -Wextra -Wno-unused-parameter"
|
||||||
WARN_CPP="-Wall"
|
WARN_CPP="-Wall -Wextra -Wno-unused-parameter"
|
||||||
SRC_C="$( find src -name '*.c')"
|
SRC_C="$( find src -name '*.c')"
|
||||||
SRC_CPP="$( find src -name '*.cpp')"
|
SRC_CPP="$( find src -name '*.cpp')"
|
||||||
#TESTS_C="$( find tests -name '*.c')"
|
#TESTS_C="$( find tests -name '*.c')"
|
||||||
@ -37,30 +37,17 @@ esac
|
|||||||
|
|
||||||
# TASKS
|
# TASKS
|
||||||
case "$TASK" in
|
case "$TASK" in
|
||||||
|
# recompile kerep.a in the next build task
|
||||||
rebuild_kerep)
|
rebuild_kerep)
|
||||||
TASK_SCRIPT=tasks/rebuild_kerep.sh
|
TASK_SCRIPT=tasks/rebuild_kerep.sh
|
||||||
;;
|
;;
|
||||||
# generates different profile info
|
# creates executable using profiling info if it exists
|
||||||
build_profile)
|
|
||||||
OUTDIR="$OUTDIR/profile"
|
|
||||||
# -flto applies more optimizations across object files
|
|
||||||
# -flto=auto is needed to multithreaded copilation
|
|
||||||
# -fuse-linker-plugin is required to use static libs with lto, it strips away all
|
|
||||||
# -pg adds code to executable, that generates file containing function call info (gmon.out)
|
|
||||||
# -fprofile-generate
|
|
||||||
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -pg -fprofile-generate -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
|
|
||||||
CPP_ARGS="$C_ARGS"
|
|
||||||
LINKER_ARGS="$CPP_ARGS"
|
|
||||||
PRE_TASK_SCRIPT=tasks/pre_build.sh
|
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
|
||||||
POST_TASK_SCRIPT=cbuild/default_tasks/profile.sh
|
|
||||||
KEREP_BUILD_TASK=build_static_lib
|
|
||||||
;;
|
|
||||||
# creates executable using profile info generated by build_profile
|
|
||||||
build_exec)
|
build_exec)
|
||||||
# -flto applies more optimizations across object files
|
# -flto applies more optimizations across object files
|
||||||
# -flto=auto is needed to multithreaded copilation
|
# -flto=auto is needed to multithreaded copilation
|
||||||
# -fuse-linker-plugin is required to use static libs with lto, it strips away all
|
# -fuse-linker-plugin is required to use static libs with lto
|
||||||
|
# -fprofile-use enables compiler to use profiling info files to optimize executable
|
||||||
|
# -fprofile-prefix-path sets path where profiling info about objects are be saved
|
||||||
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS"
|
LINKER_ARGS="$CPP_ARGS"
|
||||||
@ -70,7 +57,7 @@ case "$TASK" in
|
|||||||
;;
|
;;
|
||||||
# creates executable with debug info and no optimizations
|
# creates executable with debug info and no optimizations
|
||||||
build_exec_dbg)
|
build_exec_dbg)
|
||||||
C_ARGS="-O0 -g"
|
C_ARGS="-O0 -g3"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS"
|
LINKER_ARGS="$CPP_ARGS"
|
||||||
PRE_TASK_SCRIPT=tasks/pre_build.sh
|
PRE_TASK_SCRIPT=tasks/pre_build.sh
|
||||||
@ -86,6 +73,45 @@ case "$TASK" in
|
|||||||
VALGRIND_ARGS="-s --log-file=valgrind.log --read-var-info=yes --track-origins=yes --fullpath-after=$PROJECT/ --leak-check=full --show-leak-kinds=all"
|
VALGRIND_ARGS="-s --log-file=valgrind.log --read-var-info=yes --track-origins=yes --fullpath-after=$PROJECT/ --leak-check=full --show-leak-kinds=all"
|
||||||
TASK_SCRIPT=cbuild/default_tasks/valgrind.sh
|
TASK_SCRIPT=cbuild/default_tasks/valgrind.sh
|
||||||
;;
|
;;
|
||||||
|
# generates profiling info
|
||||||
|
profile)
|
||||||
|
OUTDIR="$OUTDIR/profile"
|
||||||
|
# -flto applies more optimizations across object files
|
||||||
|
# -flto=auto is needed to multithreaded copilation
|
||||||
|
# -fuse-linker-plugin is required to use static libs with lto
|
||||||
|
# -pg adds code to executable, that generates file containing function call info (gmon.out)
|
||||||
|
# -fprofile-generate generates executable with profiling code
|
||||||
|
# -fprofile-prefix-path sets path where profiling info about objects will be saved
|
||||||
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-generate -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
|
||||||
|
CPP_ARGS="$C_ARGS"
|
||||||
|
LINKER_ARGS="$CPP_ARGS"
|
||||||
|
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
||||||
|
TASK_SCRIPT=cbuild/default_tasks/profile.sh
|
||||||
|
POST_TASK_SCRIPT=
|
||||||
|
;;
|
||||||
|
# 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)
|
||||||
|
OUTDIR="$OUTDIR/gprof"
|
||||||
|
# -pg adds code to executable, that generates file containing function call info (gmon.out)
|
||||||
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -pg"
|
||||||
|
CPP_ARGS="$C_ARGS"
|
||||||
|
LINKER_ARGS="$CPP_ARGS"
|
||||||
|
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
||||||
|
TASK_SCRIPT=cbuild/default_tasks/gprof.sh
|
||||||
|
POST_TASK_SCRIPT=
|
||||||
|
;;
|
||||||
|
# compiles executable with sanitizers and executes it to find errors and warnings
|
||||||
|
sanitize)
|
||||||
|
OUTDIR="$OUTDIR/sanitize"
|
||||||
|
C_ARGS="-O0 -g3 -fsanitize=undefined,address"
|
||||||
|
CPP_ARGS="$C_ARGS"
|
||||||
|
LINKER_ARGS="$CPP_ARGS"
|
||||||
|
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
||||||
|
TASK_SCRIPT=cbuild/default_tasks/exec.sh
|
||||||
|
POST_TASK_SCRIPT=
|
||||||
|
;;
|
||||||
# deletes generated files
|
# deletes generated files
|
||||||
clean)
|
clean)
|
||||||
TASK_SCRIPT=cbuild/default_tasks/clean.sh
|
TASK_SCRIPT=cbuild/default_tasks/clean.sh
|
||||||
|
|||||||
2
kerep
2
kerep
@ -1 +1 @@
|
|||||||
Subproject commit a200f2c96563f5782ed7b56de5a5889b7d1c31cd
|
Subproject commit a2906e2c3aba5d3f94f9eea45bc3e6faed293a7b
|
||||||
Loading…
Reference in New Issue
Block a user