#
# Copyright(C) 2007-2012 National Institute of Information and Communications Technology
#

CC=gcc
#CFLAGS=-Wall -g
CFLAGS=-Wall -O3
#CFLAGS=-Wall -O3 -pg

BIN=svm_train svm_classify svm_fv2ft svm_fv2sv svm_sv2fv svm_predict svm_mc_train svm_mc_predict svm_mc_classify

all : $(BIN)

clean :
	rm -f $(BIN)
	rm -f *.o

svm_train : svm_train.c svm_common.o svm_kernel.o svm_smo.o exception.o split.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_classify : svm_classify.c svm_common.o svm_kernel.o exception.o split.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_predict : svm_predict.c svm_common.o svm_kernel.o svm_fv.o exception.o split.o hashtable.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_fv2ft : svm_fv2ft.c svm_common.o svm_kernel.o svm_fv.o exception.o split.o hashtable.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_fv2sv : svm_fv2sv.c svm_common.o svm_kernel.o svm_fv.o exception.o split.o hashtable.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_sv2fv : svm_sv2fv.c svm_common.o svm_kernel.o svm_fv.o exception.o split.o hashtable.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_mc_train : svm_mc_train.c svm_mc.o svm_common.o svm_kernel.o svm_smo.o exception.o split.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_mc_classify : svm_mc_classify.c svm_mc.c svm_smo.o svm_common.o svm_kernel.o exception.o split.o
	$(CC) $(CFLAGS) -o $@ $+ -lm
svm_mc_predict : svm_mc_predict.c svm_mc.o svm_smo.o svm_common.o svm_kernel.o svm_fv.o exception.o split.o hashtable.o
	$(CC) $(CFLAGS) -o $@ $+ -lm

svm_common.o : svm_common.c svm_common.h svm_kernel.h exception.h split.h
	$(CC) $(CFLAGS) -c $<
svm_kernel.o : svm_kernel.c svm_common.h svm_kernel.h exception.h
	$(CC) $(CFLAGS) -c $<
svm_smo.o : svm_smo.c svm_common.h svm_kernel.h svm_smo.h exception.h
	$(CC) $(CFLAGS) -c $<
svm_fv.o : svm_fv.c svm_common.h svm_kernel.h svm_fv.h exception.h split.h
	$(CC) $(CFLAGS) -c $<
svm_mc.o : svm_mc.c svm_common.h svm_kernel.h svm_fv.h exception.h split.h
	$(CC) $(CFLAGS) -c $<

exception.o : exception.c exception.h
	$(CC) $(CFLAGS) -c $<
split.o : split.c split.h
	$(CC) $(CFLAGS) -c $<
hashtable.o : hashtable.c hashtable.h
	$(CC) $(CFLAGS) -c $<
