#!/bin/sh

# Make a digital unix shared library (OSF/1)

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

LIBRARY=$1

shift 1
OBJECTS=$*

# provided by Thomas Graichen (graichen@rzpd.de)

LIBMAJOR=2
LIBMINOR=1
VERSION="${LIBMAJOR}.${LIBMINOR}"

LIBNAME=`basename $LIBRARY`
ARNAME=`basename $LIBNAME .so`.a
DIRNAME=`dirname $LIBRARY`

rm -f ${LIBRARY}.${VERSION}
ld -o ${LIBRARY}.${VERSION} -shared -no_archive -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS}
(cd $DIRNAME; ln -sf ${LIBNAME}.${VERSION} ${LIBNAME})

rm -f ${DIRNAME}/${ARNAME}
ar clqZ ${DIRNAME}/${ARNAME} ${OBJECTS}
