The mandel example uses SDL2 for graphics output. When GCC is used to assemble the resulting *.s file it shows linker's errors about undefined symbols from the library. This behavior can be fixed by moving the flags passed to the compiler after the source file name.
44 lines
474 B
Bash
Executable file
44 lines
474 B
Bash
Executable file
#!/bin/sh
|
|
|
|
DIR=`cd $(dirname $0); pwd`
|
|
QBE=$DIR/../obj/qbe
|
|
|
|
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
|
|
|
|
|
|
$DIR/minic < $file > /tmp/minic.ssa &&
|
|
$QBE < /tmp/minic.ssa > /tmp/minic.s &&
|
|
cc /tmp/minic.s $flags
|
|
|
|
if test $? -ne 0
|
|
then
|
|
echo "error processing file $file" >&2
|
|
exit 1
|
|
fi
|
|
|
|
|