1 # Make file for Exim documentation from xfpt source.
2 # Copyright (c) The Exim Maintainers 2020 - 2021
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', 'txt', or 'info'."
7 @echo "** One other possible targets 'exim.8', 'spec.utf8'".
10 # html used to be supported, but is not here since 50023e0551 (2010).
11 # The website build script seems to handle it.
13 ############################# EVERYTHING ###############################
15 # Generate all the documentation files...
17 ## removed info files as I cannot generate them - spec.info filter.info
18 ## removed html files as superseded by new website code
19 everything: spec.pdf spec.ps spec.txt \
20 filter.pdf filter.ps filter.txt \
23 ############################## MAN PAGE ################################
25 exim.8: spec.xml x2man
28 ########################################################################
30 # .PHONY doesn't work here, because it forces a rebuild of all dependent
31 # targets, always. It sets the internal timestamp of its target to
33 # But it may happen that local_params does not change
35 local_params: FORCE GenLocalParams
37 trap 'rm -f $$tmp' EXIT; \
39 ./GenLocalParams $$tmp; \
40 cmp -s $@ $$tmp || mv -f $$tmp $@
42 ############################### FILTER #################################
44 filter.xml: local_params filter.xfpt
47 filter-pr.xml: filter.xml Pre-xml
48 ./Pre-xml -bookinfo <filter.xml >filter-pr.xml
50 filter-txt.xml: filter.xml Pre-xml
51 ./Pre-xml -ascii -html -quoteliteral <filter.xml >filter-txt.xml
53 filter-info.xml: filter.xml Pre-xml
54 ./Pre-xml -ascii -html <filter.xml >filter-info.xml
56 filter.fo: filter-pr.xml MyStyle-filter-fo.xsl MyStyle-fo.xsl MyStyle.xsl
57 /bin/rm -rf filter.fo filter-pr.fo
58 xmlto -x MyStyle-filter-fo.xsl fo filter-pr.xml
59 /bin/mv -f filter-pr.fo filter.fo
61 # Do not use pdf2ps from the PDF version; better PS is generated directly.
64 ### PS/PDF generation using fop
67 fop-filter.ps: filter.fo
68 fop filter.fo -ps filter-tmp.ps
69 mv filter-tmp.ps filter.ps
71 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
72 # contains cross links etc.
74 fop-filter.pdf: filter.fo PageLabelPDF
75 fop filter.fo -pdf filter-tmp.pdf
76 ./PageLabelPDF 2 <filter-tmp.pdf >filter.pdf
79 ### PS/PDF generation using SDoP
82 sdop-filter.ps: filter-pr.xml
83 sdop -o filter.ps filter-pr.xml
85 sdop-filter.pdf: filter.ps
86 ps2pdf filter.ps filter.pdf
89 ### PS/PDF default setting
92 filter.ps: sdop-filter.ps
94 filter.pdf: sdop-filter.pdf
99 filter.txt: filter-txt.xml Tidytxt MyStyle-txt-html.xsl MyStyle-html.xsl \
101 /bin/rm -rf filter-txt.html
102 xmlto -x MyStyle-txt-html.xsl html-nochunks filter-txt.xml
103 command -v w3m >/dev/null
104 LC_ALL=C w3m -dump filter-txt.html | ./Tidytxt >filter.txt
105 ./SanityTestText filter.txt
107 # I have not found a way of making docbook2texi write its output anywhere
108 # other than the file name that it makes up. The --to-stdout option does not
111 filter.info: filter-info.xml
112 docbook2texi filter-info.xml
113 perl -ne 's/conceptindex/cindex/;s/optionindex/findex/;print;' \
114 <exim_filtering.texi | ./Tidytxt >filter.texinfo
115 /bin/rm -rf exim_filtering.texi
116 makeinfo -o filter.info filter.texinfo
118 ########################################################################
121 ################################ SPEC ##################################
123 spec.xml: spec.xfpt local_params
126 spec-pr.xml: spec.xml Pre-xml
127 ./Pre-xml -optbreak <spec.xml >spec-pr.xml
129 spec-txt.xml: spec.xml Pre-xml
130 ./Pre-xml -ascii -html -noindex -quoteliteral \
131 <spec.xml >spec-txt.xml
133 spec-info.xml: spec.xml Pre-xml
134 ./Pre-xml -ascii -html -noindex <spec.xml >spec-info.xml
136 spec.fo: spec-pr.xml MyStyle-spec-fo.xsl MyStyle-fo.xsl MyStyle.xsl \
138 /bin/rm -rf spec.fo spec-pr.fo
139 xmlto -x MyStyle-spec-fo.xsl fo spec-pr.xml
140 /bin/mv -f spec-pr.fo spec.fo
143 ### PS/PDF generation using fop
146 # Do not use pdf2ps from the PDF version; better PS is generated directly.
149 FOP_OPTS=-Xmx512m fop spec.fo -ps spec-tmp.ps
150 mv spec-tmp.ps spec.ps
152 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
153 # contains cross links etc. We post-process it to add page label information
154 # so that the page identifiers shown by acroread are the correct page numbers.
156 fop-spec.pdf: spec.fo PageLabelPDF
157 FOP_OPTS=-Xmx512m fop spec.fo -pdf spec-tmp.pdf
158 ./PageLabelPDF 12 <spec-tmp.pdf >spec.pdf
161 ### PS/PDF generation using SDoP
164 sdop-spec.ps: spec-pr.xml
165 sdop -o spec.ps spec-pr.xml
167 sdop-spec.pdf: spec.ps
168 ps2pdf spec.ps spec.pdf
171 ### PS/PDF default setting
174 spec.ps: sdop-spec.ps
176 spec.pdf: sdop-spec.pdf
181 spec-txt.html: spec-txt.xml \
182 MyStyle-txt-html.xsl MyStyle-html.xsl MyStyle.xsl
183 xmlto -x MyStyle-txt-html.xsl html-nochunks spec-txt.xml
185 spec.utf8: spec-txt.html Tidytxt
186 @grep -iq 'LC_CTYPE=.*utf-\?8' local_params || { \
187 echo 'your current locale does not support UTF-8' >&2; \
189 command -v w3m >/dev/null
190 w3m -dump spec-txt.html | ./Tidytxt -utf8 >$@
192 spec.txt: spec-txt.html Tidytxt
193 command -v w3m >/dev/null
194 LC_ALL=C w3m -dump spec-txt.html | ./Tidytxt >$@
195 ./SanityTestText spec.txt
198 # I have not found a way of making docbook2texi write its output anywhere
199 # other than the file name that it makes up. The --to-stdout option does not
202 spec.info: spec-info.xml
203 docbook2texi spec-info.xml
204 ./TidyInfo <the_exim_mta.texi >spec.texinfo
205 /bin/rm -rf the_exim_mta.texi
206 makeinfo -o spec.info --no-split spec.texinfo
208 ########################################################################
211 ################################ TEST ##################################
213 # These targets (similar to the above) are for running little tests.
218 test-pr.xml: test.xml Pre-xml
219 ./Pre-xml <test.xml >test-pr.xml
221 test-html.xml: test.xml Pre-xml
222 ./Pre-xml -html -oneindex <test.xml >test-html.xml
224 test-txt.xml: test.xml Pre-xml
225 ./Pre-xml -ascii -html -noindex -quoteinfo \
226 <test.xml >test-txt.xml
228 test-info.xml: test.xml Pre-xml
229 ./Pre-xml -ascii -html -noindex <test.xml >test-info.xml
231 test.fo: test-pr.xml MyStyle-spec-fo.xsl MyStyle-fo.xsl MyStyle.xsl \
233 /bin/rm -rf test.fo test-pr.fo
234 xmlto -x MyStyle-spec-fo.xsl fo test-pr.xml
235 /bin/mv -f test-pr.fo test.fo
238 ### PS/PDF generation using fop
241 # Do not use pdf2ps from the PDF version; better PS is generated directly.
244 fop test.fo -ps test-tmp.ps
245 mv test-tmp.ps test.ps
247 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
248 # contains cross links etc.
250 fop-test.pdf: test.fo
251 fop test.fo -pdf test-tmp.pdf
252 mv test-tmp.pdf test.pdf
255 ### PS/PDF generation using SDoP
258 sdop-test.ps: test-pr.xml
259 sdop -o test.ps test-pr.xml
261 sdop-test.pdf: test.ps
262 ps2pdf test.ps test.pdf
265 ### PS/PDF default setting
268 test.ps: sdop-test.ps
270 test.pdf: sdop-test.pdf
276 test.txt: test-txt.xml Tidytxt MyStyle-txt-html.xsl MyStyle-html.xsl \
278 /bin/rm -rf test-txt.html
279 xmlto -x MyStyle-txt-html.xsl html-nochunks test-txt.xml
280 command -v w3m >/dev/null
281 w3m -dump test-txt.html | Tidytxt >test.txt
283 # I have not found a way of making docbook2texi write its output anywhere
284 # other than the file name that it makes up. The --to-stdout option does not
287 test.info: test-info.xml
288 docbook2texi test-info.xml
289 ./TidyInfo <short_title.texi >test.texinfo
290 /bin/rm -rf short_title.texi
291 makeinfo -o test.info test.texinfo
293 ########################################################################
296 ############################## OS FIXUP ################################
298 # Yes, we've advanced so far in text processing that we now have to
299 # hardcode in complete paths and so become dependent upon exactly where
300 # files were installed for xsl:import. Which of course varies by OS.
305 ########################################################################
308 ################################ CLEAN #################################
310 clean:; /bin/rm -rf exim.8 \
311 filter*.xml spec*.xml test*.xml \
313 filter*.html spec*.html test*.html \
314 filter*.txt spec*.txt test*.txt \
315 *.info* *.texinfo *.texi
317 ########################################################################