Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

run.sh (1535B)


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