1 # Make file for Exim documentation from xfpt source.
2 # Copyright (c) The Exim Maintainers 2020
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'".
11 ############################# EVERYTHING ###############################
13 # Generate all the documentation files...
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 \
21 ############################## MAN PAGE ################################
23 exim.8: spec.xml x2man
26 ########################################################################
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
31 # But it may happen that local_params does not change
33 local_params: FORCE GenLocalParams
35 trap 'rm -f $$tmp' EXIT; \
37 ./GenLocalParams $$tmp; \
38 cmp -s $@ $$tmp || mv -f $$tmp $@
40 ############################### FILTER #################################
42 filter.xml: local_params filter.xfpt
45 filter-pr.xml: filter.xml Pre-xml
46 ./Pre-xml -bookinfo <filter.xml >filter-pr.xml
48 filter-txt.xml: filter.xml Pre-xml
49 ./Pre-xml -ascii -html -quoteliteral <filter.xml >filter-txt.xml
51 filter-info.xml: filter.xml Pre-xml
52 ./Pre-xml -ascii -html <filter.xml >filter-info.xml
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
59 # Do not use pdf2ps from the PDF version; better PS is generated directly.
62 ### PS/PDF generation using fop
65 fop-filter.ps: filter.fo
66 fop filter.fo -ps filter-tmp.ps
67 mv filter-tmp.ps filter.ps
69 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
70 # contains cross links etc.
72 fop-filter.pdf: filter.fo PageLabelPDF
73 fop filter.fo -pdf filter-tmp.pdf
74 ./PageLabelPDF 2 <filter-tmp.pdf >filter.pdf
77 ### PS/PDF generation using SDoP
80 sdop-filter.ps: filter-pr.xml
81 sdop -o filter.ps filter-pr.xml
83 sdop-filter.pdf: filter.ps
84 ps2pdf filter.ps filter.pdf
87 ### PS/PDF default setting
90 filter.ps: sdop-filter.ps
92 filter.pdf: sdop-filter.pdf
97 filter.txt: filter-txt.xml Tidytxt MyStyle-txt-html.xsl MyStyle-html.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
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
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
116 ########################################################################
119 ################################ SPEC ##################################
121 spec.xml: spec.xfpt local_params
124 spec-pr.xml: spec.xml Pre-xml
125 ./Pre-xml -optbreak <spec.xml >spec-pr.xml
127 spec-txt.xml: spec.xml Pre-xml
128 ./Pre-xml -ascii -html -noindex -quoteliteral \
129 <spec.xml >spec-txt.xml
131 spec-info.xml: spec.xml Pre-xml
132 ./Pre-xml -ascii -html -noindex <spec.xml >spec-info.xml
134 spec.fo: spec-pr.xml MyStyle-spec-fo.xsl MyStyle-fo.xsl MyStyle.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
141 ### PS/PDF generation using fop
144 # Do not use pdf2ps from the PDF version; better PS is generated directly.
147 FOP_OPTS=-Xmx512m fop spec.fo -ps spec-tmp.ps
148 mv spec-tmp.ps spec.ps
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.
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
159 ### PS/PDF generation using SDoP
162 sdop-spec.ps: spec-pr.xml
163 sdop -o spec.ps spec-pr.xml
165 sdop-spec.pdf: spec.ps
166 ps2pdf spec.ps spec.pdf
169 ### PS/PDF default setting
172 spec.ps: sdop-spec.ps
174 spec.pdf: sdop-spec.pdf
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
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; \
187 command -v w3m >/dev/null
188 w3m -dump spec-txt.html | ./Tidytxt -utf8 >$@
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
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
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
206 ########################################################################
209 ################################ TEST ##################################
211 # These targets (similar to the above) are for running little tests.
216 test-pr.xml: test.xml Pre-xml
217 ./Pre-xml <test.xml >test-pr.xml
219 test-html.xml: test.xml Pre-xml
220 ./Pre-xml -html -oneindex <test.xml >test-html.xml
222 test-txt.xml: test.xml Pre-xml
223 ./Pre-xml -ascii -html -noindex -quoteinfo \
224 <test.xml >test-txt.xml
226 test-info.xml: test.xml Pre-xml
227 ./Pre-xml -ascii -html -noindex <test.xml >test-info.xml
229 test.fo: test-pr.xml MyStyle-spec-fo.xsl MyStyle-fo.xsl MyStyle.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
236 ### PS/PDF generation using fop
239 # Do not use pdf2ps from the PDF version; better PS is generated directly.
242 fop test.fo -ps test-tmp.ps
243 mv test-tmp.ps test.ps
245 # Do not use ps2pdf from the PS version; better PDF is generated directly. It
246 # contains cross links etc.
248 fop-test.pdf: test.fo
249 fop test.fo -pdf test-tmp.pdf
250 mv test-tmp.pdf test.pdf
253 ### PS/PDF generation using SDoP
256 sdop-test.ps: test-pr.xml
257 sdop -o test.ps test-pr.xml
259 sdop-test.pdf: test.ps
260 ps2pdf test.ps test.pdf
263 ### PS/PDF default setting
266 test.ps: sdop-test.ps
268 test.pdf: sdop-test.pdf
274 test.txt: test-txt.xml Tidytxt MyStyle-txt-html.xsl MyStyle-html.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
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
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
291 ########################################################################
294 ############################## OS FIXUP ################################
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.
303 ########################################################################
306 ################################ CLEAN #################################
308 clean:; /bin/rm -rf exim.8 \
309 filter*.xml spec*.xml test*.xml \
311 filter*.html spec*.html test*.html \
312 filter*.txt spec*.txt test*.txt \
313 *.info* *.texinfo *.texi
315 ########################################################################