#! sh
#
# Merges link libraries
#
# Usage: mergelibs.sh libdir destlib
#

AR=ppc-amigaos-ar
RANLIB=ppc-amigaos-ranlib
TMP=/t

LIBDIR=$1
DEST=$2

if [ -d $TMP/mergelibstmp ]; then rm -rf $TMP/mergelibstmp; fi
mkdir $TMP/mergelibstmp
TMP=$TMP/mergelibstmp

for lib in $LIBDIR/*.a; do
	(cd $TMP; $AR x $lib)
done

(cd $TMP; $AR r $TMP/../mergeresult *)
$RANLIB $TMP/../mergeresult
cp $TMP/../mergeresult $DEST

rm -rf $TMP/../mergeresult $TMP

