chiark / gitweb /
"make developers-reference.{html,pdf,txt}" should work now
[developers-reference.git] / Makefile
1 # Makefile, used for the developers-reference in DocBook XML
2
3 SOURCES         := $(wildcard *.dbk)
4
5 LANGS           := fr
6 TARGETS         := $(foreach fmt,html txt pdf,developers-reference.$(fmt)) \
7                      $(foreach langext,$(LANGS), \
8                        $(foreach fmt,html txt pdf,developers-reference.$(langext).$(fmt)))
9
10 # programs for creating output
11 DEBIANDOC2HTML  := debiandoc2html -c
12 DEBIANDOC2TEXT  := debiandoc2text
13 DEBIANDOC2LATEX := debiandoc2latex
14 DEBIANDOC2PS    := debiandoc2latexps
15 DEBIANDOC2PDF   := debiandoc2latexpdf
16
17 htmllink        := echo "<!entity % htmltext \"INCLUDE\">" > dynamic.ent
18 nohtmllink      := echo "<!entity % htmltext \"IGNORE\">" > dynamic.ent
19
20 make_directory  := install -d -m 755
21 install_file    := install -m 644 -p
22
23 XP=xsltproc --nonet --novalid --xinclude
24
25 XL=xmllint --nonet --noout --postvalid --xinclude
26
27 # note: the URL is used as identifier, no HTTP is used!
28 DOCBOOK_XSL=http://docbook.sourceforge.net/release/xsl/current
29
30 # one file per chapter
31 DBK2HTML=--stringparam chunk.section.depth 0 \
32     --stringparam section.autolabel 1 \
33     --stringparam use.id.as.filename 1 \
34     $(DOCBOOK_XSL)/xhtml/chunk.xsl
35
36 # all in one file
37 DBK2HTML1=--stringparam section.autolabel 1 \
38     $(DOCBOOK_XSL)/xhtml/docbook.xsl
39
40 DBK2FO=--stringparam double.sided 1 \
41     --stringparam draft.mode no \
42     --stringparam paper.type A4 \
43     $(DOCBOOK_XSL)/fo/docbook.xsl
44 # fop is currently in contrib, but can go to main now, AFAIK
45 # alternatives: docbook2pdf (seems to die on UTF-8), dblatex (0.2.4
46 # just hangs here) and xmllint (not mature enough, waits in NEW)
47 FOP=fop
48
49 .PHONY: all dropold
50 all:    $(TARGETS) dropold
51
52 dropold:
53         -rm -rf developers-reference.ja.html
54
55 .PHONY: validate
56 validate:
57         $(XL) index.dbk
58
59 .PHONY: developers-reference.html
60 developers-reference.html:      $(SOURCES)
61         $(XP) $(DBK2HTML) index.dbk
62
63 developers-reference.%.html:    developers-reference.%.sgml
64         $(htmllink)
65         $(DEBIANDOC2HTML) -l $* $<
66
67 developers-reference.txt:       $(SOURCES)
68         $(XP) $(DBK2HTML1) index.dbk \
69             | w3m -cols 65 -dump -T text/html > $@
70
71 developers-reference.%.txt:     developers-reference.%.sgml
72         $(nohtmllink)
73         $(DEBIANDOC2TEXT) -l $* -O $< > $@
74
75 developers-reference.fo:        $(SOURCES)
76         $(XP) $(DBK2FO) index.dbk > $@
77
78 developers-reference.pdf:       developers-reference.fo
79         $(FOP) -fo $< -pdf $@
80
81 developers-reference.%.pdf:     developers-reference.%.sgml
82         $(nohtmllink)
83         $(DEBIANDOC2PDF) -l $* $<
84
85 version.ent:    debian/changelog
86         ./debian/rules $@
87
88 %.validate : % version.ent
89         nsgmls -wall -gues $<
90         touch $@
91
92 .PHONY: clean
93 clean:
94         rm -f *.fo *.html *.pdf *.txt
95         rm -f version.ent
96         rm -f `find . -name "*~" -o -name "*.bak"`
97         rm -f *.validate
98         rm -f *~ *.bak .#* core
99
100 .PHONY: distclean
101 distclean: clean
102         rm -f *.rej *.orig
103
104 # if rule bomb out, delete the target
105 .DELETE_ON_ERROR: