From: j8takagi <j8takagi@nifty.com> Date: Mon, 28 Jan 2013 00:07:54 +0000 (+0900) Subject: Makefile群 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=addbf3540829f63cb3f30537fdb197f160e7b2de;p=makefiles.git Makefile群 --- addbf3540829f63cb3f30537fdb197f160e7b2de diff --git a/R_mk/Makefile b/R_mk/Makefile new file mode 100644 index 0000000..fcec929 --- /dev/null +++ b/R_mk/Makefile @@ -0,0 +1,19 @@ +# ãã¡ã¤ã«ããä½æãããã°ã©ãã£ãã¯ãã¡ã¤ã«ã +# ã¿ã¼ã²ãããã¡ã¤ã«ã¨ãã¦æå® +# +# make ããã³ make all ã§ã®ã¿ã¼ã²ãããã¡ã¤ã«ã«ãªãã»ãã +# R-distcleanã§ã®åé¤å¯¾è±¡ã«ãªãã +# +# åæè¨å®ã§ã¯ããã£ã¬ã¯ããªã«ãããã¹ã¦ã® +# Rãã¡ã¤ã«ã«å¯¾ããpdfãã¡ã¤ã« +TARGETS := $(subst .R,.pdf,$(wildcard *.R)) + +.PHONY: all clean distclean + +all: $(TARGETS) + +include R.mk + +clean: R-clean + +distclean: R-distclean diff --git a/R_mk/R.mk b/R_mk/R.mk new file mode 100644 index 0000000..5f19e7b --- /dev/null +++ b/R_mk/R.mk @@ -0,0 +1,55 @@ +.PHONY: R-clean R-distclean + +CAT = cat +ECHO = echo +EPSTOPDF = epstopdf +R = R + +RFLAG = --slave --vanilla + +# used by R postscript device. +# For details, type '?postscriptFonts' in R. +psfamily ?= Japan1 + +%.eps.R: %.R + @$(ECHO) 'postscript(file="$(subst .R,.eps,$<)",family="$(psfamily)", onefile=F, horizontal=F)' >$@ + @$(CAT) $< >>$@ + @$(ECHO) 'invisible(dev.off())' >>$@ + +%.eps: %.eps.R + $(R) $(RFLAG) <$< + +%.pdf: %.eps + $(EPSTOPDF) $< + +%.png.R: %.R + @$(ECHO) 'png("$(subst .R,.png,$<)")' >$@ + @$(CAT) $< >>$@ + @$(ECHO) 'invisible(dev.off())' >>$@ + +%.jpeg.R: %.R + @$(ECHO) 'jpeg("$(subst .R,.jpeg,$<)")' >$@ + @$(CAT) $< >>$@ + @$(ECHO) 'invisible(dev.off())' >>$@ + +# install.packages("RSVGTipsDevice") +%.svg.R: %.R + @$(ECHO) 'library("RSVGTipsDevice")' >$@ + @$(ECHO) 'devSVGTips("$(subst .R,.svg,$<)")' >>$@ + @$(CAT) $< >>$@ + @$(ECHO) 'invisible(dev.off())' >>$@ + +%.png: %.png.R + $(R) $(RFLAG) <$< + +%.jpeg: %.jpeg.R + $(R) $(RFLAG) <$< + +%.svg: %.svg.R + $(R) $(RFLAG) <$< + +R-clean: + $(RM) *.pdf.R *.png.R *.jpeg.R *.svg.R *.eps.R + +R-distclean: R-clean + $(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)) diff --git a/eukleides_mk/eukleides.mk b/eukleides_mk/eukleides.mk new file mode 100644 index 0000000..f5781b5 --- /dev/null +++ b/eukleides_mk/eukleides.mk @@ -0,0 +1,22 @@ +EUKLEIDES = eukleides +EPSTOPDF = epstopdf +# ImageMagick +CONVERT = convert + +%.eps: %.euk + $(EUKLEIDES) $< + +%.pdf: %.eps + $(EPSTOPDF) $< + +%.png: %.eps + $(CONVERT) $< $@ + +%.jpeg: %.eps + $(CONVERT) $< $@ + +eukleides-clean: + $(RM) $(subst .euk,.png,*.eps) + +eukleides-distclean: + $(RM) $(subst .euk,.pdf,*.euk) $(subst .euk,.png,*.euk) $(subst .euk,.jpeg,*.euk) diff --git a/latex_mk/Makefile b/latex_mk/Makefile new file mode 100644 index 0000000..64fde09 --- /dev/null +++ b/latex_mk/Makefile @@ -0,0 +1,20 @@ +# texãã¡ã¤ã«ããä½æãããpdfã¾ãã¯dviãã¡ã¤ã«ã +# ã¿ã¼ã²ãããã¡ã¤ã«ã¨ãã¦æå® +# +# make ããã³ make all ã§ã®ã¿ã¼ã²ãããã¡ã¤ã«ã«ãªãã»ãã +# latex.mkã§ãã¿ã¼ã²ãããã¡ã¤ã«ã«å¯¾å¿ããä¾åé¢ä¿ã +# èªåçã«ä½æããã¦dãã¡ã¤ã«ã«æ ¼ç´ãããã +# ã¾ããtex-distcleanã®åé¤å¯¾è±¡ã«ãªãã +# +# åæè¨å®ã§ã¯ããã£ã¬ã¯ããªã«ãããã¹ã¦ã®texãã¡ã¤ã« +TARGETS := $(subst .tex,.pdf,$(wildcard *.tex)) + +.PHONY: all clean distclean + +all: $(TARGETS) + +include latex.mk + +clean: tex-clean + +distclean: tex-distclean diff --git a/latex_mk/latex.mk b/latex_mk/latex.mk new file mode 100644 index 0000000..ead3a7a --- /dev/null +++ b/latex_mk/latex.mk @@ -0,0 +1,129 @@ +.PHONY: clean-tex distclean-tex + +# ã·ã§ã«ã³ãã³ã +ECHO := echo +GREP := grep +SED := sed + +# LaTeXã³ãã³ã +BIBTEX := pbibtex +DVIPDFMX := dvipdfmx +EXTRACTBB := extractbb +LATEX := platex +MENDEX := mendex + +#LaTeXãªãã·ã§ã³ +BIBTEXFLAG ?= +DVIPDFMXFLAG ?= +EXTRACTBBFLAGS ?= +LATEXFLAG ?= +MENDEXFLAG ?= + +# LaTeXã§å¦ç +COMPILE.tex = $(LATEX) -interaction=batchmode $(LATEXFLAG) $(addsuffix .tex,$(basename $<)) + +# logãã¡ã¤ã«ã«æªå®ç¾©åç §ã®è¦åããããç¢ºèª +REFWARN := 'LaTeX Warning: There were undefined references.' + +# \includeã³ãã³ãã§èªã¿è¾¼ã¾ããtexãã¡ã¤ã« +intex = $(addsuffix .tex,$(basename $(strip $(shell \ + $(SED) -n -e 's/\\\(include\|input\)\(\[[^]]*\]\)\{0,1\}{[^}]*}/&\n/gp' $< | \ + $(SED) -e 's/.*{\([^}]*\)}.*/\1/')))) + +# \includegraphicsã³ãã³ãã§èªã¿è¾¼ã¾ããã°ã©ãã£ãã¯ãã¡ã¤ã« +ingraphics = $(strip $(shell \ + $(SED) -n -e 's/\\includegraphics\(\[[^]]*\]\)\{0,1\}\({[^}]*}\)/&\n/gp' $< $(intex) | \ + $(SED) -e 's/.*{\([^}]*\)}.*/\1/')) + +# \bibliographyã³ãã³ãã§èªã¿è¾¼ã¾ããæç®ãã¼ã¿ãã¼ã¹ãã¡ã¤ã« +bibdb = $(addsuffix .bib,$(basename $(strip $(shell \ + $(SED) -n -e 's/\\bibliography\(\[[^]]*\]\)\{0,1\}{\([^}]*\)}/&\n/gp' $< $(intex) | \ + $(SED) -e 's/.*{\([^}]*\)}.*/\1/' | \ + $(SED) -e 's/,/ /g')))) + +# texãã¡ã¤ã«ã«ç´¢å¼ä½æã®æå®ããããç¢ºèª +MAKEINDEX := '\makeindex' +GREP-makeindex = $(GREP) -F $(MAKEINDEX) $< + +# ä¾åé¢ä¿ãèªåçæããdãã¡ã¤ã«ã«æ ¼ç´ +%.d: %.tex + @$(ECHO) '$@ is created by scanning $^.' + # texãã¡ã¤ã«ã®ä¾åé¢ä¿ + @($(ECHO) '$(subst .tex,.dvi,$<) $(subst .tex,.aux,$<) $(subst .tex,.d,$<): $<' >$@) + # texãã¡ã¤ã«ã®ä¾åé¢ä¿ + $(if $(intex),@( \ + $(ECHO); \ + $(ECHO) '# Include/Input Files - tex'; \ + $(ECHO) '$(subst .tex,.dvi,$<) $(subst .tex,.aux,$<): $(intex)') >>$@) + # ç»åãã¡ã¤ã«ã®ä¾åé¢ä¿ + $(if $(ingraphics),@( \ + $(ECHO); \ + $(ECHO) '# IncludeGraphic Files - pdf, jpeg/jpg, png & xbb'; \ + $(ECHO) '$(subst .tex,.dvi,$<) $(subst .tex,.aux,$<): $(ingraphics)'; \ + $(ECHO); \ + $(ECHO) '$(subst .tex,.dvi,$<) $(subst .tex,.aux,$<): $(addsuffix .xbb,$(basename $(ingraphics)))') >>$@) + # æç®å¦çç¨ãã¡ã¤ã«ã®ä¾åé¢ä¿ + $(if $(bibdb),@( \ + $(ECHO); \ + $(ECHO) '# Bibliography Files - bbl & bib'; \ + $(ECHO) '$(subst .tex,.dvi,$<): $(subst .tex,.bbl,$<)'; \ + $(ECHO); \ + $(ECHO) '$(subst .tex,.bbl,$<): $(bibdb)') >>$@) + # ç´¢å¼ä½æç¨ãã¡ã¤ã«ã®ä¾åé¢ä¿ + $(if $(strip $(shell $(GREP-makeindex))),@( \ + $(ECHO); \ + $(ECHO) '# MakeIndex Files - ind'; \ + $(ECHO) '$(subst .tex,.dvi,$<): $(subst .tex,.ind,$<)') >>$@) + +# å¤æ°TARGETSã§æå®ãããã¿ã¼ã²ãããã¡ã¤ã«ã«å¯¾å¿ããdãã¡ã¤ã«ãã¤ã³ã¯ã«ã¼ã +ifdef TARGETS + -include $(addsuffix .d,$(basename $(TARGETS))) +endif + +# ç¸äºåç §ãã¡ã¤ã«ä½æãdviãã¡ã¤ã«ãåæã«ä½æããã +%.aux: %.tex + $(COMPILE.tex) + +# dviãã¡ã¤ã«ä½æ +%.dvi: %.aux + # logãã¡ã¤ã«ã«æªå®ç¾©åç §ã®è¦åãããå ´åãLaTeXã§å¦ç + while $(GREP) -F $(REFWARN) $(addsuffix .log,$(basename $<)); do $(COMPILE.tex); done + +# æç®å¦çç¨ãã¡ã¤ã«ä½æ +# BiBTeXã§æç®å¦çããã¨ãã«ä½¿ç¨ããã +%.bbl: %.aux + $(BIBTEX) $(BIBTEXFLAG) $(addsuffix .aux,$(basename $<)) + +# ãã¦ã³ãã£ã³ã°æ å ±ãã¡ã¤ã«ä½æ +# dvipdfmxã§å³ãæ¿å ¥ããã¨ãã«ä½¿ç¨ããã +# pdfãjpeg/jpgãpngãã¡ã¤ã«ã«å¯¾å¿ +%.xbb: %.pdf + $(EXTRACTBB) $(EXTRACTBBFLAGS) $< + +%.xbb: %.jpeg + $(EXTRACTBB) $(EXTRACTBBFLAGS) $< + +%.xbb: %.jpg + $(EXTRACTBB) $(EXTRACTBBFLAGS) $< + +%.xbb: %.png + $(EXTRACTBB) $(EXTRACTBBFLAGS) $< + +# ç´¢å¼ãã¡ã¤ã«ä½æ +# ç´¢å¼ãä½æããã¨ãã«ä½¿ç¨ããã +%.idx: %.aux + +%.ind: %.idx + $(MENDEX) $(MENDEXFLAG) $< + +# PDFãã¡ã¤ã«ä½æ +%.pdf: %.dvi + $(DVIPDFMX) $(DVIPDFMXFLAG) $< + +# tex-cleanã¿ã¼ã²ãã +tex-clean: + $(RM) *.aux *.bbl *.blg *.d *.idx *.ilg *.ind *.lof *.log *.lot *.out *.toc *.xbb + +# tex-distcleanã¿ã¼ã²ãã +tex-distclean: tex-clean + $(RM) $(addsuffix .dvi,$(basename $(TARGETS))) $(addsuffix .pdf,$(basename $(TARGETS))) diff --git a/texinfo_mk/Makefile b/texinfo_mk/Makefile new file mode 100644 index 0000000..9b1a76a --- /dev/null +++ b/texinfo_mk/Makefile @@ -0,0 +1,20 @@ +# # ã¿ã¼ã²ãããæå® +# TARGET := +# # HTMLãã¡ã¤ã«ã§ä½¿ãCSSãã¡ã¤ã«ãæå® +# CSS := + +# # infoã®ã¤ã³ã¹ãã¼ã«å ãæå® +# prefix := +# infodir := + +.PHONY: all distclean clean + +all: $(TARGET) + +distclean: texinfo-distclean + +clean: texinfo-clean + +include texinfo.mk + +include install-info.mk diff --git a/texinfo_mk/install-info.mk b/texinfo_mk/install-info.mk new file mode 100644 index 0000000..1869919 --- /dev/null +++ b/texinfo_mk/install-info.mk @@ -0,0 +1,18 @@ +prefix ?= ~ +infodir ?= $(prefix)/share/info + +GZIP := gzip +INSTALL := install +INSTALL-INFO := install-info + +.PHONY: install-info uninstall-info + +install-info: yacasl2.info + $(INSTALL) -d $(infodir) + $(INSTALL) $< $(infodir)/ + $(INSTALL-INFO) $(infodir)/$(notdir $<) $(infodir)/dir + $(GZIP) -f $(infodir)/$(notdir $<) + +uninstall-info: + $(INSTALL-INFO) --delete $(addprefix $(infodir)/,$(notdir $(TARGET))) $(infodir)/dir + $(RM) $(addprefix $(infodir)/,$(notdir $(TARGET))) diff --git a/texinfo_mk/texinfo.mk b/texinfo_mk/texinfo.mk new file mode 100644 index 0000000..d709e5c --- /dev/null +++ b/texinfo_mk/texinfo.mk @@ -0,0 +1,41 @@ +.PHONY: texinfo-distclean texinfo-clean texinfo-textmp-clean + +CP := cp +DVIPDFMX := dvipdfmx +INSTALL-INFO := install-info +MKDIR := mkdir +RMR := rm -rf +TEX := ptex +TEXI2DVI := TEX=$(TEX) texi2dvi + +DVIPDFMX_FLAGS ?= +MAKEINFO_FLAGS ?= +TEXI2DVI_FLAGS ?= -q --texinfo=@afourpaper + +%.info: %.texi + $(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $< + +%.html: %.texi $(CSS) + $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $< + +%_html: %.texi $(CSS) + if test ! -e $@; then $(MKDIR) $@; fi + $(CP) $(CSS) $@/ + $(MAKEINFO) -o $@ --html --css-ref=$(CSS) $< + +%.pdf: %.dvi + $(DVIPDFMX) $(DVIPDFMXFLAGS) $< + +%.txt: %.texi + $(MAKEINFO) --no-headers --disable-encoding -o $@ $< + +%.xml: %.texi + @$(MAKEINFO) --docbook -o $@ $< + +texinfo-distclean: texinfo-clean + @$(RMR) *_html *.info *.html *.pdf *.dvi *.txt + +texinfo-clean: texinfo-textmp-clean + +texinfo-textmp-clean: + @$(RM) *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.tmp *.toc *.tp *.vr