#!/bin/sh
if [ $# = 0 ]
then
	echo "usage: `basename $0` target.a src1.a .. srcN.a"
	exit 1
fi

pwd=`pwd`
arch=$pwd/$1
shift

dir=/tmp/$$
mkdir -p $dir

cd $dir

for i in $*
do
	ar -x $pwd/$i
done

rm -f $arch
ar -q $arch *.o
ranlib $arch

cd $pwd

rm -rf $dir
