build_static_lib
This commit is contained in:
parent
3d66ff08af
commit
305f372a6c
7
Makefile
7
Makefile
@ -5,8 +5,11 @@ build_test:
|
|||||||
build_test_dbg:
|
build_test_dbg:
|
||||||
@build_scripts/build_configurations/build_test_dbg.sh
|
@build_scripts/build_configurations/build_test_dbg.sh
|
||||||
|
|
||||||
build_lib:
|
build_shared_lib:
|
||||||
@build_scripts/build_configurations/build_lib.sh
|
@build_scripts/build_configurations/build_shared_lib.sh
|
||||||
|
|
||||||
|
build_static_lib:
|
||||||
|
@build_scripts/build_configurations/build_static_lib.sh
|
||||||
|
|
||||||
###### Testing tasks #######
|
###### Testing tasks #######
|
||||||
test: build_test
|
test: build_test
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source build_scripts/init.sh
|
|
||||||
|
|
||||||
print "${CYAN}=============[build_lib]==============\n"
|
|
||||||
clear_dir "$OUTDIR"
|
|
||||||
clear_dir "$OBJDIR"
|
|
||||||
compile_c "$BUILD_LIB_C_ARGS" "$SRC_C tests/test_marshalling.c"
|
|
||||||
compile_cpp "$BUILD_LIB_CPP_ARGS" "$SRC_CPP"
|
|
||||||
link "$BUILD_LIB_CPP_ARGS $BUILD_LIB_LINKER_ARGS" "$LIB_FILE"
|
|
||||||
10
build_scripts/build_configurations/build_shared_lib.sh
Normal file
10
build_scripts/build_configurations/build_shared_lib.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source build_scripts/init.sh
|
||||||
|
|
||||||
|
print "${CYAN}==========[build_shared_lib]==========\n"
|
||||||
|
clear_dir "$OUTDIR"
|
||||||
|
clear_dir "$OBJDIR"
|
||||||
|
compile_c "$BUILD_SHARED_LIB_C_ARGS" "$SRC_C tests/test_marshalling.c"
|
||||||
|
compile_cpp "$BUILD_SHARED_LIB_CPP_ARGS" "$SRC_CPP"
|
||||||
|
link "$BUILD_SHARED_LIB_CPP_ARGS $BUILD_SHARED_LIB_LINKER_ARGS" "$SHARED_LIB_FILE"
|
||||||
10
build_scripts/build_configurations/build_static_lib.sh
Normal file
10
build_scripts/build_configurations/build_static_lib.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source build_scripts/init.sh
|
||||||
|
|
||||||
|
print "${CYAN}==========[build_shared_lib]==========\n"
|
||||||
|
clear_dir "$OUTDIR"
|
||||||
|
clear_dir "$OBJDIR"
|
||||||
|
compile_c "$BUILD_STATIC_LIB_C_ARGS" "$SRC_C tests/test_marshalling.c"
|
||||||
|
compile_cpp "$BUILD_STATIC_LIB_CPP_ARGS" "$SRC_CPP"
|
||||||
|
pack_static_lib "$STATIC_LIB_FILE"
|
||||||
@ -14,12 +14,6 @@ TESTS_C="$( find tests -name '*.c')"
|
|||||||
TESTS_CPP="$(find tests -name '*.cpp')"
|
TESTS_CPP="$(find tests -name '*.cpp')"
|
||||||
VALGRIND_ARGS="-s --log-file=valgrind.log --read-var-info=yes --track-origins=yes --fullpath-after=kerep/ --leak-check=full --show-leak-kinds=all"
|
VALGRIND_ARGS="-s --log-file=valgrind.log --read-var-info=yes --track-origins=yes --fullpath-after=kerep/ --leak-check=full --show-leak-kinds=all"
|
||||||
|
|
||||||
# build_lib
|
|
||||||
LIB_FILE=kerep.so
|
|
||||||
BUILD_LIB_C_ARGS="-O2 -fpic -flto -shared"
|
|
||||||
BUILD_LIB_CPP_ARGS="$BUILD_LIB_C_ARGS"
|
|
||||||
BUILD_LIB_LINKER_ARGS="-Wl,-soname,$LIB_FILE"
|
|
||||||
|
|
||||||
# build_test
|
# build_test
|
||||||
TEST_FILE=kerep.com
|
TEST_FILE=kerep.com
|
||||||
BUILD_TEST_C_ARGS="-O2"
|
BUILD_TEST_C_ARGS="-O2"
|
||||||
@ -31,3 +25,15 @@ TEST_DBG_FILE=$TEST_FILE
|
|||||||
BUILD_TEST_DBG_C_ARGS="-O0 -g"
|
BUILD_TEST_DBG_C_ARGS="-O0 -g"
|
||||||
BUILD_TEST_DBG_CPP_ARGS="$BUILD_TEST_DBG_C_ARGS"
|
BUILD_TEST_DBG_CPP_ARGS="$BUILD_TEST_DBG_C_ARGS"
|
||||||
BUILD_TEST_DBG_LINKER_ARGS=""
|
BUILD_TEST_DBG_LINKER_ARGS=""
|
||||||
|
|
||||||
|
# build_shared_lib
|
||||||
|
SHARED_LIB_FILE=kerep.so
|
||||||
|
BUILD_SHARED_LIB_C_ARGS="-O2 -fpic -flto -shared"
|
||||||
|
BUILD_SHARED_LIB_CPP_ARGS="$BUILD_SHARED_LIB_C_ARGS"
|
||||||
|
BUILD_SHARED_LIB_LINKER_ARGS="-Wl,-soname,$SHARED_LIB_FILE"
|
||||||
|
|
||||||
|
|
||||||
|
# build_STATIC_LIB
|
||||||
|
STATIC_LIB_FILE=kerep.a
|
||||||
|
BUILD_STATIC_LIB_C_ARGS="-O2 -fpic"
|
||||||
|
BUILD_STATIC_LIB_CPP_ARGS="$BUILD_STATIC_LIB_C_ARGS"
|
||||||
|
|||||||
@ -70,3 +70,20 @@ function link {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# (outfile)
|
||||||
|
function pack_static_lib {
|
||||||
|
print "${CYAN}----------------[link]----------------\n"
|
||||||
|
local outfile=$OUTDIR/$1
|
||||||
|
print "${BLUE}outfile: ${GRAY}$outfile\n"
|
||||||
|
local objects="$(find $OBJDIR -name *.o)"
|
||||||
|
print "${BLUE}objects: ${GRAY}$objects\n"
|
||||||
|
if ar rcs $outfile $(echo $objects | tr '\n' ' ')
|
||||||
|
then
|
||||||
|
print "${GREEN}file $CYAN$outfile ${GREEN}created\n"
|
||||||
|
rm -rf $OBJDIR
|
||||||
|
else
|
||||||
|
print "${RED}some error happened\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user