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