make install機能を追加
[YACASL2.git] / doc / Makefile
1 DOCNAME = yacasl2
2 SRC = $(DOCNAME).texi
3 CSS = style.css
4 HTMLDIR = html
5
6 MV ?= mv
7 CP ?= cp
8 MKDIR ?= mkdir
9 RMRF ?= rm -rf
10 PTEX ?= ptex
11 TEXI2DVI ?= texi2dvi
12 DVI2PDF ?= dvipdfmx
13 MAKEINFO ?= gmakeinfo
14 INSTALL ?= install
15 INSTALL-INFO ?= ginstall-info
16
17 prefix ?= ~
18 infodir ?= $(prefix)/share/info
19
20 .PHONY: all info htmlnosplit html pdf install-info clean clean-docs clean-tex-tmp
21
22 .INTERMEDIATE: $(DOCNAME).dvi
23
24 all: info html htmls pdf
25
26 info: $(DOCNAME).info
27
28 html: $(DOCNAME).html
29         $(MV) $< index.html
30
31 htmls: $(SRC) $(CSS)
32         $(INSTALL) -d $(HTMLDIR)
33         $(INSTALL) $(CSS) $(HTMLDIR)/
34         $(MAKEINFO) -o $(HTMLDIR) --html --css-ref=$(CSS) $(SRC)
35
36 pdf: $(DOCNAME).pdf
37
38 $(DOCNAME).html: $(SRC) $(CSS)
39         $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $(SRC)
40
41 $(DOCNAME).pdf: $(DOCNAME).dvi
42         $(DVI2PDF) $^
43
44 $(DOCNAME).dvi: $(SRC)
45         TEX=$(PTEX) $(TEXI2DVI) -q --texinfo=@afourpaper -o $@ $<
46         @$(MAKE) clean-tex-tmp
47
48 install-info: $(DOCNAME).info
49         $(INSTALL) -d $(infodir)
50         $(INSTALL) $(DOCNAME).info $(infodir)/$(DOCNAME)
51         $(INSTALL-INFO) $(infodir)/$(DOCNAME) $(infodir)/dir
52
53 uninstall-info: $(DOCNAME).info
54         $(INSTALL-INFO) --delete $(infodir)/$(DOCNAME) $(infodir)/dir
55         $(RM) $(infodir)/$(DOCNAME)
56
57 clean: clean-docs clean-tex-tmp
58
59 clean-docs:
60         @$(RMRF) html $(DOCNAME).info $(DOCNAME).pdf index.html
61
62 clean-tex-tmp:
63         @$(RMRF) $(DOCNAME).aux $(DOCNAME).cp $(DOCNAME).cps $(DOCNAME).fn $(DOCNAME).ky $(DOCNAME).log $(DOCNAME).pg $(DOCNAME).pgs $(DOCNAME).tmp $(DOCNAME).toc $(DOCNAME).tp $(DOCNAME).vr