lw-build-system/skel/scripts/build.c++.lib/build.lib

51 lines
1.0 KiB
Plaintext

# These are external variables, and shouldn't clash with anything else
# LIBCPP
# LIBCPP_BUILT
# LIBCPP_HEADER
# LIBCPP_BASE
if [ -z ${LIBCPP_BUILT} ]
then
LIB_BASE="@P@"
LIB="obj/${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_LIBS="-lstdc++ -lc"
echo "Building library ${LIB}..."
source src/cpplib/build.monolithic
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
do
if [ ${test} -nt ${LIB} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
echo " Compiling"
SONAME="${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${LIB}" \
-Wl,-soname,${SONAME} \
${SRC} ${SO_LIBS} || return 1
# make tests work
do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1
print_success "Library built"
else
print_success "Library up to date"
fi
LIBCPP=${LIB}
LIBCPP_BUILT=1
LIBCPP_HEADER=${HDR}
LIBCPP_BASE=${LIB_BASE}
fi