## Use the R_HOME indirection to support installations of multiple R version
## NOTE: the definition of these variables will vary by OS. Customize this page accordingly. 

#PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
#PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
#PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)

#PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
#PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)

# CXX11FLAGS=-O0 -g # Uncomment this FOR DEBUGGING ONLY
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
#-lprofiler

# RcppArmadillo/BH pull in a lot of template code; strip debugging symbols
# after linking so the installed size reflects actual code rather than
# debug info (R CMD INSTALL only strips when -S is passed explicitly, which
# R CMD check does not do). Use -S (short for --strip-debug) rather than
# $(STRIP_SHARED_LIB) (--strip-unneeded): the latter also removes .symtab,
# which makes R CMD check's compiled-code check unable to see that init.c
# calls R_registerRoutines/R_useDynamicSymbols. Use -S instead of the long
# option --strip-debug because Apple's strip only understands single-letter
# flags and errors otherwise.
.PHONY: strippedLib
strippedLib: $(SHLIB)
	if test -e "$(SHLIB)"; then strip -S $(SHLIB); fi

all: $(SHLIB) strippedLib
