PKGROOT = ./fasttext

CXX_STD = CXX11

# include adds a header to each file, ugly hack to block call to exit() and replace cerr by cout
PKG_CPPFLAGS = $(SHLIB_PTHREAD_FLAGS) -include r_compliance.h -I$(PKGROOT)

# pthread is used for multithreading by fastText
PKG_LIBS = $(SHLIB_PTHREAD_FLAGS)

OBJECTS = r_compliance.o $(PKGROOT)/args.o $(PKGROOT)/dictionary.o $(PKGROOT)/productquantizer.o $(PKGROOT)/matrix.o $(PKGROOT)/qmatrix.o $(PKGROOT)/vector.o $(PKGROOT)/model.o $(PKGROOT)/utils.o $(PKGROOT)/fasttext.o $(PKGROOT)/main.o fastrtext.o RcppExports.o

# Reduce the size of the compiled library by removing unneeded debug information
# Need to check if we are on Linux and if strip is installed
# http://dirk.eddelbuettel.com/blog/2017/08/14/#009_compact_shared_libraries
strippedLib: $(SHLIB)
		if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug $(SHLIB); fi

.phony: strippedLib
