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

CC=gcc
CFLAGS=-Wall -O3
#CFLAGS=-Wall -g
BIN=lsm_classify lsm_train

all : $(BIN)

clean :
	rm -f $(BIN)
	rm -f lsm_common.o model.o lbfgs.o
	rm -f exception.o hashtable.o split.o

lsm_classify : lsm_classify.c lsm_common.o model.o split.o hashtable.o exception.o
	$(CC) $(CFLAGS) -o $@ $+ -lm

lsm_train : lsm_train.c lsm_common.o model.o split.o hashtable.o exception.o lbfgs.o
	$(CC) $(CFLAGS) -o $@ $+ -lm

lsm_common.o : lsm_common.c lsm_common.h
	$(CC) $(CFLAGS) -c $<

lbfgs.o : lbfgs.c lbfgs.h
	$(CC) $(CFLAGS) -c $<

model.o : model.c model.h
	$(CC) $(CFLAGS) -c $<

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

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

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