#!/bin/sh
HERE=`echo $0|sed -e 's,/[^/]*$,,'`
PATH=$HERE:$PATH
file=$1
sfile=`basename $file`
shift
cflags=$*
RM=rm
#
# To disable c2, use:
C2=/bin/mv
# This has been disabled because a bug in the SUN c2 may cause it to use
# registers that it does not save if the routine mentions the status register
# (sr) 
# C2=$HERE/c2

echo cc -S $file.c
cc -S $cflags $file.c
mv $sfile.s $sfile.ccom
if ../bin/inline_sun3 -i$HERE/../etc/xkernel.il $sfile.ccom $sfile.ss &&\
    $C2 $sfile.ss $sfile.s ; then
    $RM -f $sfile.ccom $sfile.ss;
fi
