From 62a4bd43f485a1d768a9cdfec57a95b9cc1b172f Mon Sep 17 00:00:00 2001 From: j8takagi Date: Sat, 14 Jun 2014 13:29:08 +0900 Subject: [PATCH] =?utf8?q?Texinfo=E3=81=AEMakefile=E7=BE=A4=E3=82=92?= =?utf8?q?=E3=80=81YACASL2=E3=81=AA=E3=81=A9=E3=81=A7=E4=BD=BF=E3=82=8F?= =?utf8?q?=E3=82=8C=E3=81=A6=E3=81=84=E3=82=8B=E6=9C=80=E6=96=B0=E7=89=88?= =?utf8?q?=E3=81=AB=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- texinfo_mk/install-info.mk | 6 ++--- texinfo_mk/texinfo.mk | 53 +++++++++++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/texinfo_mk/install-info.mk b/texinfo_mk/install-info.mk index 1869919..e74db9c 100644 --- a/texinfo_mk/install-info.mk +++ b/texinfo_mk/install-info.mk @@ -7,12 +7,12 @@ INSTALL-INFO := install-info .PHONY: install-info uninstall-info -install-info: yacasl2.info +install-info: $(INSTALL-INFO-TARGETS) $(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))) + $(INSTALL-INFO) --delete $(addprefix $(infodir)/,$(notdir $(INSTALL-INFO-TARGETS))) $(infodir)/dir + $(RM) $(addprefix $(infodir)/,$(notdir $(INSTALL-INFO-TARGETS))) diff --git a/texinfo_mk/texinfo.mk b/texinfo_mk/texinfo.mk index d709e5c..c75c261 100644 --- a/texinfo_mk/texinfo.mk +++ b/texinfo_mk/texinfo.mk @@ -2,27 +2,65 @@ CP := cp DVIPDFMX := dvipdfmx +DVIPDFMX_FLAGS ?= +ECHO := echo INSTALL-INFO := install-info +MAKEINFO_FLAGS ?= MKDIR := mkdir RMR := rm -rf +SED := sed TEX := ptex TEXI2DVI := TEX=$(TEX) texi2dvi - -DVIPDFMX_FLAGS ?= -MAKEINFO_FLAGS ?= TEXI2DVI_FLAGS ?= -q --texinfo=@afourpaper +MV := mv + +# \includeコマンドで読み込まれるファイル +intexi = $(strip $(shell $(SED) -n -e 's/@include \(.*\)/\1/pg' $<)) + +# \imageコマンドで読み込まれるファイル +imagetexi = $(strip $(shell $(SED) -n -e 's/.*@image{\([^,]*\)\(,[^,]*,[^,]*,[^,]*,\([^,}]*\)\)}.*/\1\3/p' $<)) + +# 依存関係を自動生成し、dファイルに格納 +%.d: %.texi + @$(ECHO) '$@ is created by scanning $<.' + # texiファイルと出力ファイルの依存関係 + @$(ECHO) '$(foreach ext,.html _html .pdf .xml .info .txt .d,$(subst .texi,$(ext),$<)): $<' >$@ + # includeファイルの依存関係 + $(if $(intexi),@( \ + $(ECHO) >>$@; \ + $(ECHO) '# Include Files' >>$@; \ + $(ECHO) '$(foreach ext,.html _html .info .pdf .xml .txt,$<),$(subst .texi,$(ext),$<): $(intexi)') >>$@) + # imageファイルの依存関係 + # Docbookは未定義 + $(if $(imagetexi),@( \ + $(ECHO) >>$@; \ + $(ECHO) '# Image Files: HTML, HTML split, Info' >>$@; \ + $(ECHO) '$(foreach ext,.html _html .info,$(subst .texi,$(ext),$<)): $(imagetexi)' >>$@)) + $(if $(imagetexi),@( \ + $(ECHO) >>$@; \ + $(ECHO) '# Imagefiles: DVI -> PDF' >>$@; \ + $(ECHO) '$(subst .texi,.pdf,$<): $(addsuffix .eps,$(basename $(imagetexi)))' >>$@)) + +# 変数TEXITARGETSで指定されたターゲットファイルに対応するdファイルをインクルード +# .dファイルからヘッダファイルの依存関係を取得する +# ターゲットに clean が含まれている場合は除く +ifeq (,$(filter %clean,$(MAKECMDGOALS))) + -include $(addsuffix .d,$(basename $(TEXITARGETS))) +endif %.info: %.texi $(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $< -%.html: %.texi $(CSS) +%.html: %.texi $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $< -%_html: %.texi $(CSS) +%_html: %.texi if test ! -e $@; then $(MKDIR) $@; fi $(CP) $(CSS) $@/ $(MAKEINFO) -o $@ --html --css-ref=$(CSS) $< +%.html %_html: $(CSS) + %.pdf: %.dvi $(DVIPDFMX) $(DVIPDFMXFLAGS) $< @@ -33,9 +71,10 @@ TEXI2DVI_FLAGS ?= -q --texinfo=@afourpaper @$(MAKEINFO) --docbook -o $@ $< texinfo-distclean: texinfo-clean - @$(RMR) *_html *.info *.html *.pdf *.dvi *.txt + $(RMR) *_html *.info *.html *.pdf *.dvi *.txt texinfo-clean: texinfo-textmp-clean + $(RM) *.d texinfo-textmp-clean: - @$(RM) *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.tmp *.toc *.tp *.vr + $(RM) *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.tmp *.toc *.tp *.vr -- 2.18.0