# -*- mode: Makefile -*-
#
# Copyright 2005 - 2006  Dominick Samperi
# Copyright 2005         Uwe Ligges
# Copyright 2008 - 2018  Dirk Eddelbuettel
# Copyright 2011         Uwe Ligges, Brian Ripley, and Josh Ulrich
# Copyright 2018 - 2024  Jeroen Ooms

PKG_CPPFLAGS = $(shell pkg-config --cflags quantlib 2>/dev/null)
PKG_LIBS = $(shell pkg-config --libs quantlib 2>/dev/null)

ifeq ($(PKG_LIBS),)
  RWINLIB = ../windows/quantlib
  PKG_CPPFLAGS = -I$(RWINLIB)/include
  PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib -lQuantLib
endif

PKG_CPPFLAGS += -I../inst/include
PKG_CXXFLAGS = -DBOOST_NO_AUTO_PTR

all: clean winlibs

clean:
	rm -f $(SHLIB) $(OBJECTS)

winlibs:
ifneq ($(RWINLIB),)
	"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
endif

