From Graham Bloice:
[obnox/wireshark/wip.git] / docbook / Makefile
1 #
2 # Make the "Wireshark User Guide" and "Wireshark Developer Guide"
3 # in several formats.
4 # See the Readme.txt file for instructions.
5 #
6 # $Id$
7 #
8
9 # formatting objects processor
10 # Additional options to fop.
11 # This needs to contain at least the argument '-Xmx256m'
12 FOP_OPTS?=-Xmx256m
13
14 # fop executable
15 # Leave these commented out if you don't have fop instlled or you
16 # don't want PDF documentation.
17 #
18 # for win32 (cygwin) environments (as of fop-0.20 the cygwin script does
19 # not use $FOP_OPTS)
20 FOP?=fop-0.20.5/fop.bat
21 #
22 # for unix like environments (if you have problems with fop, try to use an absolute path here)
23 #FOP=fop-0.20.5/fop.sh
24 #
25 # One SUSE 9.1 and newer uncomment the following line (make sure you have
26 # at least fop-0.20.5-71.2)
27 #FOP=fop
28
29 # html help compiler (Win32 only)
30 # Leave these commented out if you don't have HHC installed or you
31 # don't want CHM documentation.
32 HHC?="/cygdrive/c/Program Files/HTML Help Workshop/hhc.exe"
33 #HHC="true"
34
35 # html to text converter for text version of release notes, e.g. elinks.
36 # This could also be "lynx", or "true" if neither elinks nor lynx is installed
37 # (cygwin: lynx works, elinks not available, links and true doesn't produce output)
38 #HTML2TXT=elinks -dump -dump-width 72
39 #HTML2TXT=links -dump -width 72
40 HTML2TXT?=lynx -dump -width=72 -nolist -stdin
41 #HTML2TXT="true"
42
43 ############### YOU SHOULDN'T HAVE TO EDIT ANYTHING BELOW THIS LINE! ################
44
45 # the XSL processor
46 XSLTPROC?="xsltproc"
47
48 # the XML validator (from the xsltproc package)
49 XMLLINT?="xmllint"
50
51 # Automatically generate .pdf files from .fo files
52 # Suse needs FOP_OPTS, Debian needs JAVA_OPTS
53 .fo.pdf:
54         FOP_OPTS="$(FOP_OPTS) $(JAVA_OPTS)" $(FOP) $< $@
55
56 WSUG_FILES =    \
57         wsug_src/WSUG_app_files.xml             \
58         wsug_src/WSUG_app_howitworks.xml        \
59         wsug_src/WSUG_app_messages.xml          \
60         wsug_src/WSUG_app_protocols.xml         \
61         wsug_src/WSUG_app_tools.xml             \
62         wsug_src/WSUG_chapter_advanced.xml      \
63         wsug_src/WSUG_chapter_build_install.xml \
64         wsug_src/WSUG_chapter_capture.xml       \
65         wsug_src/WSUG_chapter_customize.xml     \
66         wsug_src/WSUG_chapter_introduction.xml  \
67         wsug_src/WSUG_chapter_io.xml            \
68         wsug_src/WSUG_chapter_statistics.xml    \
69         wsug_src/WSUG_chapter_troubleshoot.xml  \
70         wsug_src/WSUG_chapter_use.xml           \
71         wsug_src/WSUG_chapter_work.xml          \
72         wsug_src/WSUG_meta_info.xml             \
73         wsug_src/WSUG_preface.xml               \
74         ws.css
75
76 WSUG_GRAPHICS = \
77         wsug_graphics/ws-analyze-menu.png               \
78         wsug_graphics/ws-bytes-pane-popup-menu.png      \
79         wsug_graphics/ws-bytes-pane-tabs.png            \
80         wsug_graphics/ws-bytes-pane.png                 \
81         wsug_graphics/ws-capture-info.png               \
82         wsug_graphics/ws-capture-interfaces.png         \
83         wsug_graphics/ws-capture-menu.png               \
84         wsug_graphics/ws-capture-options.png            \
85         wsug_graphics/ws-capture-preferences.png        \
86         wsug_graphics/ws-choose-color-rule.png          \
87         wsug_graphics/ws-coloring-fields.png            \
88         wsug_graphics/ws-coloring-rules-dialog.png      \
89         wsug_graphics/ws-decode-as-show.png             \
90         wsug_graphics/ws-decode-as.png                  \
91         wsug_graphics/ws-details-pane-popup-menu.png    \
92         wsug_graphics/ws-details-pane.png               \
93         wsug_graphics/ws-display-filter-tcp.png         \
94         wsug_graphics/ws-edit-color-rule-dialog.png     \
95         wsug_graphics/ws-edit-menu.png                  \
96         wsug_graphics/ws-enabled-protocols.png          \
97         wsug_graphics/ws-export-pdml.png                \
98         wsug_graphics/ws-export-plain.png               \
99         wsug_graphics/ws-export-ps.png                  \
100         wsug_graphics/ws-export-psml.png                \
101         wsug_graphics/ws-export-selected.png            \
102         wsug_graphics/ws-file-menu.png                  \
103         wsug_graphics/ws-file-set-dialog.png            \
104         wsug_graphics/ws-filter-add-expression.png      \
105         wsug_graphics/ws-filter-toolbar.png             \
106         wsug_graphics/ws-filters.png                    \
107         wsug_graphics/ws-find-packet.png                \
108         wsug_graphics/ws-follow-stream.png              \
109         wsug_graphics/ws-go-menu.png                    \
110         wsug_graphics/ws-goto-packet.png                \
111         wsug_graphics/ws-gui-colors-preferences.png     \
112         wsug_graphics/ws-gui-columns-preferences.png    \
113         wsug_graphics/ws-gui-font-preferences.png       \
114         wsug_graphics/ws-gui-layout-preferences.png     \
115         wsug_graphics/ws-gui-preferences.png            \
116         wsug_graphics/ws-help-menu.png                  \
117         wsug_graphics/ws-list-pane.png                  \
118         wsug_graphics/ws-main-toolbar.png               \
119         wsug_graphics/ws-menu.png                       \
120         wsug_graphics/ws-merge-gtk1.png                 \
121         wsug_graphics/ws-merge-gtk2.png                 \
122         wsug_graphics/ws-merge-win32.png                \
123         wsug_graphics/ws-nameresolution-preferences.png \
124         wsug_graphics/ws-open-gtk1.png                  \
125         wsug_graphics/ws-open-gtk2.png                  \
126         wsug_graphics/ws-open-win32.png                 \
127         wsug_graphics/ws-packet-format.png              \
128         wsug_graphics/ws-packet-pane-popup-menu.png     \
129         wsug_graphics/ws-packet-range.png               \
130         wsug_graphics/ws-packet-selected.png            \
131         wsug_graphics/ws-packet-sep-win.png             \
132         wsug_graphics/ws-print.png                      \
133         wsug_graphics/ws-printing-preferences.png       \
134         wsug_graphics/ws-save-as-gtk1.png               \
135         wsug_graphics/ws-save-as-gtk2.png               \
136         wsug_graphics/ws-save-as-win32.png              \
137         wsug_graphics/ws-statistics-menu.png            \
138         wsug_graphics/ws-stats-conversations.png        \
139         wsug_graphics/ws-stats-endpoints.png            \
140         wsug_graphics/ws-stats-hierarchy.png            \
141         wsug_graphics/ws-stats-iographs.png             \
142         wsug_graphics/ws-stats-srt-dcerpc-filter.png    \
143         wsug_graphics/ws-stats-srt-dcerpc.png           \
144         wsug_graphics/ws-stats-summary.png              \
145         wsug_graphics/ws-statusbar-empty.png            \
146         wsug_graphics/ws-statusbar-loaded.png           \
147         wsug_graphics/ws-statusbar-selected.png         \
148         wsug_graphics/ws-time-reference.png             \
149         wsug_graphics/ws-view-menu.png                  \
150         wsug_graphics/note.png                          \
151         wsug_graphics/tip.png                           \
152         wsug_graphics/warning.png                               \
153         wsug_graphics/toolbar/autoscroll_24.png                 \
154         wsug_graphics/toolbar/capture_filter_24.png             \
155         wsug_graphics/toolbar/capture_interfaces_24.png         \
156         wsug_graphics/toolbar/capture_options_24.png            \
157         wsug_graphics/toolbar/capture_restart_24.png            \
158         wsug_graphics/toolbar/capture_start_24.png              \
159         wsug_graphics/toolbar/capture_stop_24.png               \
160         wsug_graphics/toolbar/colorize_24.png                   \
161         wsug_graphics/toolbar/display_filter_24.png             \
162         wsug_graphics/toolbar/resize_columns_24.png             \
163         wsug_graphics/toolbar/stock_add_24.png                  \
164         wsug_graphics/toolbar/stock_apply_20.png                \
165         wsug_graphics/toolbar/stock_bottom_24.png               \
166         wsug_graphics/toolbar/stock_clear_24.png                \
167         wsug_graphics/toolbar/stock_close_24.png                \
168         wsug_graphics/toolbar/stock_colorselector_24.png        \
169         wsug_graphics/toolbar/stock_help_24.png                 \
170         wsug_graphics/toolbar/stock_jump_to_24.png              \
171         wsug_graphics/toolbar/stock_left_arrow_24.png           \
172         wsug_graphics/toolbar/stock_open_24.png                 \
173         wsug_graphics/toolbar/stock_preferences_24.png          \
174         wsug_graphics/toolbar/stock_print_24.png                \
175         wsug_graphics/toolbar/stock_properties_24.png           \
176         wsug_graphics/toolbar/stock_refresh_24.png              \
177         wsug_graphics/toolbar/stock_right_arrow_24.png          \
178         wsug_graphics/toolbar/stock_save_24.png                 \
179         wsug_graphics/toolbar/stock_save_as_24.png              \
180         wsug_graphics/toolbar/stock_search_24.png               \
181         wsug_graphics/toolbar/stock_stop_24.png                 \
182         wsug_graphics/toolbar/stock_top_24.png                  \
183         wsug_graphics/toolbar/stock_zoom_1_24.png               \
184         wsug_graphics/toolbar/stock_zoom_in_24.png              \
185         wsug_graphics/toolbar/stock_zoom_out_24.png             \
186         wsug_graphics/ws-logo.png                       \
187         wsug_graphics/ws-main.png
188
189 WSDG_FILES =    \
190         wsdg_src/WSDG_chapter_build_intro.xml   \
191         wsdg_src/WSDG_chapter_capture.xml       \
192         wsdg_src/WSDG_chapter_dissection.xml    \
193         wsdg_src/WSDG_chapter_env_intro.xml     \
194         wsdg_src/WSDG_chapter_libraries.xml     \
195         wsdg_src/WSDG_chapter_quick_setup.xml   \
196         wsdg_src/WSDG_chapter_sources.xml       \
197         wsdg_src/WSDG_chapter_tools.xml         \
198         wsdg_src/WSDG_chapter_userinterface.xml \
199         wsdg_src/WSDG_chapter_works.xml         \
200         wsdg_src/WSDG_meta_info.xml             \
201         wsdg_src/WSDG_preface.xml               \
202         ws.css
203
204 WSDG_GRAPHICS = \
205         wsdg_graphics/ws-capture-sync.dia       \
206         wsdg_graphics/ws-capture-sync.png       \
207         wsdg_graphics/ws-capture_internals.dia  \
208         wsdg_graphics/ws-capture_internals.png  \
209         wsdg_graphics/ws-function-blocks.dia    \
210         wsdg_graphics/ws-function-blocks.png    \
211         wsdg_graphics/ws-logo.png               \
212         wsdg_graphics/note.png                  \
213         wsdg_graphics/tip.png                   \
214         wsdg_graphics/warning.png
215
216 # user-guide.xml must be first in the list (to match $<)
217 WSUG_SOURCE =   \
218         user-guide.xml          \
219         svn_version.xml         \
220         Makefile                \
221         $(WSUG_FILES)           \
222         $(WSUG_GRAPHICS)
223
224 # developer-guide.xml must be first in the list (to match $<)
225 WSDG_SOURCE =   \
226         developer-guide.xml     \
227         svn_version.xml         \
228         Makefile                \
229         $(WSDG_FILES)           \
230         $(WSDG_GRAPHICS)
231
232 RELEASE_NOTES_SOURCE = \
233         release-notes.xml       \
234         svn_version.xml         \
235         Makefile
236
237 CLEANFILES =    \
238         *.chm                   \
239         *.fo                    \
240         *.hhc                   \
241         *.hhp                   \
242         *.pdf                   \
243         *.validated             \
244         wsdg_chm                \
245         wsdg_html               \
246         wsdg_html.zip           \
247         wsdg_html_chunked       \
248         wsdg_html_chunked.zip   \
249         wsug_chm                \
250         wsug_html               \
251         wsug_html.zip           \
252         wsug_html_chunked       \
253         wsug_html_chunked.zip   \
254         htmlhelp.*              \
255         release_notes_chm       \
256         release-notes.html      \
257         release-notes.txt       \
258         svn_version.xml         \
259         user-guide.zip          \
260
261
262 all: svn_version_check wsug.validated wsdg.validated release_notes.validated wsug wsdg release_notes
263
264 clean:
265         rm -rf $(CLEANFILES)
266
267 .SUFFIXES: .fo .pdf
268
269 #
270 # on every build, record the working copy revision string
271 #
272 # FORCE is the portable version of .PHONY
273 FORCE:
274
275 svn_version_check: FORCE
276         dos2unix ./check_svn_version.sh
277         @ ./check_svn_version.sh
278
279 svn_version.xml: svn_version_check
280
281
282 wsug: wsug_html_chunked user-guide.html user-guide-a4.pdf user-guide-us.pdf user-guide.chm user-guide.zip
283
284 # validate the content
285 wsug.validated: $(WSUG_SOURCE)
286         @ echo --- WSUG - VALIDATING XML ---
287         $(XMLLINT) --valid --noout $<
288         touch $@
289
290 # create html single page file
291 user-guide.html: wsug_html/user-guide.html
292
293 wsug_html/user-guide.html: $(WSUG_SOURCE)
294         @ echo --- WSUG - HTML SINGLE PAGE ---
295         mkdir -p wsug_html/wsug_graphics/toolbar
296         cp wsug_graphics/*.* wsug_html/wsug_graphics
297         cp wsug_graphics/toolbar/* wsug_html/wsug_graphics/toolbar
298         cp ws.css wsug_html
299         $(XSLTPROC) --stringparam base.dir wsug_html/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< > $@
300         -chmod -R og+rX wsug_html
301
302 # create html chunked page files
303 wsug_html_chunked: wsug_html_chunked/index.html
304
305 wsug_html_chunked/index.html: $(WSUG_SOURCE)
306         @ echo --- WSUG - HTML CHUNKED ---
307         mkdir -p wsug_html_chunked/wsug_graphics/toolbar
308         cp wsug_graphics/*.* wsug_html_chunked/wsug_graphics
309         cp wsug_graphics/toolbar/* wsug_html_chunked/wsug_graphics/toolbar
310         cp ws.css wsug_html_chunked
311         $(XSLTPROC) --stringparam base.dir wsug_html_chunked/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl $<
312         -chmod -R og+rX wsug_html_chunked
313
314 # create pdf file (through XSL-FO), portrait pages on US letter paper (the default)
315 # you will get lot's of errors, but that's ok
316 user-guide-us.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl
317 ifdef FOP
318         @ echo --- WSUG - PDF US PAPER ---
319         $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
320 endif
321
322 # create pdf file (through XSL-FO), portrait pages on A4 paper
323 # you will get lot's of errors, but that's ok
324 user-guide-a4.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl
325 ifdef FOP
326         @ echo --- WSUG - PDF A4 PAPER ---
327         $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
328 endif
329
330 # create MS html help file (through html chunked pages)
331 user-guide.chm: $(WSUG_SOURCE)
332 ifdef HHC
333         @ echo --- WSUG - MICROSOFT HTML HELP ---
334         mkdir -p wsug_chm/wsug_graphics/toolbar
335         -cp wsug_graphics/*.* wsug_chm/wsug_graphics/
336         -cp wsug_graphics/toolbar/* wsug_chm/wsug_graphics/toolbar/
337         $(XSLTPROC) --stringparam base.dir wsug_chm/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1  --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
338         -$(HHC) htmlhelp.hhp
339         -mv htmlhelp.chm $@
340         -rm -r htmlhelp.hhp
341         -rm -r toc.hhc
342 endif
343
344 user-guide.zip: user-guide.chm
345 ifdef HHC
346         rm -f user-guide.zip
347         zip user-guide.zip user-guide.chm
348 endif
349
350
351 wsdg: wsdg_html_chunked developer-guide.html developer-guide-a4.pdf developer-guide-us.pdf developer-guide.chm
352
353 # validate the content
354 wsdg.validated: $(WSDG_SOURCE)
355         @ echo --- WSDG - VALIDATING XML ---
356         $(XMLLINT) --valid --noout $<
357         touch $@
358
359 # create html single page file
360 developer-guide.html: wsdg_html/developer-guide.html
361
362 wsdg_html/developer-guide.html: $(WSDG_SOURCE)
363         @ echo --- WSDG - HTML SINGLE PAGE ---
364         mkdir -p wsdg_html/wsdg_graphics
365         cp wsdg_graphics/* wsdg_html/wsdg_graphics
366         cp ws.css wsdg_html
367         $(XSLTPROC) --stringparam base.dir wsdg_html/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsdg_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< > $@
368         -chmod -R og+rX wsdg_html
369
370 # create html chunked page files
371 wsdg_html_chunked: wsdg_html_chunked/index.html
372
373 wsdg_html_chunked/index.html: $(WSDG_SOURCE)
374         @ echo --- WSDG - HTML CHUNKED ---
375         mkdir -p wsdg_html_chunked
376         mkdir -p wsdg_html_chunked/wsdg_graphics
377         cp wsdg_graphics/* wsdg_html_chunked/wsdg_graphics
378         cp ws.css wsdg_html_chunked
379         $(XSLTPROC) --stringparam base.dir wsdg_html_chunked/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsdg_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl $<
380         -chmod -R og+rX wsdg_html_chunked
381
382 # create pdf file (through XSL-FO), portrait pages on US letter paper (the default)
383 # you will get lot's of errors, but that's ok
384 developer-guide-us.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl
385 ifdef FOP
386         @ echo --- WSDG - PDF US PAPER ---
387         $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
388 endif
389
390 # create pdf file (through XSL-FO), portrait pages on A4 paper
391 # you will get lot's of errors, but that's ok
392 developer-guide-a4.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl
393 ifdef FOP
394         @ echo --- WSDG - PDF A4 PAPER ---
395         $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
396 endif
397
398 # create MS html help file (through html chunked pages)
399 developer-guide.chm: $(WSDG_SOURCE)
400 ifdef HHC
401         @ echo --- WSDG - MICROSOFT HTML HELP ---
402         mkdir -p wsdg_chm/wsdg_graphics
403         cp wsdg_graphics/* wsdg_chm/wsdg_graphics
404         $(XSLTPROC) --stringparam base.dir wsdg_chm/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsdg_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --stringparam html.stylesheet ws.css --nonet http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
405         -$(HHC) htmlhelp.hhp
406         -mv htmlhelp.chm $@
407         -rm -r htmlhelp.hhp
408         -rm -r toc.hhc
409 endif
410
411
412 release_notes: release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf release-notes.chm
413
414 # validate the content
415 release_notes.validated: $(RELEASE_NOTES_SOURCE)
416         @ echo --- RELEASE NOTES - VALIDATING XML ---
417         $(XMLLINT) --valid --noout $<
418         touch $@
419
420 # create html single page file
421 release-notes.html: $(RELEASE_NOTES_SOURCE)
422         @ echo --- RELEASE NOTES - HTML ---
423         $(XSLTPROC) --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< > $@
424
425 # create txt single page file (through HTML)
426 release-notes.txt: $(RELEASE_NOTES_SOURCE)
427         @ echo --- RELEASE NOTES - TXT ---
428         $(XSLTPROC) --stringparam generate.toc "article nop" --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< | $(HTML2TXT) > $@
429         
430 # create pdf file (through XSL-FO), portrait pages on US letter paper (the default)
431 # you will get lot's of errors, but that's ok
432 release-notes-us.fo: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl
433 ifdef FOP
434         @ echo --- RELEASE NOTES - PDF US PAPER ---
435         $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
436 endif
437
438 # create pdf file (through XSL-FO), portrait pages on A4 paper
439 # you will get lot's of errors, but that's ok
440 release-notes-a4.fo: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl
441 ifdef FOP
442         @ echo --- RELEASE NOTES - PDF A4 PAPER ---
443         $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
444 endif
445
446 # create MS html help file (through html chunked pages)
447 release-notes.chm: $(RELEASE_NOTES_SOURCE)
448 ifdef HHC
449         @ echo --- RELEASE NOTES - MICROSOFT HTML HELP ---
450         $(XSLTPROC) --stringparam base.dir release_notes_chm/ --stringparam  use.id.as.filename 1 --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 --nonet http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
451         -$(HHC) htmlhelp.hhp
452         -mv htmlhelp.chm $@
453         -rm -r htmlhelp.hhp
454         -rm -r toc.hhc
455 endif
456