plan9port/bin/9c

84 lines
2.2 KiB
Text
Raw Normal View History

#!/bin/sh
2005-01-17 20:57:57 +00:00
test -f $PLAN9/config && . $PLAN9/config
usegcc()
{
cc=gcc
2004-03-02 17:34:15 +00:00
ngflags=" \
-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 \
-Wno-unknown-pragmas \
-fno-omit-frame-pointer \
"
# want to put -fno-optimize-sibling-calls here but
# that option only works with gcc3+ it seems
cflags="$ngflags -ggdb"
}
2004-03-02 17:34:15 +00:00
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
case "$tag" in
2004-12-28 23:14:43 +00:00
*BSD*) usegcc ;;
2004-03-02 16:58:49 +00:00
*Darwin*) usegcc
cflags="$ngflags -g3 -no-cpp-precomp -m32" ;;
*HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
*Linux*) usegcc
2005-07-22 18:56:31 +00:00
case "${CC9:-gcc}" in
tcc)
cc=tcc
cflags="-c -g"
;;
esac
case "${SYSVERSION:-`uname -r`}" in
2.4.*)
cflags="$cflags -D__Linux24__"
;;
2004-12-24 07:12:30 +00:00
2.6.*)
cflags="$cflags -D__Linux26__"
;;
esac
;;
*OSF1*) cc=cc; cflags="-g -O -c" ;;
2004-03-26 05:01:11 +00:00
*SunOS*-cc) cc=cc;
2005-01-07 07:16:53 +00:00
cflags="-mt -g -O -c -xCC -D__sun__"
2004-03-26 05:01:11 +00:00
u=`uname`
2004-03-26 05:05:33 +00:00
v=`uname -r`
s=`echo $u$v | tr '. ' '__'`
2005-01-19 16:45:27 +00:00
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"
2008-05-31 16:09:43 +00:00
cflags="$cflags -D__sun__ -D__${s}__"
2004-03-26 05:01:11 +00:00
;;
2009-07-15 05:55:52 +00:00
*AIX*) usegcc
cflags="$ngflags -g -D__AIX__"
;;
*)
echo 9c does not know how to compile on "$tag" 1>&2
exit 1
esac
# N.B. Must use temp file to avoid pipe; pipe loses status.
2005-03-18 19:32:06 +00:00
# The uniq at the end is for gcc's strcmp/etc. built-in nonsense,
# which multiplies single errors as a result of its expansion.
# The "Cursor. is deprecated" kills off warnings from Apple
# about using SetCursor/InitCursor. (Okay, they're deprecated,
# but you could at least tell us what to use instead, Apple!)
xtmp=/tmp/9c.$$.$USER.out
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
2005-01-07 07:15:31 +00:00
status=$?
grep -v '__p9l_autolib_' $xtmp |
egrep -v ': error: .Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|In file included from| from|use of C99 long long|ISO C forbids conversion|is deprecated|warn_unused_result' |
2005-03-18 19:32:06 +00:00
sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
2005-07-22 18:56:31 +00:00
uniq 1>&2
2005-01-07 07:15:31 +00:00
rm -f $xtmp $xtmp.status
exit $status