#-----------------------------------------------------------------------------#

THIS_DIR = benchmarks

# To test the performance of the benchmarks (with I/O suppressed),
# uncomment one the following two lines.  The `.hlc' version should be
# used for --high-level-code grades, the other version for LLDS grades.
#
# MLFLAGS += -w "`extract $(*:_init=) '' BenchEntry.hlc`"
# MLFLAGS += -w "`extract $(*:_init=) '' BenchEntry`"

#-----------------------------------------------------------------------------#

PROGS= \
	cqueens \
	crypt \
	deriv \
	deriv2 \
	nrev \
	poly \
	primes \
	qsort \
	queens \
	query \
	tak

TESTS=$(PROGS)
TESTS = $(sort $(PROGS))
SUBDIRS = 
TESTS_DIR = ..
include $(TESTS_DIR)/Mmake.common

# Module-specific options should go in Mercury.options so they
# can be found by `mmc --make'.
include Mercury.options

#-----------------------------------------------------------------------------#

%.runtest: %.res ;

SS=	$(PROGS:%=%.s)
CS=	$(PROGS:%=%.c)
ILS=	$(PROGS:%=%.il)
TIMES=	$(PROGS:%=%.time)

cs:	$(CS)

ss:	$(SS)

ils:	$(ILS)

times:	$(TIMES)

dir.%:	$(PROGS) $(SS)
	-mkdir $@
	cp $(PROGS) $(SS) $@
	cp BenchEntry $@

%.time: %
	{ count=`awk '/$*/ { print $$2; exit; }' < BenchRepeatCounts`; \
	echo "$$count	"; \
	MERCURY_OPTIONS="-t -r$$count" ./repeat_time 3 ./$*; } 2>&1 | tee $@

#-----------------------------------------------------------------------------#
