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

52 lines
1.2 KiB
Plaintext

# These are external variables, and shouldn't clash with anything else
# @NAME@
# @NAME@_BUILT
# @NAME@_HEADER
# @NAME@_BASE
if [ -z ${@NAME@_BUILT} ]
then
@NAME@_BASE=@NAME@
source src/@NAME@/soversion
@NAME@="obj/${@NAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_EXTRA="-lstdc++ -lc" # @TODO@ libs, cflags
echo "Building library ${@NAME@}..."
source src/@NAME@/build.monolithic
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
do
if [ ${test} -nt ${@NAME@} ]
then
MODIFIED=1
break
fi
done
if [ ${MODIFIED} -ne 0 ]
then
echo " Compiling"
SONAME="${@NAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@NAME@}" \
-Wl,-soname,${SONAME} \
${SRC} ${SO_EXTRA} || 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
@NAME@_BUILT=1
@NAME@_HEADER=${HDR}
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4