#!/bin/sh
TEMP=/tmp/gcc$$tmp
BIL="$@"

while [ $# -gt 0 ]
do
	case "$1" in
	-S)
		Sflag=1;;
        -o)
	        OUT=$2; shift ;;  
  
         *.c)
 		FILE=$1;;
	esac
	shift
done

FILE=`echo "${FILE}" | sed -e 's:\.c$::g'`
gcc -o ${TEMP}.s ${BIL} -S
cat ${TEMP}.s | awk -f gcclab.awk > ${TEMP}1.s

if [ "${Sflag}" = "1" ] ; then
  mv ${TEMP}1.s ${FILE}.s
else
as -o ${FILE}.o ${TEMP}1.s
fi
rm -f ${TEMP}.s ${TEMP}1.s

