libqbe/minic/mcc

45 lines
470 B
Text
Raw Normal View History

2015-11-24 22:07:17 -05:00
#!/bin/sh
2016-04-21 11:24:40 -04:00
DIR=`cd $(dirname $0); pwd`
QBE=$DIR/../qbe
2016-04-21 11:24:40 -04:00
2015-11-24 22:07:17 -05:00
usage()
{
echo "usage: mcc [LDFLAGS] file.c" >&2
exit 1
}
for i
do
case $i in
-*)
flags="$flags $i"
;;
*)
if ! test -z $file
then
usage
fi
file=$i
;;
esac
done
if test -z $file
then
usage
fi
2016-04-21 11:24:40 -04:00
$DIR/minic < $file > /tmp/minic.ssa &&
$QBE < /tmp/minic.ssa > /tmp/minic.s &&
cc /tmp/minic.s $flags
2015-11-24 22:07:17 -05:00
if test $? -ne 0
then
echo "error processing file $file" >&2
2015-11-24 22:13:44 -05:00
exit 1
2015-11-24 22:07:17 -05:00
fi