CC=c++
CFLAGS=-g
CINCLUDES=
CLIBS=
OBJS=disk_tools.o d_alloc.o d_db.o 
DOT_H=d_map.h disk_tools.h d_list.h d_hashmap.h d_alloc.h d_db.h d_vector.h

default:
	make prog

all:
	make clean
	make prog

prog:
	make int_test

disk_tools.o:disk_tools.cpp disk_tools.h 
	${CC} disk_tools.cpp -c ${CFLAGS} ${CINCLUDES}

d_test.out:${OBJS} d_test.o ${DOT_H}
	${CC} ${OBJS} -o d_test.out ${CFLAGS} ${CINCLUDES} ${CLIBS} d_test.o 

d_test.o:d_test.cpp ${DOT_H}
	${CC} d_test.cpp -c ${CFLAGS} ${CINCLUDES}

d_alloc.o:d_alloc.cpp d_alloc.h
	${CC} d_alloc.cpp -c ${CFLAGS} ${CINCLUDES}

d_db.o:d_db.cpp d_db.h
	${CC} d_db.cpp -c ${CFLAGS} ${CINCLUDES}

int_test:${OBJS}
	${CC} int_test.cpp -o int_test.out ${CFLAGS} ${CINCLUDES} ${OBJS} ${CLIBS}
	rm -f int.odb
	./int_test.out -init
	./int_test.out

test:
	rm -f test.odb
	rm -f bt.db
	./d_test.out -init
	./d_test.out
	./d_test.out
	./d_test.out

hc:
	${CC} -g ../text_tools/hashpjw.cpp hc.cpp -o hc.out ${CFLAGS} ${CINCLUDES} ${CLIBS} ${OBJS}
	${CC} -g ../text_tools/hashpjw.cpp hc_get.cpp -o hc_get.out ${CFLAGS} ${CINCLUDES} ${CLIBS} ${OBJS}

hct:
	rm -f english.odb
	./hc.out
	./hc_get.out god

httest:
	./ht_get.out god

clean:
	rm -f int_test d_test.out *.o *.core core test.odb int.odb
