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

srcdir = .

prefix = /usr/local

CXX=gcc
CXXFLAGS=-O2
CXXINCLUDES=-I. -I/d/libgp271/g++-include
LIBS=/d/libgp271/lib/libg++.a /d/libgp271/lib/libstdc++.a

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

TEST_PROGS=  builtin class virt no_nrv byval call convert call-var virt-var virt-call

#### 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:"
	@./virt
	@echo "With all member functions virtual, and -fthis-is-variable:"
	@./virt-var
	@echo "With all member functions virtual, using calls:"
	@./virt-call
	@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) -D_G_NO_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 $@

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