* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / lcc-4.2 / src / run.sh
blobe75bc9d8f8f4fce820493076d4e42ce3a0172a1b
1 #!/bin/sh
2 # $Id$
3 # run .../target/os/tst/foo.s [ remotehost ]
5 # set -x
6 target=`echo $1 | awk -F/ '{ print $(NF-3) }'`
7 os=`echo $1 | awk -F/ '{ print $(NF-2) }'`
8 dir=$target/$os
10 case "$1" in
11 *symbolic/irix*) idir=include/mips/irix; remotehost=noexecute ;;
12 *symbolic/osf*) idir=include/alpha/osf; remotehost=noexecute ;;
13 *) idir=include/$dir; remotehost=${2-$REMOTEHOST} ;;
14 esac
16 if [ ! -d "$target/$os" -o ! -d "$idir" ]; then
17 echo 2>&1 $0: unknown combination '"'$target/$os'"'
18 exit 1
21 C=`basename $1 .s`
22 BUILDDIR=${BUILDDIR-.} LCC="${LCC-${BUILDDIR}/lcc} -Wo-lccdir=$BUILDDIR"
23 TSTDIR=${TSTDIR-${BUILDDIR}/$dir/tst}
24 if [ ! -d $TSTDIR ]; then mkdir -p $TSTDIR; fi
26 echo ${BUILDDIR}/rcc$EXE -target=$target/$os $1: 1>&2
27 $LCC -S -I$idir -Ualpha -Usun -Uvax -Umips -Ux86 \
28 -Wf-errout=$TSTDIR/$C.2 -D$target -Wf-g0 \
29 -Wf-target=$target/$os -o $1 tst/$C.c
30 if [ $? != 0 ]; then remotehost=noexecute; fi
31 if [ -r $dir/tst/$C.2bk ]; then
32 diff $dir/tst/$C.2bk $TSTDIR/$C.2
34 if [ -r $dir/tst/$C.sbk ]; then
35 if diff $dir/tst/$C.sbk $TSTDIR/$C.s; then exit 0; fi
38 case "$remotehost" in
39 noexecute) exit 0 ;;
40 ""|"-") $LCC -o $TSTDIR/$C$EXE $1; $TSTDIR/$C$EXE <tst/$C.0 >$TSTDIR/$C.1 ;;
41 *) rcp $1 $remotehost:
42 if expr "$remotehost" : '.*@' >/dev/null ; then
43 remotehost="`expr $remotehost : '.*@\(.*\)'` -l `expr $remotehost : '\(.*\)@'`"
45 rsh $remotehost "cc -o $C$EXE $C.s -lm;./$C$EXE;rm -f $C$EXE $C.[so]" <tst/$C.0 >$TSTDIR/$C.1
47 esac
48 if [ -r $dir/tst/$C.1bk ]; then
49 diff $dir/tst/$C.1bk $TSTDIR/$C.1
50 exit $?
52 exit 0