## This file uses GNU make syntax $(shell ...) so we need to
## have "SystemRequirements: GNU make" in the DESCRIPTION file.
## See Rhtslib's vignette for details.
## taken and adapted from deepSNV

RHTSLIB_LIBS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript" -e \
    'Rhtslib::pkgconfig("PKG_LIBS")')
RHTSLIB_CPPFLAGS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript" -e \
    'Rhtslib::pkgconfig("PKG_CPPFLAGS")')

PKG_LIBS=$(RHTSLIB_LIBS)
PKG_CPPFLAGS=$(RHTSLIB_CPPFLAGS)

## fix for compilationg of external SCITE package courtesy of Mike Smith
USER_LIB_DIR=${R_PACKAGE_DIR}/SCITE/


all: copying $(SHLIB)

copying: scite
	mkdir -p "${USER_LIB_DIR}"
	cp scite "${USER_LIB_DIR}"
	rm scite

scite:
	$(CXX) $(PKG_CPPFLAGS) ../inst/SCITEpkg/*.cpp -o scite
