#!/bin/sh

arglist=
until [ $# -eq 0 ];do
   case $1 in
     -o) arg=$1; shift ; lib=$1 ;;
     -verlong) arg=$1; shift ; VERSION_LONG=$1 ;;
     -vershort) arg=$1; shift ; VERSION_SHORT=$1 ;;
      *) arglist="$arglist $1" ;;
   esac
   shift
done

lib=${lib%.${VERSION_SHORT}}

rm -f ${lib}.${VERSION_LONG} ${lib}.${VERSION_SHORT} ${lib}
g++ -shared -o ${lib}.${VERSION_LONG} $arglist -Wl,-soname,${lib}.${VERSION_SHORT}
ln -sf ${lib}.${VERSION_SHORT} ${lib}
/sbin/ldconfig -n $PWD
