blob: 7a388d722727db24db8dd5f4af86951cd9de9fee [file] [log] [blame] [raw]
#!/bin/sh
[ "$1" = --version ] && exec /usr/local/bin/x86_64-unknown-freebsd12-gcc-4.7.4 --version
flags="-Wall -fno-common --pipe -x c"
[ -n "$DEBUG" ] && flags="$flags -g"
[ -n "$OPTIMIZATION" ] && flags="$flags -O$OPTIMIZATION"
for d in $DEFINE; do flags="-D $d $flags"; done
for d in $UNDEFINE; do flags="-U $d $flags"; done
[ -n "$VERBOSE" ] && flags="$flags -v"
case "$ONLY_STAGE" in
E|S)
exec /usr/local/bin/x86_64-unknown-freebsd12-gcc-4.7.4 -$ONLY_STAGE $flags "$@" - -o -
;;
"")
output_file="`mktemp -t gcc.XXXXXXXX`" || exit
/usr/local/bin/x86_64-unknown-freebsd12-gcc-4.7.4 $flags "$@" - -o "$output_file"
;;
c)
output_file="`mktemp -t gcc.XXXXXXXX.o`" || exit
/usr/local/bin/x86_64-unknown-freebsd12-gcc-4.7.4 -c $flags "$@" - -o "$output_file"
;;
esac
r=$?
if [ $r = 0 ]; then
cat "$output_file" || r=1
fi
rm -f "$output_file"
exit $r