aboutsummaryrefslogtreecommitdiffstats
path: root/docbook/Makefile.nmake
blob: 21c018fda4b4d15d97fcb3b7aff1e61f8f9fcb10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#
# Make the "Wireshark User Guide" and "Wireshark Developer Guide"
# in several formats.
# See the Readme.txt file for instructions.
#
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake [target ...]
#

############### YOU SHOULDN'T HAVE TO EDIT ANYTHING BELOW THIS LINE! ################

TOOLS_DIR=..\tools
include ..\config.nmake
top_srcdir=..
include Makefile.common

WSUG_SOURCE          = $(WSUG_SOURCE)          Makefile.nmake
WSDG_SOURCE          = $(WSDG_SOURCE)          Makefile.nmake
RELEASE_NOTES_SOURCE = $(RELEASE_NOTES_SOURCE) Makefile.nmake

# Asciidoc converter
A2X_HTML_OPTS="--stylesheet=ws.css"
A2X_TEXT_OPTS=

!ifdef LYNX
A2X_TEXT_OPTS=$(A2X_TEXT_OPTS) --lynx
!endif

# Automatically generate .pdf files from .fo files
.fo.pdf:
	$(FOP) $< $@

.SUFFIXES: .fo .pdf

# -- (Public) targets -------------------------------------------------------

# Make all (default)
all: all_x

# Make only the WSUG
wsug: wsug.validated wsug_x

# Make only the WSDG
wsdg: wsdg.validated wsdg_x

# Make only the release notes
release_notes: release_notes_x

# Clean all
clean:
	rm -rf $(CLEANFILES) $(CLEANDIRS)

distclean: clean

maintainer-clean: distclean

# -- All -------------------------------------------------------------------------------

all_x: wsug.validated wsdg.validated wsug_x wsdg_x release_notes_x

# -- User Guide ------------------------------------------------------------------------

wsug_x: wsug_html_chunked wsug_html user-guide-a4.pdf user-guide-us.pdf user-guide.chm

user-guide.xml: user-guide.asciidoc $(WSUG_FILES) user-guide-docinfo.xml
	@ echo --- WSUG - XML ---
	$(SH) <<
	PATH=/usr/bin
	PYTHONHOME=/
	$(A2X) --verbose \
		--attribute=docinfo \
		--asciidoc-opts="--conf-file=asciidoc.conf --conf-file=asciidoctor-asciidoc.conf" \
		--no-xmllint \
		--format=docbook \
		user-guide.asciidoc
<<

# validate the content
wsug.validated: $(WSUG_SOURCE)
	@ echo --- WSUG - VALIDATING XML ---
	$(XMLLINT) --valid --noout user-guide.xml
	touch $@

# create html single page file
wsug_html: wsug_html\index.html

