## Note that this file uses GNU Make syntax (:=, $(shell), and ifeq/endif) so
## we need to have "SystemRequirements: GNU make" in the DESCRIPTION file.
## See "Writing portable packages" in the "Writing R Extensions" manual:
##   https://cran.r-project.org/doc/manuals/r-release/R-exts.html

include Makevars.common

KENT_MAKEFILE=Makefile.Rtwobitlib

## Linker options. Make sure the Rtwobitlib::pkgconfig() function (defined
## in R/zzz.R) produces the same PKG_LIBS value.
## We will need -lcrypto only if we decide to support the
## twoBitOpenExternalBptIndex functionality. See README.txt
## in Rtwobitlib/inst/unused_but_kept_just_in_case/
#PKG_LIBS+=-lcrypto

platform := $(shell uname -s)

ifeq (${platform},Darwin)

populate-usrlib-dir : kent mk-usrlib-dir
	cd "${KENT_SOURCE_DIR}" && cp libtwobit.a "${USRLIB_DIR}"

else

populate-usrlib-dir : kent mk-usrlib-dir
	cd "${KENT_SOURCE_DIR}" && cp libtwobit.so libtwobit.a "${USRLIB_DIR}"
	cd "${USRLIB_DIR}" && ln -s libtwobit.so libtwobit.so.2

endif
