# Register where the header files for the package can be found
PKG_CXXFLAGS=-I../inst/include/

PKG_CXXFLAGS += @PKG_CFLAGS@ @openmp_cflags@ @zlib_cflags@
PKG_LIBS = @PKG_LIBS@ @openmp_cflags@ @zlib_libs@
# See WRE $1.2.1.1. But retain user supplied PKG_* too, #4664.
# WRE states ($1.6) that += isn't portable and that we aren't allowed to use it.
# Otherwise we could use the much simpler PKG_LIBS += @openmp_cflags@ -lz.
# Can't do PKG_LIBS = $(PKG_LIBS)...  either because that's a 'recursive variable reference' error in make
# Hence the onerous @...@ substitution. Is it still appropriate in 2020 that we can't use +=?
# Note that -lz is now escaped via @zlib_libs@ when zlib is not installed


## With Rcpp 0.11.0 and later, we no longer need to set PKG_LIBS as there is
## no user-facing library. The include path to headers is already set by R.
#PKG_LIBS = 

# ..# # RcppParallel
# ..# PKG_LIBS = $(shell ${R_HOME}/bin/Rscript -e "RcppParallel::RcppParallelLibs()")

# OpenMP
PKG_CXXFLAGS += $(SHLIB_OPENMP_CXXFLAGS) -g2 # -O2 -Wall
PKG_LIBS += $(SHLIB_OPENMP_CXXFLAGS)

# Blas i Lapack
PKG_LIBS += $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) 

# RHDF5
RHDF5_LIBS = $(shell echo 'Rhdf5lib::pkgconfig("PKG_CXX_LIBS")'|\
    "${R_HOME}/bin/R" --vanilla --slave)  
PKG_LIBS += $(RHDF5_LIBS)

## With R 3.1.0 or later, you can uncomment the following line to tell R to 
## enable compilation with C++11 (or even C++14) where available

#..# CCACHE=ccache
#..# CXX = $(CCACHE) $(CXX17)
CXX_STD = CXX17

# Disable Boost concept-checking to silence warnings from BH headers (no effect on code logic)
PKG_CXXFLAGS += -DBOOST_NO_CONCEPT_CHECKING
PKG_CXXFLAGS += -DSTRICT_R_HEADERS

# Optional: safe compiler-specific additions (commented by default)
# PKG_CXXFLAGS += -g3 -O3 -std=c++17 -Wall
