all: logdb.a logdb.zip test1.out test2.out test3.out

logdb.a: logdb.o logdbfile.o cache.o capi.o
	ar r logdb.a logdb.o logdbfile.o cache.o capi.o

logdb.o: logdb.cpp logdb.h logdbfile.h cache.h common.h
	g++ -Wall -ansi -c logdb.cpp -o logdb.o

logdbfile.o: logdbfile.cpp logdbfile.h cache.h common.h
	g++ -Wall -ansi -c logdbfile.cpp -o logdbfile.o

cache.o: cache.cpp cache.h common.h
	g++ -Wall -ansi -c cache.cpp -o cache.o

capi.o: capi.cpp capi.h logdb.h
	g++ -Wall -ansi -c capi.cpp -o capi.o

test1.out: test1.exe
	${CURDIR}/test1.exe > test1.out

test1.exe: test1.o logdb.a
	g++ -Wall -ansi test1.o logdb.a -o test1.exe

test1.o: test1.cpp logdb.h
	g++ -Wall -ansi -c test1.cpp -o test1.o

test2.out: test2.exe
	${CURDIR}/test2.exe > test2.out

test2.exe: test2.o logdb.a
	g++ -Wall -ansi test2.o logdb.a -o test2.exe

test2.o: test2.cpp logdb.h
	g++ -Wall -ansi -c test2.cpp -o test2.o

test3.out: test3.exe
	${CURDIR}/test3.exe > test3.out

test3.exe: test3.o logdb.a
	gcc -Wall -ansi test3.o logdb.a -o test3.exe -lstdc++

test3.o: test3.c capi.h
	gcc -Wall -ansi -c test3.c -o test3.o

logdb.zip: logdb.cpp logdbfile.cpp cache.cpp logdb.h logdbfile.h cache.h common.h capi.cpp capi.h test1.cpp test2.cpp test3.c makefile readme.txt
	del logdb.zip
	zip logdb.zip logdb.cpp logdbfile.cpp cache.cpp logdb.h logdbfile.h cache.h common.h capi.cpp capi.h test1.cpp test2.cpp test3.c makefile readme.txt
