From: j8takagi Date: Sat, 14 Jun 2014 04:31:49 +0000 (+0900) Subject: Texinfoの依存関係を表す.dファイルを自動作成する機能を追加 X-Git-Tag: v0.2p36~3 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e555604fe364f0f292601f4d5baa258fcbfc5ae9;p=YACASL2.git Texinfoの依存関係を表す.dファイルを自動作成する機能を追加 --- diff --git a/doc/.gitignore b/doc/.gitignore index 6154d47..f8fc444 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -20,3 +20,4 @@ casl2_spec.html *.toc *.tp *.vr +*.d diff --git a/doc/Makefile b/doc/Makefile index bb4c096..dc8c378 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -7,6 +7,8 @@ CSS := style.css prefix ?= ~ infodir ?= $(prefix)/share/info +TEXITARGETS := install.html manual.html + INSTALL-INFO-TARGETS := yacasl2.info .PHONY: base all info html htmls pdf casl2_spec distclean clean diff --git a/doc/casl2_spec/Makefile b/doc/casl2_spec/Makefile index 17b62cf..cc9ada7 100644 --- a/doc/casl2_spec/Makefile +++ b/doc/casl2_spec/Makefile @@ -5,6 +5,8 @@ SED := sed CSS := style.css +TEXITARGETS := casl2_spec.html + .PHONY: all clean distclean all: casl2_spec.html casl2_spec.pdf @@ -14,10 +16,10 @@ clean: texinfo-clean $(MAKE) -C img clean distclean: clean texinfo-distclean - $(RM) *.html *.pdf + $(RM) *.d *.html *.pdf $(MAKE) -C img distclean -include casl2_spec.dep +#include casl2_spec.dep include texinfo.mk diff --git a/doc/casl2_spec/casl2_spec.dep b/doc/casl2_spec/casl2_spec.dep deleted file mode 100644 index d2fe284..0000000 --- a/doc/casl2_spec/casl2_spec.dep +++ /dev/null @@ -1,55 +0,0 @@ -casl2_spec.html: img/1_1-01.png -casl2_spec.html: img/1_2-00.png -casl2_spec.html: img/1_2-01.png -casl2_spec.html: img/1_2-02.png -casl2_spec.html: img/1_2-03.png -casl2_spec.html: img/1_2-04.png -casl2_spec.html: img/1_2-05.png -casl2_spec.html: img/1_2-06.png -casl2_spec.html: img/1_2-07.png -casl2_spec.html: img/1_2-08.png -casl2_spec.html: img/1_3-01.png -casl2_spec.html: img/2_1-01.png -casl2_spec.html: img/2_2-01.png -casl2_spec.html: img/2_3-01.png -casl2_spec.html: img/2_3-02.png -casl2_spec.html: img/2_3-03.png -casl2_spec.html: img/2_3-04.png -casl2_spec.html: img/2_3-05.png -casl2_spec.html: img/2_4-01.png -casl2_spec.html: img/2_4-02.png -casl2_spec.html: img/2_4-03.png -casl2_spec.html: img/2_4-04.png -casl2_spec.html: img/r_1-01.png -casl2_spec.html: img/r_1-02.png -casl2_spec.html: img/r_1-03.png -casl2_spec.html: img/r_1-04.png -casl2_spec.html: img/r_1-05.png - -casl2_spec.pdf: img/1_1-01.eps -casl2_spec.pdf: img/1_2-00.eps -casl2_spec.pdf: img/1_2-01.eps -casl2_spec.pdf: img/1_2-02.eps -casl2_spec.pdf: img/1_2-03.eps -casl2_spec.pdf: img/1_2-04.eps -casl2_spec.pdf: img/1_2-05.eps -casl2_spec.pdf: img/1_2-06.eps -casl2_spec.pdf: img/1_2-07.eps -casl2_spec.pdf: img/1_2-08.eps -casl2_spec.pdf: img/1_3-01.eps -casl2_spec.pdf: img/2_1-01.eps -casl2_spec.pdf: img/2_2-01.eps -casl2_spec.pdf: img/2_3-01.eps -casl2_spec.pdf: img/2_3-02.eps -casl2_spec.pdf: img/2_3-03.eps -casl2_spec.pdf: img/2_3-04.eps -casl2_spec.pdf: img/2_3-05.eps -casl2_spec.pdf: img/2_4-01.eps -casl2_spec.pdf: img/2_4-02.eps -casl2_spec.pdf: img/2_4-03.eps -casl2_spec.pdf: img/2_4-04.eps -casl2_spec.pdf: img/r_1-01.eps -casl2_spec.pdf: img/r_1-02.eps -casl2_spec.pdf: img/r_1-03.eps -casl2_spec.pdf: img/r_1-04.eps -casl2_spec.pdf: img/r_1-05.eps diff --git a/doc/texinfo.mk b/doc/texinfo.mk index 3ba0cf8..c75c261 100644 --- a/doc/texinfo.mk +++ b/doc/texinfo.mk @@ -2,28 +2,64 @@ 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) $< - $(SED) -i.bak -e 's!dir\.html#Top!\.\./!g' -e 's!src="\(.*\)\.png"!src="\1.svg"!g' $@ && $(RM) $@.bak -%_html: %.texi $(CSS) +%_html: %.texi if test ! -e $@; then $(MKDIR) $@; fi $(CP) $(CSS) $@/ $(MAKEINFO) -o $@ --html --css-ref=$(CSS) $< - $(SED) -i.bak -e 's!\.\./dir/index\.html!\.\./\.\./!g' -e 's!src="\(.*\)\.png"!src="\1.svg"!g' $@/*.html && $(RM) $@/*.html.bak + +%.html %_html: $(CSS) %.pdf: %.dvi $(DVIPDFMX) $(DVIPDFMXFLAGS) $< @@ -35,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