#-*- Makefile -*-
include ../../gnuwin32/MkRules

all: ../../../$(BINDIR)/Rblas.dll

## Rblas.dll imports xerbla_ from R.dll
## OpenBLAS 0.3.29 includes [dz]gemmtr but ATLAS does not.
## So to use latter, copy [dz]gemmtr.f from ../../modules/lapack
## and add dgemmtr.o zgemmtr.o to the dependencies.
ifeq "$(USE_ATLAS)" "YES"
../../../$(BINDIR)/Rblas.dll: ../../gnuwin32/dllversion.o
	@$(ECHO) -------- Building $@ --------
	$(DLL) -s -shared $(DLLFLAGS) -o $@ $^ Rblas.def \
	   -L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" -lf77blas -latlas
else ifeq "$(USE_OPENBLAS)" "YES"
../../../$(BINDIR)/Rblas.dll: ../../gnuwin32/dllversion.o
	@$(ECHO) -------- Building $@ --------
	$(DLL) -s -shared $(DLLFLAGS) -o $@ $^ Rblas.def \
	    -L../../../$(IMPDIR) -lR  $(shell $(PKG_CONFIG) --libs openblas)
else
../../../$(BINDIR)/Rblas.dll: blas.o blas2.o cmplxblas.o cmplxblas2.o ../../gnuwin32/dllversion.o
	@$(ECHO) -------- Building $@ --------
	$(DLL) -s -shared $(DLLFLAGS) -o $@ $^ Rblas.def -L../../../$(IMPDIR) -lR $(FLIBS)
endif

distclean clean:
	@$(RM) ../../../$(BINDIR)/Rblas.dll *~ blas.o cmplxblas.o

