# A makefile for the stuff now in libg++/etc/benchmarks

srcdir = .

prefix = /usr/local


# select QUICK= -DQUICK to get 50000 instead of 500000 iterations
QUICK= -DQUICK
#QUICK=

# call-var virt-var left out, because gcc passes -fthis-is-variable
# to collect, which tried to pass it to gcc/cc1.
TEST_PROGS=  builtin class virt no_nrv byval call convert # call-var virt-var

#### package, host, target, and site dependent Makefile fragments come in here.
##

$(TEST_PROGS) : Int.h Char.h dhrystone.cc
test_progs: $(TEST_PROGS)

C_FLAGS = $(CXXFLAGS) $(CXXINCLUDES) $(QUICK)

check: $(TEST_PROGS)
	@echo "dhrystone with builtin int and char types:"
	@./builtin
	@echo "Using classes Int and Char:"
	@./class
	@echo "Without mixed mode operators (forcing coercions):"
	@./convert
#	@echo "Using by-value, rather than by-reference calling conventions:"
#	@./byval
	@echo "Without using named return values:"
	@./no_nrv
	@echo "Using calls instead of inline functions:"
	@./call
#	@echo "Using calls, with -fthis-is-variable:"
#	@./call-var
	@echo "With all member functions virtual (non-inline):"
	@./virt
	@echo "With all member functions virtual, and -fthis-is-variable:"
#	@./virt-var
#	@echo "(Try other permutations/switches -- See Int.h.)"

run_tests: check

builtin:
	$(CXX) $(C_FLAGS) -DBUILTIN $(srcdir)/dhrystone.cc $(LIBS) -o $@

class:
	$(CXX) $(C_FLAGS) $(srcdir)/dhrystone.cc $(LIBS) -o $@

call:
	$(CXX) $(C_FLAGS) -DCALL $(srcdir)/dhrystone.cc $(LIBS) -o $@

call-var:
	$(CXX) $(C_FLAGS) -fthis-is-variable -DCALL $(srcdir)/dhrystone.cc $(LIBS) -o $@

convert:
	$(CXX) $(C_FLAGS) -DCONVERT $(srcdir)/dhrystone.cc $(LIBS) -o $@

no_nrv:
	$(CXX) $(C_FLAGS) -DNO_NRV $(srcdir)/dhrystone.cc $(LIBS) -o $@

byval:
	$(CXX) $(C_FLAGS) -DBYVAL $(srcdir)/dhrystone.cc $(LIBS) -o $@

virt:
	$(CXX) $(C_FLAGS) -DVIRT $(srcdir)/dhrystone.cc $(LIBS) -o $@

virt-var:
	$(CXX) $(C_FLAGS) -fthis-is-variable -DVIRT $(srcdir)/dhrystone.cc $(LIBS) -o $@
