#!/bin/sh

# Make a digital unix shared library (OSF/1)
# provided by Thomas Graichen (graichen@rzpd.de)

#--identification------------------------------------------------------

# $Id: mklib.osf1,v 1.7 1997/10/21 23:32:31 brianp Exp $

# $Log: mklib.osf1,v $
# Revision 1.7  1997/10/21 23:32:31  brianp
# now takes major and minor version arguments
#

#--common--------------------------------------------------------------

# Usage:  mklib libname major minor file.o ...
#
# First argument is name of output library (LIBRARY)
# Second arg is major version number (MAJOR)
# Third arg is minor version number (MINOR)
# Rest of arguments are object files (OBJECTS)

LIBRARY=$1
shift 1

MAJOR=$1
shift 1

MINOR=$1
shift 1

OBJECTS=$*

#--platform------------------------------------------------------------

MAJOR=2
VERSION="${MAJOR}.${MINOR}"

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}
