## Define the appropriate configuration variables.

PACKAGE = /fsys2/u/usystem/software/u++-4.7

## Include the architecture dependent definitions.

.INCLUDE : ${PACKAGE}/CONFIG

## Ensure the correct shell is used

SHELL !:= /bin/sh
GROUPSHELL !:= /bin/sh

## Define the path names of important directories.

SRCDIR = ${PACKAGE}/src/examples

HOSTNAME = $(shell hostname)
.IF ${HOSTNAME} == plg2.math
	CCFLAGS += -msupersparc
#.ELSE
#	CCFLAGS += -O2		# -O3 takes too long or is too big to compile on some architectures
.END

.IF ${TCPU} == i386
	WORK = 50000
.ELIF ${TCPU} == m68k
	WORK = 50000
.ELSE
	WORK = 500000
.END

GROUPFLAGS = -x

all :
@[
if [ ${MULTI} = TRUE ] ; then
	multi=${MULTI}
fi

for filename in Bench FloatTest BinaryInsertionSort Merger Philosopher MonAcceptBB MonConditionBB SemaphoreBB TaskAcceptBB TimeSlice Timeout ; do
	for ccflags in "" "-nodebug" $${{multi+"-multi"}} $${{multi+"-multi -nodebug"}} ; do
		${INSTALLBINDIR}/u++ ${CCFLAGS} $${{ccflags}} $${{filename}}.cc
		./a.out
	done
done

for filename in AEHM1 AEHM2 AEHM3 ; do
	for ccflags in "" $${{multi+"-multi"}} ; do
		${INSTALLBINDIR}/u++ ${CCFLAGS} $${{ccflags}} $${{filename}}.cc
		./a.out
	done
done

for filename in Migrate Sleep PeriodicTaskTest RealTimePhilosophers ; do
	for ccflags in "" "-nodebug" $${{multi+"-multi"}} $${{multi+"-multi -nodebug"}} ; do
		${INSTALLBINDIR}/u++ ${CCFLAGS} $${{ccflags}} $${{filename}}.cc
		time ./a.out
	done
done

${INSTALLBINDIR}/u++ ${CCFLAGS} uCalibrate.cc
./a.out > uCalibrate.h

for ccflags in "" "-nodebug" $${{multi+"-multi"}} $${{multi+"-multi -nodebug"}} ; do
	${INSTALLBINDIR}/u++ ${CCFLAGS} $${{ccflags}} Sim.cc
	time ./a.out 1 100 ${WORK}
	time ./a.out 2 100 ${WORK}
	time ./a.out 4 100 ${WORK}
	time ./a.out 8 100 ${WORK}
done

"rm" -f ./a.out
]

## Local Variables: ##
## compile-command: "dmake" ##
## End: ##
