]> git.saurik.com Git - apt.git/blob - buildlib/docbook.mak
use std-algorithms instead of manual loops to avoid overflow warning
[apt.git] / buildlib / docbook.mak
1 # -*- make -*-
2
3 # This processes DocBook XML to produce html and plain text output
4
5 # Input
6 # $(SOURCE) - The documents to use
7
8 # All output is written to files in the build doc directory
9
10 # See defaults.mak for information about LOCAL
11
12 # Some local definitions
13 LOCAL := docbook-$(firstword $(SOURCE))
14 $(LOCAL)-HTML := $(addsuffix .html,$(addprefix $(DOC)/,$(basename $(SOURCE))))
15 $(LOCAL)-TEXT := $(addsuffix .text,$(addprefix $(DOC)/,$(basename $(SOURCE))))
16 INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent
17
18 docbook:
19
20
21 #---------
22
23 # Rules to build HTML documentations
24 ifdef XSLTPROC
25
26 DOCBOOK_HTML_STYLESHEET := docbook-html-style.xsl
27
28 # Install generation hooks
29 docbook: $($(LOCAL)-HTML)
30 veryclean: veryclean/html/$(LOCAL)
31
32 vpath %.dbk $(SUBDIRS)
33 vpath $(DOCBOOK_HTML_STYLESHEET) $(SUBDIRS)
34 $(DOC)/%.html: %.dbk $(DOCBOOK_HTML_STYLESHEET) $(INCLUDES)
35 echo Creating html for $< to $@
36 -rm -rf $@
37 mkdir -p $@
38 $(DOCBOOK) \
39 --stringparam base.dir $@/ \
40 --stringparam l10n.gentext.default.language $(LC) \
41 $(<D)/$(DOCBOOK_HTML_STYLESHEET) $< || exit 199
42
43 # Clean rule
44 .PHONY: veryclean/html/$(LOCAL)
45 veryclean/html/$(LOCAL):
46 -rm -rf $($(@F)-HTML)
47
48 endif
49
50 #---------
51
52 # Rules to build Text documentations
53 ifdef XSLTPROC
54
55 DOCBOOK_TEXT_STYLESHEET := docbook-text-style.xsl
56
57 # Install generation hooks
58 docbook: $($(LOCAL)-TEXT)
59 veryclean: veryclean/text/$(LOCAL)
60
61 vpath %.dbk $(SUBDIRS)
62 vpath $(DOCBOOK_TEXT_STYLESHEET) $(SUBDIRS)
63 $(DOC)/%.text: %.dbk $(DOCBOOK_TEXT_STYLESHEET) $(INCLUDES)
64 echo Creating text for $< to $@
65 $(DOCBOOK) \
66 --stringparam l10n.gentext.default.language $(LC) \
67 $(<D)/$(DOCBOOK_TEXT_STYLESHEET) $< | \
68 LC_ALL=C.UTF-8 $(DOCBOOK2TEXT) > $@ || exit 198
69
70 # Clean rule
71 .PHONY: veryclean/text/$(LOCAL)
72 veryclean/text/$(LOCAL):
73 -rm -rf $($(@F)-TEXT)
74
75 endif