RBIN="${R_HOME}/bin/R"
RSCRIPT="${R_HOME}/bin/Rscript"

SWI_HOME := $(shell "${RSCRIPT}" -e "source('../R/plbase.R'); .cat.swipl64()")
PKG_CPPFLAGS := -I"$(SWI_HOME)/include" -D_REENTRANT -D__SWI_PROLOG__ -DRPACKAGE

SWI_LIBS := $(shell "${RSCRIPT}" -e "source('../R/plbase.R'); .cat.swilibs()")
PKG_LIBS = $(SWI_LIBS)

ifeq ($(strip $(SWI_HOME)),)
  $(error Please install R package rswipl or SWI-Prolog from https://swi-prolog.org...)
else
  $(info Found SWI-Prolog at $(SWI_HOME))
endif

$(SHLIB): rolog.o RcppExports.o

clean:
	-rm -f rolog.o rolog.so RcppExports.o
