]> matita.cs.unibo.it Git - helm.git/blob - matita/help/C/Makefile
2ca1a16b1034f5dc5a9de11281a1f2d956ec62b0
[helm.git] / matita / help / C / Makefile
1
2 include ../../../Makefile.defs
3
4 XSLTPROC=xsltproc
5 XHTML_XSL=xsl/matita-xhtml.xsl
6 FO_XSL=xsl/matita-fo.xsl
7 TEX_XSL=xsl/matita-tex.xsl
8 TEX_UNICODE_PATH=$(SRCROOT)/share/texmf/unicode
9 TEX_ENV=TEXINPUTS=.:$(TEX_UNICODE_PATH):$(TEX_UNICODE_PATH)/data:
10 MAIN=matita.xml
11 DEPS := $(wildcard *.xml)
12
13 DESTDIR = /usr/local/share/doc/matita/
14
15 all: quickref
16
17 quickref: tactics_quickref.xml declarative_tactics_quickref.xml
18
19 tactics_quickref.xml: xsl/tactic_quickref.xsl sec_tactics.xml
20         $(XSLTPROC) --param declarative "''" $< matita.xml > tactics_quickref.xml
21 declarative_tactics_quickref.xml: xsl/tactic_quickref.xsl sec_declarative_tactics.xml
22         $(XSLTPROC) --param declarative "'declarative_'" $< matita.xml > declarative_tactics_quickref.xml
23
24 # one of: "fop", "pdflatex"
25 PDF_METHOD=pdflatex
26
27 # one of: "docbook2tex", "xsl"
28 TEX_METHOD=xsl
29
30 clean:
31         rm -f *.html *.fo *.pdf
32         rm -rf $(filter-out version.txt,$(wildcard *.txt))
33         rm -f *-stamp
34         rm -f matita.out matita.log matita.glo matita.dvi matita.idx
35         rm -f matita.aux matita.tex
36
37 # test (dumb implementation)
38 test:
39         SP_ENCODING=UTF-8 docbook2txt matita.xml
40
41 # XHTMLs generation
42
43 .PHONY: html
44 html: html-stamp
45 html-stamp: $(MAIN) $(DEPS) $(XHTML_XSL)
46         $(XSLTPROC) $(XHTML_XSL) $<
47         touch $@
48
49 # TXTs generation
50
51 TXTS = $(patsubst %.html,%.txt,$(wildcard *.html))
52 .PHONY: txt
53 txt: txt-stamp
54 txt-stamp: html-stamp
55         $(MAKE) $(TXTS)
56         touch $@
57 %.txt: %.html
58         w3m -dump -no-graph $< > $@
59
60 # PDF generation
61
62 pdf: pdf-stamp
63 pdf-stamp: $(patsubst %.xml,%.pdf,$(MAIN))
64         touch $@
65
66 %.fo: %.xml
67         $(XSLTPROC) $(FO_XSL) $< | xmllint --format - > $@
68 ifeq ($(TEX_METHOD),docbook2tex)
69 %.tex: %.xml $(DEPS)
70         docbook2tex $<
71 else ifeq ($(TEX_METHOD),xsl)
72 %.tex: %.xml $(TEX_XSL) $(DEPS)
73         $(XSLTPROC) $(TEX_XSL) $< > $@
74 endif
75
76 ifeq ($(PDF_METHOD),fop)
77 %.pdf: %.fo
78         fop $< $@
79 else ifeq ($(PDF_METHOD),pdflatex)
80 %.pdf: %.tex
81         $(TEX_ENV) pdflatex $<
82 endif
83
84 %.dvi: %.tex
85         $(TEX_ENV) latex $<
86 %.ps: %.dvi
87         dvips $<
88
89 # installation
90
91 install: install-html
92 install-html: html-stamp
93         cp *.html *.css $(DESTDIR)
94         test -d $(DESTDIR)/figures || mkdir $(DESTDIR)/figures
95         cp figures/* $(DESTDIR)/figures/
96
97 # shotcuts
98
99 tex: $(patsubst %.xml,%.tex,$(MAIN))
100 dvi: $(patsubst %.xml,%.dvi,$(MAIN))
101 ps: $(patsubst %.xml,%.ps,$(MAIN))
102
103 .PRECIOUS: matita.tex matita.dvi
104