CC = gcc
CFLAGS = -O3 -Wall -g -pg
#CFLAGS = -O2 -g -pg
RM= rm -f
CP= cp

BIN= ../bin
LIB= ../lib

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

OBJS	= dafst.o \
	fst_get_probability.o fst_probability_io.o load_double.o \
	t2b.o b2t.o \
	hsplit.o \
	binio.o \
	fstdic.o \
	fstdic_build.o \
	file2lines.o

all: 	libkmat_exploit.a

libkmat_exploit.a: $(OBJS)
	$(AR) rcv $(LIB)/$@ $(OBJS)
	ranlib $(LIB)/$@

ln:
	${RM} *.c *.h
	ln -s /home/dglee/rnd/fnlp/trunk/src/libbin2txt/b2t.c b2t.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/libbin2txt/t2b.c t2b.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/libbinio/binio.c binio.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/dafst/dafst.c dafst.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/probtool/fst_get_probability.c fst_get_probability.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/probtool/fst_probability_io.c fst_probability_io.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/leedcc/hsplit.c hsplit.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/probtool/load_double.c load_double.c
	ln -s /home/dglee/rnd/fnlp/trunk/include/bin2txt.h bin2txt.h
	ln -s /home/dglee/rnd/fnlp/trunk/include/binio.h binio.h
	ln -s /home/dglee/rnd/fnlp/trunk/include/dafst.h dafst.h
	ln -s /home/dglee/rnd/fnlp/trunk/include/hsplit.h hsplit.h
	ln -s /home/dglee/rnd/fnlp/trunk/src/probtool/load_double.h load_double.h
	ln -s /home/dglee/rnd/fnlp/trunk/include/probtool.h probtool.h
	ln -s /home/dglee/rnd/fnlp/trunk/src/fstdic/fstdic.c fstdic.c
	ln -s /home/dglee/rnd/fnlp/trunk/src/fstdic/fstdic_build.c fstdic_build.c
	ln -s /home/dglee/rnd/fnlp/trunk/include/fstdic.h fstdic.h
	ln -s /home/dglee/rnd/fnlp/trunk/src/sort_uniq/file2lines.c file2lines.c
	ln -s /home/dglee/rnd/fnlp/trunk/include/sort_uniq.h sort_uniq.h
	
clean: 	rmobj rmlib

rmobj:
	${RM} *.o 

rmlib:
	${RM} $(LIB)/libkmat_exploit.a
