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
CSS := style.css
+TEXITARGETS := casl2_spec.html
+
.PHONY: all clean distclean
all: casl2_spec.html casl2_spec.pdf
$(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
+++ /dev/null
-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
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) $<
@$(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