BASEPATH   = ../..
include ${BASEPATH}/stm.mk
LIBPATH_WIN= ${RELPATH}

CPPFLAGS= -O -c -I${BASEPATH}/lib/ -fPIC
LFLAGS_WIN = -L${LIBPATH_WIN}/

linux : LFLAGS  = -L${LIBPATH}/ -lm -lpthread -lstm
windows : LFLAGS  = -L ${LIBPATH_WIN} -L${LIBPATH}/ -lm -lstm
LEX     = flex
linux : LEXFLAGS = --noyywrap
windows : LEXFLAGS = 

default:
	# ${MAKE} linux | windows | clean

linux: feature
	${COPY} feature ${RELPATH}

windows: feature.exe
	${COPY} feature.exe ${RELPATH}

# add to link line for rpath! -Wl,-rpath,/some/path
feature.exe: feature.o 
	${LINK} ${LFLAGS} -o feature feature.o 

feature: feature.o 
	${LINK} ${LFLAGS} -ldl -o feature  feature.o

clean: 
	${RM} *.o *.dylib scanner.cpp *.cc  *.so feature feature.exe\
	   	${RELPATH}/feature ${RELPATH}/feature.exe

#
# C++ compilation
#

feature.o: feature.cpp ${HEADERS}
	${CPP} ${CPPFLAGS} feature.cpp 

