Blob


1 #!/bin/sh
3 usegcc()
4 {
5 cc=gcc
6 ngflags=" \
7 -O2 \
8 -c \
9 -Wall \
10 -Wno-parentheses \
11 -Wno-missing-braces \
12 -Wno-switch \
13 -Wno-comment \
14 -Wno-sign-compare \
15 -Wno-unknown-pragmas \
16 -fno-omit-frame-pointer \
17 "
18 # want to put -fno-optimize-sibling-calls here but
19 # that option only works with gcc3+ it seems
20 cflags="$ngflags -ggdb"
21 }
23 tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
24 case "$tag" in
25 *BSD*) usegcc ;;
26 *Darwin*) usegcc
27 cflags="$ngflags -g3 -no-cpp-precomp" ;;
28 *HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
29 *Linux*) usegcc ;;
30 *OSF1*) cc=cc; cflags="-g -O -c" ;;
31 *SunOS*-cc) cc=cc;
32 cflags="-g -O -c -xCC -D__sun__"
33 u=`uname`
34 v=`uname -r`
35 s=`echo $u$v | tr '. ' '__'`
36 cflags="$cflags -D__$s__"
37 ;;
38 *SunOS*-gcc) usegcc
39 u=`uname`
40 v=`uname -r`
41 s=`echo $u$v | tr '. ' '__'`
42 cflags="$ngflags -g"
43 cflags="$cflags -D__$s__"
44 ;;
45 *)
46 echo 9c does not know how to compile on "$tag" 1>&2
47 exit 1
48 esac
50 case "$tag" in
51 *SunOS*-cc)
52 exec $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>&1 |
53 /bin/sed 's/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' 1>&2
54 ;;
55 *)
56 exec $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@"
57 ;;
58 esac