CXX_STD = CXX11
PKG_CXXFLAGS += -DRCPP_USE_UNWIND_PROTECT

# Needed due to RcppArmadillo
PKG_LIBS += $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
# Needed due to RcppParallel
PKG_LIBS += $(shell ${R_HOME}/bin/Rscript -e "RcppParallel::RcppParallelLibs()")

# Get source files (see https://stackoverflow.com/a/27794283/5793905 but note the quotes)
CPP_SOURCES = $(shell find . -type f -name '*.cpp')

# Change extension (see https://www.gnu.org/software/make/manual/make.html#Text-Functions)
OBJECTS = $(CPP_SOURCES:.cpp=.o)
