all:  $(DLLNAME).dll

SOURCES=$(wildcard -f *.c *.f)
OBJSA=$(foreach i,$(SOURCES),$(basename $i).o)

include ../../../gnuwin32/MkRules

ifdef DEBUG
  DLLFLAGS=
  DEBUGFLAG=-g
else
  DLLFLAGS=-s
  DEBUGFLAG=
endif

CFLAGS=-I../../../include -include ../../../include/globalvar.h $(DEBUGFLAG) -O2
FFLAGS=-O2
DLLLIBS=-L../../../gnuwin32  $(FLIBS) -lR 


#ifeq ($(PKG),gee)
# OBJS-NO = gee.sa.o gee_i.o
#endif 


#ifeq ($(PKG),WaveThresh)
# OBJS-NO = Sconvolve.o
#endif 


#ifeq ($(PKG),akima)
# OBJS-NO = ttidbs.o
#endif 

ifeq ($(PKG),locfit)
  CFLAGS+=-Dlgamma=lgammafn
endif 

ifeq ($(PKG),survival4)
  survreg-CFLAGS=-include ../../../include/Platform.h
endif

ifeq ($(PKG),rmutil)
  iv-CFLAGS+=-Dgamma=gammafn -Dlgam=lgammafn
  dist-CFLAGS+=-include ../../../include/Platform.h
endif

ifeq ($(PKG),event)
  ksurvb-CFLAGS+=-include ../../../include/Platform.h
  ksurvg-CFLAGS+=-include ../../../include/Platform.h
endif

ifeq ($(PKG),gnlm)
  dist-CFLAGS+=-include ../../../include/Platform.h
endif
ifeq ($(PKG),repeated)
  kcountb-CFLAGS+=-include ../../../include/Platform.h
endif


ifeq ($(PKG),stable)
  CFLAGS+=-include ../../../include/Platform.h
endif


AA=$(wildcard Makefile)
ifeq ($(AA),Makefile)
 include Makefile
else
 OBJS=$(filter-out $(OBJS-NO),$(OBJSA))
endif

$(DLLNAME).a: $(OBJS) #
	$(RM) -f $@
	$(AR) cr $@ *.o
	$(RANLIB) $@

$(DLLNAME).dll : $(DLLNAME).a
