summary refs log tree commit diff
path: root/minic/mcc
blob: 5a95042b997722399710f64ecce0ce33a962863c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

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


../minic/minic < $file        > /tmp/minic.ssa &&
../src/qbe < /tmp/minic.ssa   > /tmp/minic.s   &&
cc $flags /tmp/minic.s

if test $? -ne 0
then
	echo "error processing file $file" >&2
	exit 1
fi