#-*- Makefile -*- RLIB=../../../library DPKG=$(RLIB)/$(PKG) SPKG=. ifeq ($(strip $(DLLNM)),) DLLNAME=$(PKG) else DLLNAME=$(DLLNM) endif #this can be overwriten by the caller SRC = src STAMP = YES #source directory SSPKG=$(SPKG)/$(SRC) LSOURCES=$(wildcard $(SSPKG)/*.c $(SSPKG)/*.f $(SSPKG)/*.cc \ $(SSPKG)/*.cpp $(SSPKG)/*.C) ifeq ($(strip $(LSOURCES)),) LOBJS= DYNLIB= else LOBJS=$(foreach i, $(LSOURCES), $(basename $i).o) DYNLIB=$(DPKG)/libs/$(DLLNAME).dll endif # data DSOURCES=$(filter-out $(SPKG)/data/CVS, $(wildcard $(SPKG)/data/*)) ifeq ($(strip $(DSOURCES)),) DATA= else DATA=$(DPKG)/data endif # R PKGRFILES0=$(wildcard $(SPKG)/R/*.[RSqrs]) RWIN32=$(wildcard $(SPKG)/R/windows/*.[Rr]) ifeq ($(strip RWIN32),) PKGRFILES=$(PKGRFILES0) else R1 = $(foreach i,$(RWIN32), $(addprefix $(SPKG)/R/, $(notdir $i))) PKGRFILES=$(filter-out $(R1), $(PKGRFILES0)) $(RWIN32) endif # Others OFILES0=$(wildcard $(SPKG)/*) OFILES1= DESCRIPTION INDEX TITLE OFILES-NO= R r chm data man src src-c Makefile.in inst check orig tests \ DESCRIPTION DESCRIPTION.in INDEX TITLE index title \ configure configure.in cleanup CVS cvs OFILES3=$(foreach i, $(OFILES1), $(SPKG)/$i) OFILES2=$(foreach i, $(OFILES-NO), $(SPKG)/$i) OFILES=$(filter-out $(OFILES2),$(OFILES0)) INSTFILES=$(wildcard $(SPKG)/inst/*) # src Makefile? SRCMAKE=$(wildcard $(SSPKG)/Makefile.win) all: bare $(DATA) $(DYNLIB) bare: $(DPKG)/zzzz $(DPKG)/R/$(PKG) include $(RHOME)/src/gnuwin32/MkRules clean: ifeq ($(strip $(SRCMAKE)),) $(RM) $(SSPKG)/$(DLLNAME).dll $(LOBJS) $(SSPKG)/$(DLLNAME).a $(SSPKG)/$(DLLNAME).def $(SSPKG)/$(DLLNAME)_res.* else $(MAKE) -C $(SSPKG) RHOME=$(RHOME) -f Makefile.win clean endif $(RM) -rf $(SPKG)/chm $(SPKG)/check SEDP='/^[ ]*$$/d;s/$(DLLNAME).so/$(DLLNAME).dll/' $(DPKG)/R/$(PKG): $(PKGRFILES) ifneq ($(strip $(PKGRFILES)),) @echo " installing R files" @$(MKDIR) -p $(DPKG)/R # $(CAT) $(PKGRFILES) | $(SED) $(SEDP) > $@ @$(CAT) $(PKGRFILES) > $@ else @$(ECHO) " no R files in this package" endif $(SPKG)/TITLE: if [ ! -f $(SPKG)/TITLE -a -f $(SPKG)/DESCRIPTION ] ; then \ perl $(RHOME)/share/perl/maketitle.pl $(SPKG)/DESCRIPTION > $@; \ fi # This fails if DESCRIPTION.. doesn't exist. # $(DPKG)/zzzz: $(OFILES3) $(OFILES) # On the other hand, ...zzzz is never created so $(DPKG)/zzzz: $(SPKG)/TITLE @$(ECHO) "---------- Making package $(PKG) ------------" $(MKDIR) -p $(DPKG) ifeq ($(strip $(INSTFILES)),) -$(CP) -r $(OFILES3) $(OFILES) $(DPKG)/ else -$(CP) -r $(OFILES3) inst/* $(DPKG)/ endif ifeq ($(strip $(STAMP)),YES) @echo " adding build stamp to DESCRIPTION" @echo "cat('Built: R ', R.version[['major']], '.', R.version[['minor']], '; Win32; ', format(Sys.time()), sep='')" | $(RHOME)/bin/Rterm --slave >> ${DPKG}/DESCRIPTION endif $(DATA): $(DSOURCES) @echo " installing data files" @$(MKDIR) -p $(DATA) @$(CP) $^ $@ $(DYNLIB): $(SSPKG)/$(DLLNAME).dll $(MKDIR) -p $(DPKG)/libs $(CP) $^ $@ $(SSPKG)/$(DLLNAME).dll: FORCE @echo " making DLL" ifeq ($(strip $(SRCMAKE)),) @$(MAKE) -C $(SSPKG) RHOME=$(RHOME) \ -f $(RHOME)/src/gnuwin32/MakeDll DLLNAME=$(DLLNAME) else @$(MAKE) -C $(SSPKG) RHOME=$(RHOME) -f Makefile.win endif FORCE: