#!/bin/sh

# Make a FreeBSD shared library
# contributed by Mark Diekhans <markd@grizzly.com>

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

VERSION="2.1"

LIBRARY=$1
shift 1
OBJECTS=$*

BASENAME=`echo ${LIBRARY} | sed "s/\.a//g"`
SHLIB=${BASENAME}.so.${VERSION}
STLIB=${BASENAME}.a

rm -f ${SHLIB} ${STLIB}

ar cq ${STLIB} ${OBJECTS}
ranlib ${STLIB}
ld -Bshareable -o ${SHLIB} ${OBJECTS}

mv ${SHLIB} ../lib