wsug_html\index.html: $(WSUG_SOURCE)
	@ echo --- WSUG - HTML SINGLE PAGE ---
	if not exist wsug_html\wsug_graphics\toolbar md wsug_html\wsug_graphics\toolbar
	cp wsug_graphics/*.* wsug_html/wsug_graphics
	cp common_graphics/*.* wsug_html/wsug_graphics
	cp wsug_graphics/toolbar/* wsug_html/wsug_graphics/toolbar
	cp ws.css wsug_html
	$(XSLTPROC) --stringparam base.dir wsug_html/ $(COMMON_XSLTPROC_ARGS) \
		$(WSUG_XSLTPROC_ARGS) $(SINGLE_XSLTPROC_ARGS) user-guide.xml > $@

# create html chunked page files
wsug_html_chunked: wsug_html_chunked\index.html

wsug_html_chunked\index.html: $(WSUG_SOURCE)
	@ echo --- WSUG - HTML CHUNKED ---
	if not exist wsug_html_chunked\wsug_graphics\toolbar md wsug_html_chunked\wsug_graphics\toolbar
	cp wsug_graphics/*.* wsug_html_chunked/wsug_graphics
	cp common_graphics/*.* wsug_html_chunked/wsug_graphics
	cp wsug_graphics/toolbar/* wsug_html_chunked/wsug_graphics/toolbar
	cp ws.css wsug_html_chunked
	$(XSLTPROC) --stringparam base.dir wsug_html_chunked/ $(COMMON_XSLTPROC_ARGS) \
		$(WSUG_XSLTPROC_ARGS)  $(CHUNKED_XSLTPROC_ARGS) user-guide.xml

# create pdf file (through XSL-FO), portrait pages on US letter paper (the default)
# you will get lot's of errors, but that's ok
user-guide-us.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl
!ifdef FOP
	@ echo --- WSUG - PDF US PAPER ---
	$(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl user-guide.xml > $@
!endif

# create pdf file (through XSL-FO), portrait pages on A4 paper
# you will get lot's of errors, but that's ok
user-guide-a4.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl
!ifdef FOP
	@ echo --- WSUG - PDF A4 PAPER ---
	$(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl user-guide.xml > $@
!endif

# create MS html help file (through html chunked pages)
user-guide.chm: $(WSUG_SOURCE)
!ifdef HHC_EXE
	@ echo --- WSUG - MICROSOFT HTML HELP ---
	if not exist wsug_chm\wsug_graphics\toolbar md wsug_chm\wsug_graphics\toolbar
	-cp wsug_graphics/*.* wsug_chm/wsug_graphics
	-cp common_graphics/*.* wsug_chm/wsug_graphics
	-cp wsug_graphics/toolbar/* wsug_chm/wsug_graphics/toolbar
	$(XSLTPROC) --stringparam base.dir wsug_chm/ $(COMMON_XSLTPROC_ARGS) \
		$(WSUG_XSLTPROC_ARGS) $(HTMLHELP_XSLTPROC_ARGS) user-guide.xml
	-$(HHC_EXE) htmlhelp.hhp
	-mv htmlhelp.chm $@
	-rm -r htmlhelp.hhp
	-rm -r toc.hhc
!endif

wsluarm: make-wsluarm.pl $(WSLUA_MODULES)
	if not exist wsluarm_src md wsluarm_src
	$(PERL) make-wsluarm.pl $(WSLUA_MODULES)
	touch wsluarm

# -- Developer's Guide ------------------------------------------------------------------------

wsdg_x: wsdg_html_chunked wsdg_html developer-guide-a4.pdf developer-guide-us.pdf developer-guide.chm

developer-guide.xml: developer-guide.asciidoc $(WSDG_FILES) wsluarm developer-guide-docinfo.xml
	@ echo --- WSDG - XML ---
	$(SH) <<
	PATH=/usr/bin
	PYTHONHOME=/
	$(A2X) --verbose \
		--attribute=docinfo \
		--asciidoc-opts="--conf-file=asciidoc.conf --conf-file=asciidoctor-asciidoc.conf" \
		--no-xmllint \
		--format=docbook \
		developer-guide.asciidoc
<<

# validate the content
wsdg.validated: $(WSDG_SOURCE)
	@ echo --- WSDG - VALIDATING XML ---
	$(XMLLINT) --valid --noout developer-guide.xml
	touch $@

# create html single page file
wsdg_html: wsdg_html\index.html

wsdg_html\index.html: $(WSDG_SOURCE)
	@ echo --- WSDG - HTML SINGLE PAGE ---
	if not exist wsdg_html\wsdg_graphics md wsdg_html\wsdg_graphics
	if not exist wsdg_html\wsdg_graphics\toolbar md wsdg_html\wsdg_graphics\toolbar
	cp wsdg_graphics/*.* wsdg_html/wsdg_graphics
	cp common_graphics/*.* wsdg_html/wsdg_graphics
	cp wsdg_graphics/toolbar/* wsdg_html/wsdg_graphics/toolbar
	cp ws.css wsdg_html
	$(XSLTPROC) --stringparam base.dir wsdg_html/ $(COMMON_XSLTPROC_ARGS) \
		$(WSDG_XSLTPROC_ARGS) $(SINGLE_XSLTPROC_ARGS) developer-guide.xml > $@

# create html chunked page files
wsdg_html_chunked: wsdg_html_chunked\index.html

wsdg_html_chunked\index.html: $(WSDG_SOURCE)
	@ echo --- WSDG - HTML CHUNKED ---
	if not exist wsdg_html_chunked\wsdg_graphics md wsdg_html_chunked\wsdg_graphics
	if not exist wsdg_html_chunked\wsdg_graphics\toolbar md wsdg_html_chunked\wsdg_graphics\toolbar
	cp wsdg_graphics/*.* wsdg_html_chunked/wsdg_graphics
	cp common_graphics/*.* wsdg_html_chunked/wsdg_graphics
	cp wsdg_graphics/toolbar/* wsdg_html_chunked/wsdg_graphics/toolbar
	cp ws.css wsdg_html_chunked
	$(XSLTPROC) --stringparam base.dir wsdg_html_chunked/ $(COMMON_XSLTPROC_ARGS) \
		$(WSDG_XSLTPROC_ARGS) $(CHUNKED_XSLTPROC_ARGS) developer-guide.xml

# create pdf file (through XSL-FO), portrait pages on US letter paper (the default)
# you will get lot's of errors, but that's ok
developer-guide-us.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl
!ifdef FOP
	@ echo --- WSDG - PDF US PAPER ---
	$(XSLTPROC) --stringparam paper.type letter --nonet custom_layer_pdf.xsl developer-guide.xml > $@
!endif

# create pdf file (through XSL-FO), portrait pages on A4 paper
# you will get lot's of errors, but that's ok
developer-guide-a4.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl
!ifdef FOP
	@ echo --- WSDG - PDF A4 PAPER ---
	$(XSLTPROC) --stringparam paper.type A4 --nonet custom_layer_pdf.xsl developer-guide.xml > $@
!endif

# create MS html help file (through html chunked pages)
developer-guide.chm: $(WSDG_SOURCE)
!ifdef HHC_EXE
	@ echo --- WSDG - MICROSOFT HTML HELP ---
	if not exist wsdg_chm\wsdg_graphics md wsdg_chm\wsdg_graphics
	if not exist wsdg_chm\wsdg_graphics\toolbar md wsdg_chm\wsdg_graphics\toolbar
	-cp wsdg_graphics/*.* wsdg_chm/wsdg_graphics
	-cp common_graphics/*.* wsdg_chm/wsdg_graphics
	-cp wsdg_graphics/toolbar/* wsdg_chm/wsdg_graphics/toolbar
	$(XSLTPROC) --stringparam base.dir wsdg_chm/ $(COMMON_XSLTPROC_ARGS) \
		$(WSDG_XSLTPROC_ARGS) $(HTMLHELP_XSLTPROC_ARGS) developer-guide.xml
	-$(HHC_EXE) htmlhelp.hhp
	-mv htmlhelp.chm $@
	-rm -r htmlhelp.hhp
	-rm -r toc.hhc
!endif

# -- Release Notes ------------------------------------------------------------------------

release_notes_x: release-notes.html release-notes.txt

release_notes_pdf: release-notes-a4.pdf release-notes-us.pdf

# create html single page file
release-notes.html: $(RELEASE_NOTES_SOURCE)
	@ echo --- RELEASE NOTES - HTML ---
	$(SH) <<
	PATH=/usr/bin
	PYTHONHOME=/
	$(A2X) -v --format=xhtml $(A2X_HTML_OPTS) release-notes.asciidoc
<<

# create txt single page file (through HTML)
release-notes.txt: $(RELEASE_NOTES_SOURCE)
	@ echo --- RELEASE NOTES - TXT ---
	$(SH) <<
	PATH=/usr/bin
	PYTHONHOME=/
	TZ=UTC
	$(A2X) -v --format=text $(A2X_TEXT_OPTS) \
		--xsltproc-opts "--stringparam generate.toc \"article nop\"" \
		release-notes.asciidoc
<<
	mv release-notes.text $@

news: release-notes.txt
	copy release-notes.txt ..\NEWS

# create pdf file, portrait pages on US letter paper
release-notes-us.pdf: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl
	@ echo --- RELEASE NOTES - PDF US LETTER PAPER ---
	$(SH) <<
	PATH=/usr/bin
	PYTHONHOME=/
	$(A2X) --format=pdf $(A2X_HTML_OPTS) \
		--xsltproc-opts "--stringparam paper.type letter --nonet" \
		--xsl-file=custom_layer_pdf.xsl \
		release-notes.asciidoc
<<
	mv release-notes.pdf $@

# create pdf file, portrait pages on A4 paper
release-notes-a4.pdf: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl
	@ echo --- RELEASE NOTES - PDF A4 PAPER ---
	$(SH) <<
	PATH=/usr/bin
	PYTHONHOME=/
	$(A2X) --format=pdf $(A2X_HTML_OPTS) \
		--xsltproc-opts "--stringparam paper.type A4 --nonet" \
		--xsl-file=custom_layer_pdf.xsl \
		release-notes.asciidoc
<<
	mv release-notes.pdf $@

_FORCE_:  ## Assumption: no file named _FORCE_ exists in the current directory