#!/bin/sh

# Make a NetBSD shared library
# contributed by Michael Graff (explorer@flame.org)

# First argument is name of output library
# Rest of arguments are object files

set -x

LIBRARY=`basename $1 .so`

shift 1
OBJECTS=$*

VERSION="2.1"

echo "Building PIC library $LIBRARY"
rm -f ${LIBRARY}_pic.a ${LIBRARY}.so.${VERSION}
ar cq ${LIBRARY}_pic.a ${OBJECTS}
ranlib ${LIBRARY}_pic.a

ld -x -Bshareable -Bforcearchive -o ${LIBRARY}.so.${VERSION} ${LIBRARY}_pic.a

cp ${LIBRARY}_pic.a ${LIBRARY}.so.${VERSION} ../lib


