PKG_LIBS+=-lz
CXX_STD=CXX11
CXX1X=$(shell ${R_HOME}/bin${R_ARCH_BIN}/R CMD config CXX11)
PKG_LIBS+=$(shell $(R_HOME)/bin/Rscript.exe -e "Rcpp:::LdFlags()") 

ZLIB_CFLAGS+=$(shell echo 'zlibbioc::pkgconfig("PKG_CFLAGS")'|\
	"${R_HOME}/bin/R" --vanilla --slave)
PKG_LIBS+=$(shell echo 'zlibbioc::pkgconfig("PKG_LIBS_shared")' |\
	"${R_HOME}/bin/R" --vanilla --slave)
%.o: %.c
	$(CC) $(ZLIB_CFLAGS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
%.o: %.cpp
	$(CXX) $(ZLIB_CFLAGS) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@

ifeq ($(shell $(CXX1X) -fopenmp -E -xc++ - 2>&1 >/dev/null && echo 'true'), true)
  PKG_CXXFLAGS+=$(SHLIB_OPENMP_CXXFLAGS)
  PKG_LIBS+=$(SHLIB_OPENMP_CXXFLAGS)
endif
