#-*- 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 #source directory SSPKG=$(SPKG)/$(SRC) LSOURCES=$(wildcard $(SSPKG)/*.c $(SSPKG)/*.f) 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))) R2 = $(R1) $(SPKG)/R/system.unix.R $(SPKG)/R/system.mac.R PKGRFILES=$(filter-out $(R2), $(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 \ DESCRIPTION DESCRIPTION.in INDEX TITLE index title OFILES3=$(foreach i, $(OFILES1), $(SPKG)/$i) OFILES2=$(foreach i, $(OFILES-NO), $(SPKG)/$i) OFILES=$(filter-out $(OFILES2),$(OFILES0)) INSTFILES=$(wildcard $(SPKG)/inst/*) all: $(DPKG)/zzzz $(DPKG)/R/$(PKG) $(DATA) $(DYNLIB) include $(RHOME)/src//gnuwin32/MkRules clean: $(RM) $(SSPKG)/$(DLLNAME).dll $(LOBJS) $(SSPKG)/$(DLLNAME).a $(SSPKG)/$(DLLNAME).def $(RM) -rf $(SPKG)/chm SEDP='/^[ ]*$$/d;s/$(DLLNAME).so/$(DLLNAME).dll/' $(DPKG)/R/$(PKG): $(PKGRFILES) ifneq ($(strip $(PKGRFILES)),) $(MKDIR) -p $(DPKG)/R $(CAT) $(PKGRFILES) | sed $(SEDP) > $@ else @$(ECHO) " no R files in this package" endif # This fails if DESCRIPTION.. doesn't exist. # $(DPKG)/zzzz: $(OFILES3) $(OFILES) # On the other hand, ...zzzz is never created so $(DPKG)/zzzz: @$(ECHO) "---------- Making package $(PKG) ------------" $(MKDIR) -p $(DPKG) ifeq ($(strip $(INSTFILES)),) -$(CP) -r $(OFILES3) $(OFILES) $(DPKG)/ else -$(CP) -r $(OFILES3) inst/* $(DPKG)/ endif $(DATA): $(DSOURCES) $(MKDIR) -p $(DATA) $(CP) $^ $@ $(DYNLIB): $(SSPKG)/$(DLLNAME).dll $(MKDIR) -p $(DPKG)/libs $(CP) $^ $@ $(SSPKG)/$(DLLNAME).dll: FORCE $(MAKE) -C $(SSPKG) RHOME=$(RHOME) \ -f $(RHOME)/src/gnuwin32/MakeDll DLLNAME=$(DLLNAME) FORCE: