## 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, and R's default CXXFLAGS
# include -g; strip debugging symbols after linking so the installed size
# reflects actual code rather than debug info (R CMD INSTALL only strips
# when --strip is passed explicitly, which R CMD check does not do).
# Use --strip-debug rather than $(STRIP_SHARED_LIB) (--strip-unneeded):
# the latter also removes .symtab, which makes R CMD check's compiled-code
# check ("nm ... biglasso.so: no symbols") unable to see that init.c calls
# R_registerRoutines/R_useDynamicSymbols.
.PHONY: strippedLib
strippedLib: $(SHLIB)
	if test -e "$(SHLIB)"; then strip --strip-debug $(SHLIB); fi

all: $(SHLIB) strippedLib
