example = gdfa
example1 = run-database-jobs
example2 = sports-store
example3 = criminal
test1a = timed_test1a
test1b = timed_test1b
test1c = timed_test1c
test2a = timed_test2a
test2b = timed_test2b
test2c = timed_test2c
test3  = timed_test3
test4  = nodestinations
test5  = noinput
test6 = test_char
test7 = test_string
test8 = test_int
test9 = test_double
test10 = testreadcont
test11 = testarray
test12 = test_inserters
test13 = testrwfiles
test14 = priority2_fallthrough
test15 = priority2_nofallthrough
test16 = priority3_fallthrough
test17 = priority3_nofallthrough
test18 = priority4_fallthrough
test19 = priority4_nofallthrough
test20 = test_char_istream
test21 = test_string_istream
test22 = test_int_istream
test23 = test_double_istream
test24 = opcount_test1a
test25 = opcount_test1b
test26 = opcount_test2a
test27 = opcount_test2b
test28 = opcount_test3
test29 = opcount_test4
test_help1 = genints
test_help2 = gendoubles
test_help13 = validaterwfiles
#Cygwin verstion:
compiler = g++ -O3
#Solaris (UNIX) verstion:
#compiler = g++3 -O3
exe = -o $(example).exe
boostpath = C:/BGL/boost_1_25_1
#includes = -I$(boostpath) -I$(opcountpath)
includes = -I$(boostpath)


doc:
	pdfnuweb $(example)
	pdflatex $(example)
	pdfnuweb $(example)
	pdflatex $(example)
	pdflatex $(example)
	pdflatex $(example)

all:	doc opcount_tests correctness_tests timed_tests examples

opcount_tests:
	$(compiler) $(includes) $(options) -o $(test24).exe $(test24).cpp
	$(compiler) $(includes) $(options) -o $(test25).exe $(test25).cpp
	$(compiler) $(includes) $(options) -o $(test26).exe $(test26).cpp
	$(compiler) $(includes) $(options) -o $(test27).exe $(test27).cpp
	$(compiler) $(includes) $(options) -o $(test28).exe $(test28).cpp
	$(compiler) $(includes) $(options) -o $(test29).exe $(test29).cpp
	./$(test24).exe      > opcount_test.out
	./$(test25).exe     >> opcount_test.out
	./$(test26).exe     >> opcount_test.out
	./$(test27).exe     >> opcount_test.out
	./$(test28).exe     >> opcount_test.out
	./$(test29).exe     >> opcount_test.out

correctness_tests:
	$(compiler) $(options) -o $(test4).exe $(test4).cpp
	$(compiler) $(options) -o $(test5).exe $(test5).cpp
	$(compiler) $(options) -o $(test6).exe $(test6).cpp
	$(compiler) $(options) -o $(test7).exe $(test7).cpp
	$(compiler) $(options) -o $(test8).exe $(test8).cpp
	$(compiler) $(options) -o $(test9).exe $(test9).cpp
	$(compiler) $(options) -o $(test10).exe $(test10).cpp
	$(compiler) $(options) -o $(test11).exe $(test11).cpp
	$(compiler) $(options) -o $(test12).exe $(test12).cpp
	$(compiler) $(options) -o $(test13).exe $(test13).cpp
	$(compiler) $(options) -o $(test_help13).exe $(test_help13).cpp
	$(compiler) $(options) -o $(test14).exe $(test14).cpp
	$(compiler) $(options) -o $(test15).exe $(test15).cpp
	$(compiler) $(options) -o $(test16).exe $(test16).cpp
	$(compiler) $(options) -o $(test17).exe $(test17).cpp
	$(compiler) $(options) -o $(test18).exe $(test18).cpp
	$(compiler) $(options) -o $(test19).exe $(test19).cpp
	$(compiler) $(options) -o $(test20).exe $(test20).cpp
	$(compiler) $(options) -o $(test21).exe $(test21).cpp
	$(compiler) $(options) -o $(test_help1).exe $(test_help1).cpp
	$(compiler) $(options) -o $(test22).exe $(test22).cpp
	$(compiler) $(options) -o $(test_help2).exe $(test_help2).cpp
	$(compiler) $(options) -o $(test23).exe $(test23).cpp
	./$(test4).exe  < a_christmas_carol.txt    > correctness_test.out
	./$(test5).exe  < a_christmas_carol.txt   >> correctness_test.out
	./$(test6).exe                            >> correctness_test.out
	./$(test7).exe                            >> correctness_test.out
	./$(test8).exe                            >> correctness_test.out
	./$(test9).exe                            >> correctness_test.out
	./$(test10).exe < a_christmas_carol.txt   >> correctness_test.out
	./$(test11).exe < a_christmas_carol.txt   >> correctness_test.out
	./$(test12).exe < a_christmas_carol.txt   >> correctness_test.out
	./$(test13).exe   a_christmas_carol.txt   >> correctness_test.out
	./$(test_help13).exe                      >> correctness_test.out
	./$(test14).exe                           >> correctness_test.out
	./$(test15).exe                           >> correctness_test.out
	./$(test16).exe                           >> correctness_test.out
	./$(test17).exe                           >> correctness_test.out
	./$(test18).exe                           >> correctness_test.out
	./$(test19).exe                           >> correctness_test.out
	./$(test20).exe < a_christmas_carol.txt   >> correctness_test.out
	./$(test21).exe < a_christmas_carol.txt   >> correctness_test.out
	./$(test_help1).exe 100000                >  randint100000.txt
	./$(test22).exe < randint100000.txt       >> correctness_test.out
	./$(test_help2).exe 100000                >  randdouble100000.txt
	./$(test23).exe < randdouble100000.txt    >> correctness_test.out

timed_tests:
	$(compiler) $(options) -o $(test1a).exe $(test1a).cpp
	$(compiler) $(options) -o $(test1b).exe $(test1b).cpp
	$(compiler) $(options) -o $(test1c).exe $(test1c).cpp
	$(compiler) $(options) -o $(test2a).exe $(test2a).cpp
	$(compiler) $(options) -o $(test2b).exe $(test2b).cpp
	$(compiler) $(options) -o $(test2c).exe $(test2c).cpp
	$(compiler) $(options) -o $(test3).exe $(test3).cpp
	./$(test1a).exe >  timed_test.out
	./$(test1b).exe >> timed_test.out
	./$(test1c).exe >> timed_test.out
	./$(test2a).exe >> timed_test.out
	./$(test2b).exe >> timed_test.out
	./$(test2c).exe >> timed_test.out
	./$(test3).exe  >> timed_test.out

examples:
	$(compiler) $(options) -o $(example1).exe $(example1).cpp
	$(compiler) $(options) -o $(example2).exe $(example2).cpp
	$(compiler) $(options) -o $(example3).exe $(example3).cpp
	./$(example1).exe
	./$(example2).exe
	./$(example3).exe

clean:
	touch bs.exe bs.out rand.txt output
	rm *.exe *.out rand*.txt output*

zip:
	zip gdfa_library Makefile gdfa.w opcount*.pdf timed_test*.pdf a_christmas_carol.txt

