1 .PHONY: R-clean R-distclean
9 RFLAG = --slave --vanilla
11 # read.table文で読み込まれるファイル
12 tablefiles = $(strip $(shell $(SED) -n -e 's/.*read\.table."\(.*\)".*;/\1/gp' $<))
15 sourcefiles = $(strip $(shell $(SED) -n -e 's/.*source."\(.*\)".*;/\1/gp' $<))
17 # used by R postscript device.
18 # For details, type '?postscriptFonts' in R.
23 @$(ECHO) '$@ is created by scanning $^.'
25 @($(ECHO) '$(subst .R,.eps,$<) $(subst .R,.png,$<) $(subst .R,.jpeg,$<): $<' >$@)
27 $(if $(tablefiles),@( \
29 $(ECHO) '# Table Files'; \
30 $(ECHO) '$(subst .R,.eps,$<) $(subst .R,.png,$<) $(subst .R,.jpeg,$<): $(tablefiles)') >>$@)
32 $(if $(sourcefiles),@( \
34 $(ECHO) '# Source Files'; \
35 $(ECHO) '$(subst .R,.eps,$<) $(subst .R,.png,$<) $(subst .R,.jpeg,$<): $(sourcefiles)') >>$@)
37 # ターゲットがclean で終わるもの以外の場合、
38 # RTARGETSで指定されたファイルに対応するdファイルをインクルードし、
40 ifeq (,$(filter %clean %d,$(MAKECMDGOALS))))
41 -include $(addsuffix .d,$(basename $(RTARGETS)))
45 @$(ECHO) 'postscript(file="$(subst .R,.eps,$<)",family="$(psfamily)", onefile=F, horizontal=F)' >$@
47 @$(ECHO) 'invisible(dev.off())' >>$@
56 @$(ECHO) 'pdf("$(subst .R,.pdf,$<)", family="Japan1")' >$@
58 @$(ECHO) 'invisible(dev.off())' >>$@
61 @$(ECHO) 'png("$(subst .R,.png,$<)")' >$@
63 @$(ECHO) 'invisible(dev.off())' >>$@
66 @$(ECHO) 'jpeg("$(subst .R,.jpeg,$<)")' >$@
68 @$(ECHO) 'invisible(dev.off())' >>$@
70 # install.packages("RSvgDevice")
72 @$(ECHO) 'library("RSvgDevice")' >$@
73 @$(ECHO) 'devSVG("$(subst .R,.svg,$<)")' >>$@
75 @$(ECHO) 'invisible(dev.off())' >>$@
90 $(RM) *.pdf.R *.png.R *.jpeg.R *.svg.R *.eps.R *.d
93 $(RM) $(subst .R,.pdf,$(wildcard *.R)) $(subst .R,.png,$(wildcard *.R)) $(subst .R,.jpeg,$(wildcard *.R)) $(subst .R,.svg,$(wildcard *.R)) $(subst .R,.eps,$(wildcard *.R))