]> git.saurik.com Git - apt.git/blame_incremental - buildlib/docbook.mak
build: Convert from DebianDoc SGML to DocBook XML
[apt.git] / buildlib / docbook.mak
... / ...
CommitLineData
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
13LOCAL := docbook-$(firstword $(SOURCE))
14$(LOCAL)-HTML := $(addsuffix .html,$(addprefix $(DOC)/,$(basename $(SOURCE))))
15$(LOCAL)-TEXT := $(addsuffix .text,$(addprefix $(DOC)/,$(basename $(SOURCE))))
16
17docbook:
18
19
20#---------
21
22# Rules to build HTML documentations
23ifdef XSLTPROC
24
25DOCBOOK_HTML_STYLESHEET := docbook-html-style.xsl
26
27# Install generation hooks
28docbook: $($(LOCAL)-HTML)
29veryclean: veryclean/html/$(LOCAL)
30
31vpath %.dbk $(SUBDIRS)
32vpath $(DOCBOOK_HTML_STYLESHEET) $(SUBDIRS)
33$(DOC)/%.html: %.dbk $(DOCBOOK_HTML_STYLESHEET)
34 echo Creating html for $< to $@
35 -rm -rf $@
36 mkdir -p $@
37 $(DOCBOOK) \
38 --stringparam base.dir $@/ \
39 --stringparam l10n.gentext.default.language $(LC) \
40 $(<D)/$(DOCBOOK_HTML_STYLESHEET) $< || exit 199
41
42# Clean rule
43.PHONY: veryclean/html/$(LOCAL)
44veryclean/html/$(LOCAL):
45 -rm -rf $($(@F)-HTML)
46
47endif
48
49#---------
50
51# Rules to build Text documentations
52ifdef XSLTPROC
53
54DOCBOOK_TEXT_STYLESHEET := docbook-text-style.xsl
55
56# Install generation hooks
57docbook: $($(LOCAL)-TEXT)
58veryclean: veryclean/text/$(LOCAL)
59
60vpath %.dbk $(SUBDIRS)
61vpath $(DOCBOOK_TEXT_STYLESHEET) $(SUBDIRS)
62$(DOC)/%.text: %.dbk $(DOCBOOK_TEXT_STYLESHEET)
63 echo Creating text for $< to $@
64 $(DOCBOOK) \
65 --stringparam l10n.gentext.default.language $(LC) \
66 $(<D)/$(DOCBOOK_TEXT_STYLESHEET) $< | \
67 LC_ALL=C.UTF-8 $(DOCBOOK2TEXT) > $@ || exit 198
68
69# Clean rule
70.PHONY: veryclean/text/$(LOCAL)
71veryclean/text/$(LOCAL):
72 -rm -rf $($(@F)-TEXT)
73
74endif