]>
Commit | Line | Data |
---|---|---|
a034d852 GJ |
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 | ||
17 | docbook: | |
18 | ||
19 | ||
20 | #--------- | |
21 | ||
22 | # Rules to build HTML documentations | |
23 | ifdef XSLTPROC | |
24 | ||
25 | DOCBOOK_HTML_STYLESHEET := docbook-html-style.xsl | |
26 | ||
27 | # Install generation hooks | |
28 | docbook: $($(LOCAL)-HTML) | |
29 | veryclean: veryclean/html/$(LOCAL) | |
30 | ||
31 | vpath %.dbk $(SUBDIRS) | |
32 | vpath $(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) | |
44 | veryclean/html/$(LOCAL): | |
45 | -rm -rf $($(@F)-HTML) | |
46 | ||
47 | endif | |
48 | ||
49 | #--------- | |
50 | ||
51 | # Rules to build Text documentations | |
52 | ifdef XSLTPROC | |
53 | ||
54 | DOCBOOK_TEXT_STYLESHEET := docbook-text-style.xsl | |
55 | ||
56 | # Install generation hooks | |
57 | docbook: $($(LOCAL)-TEXT) | |
58 | veryclean: veryclean/text/$(LOCAL) | |
59 | ||
60 | vpath %.dbk $(SUBDIRS) | |
61 | vpath $(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) | |
71 | veryclean/text/$(LOCAL): | |
72 | -rm -rf $($(@F)-TEXT) | |
73 | ||
74 | endif |