FCC=$(FORKDIR)/bin/fcc
INCL=$(FORKDIR)/include
CFLAGS = -I$(INCL) -c -g0 -m -FORK -S -v
# CFLAGS = -I$(INCL) -c -m -FORK -S 
LFLAGS = -T -v
PROGS=testHash testskip index.ps testpq testRTree
SRC=hashtable.c HashTable.c testHash.c HashTable.h hashtable.h \
    skip.h skip.c testskip.c pqueue.c pqueue.h testpq.c index.tex
OBJS=hashtable.o HashTable.o testHash.o skip.o testskip.o \
     testpq.o pqueue.o testRTree.o RTree.o index.ps RTREE.fig TSKIP.fig
ASMS=hashtable.s HashTable.o testHash.s skip.s testskip.s \
     testpq.s pqueue.s testRTree.s RTree.s index.dvi RTREE TSKIP
STUFF=Makefile README
TARFILE=util.tar

all:	$(PROGS) hashtable.o HashTable.o skip.o RTree.o

HashTable.o:	HashTable.c HashTable.h
	$(FCC) $(CFLAGS) HashTable.c

hashtable.o:	hashtable.c hashtable.h
	$(FCC) $(CFLAGS) hashtable.c

testHash.o:	testHash.c HashTable.c HashTable.h
	$(FCC) $(CFLAGS) testHash.c

testHash:	testHash.o HashTable.o
	$(FCC) $(LFLAGS) -o testHash HashTable.o testHash.o

pqueue.o:	pqueue.c
	$(FCC) $(CFLAGS) pqueue.c

testpq.o:	testpq.c pqueue.c pqueue.h
	$(FCC) $(CFLAGS) testpq.c

testpq:	testpq.o pqueue.o
	$(FCC) $(LFLAGS) -o testpq testpq.o pqueue.o

skip.o:	skip.c skip.h
	$(FCC) $(CFLAGS) -T skip.c

testskip.o:	skip.c testskip.c skip.h
	$(FCC) $(CFLAGS) -T testskip.c

testskip:	testskip.o skip.o
	$(FCC) $(LFLAGS) -o testskip testskip.o skip.o

RTree.o:	RTree.c RTree.h
	$(FCC) $(CFLAGS) -T RTree.c

testRTree.o:	RTree.c testRTree.c RTree.h
	$(FCC) $(CFLAGS) -T testRTree.c

testRTree:	testRTree.o RTree.o
	$(FCC) $(LFLAGS) -o testRTree testRTree.o RTree.o

index.ps:	index.dvi
	dvips index.dvi

index.dvi:	index.tex
	latex index.tex; latex index.tex

clean:
	rm -f $(PROGS) $(OBJS) $(ASMS)

tar:	clean
	tar cvf $(TARFILE) $(SRC) $(STUFF); echo "### gzipping tarfile ###"; gzip --best $(TARFILE)
