506bf19f907c9c13750d4670abd95f16e54e4529
[obnox/wireshark/wip.git] / docbook / Makefile.am
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 is found in configure.in .
15 # XXX - have it check for the right version (0.20.5 or newer)?
16
17 # html to text converter for text version of release notes, e.g. elinks.
18 # This could also be "lynx", or "true" if neither elinks nor lynx is installed
19 # (See Bug # 1446 for note re 'force-html' below)
20 # Sorry about the indenting, but that's what automake requires...
21 if HAVE_ELINKS
22 HTML2TXT=$(ELINKS) -dump -dump-width 72
23 ## links: -dump requires 'url' argument (as opposed to elinks & lynx)
24 ## (Rather than fixing things we'll just disable the use of links).
25 ##else
26 ##if HAVE_LINKS
27 ##HTML2TXT=$(LINKS) -dump -width 72
28 else
29 if HAVE_LYNX
30 HTML2TXT=$(LYNX) -dump -width=72 -nolist -stdin -force-html
31 else
32 HTML2TXT="true"
33 endif
34 ##endif
35 endif
36
37 ############### YOU SHOULDN'T HAVE TO EDIT ANYTHING BELOW THIS LINE! ################
38
39 include Makefile.common
40
41 # Automatically generate .pdf files from .fo files
42 # Suse needs FOP_OPTS, Debian needs JAVA_OPTS
43 .fo.pdf:
44 if HAVE_FOP
45         FOP_OPTS=$(FOP_OPTS) JAVA_OPTS=$(FOP_OPTS) $(FOP) $< $@
46 else
47         false
48 endif
49
50
51 if HAVE_XSLTPROC
52 ALL_TARGETS=svn_version_check wsug wsdg release_notes
53 else
54 # if we don't have XSLTPROC, there's nothing to do...
55 ALL_TARGETS=svn_version_check
56 endif
57
58 all: $(ALL_TARGETS)
59
60 #
61 # on every build, record the working copy revision string
62 #
63 # FORCE is the portable version of .PHONY
64 FORCE:
65
66 svn_version_check: FORCE
67         cat $(srcdir)/check_svn_version.sh | tr -d '\015' | /bin/bash
68
69 svn_version.xml: svn_version_check
70
71 # Wireshark User Guide
72 if HAVE_FOP
73 WSUG_TARGETS=wsug.validated wsug_html_chunked user-guide.html user-guide-a4.pdf user-guide-us.pdf 
74 else
75 WSUG_TARGETS=wsug.validated wsug_html_chunked user-guide.html
76 endif
77
78 wsug: $(WSUG_TARGETS)
79
80 # validate the content
81 wsug.validated: $(WSUG_SOURCE) wsluarm
82 if HAVE_XMLLINT
83         @ echo --- WSUG - VALIDATING XML ---
84         $(XMLLINT) --valid --noout $<
85         touch $@
86 else
87         @ echo --- WSUG - SKIP VALIDATION ---
88 endif
89
90 # create html single page file
91 user-guide.html: wsug_html/user-guide.html
92
93 wsug_html/user-guide.html: $(WSUG_SOURCE) wsluarm
94         @ echo --- WSUG - HTML SINGLE PAGE ---
95         mkdir -p wsug_html/wsug_graphics/toolbar
96         cp $(srcdir)/wsug_graphics/*.* wsug_html/wsug_graphics
97         cp $(srcdir)/wsug_graphics/toolbar/* wsug_html/wsug_graphics/toolbar
98         cp $(srcdir)/ws.css wsug_html
99         $(XSLTPROC) --stringparam base.dir wsug_html/ --stringparam  use.id.as.filename 1 \
100                     --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ \
101                     --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 \
102                     --stringparam html.stylesheet ws.css \
103                     --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< > $@
104         -chmod -R og+rX wsug_html
105
106 # create html chunked page files
107 wsug_html_chunked: wsug_html_chunked/index.html
108
109 wsug_html_chunked/index.html: $(WSUG_SOURCE) wsluarm
110         @ echo --- WSUG - HTML CHUNKED ---
111         mkdir -p wsug_html_chunked/wsug_graphics/toolbar
112         cp $(srcdir)/wsug_graphics/*.* wsug_html_chunked/wsug_graphics
113         cp $(srcdir)/wsug_graphics/toolbar/* wsug_html_chunked/wsug_graphics/toolbar
114         cp $(srcdir)/ws.css wsug_html_chunked
115         $(XSLTPROC) --stringparam base.dir wsug_html_chunked/ --stringparam  use.id.as.filename 1 \
116                     --stringparam admon.graphics 1 --stringparam admon.graphics.path wsug_graphics/ \
117                     --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 \
118                     --stringparam html.stylesheet ws.css \
119                     --nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl $<
120         -chmod -R og+rX wsug_html_chunked
121
122 # create pdf file (through XSL-FO), portrait pages on US letter paper
123 # you will get lot's of errors, but that's ok
124 user-guide-us.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl wsluarm
125         @ echo --- WSUG - PDF US PAPER ---
126         $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
127
128 # create pdf file (through XSL-FO), portrait pages on A4 paper
129 # you will get lot's of errors, but that's ok
130 user-guide-a4.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl wsluarm
131         @ echo --- WSUG - PDF A4 PAPER ---
132         $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
133
134 wsluarm: make-wsluarm.pl $(WSLUA_MODULES)
135         mkdir -p wsluarm_src
136         $(PERL) $(srcdir)/make-wsluarm.pl $(WSLUA_MODULES)
137         touch wsluarm
138
139
140 # Wireshark Developer Guide
141 if HAVE_FOP
142 WSDG_TARGETS=wsdg.validated wsdg_html_chunked developer-guide.html developer-guide-a4.pdf developer-guide-us.pdf
143 else
144 WSDG_TARGETS=wsdg.validated wsdg_html_chunked developer-guide.html
145 endif
146
147 wsdg: $(WSDG_TARGETS)
148
149 # validate the content
150 wsdg.validated: $(WSDG_SOURCE)
151 if HAVE_XMLLINT
152         @ echo --- WSDG - VALIDATING XML ---
153         $(XMLLINT) --valid --noout $<
154         touch $@
155 else
156         @ echo --- WSDG - SKIP VALIDATION ---
157 endif
158
159 # create html single page file
160 developer-guide.html: wsdg_html/developer-guide.html
161
162 wsdg_html/developer-guide.html: $(WSDG_SOURCE)
163         @ echo --- WSDG - HTML SINGLE PAGE ---
164         mkdir -p wsdg_html/wsdg_graphics
165         cp $(srcdir)/wsdg_graphics/* wsdg_html/wsdg_graphics
166         cp $(srcdir)/ws.css wsdg_html
167         $(XSLTPROC) --stringparam base.dir wsdg_html/ --stringparam  use.id.as.filename 1 \
168                     --stringparam admon.graphics 1 --stringparam admon.graphics.path wsdg_graphics/ \
169                     --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 \
170                     --stringparam html.stylesheet ws.css \
171                     --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $< > $@
172         -chmod -R og+rX wsdg_html
173
174 # create html chunked page files
175 wsdg_html_chunked: wsdg_html_chunked/index.html
176
177 wsdg_html_chunked/index.html: $(WSDG_SOURCE)
178         @ echo --- WSDG - HTML CHUNKED ---
179         mkdir -p wsdg_html_chunked/wsdg_graphics
180         cp $(srcdir)/wsdg_graphics/* wsdg_html_chunked/wsdg_graphics
181         cp $(srcdir)/ws.css wsdg_html_chunked
182         $(XSLTPROC) --stringparam base.dir wsdg_html_chunked/ --stringparam  use.id.as.filename 1 \
183                     --stringparam admon.graphics 1 --stringparam admon.graphics.path wsdg_graphics/  \
184                     --stringparam section.autolabel 1 --stringparam  section.label.includes.component.label 1 \
185                     --stringparam html.stylesheet ws.css \
186                     --nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl $<
187         -chmod -R og+rX wsdg_html_chunked
188
189 # create pdf file (through XSL-FO), portrait pages on US letter paper
190 # you will get lot's of errors, but that's ok
191 developer-guide-us.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl
192         @ echo --- WSDG - PDF US PAPER ---
193         $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
194
195 # create pdf file (through XSL-FO), portrait pages on A4 paper
196 # you will get lot's of errors, but that's ok
197 developer-guide-a4.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl
198         @ echo --- WSDG - PDF A4 PAPER ---
199         $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
200
201
202 if HAVE_FOP
203 RELEASE_NOTES_TARGETS=release_notes.validated release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf
204 else
205 RELEASE_NOTES_TARGETS=release_notes.validated release-notes.html release-notes.txt
206 endif
207
208 release_notes: $(RELEASE_NOTES_TARGETS)
209
210 # validate the content
211 release_notes.validated: $(RELEASE_NOTES_SOURCE)
212 if HAVE_XMLLINT
213         @ echo --- RELEASE NOTES - VALIDATING XML ---
214         $(XMLLINT) --valid --noout $<
215         touch $@
216 else
217         @ echo --- RELEASE NOTES - SKIP VALIDATION ---
218 endif
219
220 # create html single page file
221 release-notes.html: $(RELEASE_NOTES_SOURCE)
222         @ echo --- RELEASE NOTES - HTML ---
223         $(XSLTPROC) --nonet http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $< > $@
224
225 # create txt single page file (through HTML)
226 release-notes.txt: $(RELEASE_NOTES_SOURCE)
227         @ echo --- RELEASE NOTES - TXT ---
228         $(XSLTPROC) --stringparam generate.toc "article nop" \
229                     --nonet http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $< | $(HTML2TXT) > $@
230
231 news: release-notes.txt
232         cp release-notes.txt ../NEWS 
233
234 # create pdf file (through XSL-FO), portrait pages on US letter paper
235 # you will get lot's of errors, but that's ok
236 release-notes-us.fo: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl
237         @ echo --- RELEASE NOTES - PDF US PAPER ---
238         $(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl $< > $@
239
240 # create pdf file (through XSL-FO), portrait pages on A4 paper
241 # you will get lot's of errors, but that's ok
242 release-notes-a4.fo: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl
243         @ echo --- RELEASE NOTES - PDF A4 PAPER ---
244         $(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl $< > $@
245
246 clean-local:
247         -rm -rf $(CLEANDIRS)
248
249 # XXX if we actually use automake to build this stuff, most of this shouldn't
250 # be necessary
251 EXTRA_DIST=$(WSUG_SOURCE) $(WSDG_SOURCE) $(RELEASE_NOTES_SOURCE) \
252             check_svn_version.sh make-wsluarm.pl Makefile.nmake
253
254 MAINTAINERCLEANFILES = \
255         Makefile.in