blob: f4d43c64a0b46bc1eb918a382d6a25dd8e7210e0 [file] [log] [blame] [raw]
#!/bin/sh
SUNC_PREFIX="/media/f01a9cd1-2570-4619-b4cd-41a27bdcfbd3/Program Files/sunstudio12/prod"
if [ "$1" = --version ]; then
"$SUNC_PREFIX/bin/cc" -V 2>&1
exit 0
fi
flags="-m32 -I /usr/include/i386-linux-gnu"
[ -n "$ONLY_STAGE" ] && flags="$flags -$ONLY_STAGE"
[ -n "$OPTIMIZATION" ] && flags="$flags -xO$OPTIMIZATION"
[ -n "$DEBUG" ] && flags="$flags -g"
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"
# suncc(1) requires working directory being writable
[ -n "$TMPDIR" ] && cd "$TMPDIR" || cd /tmp || exit
input_file="`mktemp -t suncc.XXXXXXXX.c`" || exit
trap 'rm -f "$input_file"' EXIT
cat > "$input_file" || exit
case "$ONLY_STAGE" in
E|S)
output_file=/dev/stdout
;;
*)
output_file="`mktemp -t suncc.XXXXXXXX`" || exit
trap 'rm -f "$input_file" "$output_file"' EXIT
;;
esac
"$SUNC_PREFIX/bin/cc" $flags "$@" "$input_file" -o "$output_file"
r=$?
rm -f "$input_file"
[ $r = 0 ] && [ "$output_file" != /dev/stdout ] && [ -f "$output_file" ] && cat "$output_file"
exit $r