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

53 lines
1.1 KiB
Plaintext

# These are external variables, and shouldn't clash with anything else
# LIBC
# LIBC_BUILT
# LIBC_HEADER
# LIBC_BASE
if [ -z ${LIBC_BUILT} ]
then
LIB_BASE="@P@"
LIB="obj/${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_LIBS="-lc"
echo "Building library ${LIB}..."
source src/clib/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 ${CC} ${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
LIBC=${LIB}
LIBC_BUILT=1
LIBC_HEADER=${HDR}
LIBC_BASE=${LIB_BASE}
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4