# CPP=xlC
CPP=g++
CPPFLAGS=-c -DDEBUG
# CPPFLAGS=-c
LIB=ucb
# toggle test run for purge
MY_EXAMPLE=-DMY_EXAMPLE
# MY_EXAMPLE=
stl_purge:	stl_purge.C
	$(CPP) $(MY_EXAMPLE) stl_purge.C -o stl_purge -l$(LIB)
all:	stl_purge testisort testiisort testiisort testmsort testqsort testhsort mpurge testfhsort slow
clean:
	rm -f stl_purge stl_purge.ii insort.o testisort indir_insort.o testiisort mergesort.o testmsort mpurge testqsort heapsort.o testhsort fastheap.o testfhsort t.ps slow slow_purge.ii quicksort.o
insort.o:	insort.C
	$(CPP) $(CPPFLAGS) insort.C
testisort:	insort.o testisort.C
	$(CPP) insort.o testisort.C -o testisort -l$(LIB)
indir_insort.o:	indir_insort.C
	$(CPP) $(CPPFLAGS) indir_insort.C
testiisort:	indir_insort.o testiisort.C
	$(CPP) insort.o indir_insort.o testiisort.C -o testiisort -l$(LIB)
mergesort.o:	mergesort.C indir_insort.o
	$(CPP) $(CPPFLAGS) mergesort.C
testmsort:	mergesort.o testmsort.C
	$(CPP) indir_insort.o mergesort.o testmsort.C -o testmsort -l$(LIB)
mpurge:	mergesort.o purge.C
	$(CPP) $(MY_EXAMPLE) mergesort.o indir_insort.o purge.C -o mpurge -l$(LIB)
quicksort.o:	quicksort.C
	$(CPP) $(CPPFLAGS) quicksort.C
testqsort:	insort.o quicksort.o
	$(CPP) insort.o quicksort.o -o testqsort -l$(LIB)
heapsort.o:	heapsort.C
	$(CPP) $(CPPFLAGS) heapsort.C
testhsort:	heapsort.o testhsort.C
	$(CPP) heapsort.o testhsort.C -o testhsort -l$(LIB)
fastheap.o:	fastheap.C
	$(CPP) $(CPPFLAGS) fastheap.C
testfhsort:	heapsort.o fastheap.o testfhsort.C
	$(CPP) heapsort.o fastheap.o testfhsort.C -o testfhsort -l$(LIB)
slow:	slow_purge.C mergesort.o
	$(CPP) indir_insort.o mergesort.o slow_purge.C -o slow -l$(LIB)
