#!/bin/shobjtype=$cputypetest -f $PF9/$objtype/config && . $PF9/$objtype/config. $PF9/linux/bin/9c_opts.shusegcc(){ cc=gcc ngflags=-c if $opti; then ngflags="-O2 $ngflags" fi if $warn; then ngflags="$ngflags \ -Wall \ -Wno-parentheses \ -Wno-missing-braces \ -Wno-switch \ -Wno-comment \ -Wno-sign-compare \ -Wno-unknown-pragmas \ " fi ngflags="$ngflags \ -fno-omit-frame-pointer \ " # want to put -fno-optimize-sibling-calls here but # that option only works with gcc3+ it seems cflags="$ngflags -ggdb"}tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"case "$tag" in*BSD*) usegcc ;;*Darwin*) usegcc cflags="$ngflags -g3 -no-cpp-precomp" ;;*Linux*) usegcc case "${CC9:-gcc}" in tcc) cc=tcc cflags="-c -g" ;; esac case "${SYSVERSION:-`uname -r`}" in 2.4.*) cflags="$cflags -D__Linux24__" ;; 2.6.*) cflags="$cflags -D__Linux26__" ;; esac ;;*) echo 9c does not know how to compile on "$tag" 1>&2 exit 1esacfor src in $srcs; do if test -z "$outfile"; then outfile=`echo $src | sed 's,[^/]*/,,g;s,[.]c$,,'`.$O fi # N.B. Must use temp file to avoid pipe; pipe loses status. # The uniq at the end is for gcc's strcmp/etc. built-in nonsense, # which multiplies single errors as a result of its expansion. xtmp=/tmp/9c.$$.$USER.out $cc -o $outfile -DPLAN9PORT -DPF9 -I$PF9/$objtype/include -I$PF9/include $cflags $opts $src 2>$xtmp 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' | sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' | uniq 1>&2 rm -f $xtmp $xtmp.status exit $statusdone
#!/bin/sh
objtype=$cputype
test -f $PF9/$objtype/config && . $PF9/$objtype/config
. $PF9/linux/bin/9c_opts.sh
usegcc()
{
cc=gcc
ngflags=-c
if $opti; then
ngflags="-O2 $ngflags"
fi
if $warn; then
ngflags="$ngflags \
-Wall \
-Wno-parentheses \
-Wno-missing-braces \
-Wno-switch \
-Wno-comment \
-Wno-sign-compare \
-Wno-unknown-pragmas \
"
fi
ngflags="$ngflags \
-fno-omit-frame-pointer \
"
# want to put -fno-optimize-sibling-calls here but
# that option only works with gcc3+ it seems
cflags="$ngflags -ggdb"
}
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
case "$tag" in
*BSD*) usegcc ;;
*Darwin*) usegcc
cflags="$ngflags -g3 -no-cpp-precomp" ;;
*Linux*) usegcc
case "${CC9:-gcc}" in
tcc)
cc=tcc
cflags="-c -g"
;;
esac
case "${SYSVERSION:-`uname -r`}" in
2.4.*)
cflags="$cflags -D__Linux24__"
;;
2.6.*)
cflags="$cflags -D__Linux26__"
;;
esac
;;
*)
echo 9c does not know how to compile on "$tag" 1>&2
exit 1
esac
for src in $srcs; do
if test -z "$outfile"; then
outfile=`echo $src | sed 's,[^/]*/,,g;s,[.]c$,,'`.$O
fi
# N.B. Must use temp file to avoid pipe; pipe loses status.
# The uniq at the end is for gcc's strcmp/etc. built-in nonsense,
# which multiplies single errors as a result of its expansion.
xtmp=/tmp/9c.$$.$USER.out
$cc -o $outfile -DPLAN9PORT -DPF9 -I$PF9/$objtype/include -I$PF9/include $cflags $opts $src 2>$xtmp
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' |
sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
uniq 1>&2
rm -f $xtmp $xtmp.status
exit $status
done