#-*- Makefile -*-
#
# ${R_HOME}/src/library/stats/src/Makefile.win

pkg = stats

srcdir = .
top_srcdir = ../../../..

top_builddir = ../../../..
subdir = src/library/$(pkg)/src
R_HOME = $(top_builddir)

SOURCES_C = init.c kmeans.c \
  ansari.c bandwidths.c chisqsim.c d2x2xk.c fexact.c kendall.c ks.c \
  line.c smooth.c \
  prho.c swilk.c \
  ksmooth.c loessc.c monoSpl.c isoreg.c Srunmed.c \
  dblcen.c distance.c hclust-utils.c \
  nls.c rWishart.c \
  HoltWinters.c PPsum.c arima.c burg.c filter.c \
  mAR.c pacf.c starma.c port.c family.c sbart.c \
  approx.c loglin.c lowess.c massdist.c splines.c lm.c \
  complete_cases.c cov.c deriv.c fft.c fourier.c model.c optim.c optimize.c \
  integrate.c random.c distn.c zeroin.c rcont.c influence.c

SOURCES_F = bsplvd.f bvalue.f bvalus.f loessf.f ppr.f qsbart.f \
  sgram.f sinerp.f sslvrg.f stxwx.f \
  hclust.f kmns.f \
  eureka.f stl.f portsrc.f lminfl.f

DEPENDS = $(SOURCES_C:.c=.d)
OBJECTS = $(SOURCES_C:.c=.o) $(SOURCES_F:.f=.o) ../../../gnuwin32/dllversion.o

SHLIB = $(pkg).dll
RESFLAGS = -I $(R_HOME)/include

# OpenMP is too slow to be useful.
PKG_CPPFLAGS = -DHAVE_CONFIG_H -I$(R_HOME)/src/include
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

all: makeMakedeps shlib

shlib: $(SHLIB)
	@mkdir -p $(top_builddir)/library/$(pkg)/libs$(R_ARCH)
	@cp $(SHLIB) $(top_builddir)/library/$(pkg)/libs$(R_ARCH)

include $(R_HOME)/etc${R_ARCH}/Makeconf
include $(top_srcdir)/share/make/winshlib.mk


## Meeded with i386 gcc 4.5.0 -- PR#14427
portsrc_FFLAGS=$(SAFE_FFLAGS)
portsrc.o: portsrc.f
	$(F77) $(portsrc_FFLAGS) -c $< -o $@


mostlyclean distclean: clean
clean:
	@-rm -f Makedeps *.d *.o $(SHLIB)

makeMakedeps: $(DEPENDS)
	@$(RM) Makedeps
	-@cat $(DEPENDS) > Makedeps


-include Makedeps
