build_scripts
This commit is contained in:
parent
914d4c4e10
commit
62963e6666
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ obj/
|
||||
*.user
|
||||
*.vcxproj.filters
|
||||
.config
|
||||
deps/kerep.a
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -4,5 +4,5 @@ source build_scripts/init.sh
|
||||
|
||||
print "${CYAN}================[test]================\n"
|
||||
cd $OUTDIR
|
||||
./$TEST_FILE
|
||||
./$BUILD_FILE
|
||||
cd ..
|
||||
|
||||
@ -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 ..
|
||||
|
||||
23
build_scripts/build_deps.sh
Normal file
23
build_scripts/build_deps.sh
Normal 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
|
||||
@ -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=""
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user