#-*- Makefile -*- all: makeMakedeps $(DLLNAME).dll .PHONY : all makeMakedeps # set this in Makevars.win to supply your own resource file RCNAME=${DLLNAME}_res # set this (e.g. in SHLIB) to suppress adding version info to the DLL RCOBJ=$(RCNAME).o # Don't use SOURCES as this get passed on for libR. CSOURCES=$(wildcard -f *.c) CXXSOURCES=$(wildcard -f *.cc *.cpp *.C) FSOURCES=$(wildcard -f *.f) FCSOURCES=$(wildcard -f *.f90 *.f95) MSOURCES=$(wildcard -f *.m) OBJSA=$(foreach i,$(CSOURCES) $(FSOURCES) $(CXXSOURCES) $(FCSOURCES) $(MSOURCES),$(basename $i).o) include $(RHOME)/src/gnuwin32/MkRules ifneq ($(strip $(FCSOURCES)),) # don't assume F95 can be cross-compiled in the same way DLL="$(F95)" else ifneq ($(strip $(CXXSOURCES)),) DLL_LDMAIN=g++ endif ifneq ($(strip $(FSOURCES)),) EXTRA_LIBS+=$(FLIBS) endif ifneq ($(strip $(MSOURCES)),) EXTRA_LIBS+=-lobjc endif endif ifdef DEBUG DLLFLAGS= DEBUGFLAG=$(G_FLAG) -Wall else DLLFLAGS=-s DEBUGFLAG=-Wall endif COPTFLAG=-O3 CXXOPTFLAG=-O2 FOPTFLAG=-O3 CPPFLAGS=$(PKG_CPPFLAGS) -I$(RHOME)/include $(CLINK_CPPFLAGS) CFLAGS=$(CPPFLAGS) $(DEBUGFLAG) $(COPTFLAG) $(C99FLAG) $(PKG_CFLAGS) CXXFLAGS=$(CPPFLAGS) $(DEBUGFLAG) $(CXXOPTFLAG) $(PKG_CXXFLAGS) FFLAGS=$(FOPTFLAG) $(DEBUGFLAG) $(PKG_FFLAGS) DLLLIBS=-L$(RHOME)/bin $(PKG_LIBS) $(PKG_LIBS2) $(EXTRA_LIBS) -lR RESFLAGS=-I $(RHOME)/include # for use by Makevars.win R_HOME=$(RHOME) AA=$(wildcard Makefile) ifeq ($(AA),Makefile) include Makefile else OBJS=$(filter-out $(OBJS-NO),$(OBJSA)) endif AA=$(wildcard Makevars.win) ifeq ($(AA),Makevars.win) include Makevars.win else -include Makevars endif $(DLLNAME)_res.rc: @PERL5LIB=$(RHOME)/share/perl perl $(RHOME)/src/gnuwin32/makeDllRes.pl $(DLLNAME) > $@ $(DLLNAME)_res.o: $(DLLNAME)_res.rc $(RHOME)/include/Rversion.h ifeq ($(wildcard $(DLLNAME)-win.def),$(DLLNAME)-win.def) $(DLLNAME).dll : $(DLLNAME)-win.def $(OBJS) $(RCOBJ) $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $^ $($*-DLLLIBS) $(DLLLIBS) else $(DLLNAME).dll : $(OBJS) $(RCOBJ) endif # Dependencies CXXSOURCES1=$(wildcard -f *.cc) CXXSOURCES2=$(wildcard -f *.cpp) CXXSOURCES3=$(wildcard -f *.C) DEPS=$(CSOURCES:.c=.d) $(CXXSOURCES1:.cc=.d) $(CXXSOURCES2:.cpp=.d) $(CXXSOURCES3:.C=.d) $(MSOURCES:.m=.d) makeMakedeps: $(DEPS) @$(RM) Makedeps ifneq ($(strip $(DEPS)),) @cat $(DEPS) >> Makedeps endif -include Makedeps