#-----------------------------------------------------------------------
#
# Purpose:  Makevar for the R packages using stk++
# Author:   Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org
#-----------------------------------------------------------------------
#
PKGNAME = HDPenReg

PKGDIR    = ./$(PKGNAME)
PKGLIBDIR = $(PKGDIR)/lib
PKGLIB    = $(PKGLIBDIR)/lib$(PKGNAME).a

## Use the R_HOME indirection to support installations of multiple R version
PKG_CXXFLAGS = -DSTKBASEARRAYS=1 `${R_HOME}/bin/Rscript -e "Rcpp:::CxxFlags()"` `${R_HOME}/bin/Rscript -e "rtkpp:::CxxFlags()"`
PKG_CPPFLAGS = -DSTKBASEARRAYS=1 `${R_HOME}/bin/Rscript -e "Rcpp:::CxxFlags()"` `${R_HOME}/bin/Rscript -e "rtkpp:::CxxFlags()"`  $(SHLIB_OPENMP_CXXFLAGS)

PKG_LIBS = $(PKGLIB)  `$(R_HOME)/bin/Rscript -e "rtkpp:::LdFlags()"`  $(SHLIB_OPENMP_CFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)


export

.PHONY: all pkglib

## $(SHLIB) is the usual default target that is built automatically from all source
## files in this directory. pkglib is an additional target for the libraries
## that will be installed in $(STKPPDIR) and $(PKGLIB) and which users can link against.


all: $(SHLIB)
$(SHLIB): pkglib

pkglib:
	(cd $(PKGDIR) && $(MAKE)  all)
	(cd $(PKGDIR) && $(MAKE) clean)
