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 = -pthread -include r_compliance.h -I$(PKGROOT)

# pthread is used for multithreading by fastText
PKG_LIBS = -pthread

OBJECTS = add_prefix.o r_compliance.o $(PKGROOT)/autotune.o $(PKGROOT)/args.o $(PKGROOT)/matrix.o $(PKGROOT)/dictionary.o $(PKGROOT)/loss.o $(PKGROOT)/productquantizer.o $(PKGROOT)/densematrix.o $(PKGROOT)/quantmatrix.o $(PKGROOT)/vector.o $(PKGROOT)/model.o $(PKGROOT)/utils.o $(PKGROOT)/meter.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-unneeded -K R_registerRoutines -K R_useDynamicSymbols $(SHLIB); fi

# .phony: strippedLib
