build_scripts

This commit is contained in:
timerix 2022-08-16 15:54:23 +06:00
parent 914d4c4e10
commit 62963e6666
8 changed files with 38 additions and 13 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ obj/
*.user
*.vcxproj.filters
.config
deps/kerep.a

View File

@ -5,6 +5,7 @@ source build_scripts/init.sh
print "${CYAN}===============[build]================\n"
clear_dir "$OUTDIR"
clear_dir "$OBJDIR"
compile_c "$BUILD_C_ARGS" "$SRC_C $TESTS_C"
compile_cpp "$BUILD_CPP_ARGS" "$SRC_CPP $TESTS_CPP"
link "$BUILD_CPP_ARGS $BUILD_LINKER_ARGS" $BUILD_FILE
compile_c "$BUILD_C_ARGS" "$SRC_C"
compile_cpp "$BUILD_CPP_ARGS" "$SRC_CPP"
ar x deps/* --output=obj
link "$BUILD_CPP_ARGS $BUILD_LINKER_ARGS" "$BUILD_FILE"

View File

@ -5,6 +5,6 @@ source build_scripts/init.sh
print "${CYAN}=============[build_dbg]==============\n"
clear_dir "$OUTDIR"
clear_dir "$OBJDIR"
compile_c "$BUILD_DBG_C_ARGS" "$SRC_C $TESTS_C"
compile_cpp "$BUILD_DBG_CPP_ARGS" "$SRC_CPP $TESTS_CPP"
link "$BUILD_DBG_CPP_ARGS $BUILD_DBG_LINKER_ARGS" $TEST_DBG_FILE
compile_c "$BUILD_DBG_C_ARGS" "$SRC_C"
compile_cpp "$BUILD_DBG_CPP_ARGS" "$SRC_CPP"
link "$BUILD_DBG_CPP_ARGS $BUILD_DBG_LINKER_ARGS" "$BUILD_FILE"

View File

@ -4,5 +4,5 @@ source build_scripts/init.sh
print "${CYAN}================[test]================\n"
cd $OUTDIR
./$TEST_FILE
./$BUILD_FILE
cd ..

View File

@ -4,6 +4,6 @@ source build_scripts/init.sh
print "${CYAN}===========[test_valgrind]============\n"
cd $OUTDIR
valgrind $VALGRIND_ARGS ./$TEST_DBG_FILE
valgrind $VALGRIND_ARGS ./$BUILD_DBG_FILE
cat "valgrind.log"
cd ..

View File

@ -0,0 +1,23 @@
#!/bin/bash
source build_scripts/colors.sh
printf "${CYAN}=============[build_deps]=============\n"
mkdir -p deps
cd ../kerep/
if [ ! -f "bin/kerep.a" ]; then
printf "${YELLOW}../kerep/bin/kerep.a doesn't exist\n"
while true; do
printf "${WHITE}build it from source? (y/n) "
read answ
case $answ in
[Yy] ) break;;
[Nn] ) exit;;
* ) printf "${RED}incorrect answer\n";;
esac
done
make build_static_lib
fi
cp bin/kerep.a ../cobek/deps/
printf "${GREEN} copied ${CYAN}kerep.a\n"
cd ../cobek

View File

@ -10,18 +10,16 @@ WARN_C="-Wall -Wno-discarded-qualifiers" #-Wextra
WARN_CPP="-Wall -Wno-unused-variable -Wno-return-type" #-Wextra
SRC_C="$( find src -name '*.c')"
SRC_CPP="$( find src -name '*.cpp')"
TESTS_C="$( find tests -name '*.c')"
TESTS_CPP="$(find tests -name '*.cpp')"
VALGRIND_ARGS="-s --log-file=valgrind.log --read-var-info=yes --track-origins=yes --fullpath-after=cobek/ --leak-check=full --show-leak-kinds=all"
# build
TEST_FILE=cb2c.com
BUILD_FILE=cb2c.com
BUILD_C_ARGS="-O2"
BUILD_CPP_ARGS="$BUILD_C_ARGS"
BUILD_LINKER_ARGS=""
# build_dbg
TEST_DBG_FILE=$TEST_FILE
BUILD_DBG_FILE=$TEST_FILE
BUILD_DBG_C_ARGS="-O0 -g"
BUILD_DBG_CPP_ARGS="$BUILD_DBG_C_ARGS"
BUILD_DBG_LINKER_ARGS=""

View File

@ -7,7 +7,7 @@ source build_scripts/colors.sh
source build_scripts/functions.sh
if [ ! -f ".config" ]; then
print "${YELLOW}./.config doesn't exists\n"
print "${YELLOW}./.config doesn't exist\n"
cp build_scripts/default.config.sh .config
print "${YELLOW}default config created\n"
while true; do
@ -21,3 +21,5 @@ if [ ! -f ".config" ]; then
done
fi
source .config
bash build_scripts/build_deps.sh