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 case "`uname -r`" in
31 2.6*)
32 cflags="$cflags -D__Linux26__"
33 ;;
34 esac
35 ;;
36 *OSF1*) cc=cc; cflags="-g -O -c" ;;
37 *SunOS*-cc) cc=cc;
38 cflags="-g -O -c -xCC -D__sun__"
39 u=`uname`
40 v=`uname -r`
41 s=`echo $u$v | tr '. ' '__'`
42 cflags="$cflags -D__$s__"
43 ;;
44 *SunOS*-gcc) usegcc
45 u=`uname`
46 v=`uname -r`
47 s=`echo $u$v | tr '. ' '__'`
48 cflags="$ngflags -g"
49 cflags="$cflags -D__$s__"
50 ;;
51 *)
52 echo 9c does not know how to compile on "$tag" 1>&2
53 exit 1
54 esac
56 case "$tag" in
57 *SunOS*-cc)
58 exec $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>&1 |
59 /bin/sed 's/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' 1>&2
60 ;;
61 *)
62 exec $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@"
63 ;;
64 esac