Copyright updates:
[exim.git] / doc / doc-docbook / Makefile
1 # Make file for Exim documentation from xfpt source.
2 # Copyright (c) The Exim Maintainers 2020
3 export LC_ALL=C
4
5 notarget:; @echo "** You must specify a target, in the form x.y, where x is 'filter', 'spec',"
6 @echo "** or 'test', and y is 'xml', 'fo', 'ps', 'pdf', 'html', 'txt', or 'info'."
7 @echo "** One other possible targets 'exim.8', 'spec.utf8'".
8 exit 1
9
10
11 ############################# EVERYTHING ###############################
12 #
13 # Generate all the documentation files...
14 #
15 ## removed info files as I cannot generate them - spec.info filter.info
16 ## removed html files as superseded by new website code
17 everything: spec.pdf spec.ps spec.txt \
18 filter.pdf filter.ps filter.txt \
19 exim.8
20
21 ############################## MAN PAGE ################################
22
23 exim.8: spec.xml x2man
24 ./x2man
25
26 ########################################################################
27
28 # .PHONY doesn't work here, because it forces a rebuild of all dependent
29 # targets, always. It sets the internal timestamp of its target to
30 # now().
31 # But it may happen that local_params does not change
32 FORCE:
33 local_params: FORCE GenLocalParams
34 @set -e; \
35 trap 'rm -f $$tmp' EXIT; \
36 tmp=`mktemp`; \
37 ./GenLocalParams $$tmp; \
38 cmp -s $@ $$tmp || mv -f $$tmp $@
39
40 ############################### FILTER #################################
41
42 filter.xml: local_params filter.xfpt
43 xfpt filter.xfpt
44
45 filter-pr.xml: filter.xml Pre-xml
46 ./Pre-xml -bookinfo <filter.xml >filter-pr.xml
47
48 filter-txt.xml: filter.xml Pre-xml
49 ./Pre-xml -ascii -html -quoteliteral <filter.xml >filter-txt.xml
50
51 filter-info.xml: filter.xml Pre-xml
52 ./Pre-xml -ascii -html <filter.xml >filter-info.xml
53
54 filter.fo: filter-pr.xml MyStyle-filter-fo.xsl MyStyle-fo.xsl MyStyle.xsl
55 /bin/rm -rf filter.fo filter-pr.fo
56 xmlto -x MyStyle-filter-fo.xsl fo filter-pr.xml
57 /bin/mv -f filter-pr.fo filter.fo
58
59 # Do not use pdf2ps from the PDF version; better PS is generated directly.
60
61 ###
62 ### PS/PDF generation using fop
63 ###
64
65 fop-filter.ps: filter.fo
66 fop filter.fo -ps filter-tmp.ps
67 mv filter-tmp.ps filter.ps
68
69 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
70 # contains cross links etc.
71
72 fop-filter.pdf: filter.fo PageLabelPDF
73 fop filter.fo -pdf filter-tmp.pdf
74 ./PageLabelPDF 2 <filter-tmp.pdf >filter.pdf
75
76 ###
77 ### PS/PDF generation using SDoP
78 ###
79
80 sdop-filter.ps: filter-pr.xml
81 sdop -o filter.ps filter-pr.xml
82
83 sdop-filter.pdf: filter.ps
84 ps2pdf filter.ps filter.pdf
85
86 ###
87 ### PS/PDF default setting
88 ###
89
90 filter.ps: sdop-filter.ps
91
92 filter.pdf: sdop-filter.pdf
93
94 ###
95 ###
96
97 filter.txt: filter-txt.xml Tidytxt MyStyle-txt-html.xsl MyStyle-html.xsl \
98 MyStyle.xsl
99 /bin/rm -rf filter-txt.html
100 xmlto -x MyStyle-txt-html.xsl html-nochunks filter-txt.xml
101 command -v w3m >/dev/null
102 LC_ALL=C w3m -dump filter-txt.html | ./Tidytxt >filter.txt
103 ./SanityTestText filter.txt
104
105 # I have not found a way of making docbook2texi write its output anywhere
106 # other than the file name that it makes up. The --to-stdout option does not
107 # work.
108
109 filter.info: filter-info.xml
110 docbook2texi filter-info.xml
111 perl -ne 's/conceptindex/cindex/;s/optionindex/findex/;print;' \
112 <exim_filtering.texi | ./Tidytxt >filter.texinfo
113 /bin/rm -rf exim_filtering.texi
114 makeinfo -o filter.info filter.texinfo
115
116 ########################################################################
117
118
119 ################################ SPEC ##################################
120
121 spec.xml: spec.xfpt local_params
122 xfpt spec.xfpt
123
124 spec-pr.xml: spec.xml Pre-xml
125 ./Pre-xml -optbreak <spec.xml >spec-pr.xml
126
127 spec-txt.xml: spec.xml Pre-xml
128 ./Pre-xml -ascii -html -noindex -quoteliteral \
129 <spec.xml >spec-txt.xml
130
131 spec-info.xml: spec.xml Pre-xml
132 ./Pre-xml -ascii -html -noindex <spec.xml >spec-info.xml
133
134 spec.fo: spec-pr.xml MyStyle-spec-fo.xsl MyStyle-fo.xsl MyStyle.xsl \
135 MyTitleStyle.xsl
136 /bin/rm -rf spec.fo spec-pr.fo
137 xmlto -x MyStyle-spec-fo.xsl fo spec-pr.xml
138 /bin/mv -f spec-pr.fo spec.fo
139
140 ###
141 ### PS/PDF generation using fop
142 ###
143
144 # Do not use pdf2ps from the PDF version; better PS is generated directly.
145
146 fop-spec.ps: spec.fo
147 FOP_OPTS=-Xmx512m fop spec.fo -ps spec-tmp.ps
148 mv spec-tmp.ps spec.ps
149
150 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
151 # contains cross links etc. We post-process it to add page label information
152 # so that the page identifiers shown by acroread are the correct page numbers.
153
154 fop-spec.pdf: spec.fo PageLabelPDF
155 FOP_OPTS=-Xmx512m fop spec.fo -pdf spec-tmp.pdf
156 ./PageLabelPDF 12 <spec-tmp.pdf >spec.pdf
157
158 ###
159 ### PS/PDF generation using SDoP
160 ###
161
162 sdop-spec.ps: spec-pr.xml
163 sdop -o spec.ps spec-pr.xml
164
165 sdop-spec.pdf: spec.ps
166 ps2pdf spec.ps spec.pdf
167
168 ###
169 ### PS/PDF default setting
170 ###
171
172 spec.ps: sdop-spec.ps
173
174 spec.pdf: sdop-spec.pdf
175
176 ###
177 ###
178
179 spec-txt.html: spec-txt.xml \
180 MyStyle-txt-html.xsl MyStyle-html.xsl MyStyle.xsl
181 xmlto -x MyStyle-txt-html.xsl html-nochunks spec-txt.xml
182
183 spec.utf8: spec-txt.html Tidytxt
184 @grep -iq 'LC_CTYPE=.*utf-\?8' local_params || { \
185 echo 'your current locale does not support UTF-8' >&2; \
186 false; }
187 command -v w3m >/dev/null
188 w3m -dump spec-txt.html | ./Tidytxt -utf8 >$@
189
190 spec.txt: spec-txt.html Tidytxt
191 command -v w3m >/dev/null
192 LC_ALL=C w3m -dump spec-txt.html | ./Tidytxt >$@
193 ./SanityTestText spec.txt
194
195
196 # I have not found a way of making docbook2texi write its output anywhere
197 # other than the file name that it makes up. The --to-stdout option does not
198 # work.
199
200 spec.info: spec-info.xml
201 docbook2texi spec-info.xml
202 ./TidyInfo <the_exim_mta.texi >spec.texinfo
203 /bin/rm -rf the_exim_mta.texi
204 makeinfo -o spec.info --no-split spec.texinfo
205
206 ########################################################################
207
208
209 ################################ TEST ##################################
210
211 # These targets (similar to the above) are for running little tests.
212
213 test.xml: test.xfpt
214 xfpt test.xfpt
215
216 test-pr.xml: test.xml Pre-xml
217 ./Pre-xml <test.xml >test-pr.xml
218
219 test-html.xml: test.xml Pre-xml
220 ./Pre-xml -html -oneindex <test.xml >test-html.xml
221
222 test-txt.xml: test.xml Pre-xml
223 ./Pre-xml -ascii -html -noindex -quoteinfo \
224 <test.xml >test-txt.xml
225
226 test-info.xml: test.xml Pre-xml
227 ./Pre-xml -ascii -html -noindex <test.xml >test-info.xml
228
229 test.fo: test-pr.xml MyStyle-spec-fo.xsl MyStyle-fo.xsl MyStyle.xsl \
230 MyTitleStyle.xsl
231 /bin/rm -rf test.fo test-pr.fo
232 xmlto -x MyStyle-spec-fo.xsl fo test-pr.xml
233 /bin/mv -f test-pr.fo test.fo
234
235 ###
236 ### PS/PDF generation using fop
237 ###
238
239 # Do not use pdf2ps from the PDF version; better PS is generated directly.
240
241 fop-test.ps: test.fo
242 fop test.fo -ps test-tmp.ps
243 mv test-tmp.ps test.ps
244
245 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
246 # contains cross links etc.
247
248 fop-test.pdf: test.fo
249 fop test.fo -pdf test-tmp.pdf
250 mv test-tmp.pdf test.pdf
251
252 ###
253 ### PS/PDF generation using SDoP
254 ###
255
256 sdop-test.ps: test-pr.xml
257 sdop -o test.ps test-pr.xml
258
259 sdop-test.pdf: test.ps
260 ps2pdf test.ps test.pdf
261
262 ###
263 ### PS/PDF default setting
264 ###
265
266 test.ps: sdop-test.ps
267
268 test.pdf: sdop-test.pdf
269
270 ###
271 ###
272
273
274 test.txt: test-txt.xml Tidytxt MyStyle-txt-html.xsl MyStyle-html.xsl \
275 MyStyle.xsl
276 /bin/rm -rf test-txt.html
277 xmlto -x MyStyle-txt-html.xsl html-nochunks test-txt.xml
278 command -v w3m >/dev/null
279 w3m -dump test-txt.html | Tidytxt >test.txt
280
281 # I have not found a way of making docbook2texi write its output anywhere
282 # other than the file name that it makes up. The --to-stdout option does not
283 # work.
284
285 test.info: test-info.xml
286 docbook2texi test-info.xml
287 ./TidyInfo <short_title.texi >test.texinfo
288 /bin/rm -rf short_title.texi
289 makeinfo -o test.info test.texinfo
290
291 ########################################################################
292
293
294 ############################## OS FIXUP ################################
295
296 # Yes, we've advanced so far in text processing that we now have to
297 # hardcode in complete paths and so become dependent upon exactly where
298 # files were installed for xsl:import. Which of course varies by OS.
299
300 os-fixup:
301 ./OS-Fixups
302
303 ########################################################################
304
305
306 ################################ CLEAN #################################
307
308 clean:; /bin/rm -rf exim.8 \
309 filter*.xml spec*.xml test*.xml \
310 *.fo *.pdf *.ps \
311 filter*.html spec*.html test*.html \
312 filter*.txt spec*.txt test*.txt \
313 *.info* *.texinfo *.texi
314
315 ########################################################################