CXX = c++
VERSION = 0.13
CXXFLAGS = -O3 -Wall -Wno-deprecated
EXECPREFIX =
LDFLAGS  = 
TARGETS1 = bact_learn${EXEC_PREFIX}
TARGETS2 = bact_classify${EXEC_PREFIX}
TARGETS3 = bact_mkmodel${EXEC_PREFIX}
OBJ = str2node.o

all: bact_learn bact_mkmodel bact_classify

bact_learn: bact_learn.o ${OBJ}
	${CXX} ${CFLAGS} ${LDFLAGS} -o ${TARGETS1} ${OBJ} bact_learn.o ${LDFLAGS}

bact_classify: bact_classify.o ${OBJ}
	${CXX} ${CFLAGS} ${LDFLAGS} -o ${TARGETS2} ${OBJ} bact_classify.o ${LDFLAGS}

bact_mkmodel: bact_mkmodel.o ${OBJ}
	${CXX} ${CFLAGS} ${LDFLAGS} -o ${TARGETS3} ${OBJ} bact_mkmodel.o ${LDFLAGS}

clean:
	rm -f *.o ${TARGETS1} ${TARGETS2} ${TARGETS3} core *~ *.tar.gz *.exe core* med.model* jp.model*

dist:	
	rm -fr bact-${VERSION}
	mkdir bact-${VERSION}
	cp *.h *.cpp Makefile bact.css index.html README AUTHORS COPYING jp.* med.* bact-${VERSION} 
	tar zcfv bact-${VERSION}.tar.gz bact-${VERSION}
	rm -fr bact-${VERSION}

export:
	scp bact-${VERSION}.tar.gz index.html bact.css chasen.org:public_html/software/bact/

check:
test:	
	./bact_learn -T1000 med.train med.model 
	./bact_mkmodel -i med.model -o med.model.bin -O med.model.O
	./bact_classify med.test med.model.bin
	sleep 4
	./bact_learn -T1000 jp.train jp.model 
	./bact_mkmodel -i jp.model -o jp.model.bin -O jp.model.O
	./bact_classify jp.test jp.model.bin
	
