2003-11-23 18:29:08 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
usegcc()
|
|
|
|
{
|
|
|
|
cc=gcc
|
2004-03-02 17:34:15 +00:00
|
|
|
ngflags=" \
|
2003-11-23 18:29:08 +00:00
|
|
|
-O2 \
|
|
|
|
-c \
|
|
|
|
-Wall \
|
|
|
|
-Wno-parentheses \
|
|
|
|
-Wno-missing-braces \
|
|
|
|
-Wno-switch \
|
2004-02-09 19:33:05 +00:00
|
|
|
-Wno-comment \
|
2003-11-25 02:36:46 +00:00
|
|
|
-Wno-sign-compare \
|
2004-05-03 17:26:17 +00:00
|
|
|
-Wno-unknown-pragmas \
|
2004-04-29 17:13:24 +00:00
|
|
|
-fno-omit-frame-pointer \
|
2003-11-23 18:29:08 +00:00
|
|
|
"
|
2004-04-29 17:13:24 +00:00
|
|
|
# want to put -fno-optimize-sibling-calls here but
|
|
|
|
# that option only works with gcc3+ it seems
|
2004-03-02 19:29:39 +00:00
|
|
|
cflags="$ngflags -ggdb"
|
2003-11-23 18:29:08 +00:00
|
|
|
}
|
|
|
|
|
2004-03-02 17:34:15 +00:00
|
|
|
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
|
2003-11-23 18:29:08 +00:00
|
|
|
case "$tag" in
|
2004-12-28 23:14:43 +00:00
|
|
|
*BSD*) usegcc ;;
|
2004-03-02 16:58:49 +00:00
|
|
|
*Darwin*) usegcc
|
2004-03-02 17:34:15 +00:00
|
|
|
cflags="$ngflags -g3 -no-cpp-precomp" ;;
|
2003-11-23 18:29:08 +00:00
|
|
|
*HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
|
2004-09-17 22:09:31 +00:00
|
|
|
*Linux*) usegcc
|
2005-01-04 21:13:58 +00:00
|
|
|
case "${SYSVERSION:-`uname -r`}" in
|
2004-12-24 07:12:30 +00:00
|
|
|
2.6.*)
|
2004-09-17 22:09:31 +00:00
|
|
|
cflags="$cflags -D__Linux26__"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2003-11-23 18:29:08 +00:00
|
|
|
*OSF1*) cc=cc; cflags="-g -O -c" ;;
|
2004-03-26 05:01:11 +00:00
|
|
|
*SunOS*-cc) cc=cc;
|
|
|
|
cflags="-g -O -c -xCC -D__sun__"
|
|
|
|
u=`uname`
|
2004-03-26 05:05:33 +00:00
|
|
|
v=`uname -r`
|
|
|
|
s=`echo $u$v | tr '. ' '__'`
|
|
|
|
cflags="$cflags -D__$s__"
|
2004-03-26 05:01:11 +00:00
|
|
|
;;
|
|
|
|
*SunOS*-gcc) usegcc
|
|
|
|
u=`uname`
|
2004-03-26 05:05:33 +00:00
|
|
|
v=`uname -r`
|
|
|
|
s=`echo $u$v | tr '. ' '__'`
|
2004-04-24 04:52:49 +00:00
|
|
|
cflags="$ngflags -g"
|
2004-03-26 05:05:33 +00:00
|
|
|
cflags="$cflags -D__$s__"
|
2004-03-26 05:01:11 +00:00
|
|
|
;;
|
2003-11-23 18:29:08 +00:00
|
|
|
*)
|
|
|
|
echo 9c does not know how to compile on "$tag" 1>&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2005-01-04 21:13:58 +00:00
|
|
|
# N.B. Must use temp file to avoid pipe; pipe loses status.
|
|
|
|
xtmp=/tmp/9c.$$.$USER.out
|
|
|
|
status=x
|
2004-04-24 04:52:49 +00:00
|
|
|
case "$tag" in
|
|
|
|
*SunOS*-cc)
|
2005-01-04 21:13:58 +00:00
|
|
|
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>&1 |
|
2004-04-25 21:28:51 +00:00
|
|
|
/bin/sed 's/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' 1>&2
|
2005-01-04 21:13:58 +00:00
|
|
|
status=$?
|
2004-04-24 04:52:49 +00:00
|
|
|
;;
|
|
|
|
*)
|
2005-01-04 21:13:58 +00:00
|
|
|
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@"
|
|
|
|
status=$?
|
2004-04-24 04:52:49 +00:00
|
|
|
;;
|
2005-01-04 21:13:58 +00:00
|
|
|
esac >$xtmp 2>&1
|
|
|
|
grep -v '__p9l_autolib_' $xtmp
|
|
|
|
rm -f $xtmp
|
|
|
|
exit $status
|