
#usage: S LOAD [file ...]
VERSION=$SHOME/newfun/lib/main.a
L=$SHOME/newfun/lib export L
what=local.Sqpe
opts=

case $# in
0) make=*.[rcfe];;
*) make=$*;;
esac

export local_load here
for i in $make
do
case $i in
"*.[rcfe]") echo nothing to LOAD; exit 1;;
*load_time.c) ;; #ignore
*.[crfe] )
	this=`echo $i|sed 's/..$/.o/'`
	local_load="$local_load $this"
	need="$need $this"
	;;
*=*) opts="$opts $i"
	;;
*) local_load="$local_load $i";;
esac
done

if test -s $what; then
	mv $what  o$what;
	restore="mv o$what $what; exit 1"
else
	restore="exit 1"
fi

mf="-f $SHOME/newfun/lib/S_makefile"
if test -r makefile
then
mf="$mf -f makefile"
fi

make $mf VERSION=$VERSION $need  $what $opts || $restore

if test -s o$what;then rm o$what; fi
