VirtualBox

source: vbox/trunk/doc/manual/Makefile.kmk@ 68716

Last change on this file since 68716 was 68400, checked in by vboxsync, 7 years ago

manual/Makefile.kmk: only try to validate anything if the docbook DTD path is set (the user manual already did this)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 50.6 KB
Line 
1# $Id: Makefile.kmk 68400 2017-08-11 19:11:14Z vboxsync $
2## @file
3# Sub-Makefile for the VirtualBox User Manual, SDK reference and other manuals.
4#
5
6#
7# Copyright (C) 2006-2016 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18#
19# This slightly messy makefile transforms the DocBook XML source for the
20# user manual into presentation output. We support two targets:
21#
22# -- UserManual.pdf, generated by LaTex
23#
24# -- VirtualBox.chm
25#
26# Both files end up in PATH_STAGE_BIN.
27#
28# Both targets indirectly depend on the XML files in this directory;
29# "indirectly" because we first copy them to PATH_TARGET and hack them
30# up a bit for variable substitution and such (see below).
31# The toolchains are roughly like this:
32#
33# -- PDF file via Apache FOP: pre-process the XML files in PATH_TARGET,
34# then create a .FO file (another XML format for "formatted objects")
35# via xsltproc, then feed the .FO file to Apache FOP to create the PDF.
36#
37# -- PDF file via LaTeX: pre-process the XML files in PATH_TARGET, then
38# run our custom "dblatex" perl script on UserManual.xml, which parses
39# the XML (using the Perl SAX parsers) and dumps a matching latex file
40# to UserManual.tex. This is then regularly processed by pdflatex to
41# generate PDF.
42#
43# -- CHM file: again, pre-process the XML files in PATH_TARGET, then use
44# xsltproc to create a .HHP file for the Microsoft Help Compiler, then
45# feed that file to it.
46#
47
48SUB_DEPTH = ../..
49include $(KBUILD_PATH)/subheader.kmk
50
51
52#
53# Globals
54#
55
56# Error out if someone tries to override old globals.
57ifdef HTMLHELPOPTS
58 $(error HTMLHELPOPTS was renamed to VBOX_HTMLHELP_OPTS!)
59endif
60ifdef DOCBOOKPATH
61 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
62endif
63ifdef DOCBOOKPATH
64 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
65endif
66ifdef XML_CATALOG
67 $(error XML_CATALOG was renamed to VBOX_XML_CATALOG!)
68endif
69ifdef XML_CATALOG_DOCBOOK
70 $(error XML_CATALOG_DOCBOOK was renamed to VBOX_XML_CATALOG_DOCBOOK!)
71endif
72ifdef VBOXMANAGEPATH
73 $(error VBOXMANAGEPATH was renamed to VBOXMANAGEHELP_PATH!)
74endif
75ifdef PDFLATEX_INTERACTION
76 $(error PDFLATEX_INTERACTION was renamed to VBOX_PDFLATEX_INTERACTION!)
77endif
78ifdef PDFLATEX
79 $(error PDFLATEX was renamed to VBOX_PDFLATEX_CMD!)
80endif
81ifdef HHC
82 $(error HHC was renamed to VBOX_HHC!)
83endif
84
85# Source and output locations.
86VBOX_PATH_MANUAL_SRC := $(PATH_SUB_CURRENT)
87VBOX_PATH_MANUAL_OUTBASE := $(PATH_TARGET)/manual
88
89# tool locations
90ifndef VBOX_OSE
91 # use docbook from our tools directory
92 VBOX_PATH_DOCBOOK ?= $(PATH_DEVTOOLS)/common/DocBook/v1.69.1
93 VBOX_PATH_DOCBOOK_DTD ?= $(PATH_DEVTOOLS)/common/docbook-xml/v4.3
94 VBOX_XML_CATALOG ?= $(VBOX_PATH_MANUAL_OUTBASE)/catalog
95 VBOX_XML_CATALOG_DOCBOOK ?= $(VBOX_PATH_MANUAL_OUTBASE)/docbook
96else
97 # use docbook of the build host
98 VBOX_PATH_DOCBOOK ?= http://docbook.sourceforge.net/release/xsl/current/
99endif
100
101# xsltproc with the catalog trick if applicable.
102ifdef VBOX_XML_CATALOG
103 VBOX_XSLTPROC_WITH_CAT = $(REDIRECT) -E "XML_CATALOG_FILES=$(VBOX_XML_CATALOG)" $1 -- \
104 $(VBOX_XSLTPROC) --nonet --xinclude $(VBOX_XSLTPROC_OPTS)
105 VBOX_XMLLINT_WITH_CAT = $(REDIRECT) -E "XML_CATALOG_FILES=$(VBOX_XML_CATALOG)" -- \
106 $(VBOX_XMLLINT) --nonet --xinclude --noout $(VBOX_XMLLINT_OPTS)
107else
108 VBOX_XSLTPROC_WITH_CAT = $(if $(1), $(REDIRECT) $1 --,) $(VBOX_XSLTPROC) --nonet --xinclude $(VBOX_XSLTPROC_OPTS)
109 VBOX_XMLLINT_WITH_CAT = $(VBOX_XMLLINT) --nonet --xinclude --noout $(VBOX_XMLLINT_OPTS)
110endif
111
112VBOXMANAGEHELP_PATH ?= $(PATH_STAGE_BIN)/VBoxManageHelp$(SUFF_EXE)
113
114 # VBOX_PDFLATEX_INTERACTION = errorstopmode - Use this when you wants to figure out build failures
115 # without catting the log a million times.
116VBOX_PDFLATEX_INTERACTION ?= batchmode
117ifeq ($(KBUILD_HOST),win)
118 ifndef VBOX_PDFLATEX
119 VBOX_PDFLATEX := $(firstword $(rsort $(wildcard $(PATH_DEVTOOLS)/win.x86/miktex-portable/*/miktex/bin/pdflatex.exe)))
120 ifneq ($(VBOX_PDFLATEX),)
121 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION)
122 endif
123 endif
124 ifndef VBOX_PDFLATEX
125 # Tell MiKTeX to automatically download packages if system wide install.
126 VBOX_PDFLATEX := pdflatex
127 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION) --enable-installer
128 endif
129else
130 VBOX_PDFLATEX ?= pdflatex
131 VBOX_PDFLATEX_HALT = $(shell ( $(VBOX_PDFLATEX) -version | head -1 | grep 141592 > /dev/null ) && echo -halt-on-error )
132 VBOX_PDFLATEX_CMD = pdflatex $(VBOX_PDFLATEX_HALT) -interaction $(VBOX_PDFLATEX_INTERACTION)
133endif
134
135# Windows HTML Help Workshop compiler (stupid thing always returns an error!)
136VBOX_HHC = -$(EXEC_X86_WIN32) $(VBOX_PATH_HTML_HELP_WORKSHOP)/hhc.exe
137
138
139# Additional xsltproc options when generating
140VBOX_HTMLHELP_OPTS ?=
141
142# SDK related globals.
143VBOX_MANUAL_APIREF_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef_apiref.xml
144VBOX_DOC_XIDL_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
145VBOX_DOC_XIDL_SRC_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.xidl.tmp
146
147##
148# Non-pattern-rule approach to editing XSLT files.
149# $(evalcall2 def_vbox_replace_paths_in_xslt)
150# @param 1 The XSLT source file (relative to Makefile dir).
151# @param 2 Optional output subdirectory (leading slash).
152define def_vbox_replace_paths_in_xslt
153OTHER_CLEAN += $$(VBOX_PATH_MANUAL_OUTBASE)$2/$(notdir $1)
154$$(VBOX_PATH_MANUAL_OUTBASE)$2/$(notdir $1): $$(VBOX_PATH_MANUAL_SRC)/$1 | $$$$(dir $$$$@)
155 $$(call MSG_L1,Pre-processing $$(<) to $$(@))
156 $$(QUIET)$$(SED) \
157 -e 's|@VBOX_PATH_DOCBOOK@|$$(VBOX_PATH_DOCBOOK)|g' \
158 -e 's|@VBOX_PATH_MANUAL_SRC@|$$(VBOX_PATH_MANUAL_SRC)|g' \
159 -e 's|@VBOX_PATH_MANUAL_OUTBASE@|$$(VBOX_PATH_MANUAL_OUTBASE)|g' \
160 -e 's|@VBOX_PATH_MANUAL_OUT_LANG@|$$(VBOX_PATH_MANUAL_OUTBASE)$2|g' \
161 --output "$$(@)" $$<
162endef
163
164##
165# Non-pattern-rule approach to editing XML files.
166# $(evalcall2 def_vbox_replace_stuff_in_xml)
167# @param 1 The XSLT source file (relative to Makefile dir).
168# @param 2 Optional output subdirectory (leading slash).
169#
170define def_vbox_replace_stuff_in_xml
171OTHER_CLEAN += $$(VBOX_PATH_MANUAL_OUTBASE)$2/$(notdir $1)
172$$(VBOX_PATH_MANUAL_OUTBASE)$2/$(notdir $1): $$(VBOX_PATH_MANUAL_SRC)/$1 $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
173 $$(call MSG_L1,Pre-processing $$(<) to $$(@))
174 $$(QUIET)$$(SED) \
175 -e 's|@VBOX_PATH_DOCBOOK@|$$(VBOX_PATH_DOCBOOK)|g' \
176 -e 's|@VBOX_PATH_MANUAL_SRC@|$$(VBOX_PATH_MANUAL_SRC)|g' \
177 -e 's|@VBOX_PATH_MANUAL_OUTBASE@|$$(VBOX_PATH_MANUAL_OUTBASE)|g' \
178 -e 's|@VBOX_PATH_MANUAL_OUT_LANG@|$$(VBOX_PATH_MANUAL_OUTBASE)$2|g' \
179 \
180 -e 's/@VBOX_VERSION_MAJOR@/$$(VBOX_VERSION_MAJOR)/g' \
181 -e 's/@VBOX_VERSION_MINOR@/$$(VBOX_VERSION_MINOR)/g' \
182 -e 's/@VBOX_VERSION_BUILD@/$$(VBOX_VERSION_BUILD)/g' \
183 -e 's/@VBOX_VERSION_STRING@/$$(VBOX_VERSION_STRING)/g' \
184 -e 's/@VBOX_VENDOR@/$$(VBOX_VENDOR)/g' \
185 -e 's/@VBOX_PRODUCT@/$$(VBOX_PRODUCT)/g' \
186 -e 's/@VBOX_C_YEAR@/$$(VBOX_C_YEAR)/g' \
187 \
188 --output "$$(@)" $$<
189endef
190
191## List of refentry files (manpages).
192VBOX_MANUAL_XML_REFENTRY_FILES = \
193 man_VBoxManage-debugvm.xml \
194 man_VBoxManage-extpack.xml \
195 man_VBoxManage-unattended.xml
196
197
198#
199# Targets
200#
201
202BLDDIRS += $(VBOX_PATH_MANUAL_OUTBASE) $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, $(VBOX_MANUAL_LANGUAGES))
203
204
205if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
206 if defined(VBOX_ONLY_SDK) || defined(VBOX_WITH_DOCS_SDKREF)
207 INSTALLS += VBox-docs-sdkref
208 endif
209
210 ifdef VBOX_WITH_DOCS_CHM
211 INSTALLS += VBox-docs-usermanual-chm
212 VBOX_PATH_BIN_CHM = $(PATH_STAGE_BIN)/VirtualBox.chm
213 else # Do not build chm.
214 VBOX_PATH_BIN_CHM =
215 endif
216
217 ifndef VBOX_ONLY_SDK
218 VBOX_MANUAL_PACK += \
219 $(PATH_STAGE_BIN)/UserManual.pdf \
220 $(VBOX_PATH_BIN_CHM)
221 INSTALLS += VBox-docs-usermanual
222
223 ifdef VBOX_WITH_DOCS_TRANSLATIONS
224 INSTALLS += VBox-docs-usermanual-l10n
225 VBOX_MANUAL_PACK += \
226 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf)
227 ifdef VBOX_WITH_DOCS_CHM
228 INSTALLS += VBox-docs-usermanual-l10n-chm
229 VBOX_MANUAL_PACK += \
230 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm)
231 endif
232 endif
233 endif # !VBOX_ONLY_SDK
234
235 ifdef VBOX_WITH_DOCS_ACCESSIBILITY
236 INSTALLS += VBox-docs-accessibility
237 INSTALLS += VBox-docs-accessibility-html
238 endif
239
240 ifdef VBOX_ONLY_DOCS
241 PACKING += $(PATH_STAGE_BIN)/VBoxDocumentation.zip
242 endif
243
244 ifdef VBOX_WITH_DOCS_TRANSLATIONS
245 VBOX_MANUAL_LANGUAGES += $(VBOX_MANUAL_ADD_LANGUAGES)
246 endif
247
248 VBOX_MANUAL_XML_CHANGELOG = \
249 user_ChangeLogImpl.xml
250
251 VBOX_MANUAL_XML_FILES = \
252 UserManual.xml \
253 user_AdvancedTopics.xml \
254 user_BasicConcepts.xml \
255 user_Glossary.xml \
256 user_Frontends.xml \
257 user_Installation.xml \
258 user_GuestAdditions.xml \
259 user_Introduction.xml \
260 user_KnownIssues.xml \
261 user_PrivacyPolicy.xml \
262 user_Security.xml \
263 user_Technical.xml \
264 user_ThirdParty.xml \
265 user_Troubleshooting.xml \
266 user_VBoxManage.xml \
267 user_VirtualBoxAPI.xml \
268 user_Storage.xml \
269 user_Networking.xml
270
271 VBOX_MANUAL_XML_FILES_INCL_CHANGELOG = $(VBOX_MANUAL_XML_FILES) \
272 user_ChangeLog.xml
273
274 VBOX_SDKREF_XML_FILES = \
275 SDKRef.xml
276
277 VBOX_ACCESSIBILITY_XML_FILES = \
278 Accessibility.xml
279
280 # Wildcard the images path for every supported language
281 $(foreach f,$(VBOX_MANUAL_LANGUAGES), \
282 $(eval VBOX_MANUAL_PNG_FILES_$$(f) := $$(patsubst $$(VBOX_PATH_MANUAL_SRC)/$$(f)/%,%,$$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$$(f)/images/*.png))))
283
284 VBOX_MANUAL_TEX_UNICODE_FILES = \
285 $(wildcard $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/*)
286
287 VBOX_MANUAL_LATEX_FILES_TARGET = \
288 $(addprefix UserManual.,aux log out toc tex)
289
290 VBOX_SDKREF_LATEX_FILES_TARGET = \
291 $(addprefix SDKRef.,aux log out toc tex)
292
293 VBOX_ACCESSIBILITY_LATEX_FILES_TARGET = \
294 $(addprefix Accessibility.,aux log out toc tex)
295
296 BLDDIRS += \
297 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/,\
298 $(addsuffix /images, $(VBOX_MANUAL_LANGUAGES)) \
299 $(addsuffix /html-single, $(VBOX_MANUAL_LANGUAGES)) \
300 $(addsuffix /html-chunks, $(VBOX_MANUAL_LANGUAGES)) \
301 $(addsuffix /HTMLHelp, $(VBOX_MANUAL_LANGUAGES)) \
302 $(addsuffix /HTMLHelp/images, $(VBOX_MANUAL_LANGUAGES)) \
303 )
304
305 # Explicit cleaning has some overlap with default cleaning rules, since this
306 # Makefile is using very complex conditionals for selectively creating
307 # specific files, and not everyone remembers to use the same with "kmk clean".
308 OTHER_CLEAN += \
309 $(VBOX_XML_CATALOG) \
310 $(VBOX_XML_CATALOG_DOCBOOK) \
311 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/, \
312 $(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG) \
313 $(VBOX_MANUAL_XML_REFENTRY_FILES) \
314 $(addprefix user_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
315 $(patsubst man_%,%.1,$(basename $(VBOX_MANUAL_XML_REFENTRY_FILES))) \
316 $(VBOX_MANUAL_LATEX_FILES_TARGET) \
317 $(VBOX_MANUAL_PNG_FILES_$(lang)) \
318 $(notdir $(VBOX_MANUAL_TEX_UNICODE_FILES)) \
319 $(addprefix HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(lang))) \
320 html-single/UserManual.html \
321 $(addprefix HTMLHelp/, index.html go01.html) \
322 $(addprefix html-chunks/, index.html go01.html) \
323 $(foreach n,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 \
324 ,html-chunks/ch$(n).html \
325 html-chunks/re$(n).html \
326 HTMLHelp/ch$(n).html \
327 HTMLHelp/re$(n).html \
328 $(foreach d2,0 1 2 3 4 5 6 7 8 9,$(foreach d1,0 1 2 3 4 5 6 7 8 9,HTMLHelp/ch$(n)s$(d2)$(d1).html)) ) \
329 $(foreach n,a b c \
330 ,html-chunks/ap$(n).html \
331 HTMLHelp/ap$(n).html \
332 $(foreach s,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20,HTMLHelp/ap$(n)s$(s).html) ) \
333 HTMLHelp/toc.hhc \
334 HTMLHelp/htmlhelp.hhp \
335 titlepage-htmlhelp.xsl \
336 UserManual.pdf \
337 VirtualBox.chm \
338 ChangeLog.html \
339 validatemanual.run \
340 )) \
341 $(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG) \
342 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
343 $(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml \
344 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf) \
345 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm) \
346 $(PATH_STAGE_BIN)/UserManual.pdf \
347 $(PATH_STAGE_BIN)/VirtualBox.chm \
348 \
349 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
350 $(VBOX_SDKREF_XML_FILES) \
351 $(VBOX_SDKREF_LATEX_FILES_TARGET) \
352 SDKRef.pdf \
353 ) \
354 $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf \
355 \
356 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
357 $(VBOX_ACCESSIBILITY_XML_FILES) \
358 $(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET) \
359 html-single/Accessibility.html \
360 Accessibility.pdf \
361 ) \
362 $(PATH_STAGE_BIN)/Accessibility.html \
363 $(PATH_STAGE_BIN)/Accessibility.pdf \
364 \
365 $(VBOX_DOC_XIDL_SRC_TMP) \
366 $(VBOX_MANUAL_APIREF_TMP)
367
368endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
369
370#
371# target for installing UserManual.pdf
372#
373VBox-docs-usermanual_INST = $(INST_BIN)
374VBox-docs-usermanual_MODE = a+r,u+w
375VBox-docs-usermanual_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf
376
377#
378# target for installing translated UserManual_*.pdf
379#
380VBox-docs-usermanual-l10n_INST = $(INST_BIN)
381VBox-docs-usermanual-l10n_MODE = a+r,u+w
382VBox-docs-usermanual-l10n_SOURCES = $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(f)/UserManual.pdf=>UserManual_$(f).pdf)
383
384#
385# target for installing VirtualBox.chm
386#
387VBox-docs-usermanual-chm_INST = $(INST_BIN)
388VBox-docs-usermanual-chm_MODE = a+r,u+w
389VBox-docs-usermanual-chm_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.chm
390
391#
392# target for installing translated VirtualBox_*.chm
393#
394VBox-docs-usermanual-l10n-chm_INST = $(INST_BIN)
395VBox-docs-usermanual-l10n-chm_MODE = a+r,u+w
396VBox-docs-usermanual-l10n-chm_SOURCES = $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(f)/VirtualBox.chm=>VirtualBox_$(f).chm)
397
398#
399# target for installing SDKRef.pdf
400#
401VBox-docs-sdkref_INST = $(INST_SDK)docs/
402VBox-docs-sdkref_MODE = a+r,u+w
403VBox-docs-sdkref_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf
404
405#
406# target for installing Accessibility.pdf
407#
408VBox-docs-accessibility_INST = $(INST_BIN)
409VBox-docs-accessibility_MODE = a+r,u+w
410VBox-docs-accessibility_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf
411
412#
413# target for installing Accessibility.html
414#
415VBox-docs-accessibility-html_INST = $(INST_BIN)
416VBox-docs-accessibility-html_MODE = a+r,u+w
417VBox-docs-accessibility-html_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
418
419
420#
421# To avoid network I/O for fetching DTDs, we generate catalogs mapping the public
422# entity IDs to local files. (Obviously, only done when we have local files.)
423#
424ifdef VBOX_XML_CATALOG
425# Create a catalog file for xsltproc that points to docbook catalog.
426$(VBOX_XML_CATALOG): $(MAKEFILE_CURRENT) | $$(dir $$@)
427 $(call MSG_L1,Creating catalog $@)
428 $(QUIET)$(RM) -f [email protected] $@
429 $(QUIET)$(APPEND) [email protected] '<?xml version="1.0"?>'
430 $(QUIET)$(APPEND) [email protected] '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">'
431 $(QUIET)$(APPEND) [email protected] '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">'
432 $(QUIET)$(APPEND) [email protected] ' <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook XML" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
433 $(QUIET)$(APPEND) [email protected] ' <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
434 $(QUIET)$(APPEND) [email protected] ' <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
435 $(QUIET)$(APPEND) [email protected] ' <delegateURI uriStartString="http://www.oasis-open.org/docbook/" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
436 $(QUIET)$(APPEND) [email protected] '</catalog>'
437 $(QUIET)$(MV) -f [email protected] $@
438
439# Create a docbook catalog file for xsltproc that points to the local docbook files.
440$(VBOX_XML_CATALOG_DOCBOOK): $(MAKEFILE_CURRENT) | $$(dir $$@)
441 $(call MSG_L1,Creating catalog $@)
442 $(QUIET)$(RM) -f [email protected] $@
443 $(QUIET)$(APPEND) [email protected] '<?xml version="1.0"?>'
444 $(QUIET)$(APPEND) [email protected] '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">'
445 $(QUIET)$(APPEND) [email protected] '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">'
446 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//ELEMENTS DocBook XML Information Pool V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbpoolx.mod"/>'
447 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//DTD DocBook XML V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd"/>'
448 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//DTD DocBook XML V4.4//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd"/>'
449 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//ENTITIES DocBook XML Character Entities V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbcentx.mod"/>'
450 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//ENTITIES DocBook XML Notations V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbnotnx.mod"/>'
451 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//ENTITIES DocBook XML Additional General Entities V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbgenent.mod"/>'
452 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbhierx.mod"/>'
453 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//DTD XML Exchange Table Model 19990315//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/soextblx.dtd"/>'
454 $(QUIET)$(APPEND) [email protected] ' <public publicId="-//OASIS//DTD DocBook XML CALS Table Model V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/calstblx.dtd"/>'
455 $(QUIET)$(APPEND) [email protected] ' <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.3" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
456 $(QUIET)$(APPEND) [email protected] ' <rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.3" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
457 $(QUIET)$(APPEND) [email protected] ' <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
458 $(QUIET)$(APPEND) [email protected] ' <rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.4" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
459 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsa.ent"/>'
460 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsb.ent"/>'
461 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsc.ent"/>'
462 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsn.ent"/>'
463 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amso.ent"/>'
464 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsr.ent"/>'
465 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Box and Line Drawing//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-box.ent"/>'
466 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Russian Cyrillic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-cyr1.ent"/>'
467 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-cyr2.ent"/>'
468 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Diacritical Marks//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-dia.ent"/>'
469 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Greek Letters//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk1.ent"/>'
470 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Monotoniko Greek//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk2.ent"/>'
471 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Greek Symbols//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk3.ent"/>'
472 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk4.ent"/>'
473 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Latin 1//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-lat1.ent"/>'
474 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Added Latin 2//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-lat2.ent"/>'
475 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-num.ent"/>'
476 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES Publishing//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-pub.ent"/>'
477 $(QUIET)$(APPEND) [email protected] ' <public publicId="ISO 8879:1986//ENTITIES General Technical//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-tech.ent"/>'
478 $(QUIET)$(APPEND) [email protected] '</catalog>'
479 $(QUIET)$(MV) -f [email protected] $@
480endif
481
482
483if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
484
485
486##########################################################################################
487#
488# Rules: Preprocess DocBook XML files
489# (preliminary step for both CHM and PDF generation)
490#
491##########################################################################################
492
493#
494# The following rules for $(VBOX_PATH_MANUAL_OUTBASE)/*.xml process the XML files
495# in doc/manual to allow for some magic variable replacements. The PDF and CHM
496# targets do not depend on the XML files in doc/manual, but those in
497# $(VBOX_PATH_MANUAL_OUTBASE) instead, which we copy there from here, after that magic
498# processing.
499#
500# So, before copying, the following steps are performed:
501#
502# -- $VBOX_VERSION_* strings are replaced with the actual current VBox version.
503# -- $VBOX_MANAGE_OUTPUT (in VBoxManage.xml) is replaced with the current
504# output of the actual VBoxManage program, to save us from having to
505# update the manual all the time.
506#
507
508# Only one changelog for all languages
509# $(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG): $(VBOX_PATH_MANUAL_SRC)/$(VBOX_MANUAL_XML_CHANGELOG) | $$(dir $$@)
510# $(QUIET)$(INSTALL) -m 0644 $< $@
511
512# Manual dependency on user_ChangeLogImpl.xml
513$(foreach lang,$(VBOX_MANUAL_LANGUAGES) \
514,$(eval $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/user_ChangeLog.xml: $(VBOX_PATH_MANUAL_SRC)/user_ChangeLogImpl.xml))
515
516# Manual dependency for user_VBoxManage.xml.
517$(foreach lang,$(VBOX_MANUAL_LANGUAGES), \
518$(eval $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/user_VBoxManage.xml: $(VBOX_PATH_MANUAL_SRC)/$(lang)/user_VBoxManage.xml \
519 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/user_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
520 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/overview_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
521 $(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml ))
522
523# Intermediate step to do some variable replacement in the document.
524$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG) \
525,$(evalcall2 def_vbox_replace_stuff_in_xml,/$(lang)/$(file),/$(lang))))
526
527##
528# Morph man pages into manual sections.
529# $(evalcall2 def_vbox_refentry_to_user_sect1)
530# @param 1 The XSLT source file (relative to Makefile dir).
531# @param 2 Optional output subdirectory.
532define def_vbox_refentry_to_user_sect1
533$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/user_$(2): \
534 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
535 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl \
536 $$(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
537 $$(VBOX_VERSION_STAMP) | $$(dir $$@)
538 $$(call MSG_TOOL,xsltproc $$(notdir $$(filter %.xsl,$$^)),,$$(filter %.xml,$$^),$$@)
539 $$(QUIET)$$(RM) -f "$$@"
540 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl $$<
541endef
542$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
543, $(evalcall2 def_vbox_refentry_to_user_sect1,$(lang),$(file))))
544
545
546# Generates the VBoxManage command overview include file (shared between
547# languages) from the refsynopsisdiv section of the man pages.
548$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)): \
549 $(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-overview.xsl \
550 $$(patsubst overview_%,$$(VBOX_PATH_MANUAL_SRC)/en_US/%,$$(notdir $$@)) \
551 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
552 | $$(dir $$@)
553 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
554 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" $< $(filter %.xml,$^)
555
556$(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml: $(VBOXMANAGEHELP_PATH) $(MAKEFILE_CURRENT) | $$(dir $$@)
557 $(call MSG_GENERATE,,$@,)
558 $(QUIET)$(RM) -f $@ [email protected]
559 $(QUIET)$(APPEND) -tn "$@" \
560 '<?xml version="1.0" encoding="UTF-8"?>' \
561 '<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">' \
562 '<sect1> <!-- this will be skipped via xpointer in the include. --> '
563 $(QUIET)$(REDIRECT) -wo [email protected] -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
564 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
565 -- \
566 $(VBOXMANAGEHELP_PATH) --dumpopts
567 $(QUIET)$(SED) \
568 -e ':a' \
569 -e 'N' \
570 -e '$(DOLLAR)!ba' \
571 -e 's/</\&lt\;/g' \
572 -e 's/>/\&gt\;/g' \
573 -e 's/\n*$(DOLLAR)/<\/screen>/' \
574 -e 's/^/<screen>/' \
575 --append $@ [email protected]
576 $(QUIET)$(RM) -f [email protected]
577 $(QUIET)$(APPEND) -n "$@" \
578 ' <remark role="VBoxManage-overview">' \
579 $(foreach refentry, $(filter man_VBoxManage%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
580 , ' <xi:include href="overview_$(refentry)" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />') \
581 ' </remark>' \
582 '</sect1>'
583
584
585
586
587##########################################################################################
588#
589# Shared rules for PDF generation
590#
591##########################################################################################
592
593ifndef VBOX_OSE
594# copy ucs.sty and related files
595$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/ucs.sty):
596 $(call MSG_L1,Copying unicode support for LaTeX)
597 $(QUIET)$(INSTALL_STAGING) -m0644 -- $(VBOX_MANUAL_TEX_UNICODE_FILES) "$(@D)"
598endif
599
600# copy the PNG files.
601# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
602define def_vbox_cp_images_pdf
603local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
604$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
605 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
606 $$(call MSG_L1,Copying temporary $$< => $$@)
607 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
608endef
609
610$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_cp_images_pdf))
611
612
613##########################################################################################
614#
615# UserManual.pdf
616#
617##########################################################################################
618
619$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.pdf): \
620 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.pdf : \
621 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.tex \
622 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/%/ucs.sty) \
623 $(foreach f,$(VBOX_MANUAL_LANGUAGES),\
624 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_MANUAL_PNG_FILES_$(f)))) | $$(dir $$@)
625# PDF generation via Latex: generate the .tex file
626 $(call MSG_L1,pdflatex $< (four passes) -> $@)
627 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
628 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
629 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
630 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
631 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
632 $(QUIET)$(SED) -n \
633 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
634 $(basename $@).log
635 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
636
637# generate temporary LaTeX source from processed XML
638$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.tex): \
639 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.tex : \
640 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.xml \
641 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
642 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/%/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
643 $(if $(and $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_DOCBOOK_DTD)),$(VBOX_PATH_MANUAL_OUTBASE)/%/validatemanual.run,) \
644 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE_CURRENT)
645 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
646 $(QUIET)$(RM) -f $(addprefix $(@D)/,$(VBOX_MANUAL_LATEX_FILES_TARGET))
647# generate TeX source from processed docbook and store it in UserManual.tex.tmp;
648# pass current language to xsltproc in TARGETLANG variable (extract it from the
649# current directory, should become "de_DE" or the like)
650 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG $(notdir $(@D)) \
651 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
652# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
653# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
654 $(QUIET)$(SED) \
655 -e 's|^\\QUOTE{}|\\OQ{}|g' \
656 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
657 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
658 --output $@ [email protected]
659 $(QUIET)$(RM) -f [email protected]
660
661# Useful aliases
662usermanual UserManual.pdf:: $(PATH_STAGE_BIN)/UserManual.pdf
663
664debug-usermanual:
665 $(MAKE) --pretty-command-printing -j1 VBOX_PDFLATEX_INTERACTION=errorstopmode $(PATH_STAGE_BIN)/UserManual.pdf
666
667#
668# Generate rules for validating the UserManual.xml. These are invoked
669# automatically at build time, but can also be manually invoked via the
670# 'validatemanual' and 'validatemanual_<lang>' aliases.
671#
672define def_vbox_validate_xml
673validatemanual_$(lang):: $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/validatemanual.run
674$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/validatemanual.run: \
675 $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/UserManual.xml \
676 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/,$$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
677 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(MAKEFILE_CURRENT) | $$$$(dir $$$$@)
678 $$(call MSG_L1,Validating $$<)
679 $$(QUIET)$$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$<
680 $$(QUIET)$$(APPEND) -t "$$@" "done"
681endef
682$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_validate_xml))
683validatemanual:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),validatemanual_$(lang))
684
685
686
687#
688# SDKRef.pdf
689#
690
691# Replace <tt> tags in VirtualBox.xidl.
692$(VBOX_DOC_XIDL_SRC_TMP): $(VBOX_DOC_XIDL_SRC) $(MAKEFILE_CURRENT) | $$(dir $$@)
693 $(call MSG_L1,Generating $@)
694 $(QUIET)$(SED) -e 's|@a \+\(\w\+\)|<tt>\1</tt>|g' \
695 -e 's|@c \+\(\w\+\)|<tt>\1</tt>|g' \
696 --output $@ $<
697
698# Generate SDKRef_apiref.xml as a docbook file excerpt that will be referenced from the SDKRef.xml.
699$(VBOX_MANUAL_APIREF_TMP): $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl $(VBOX_DOC_XIDL_SRC_TMP)
700 $(call MSG_L1,Generating $@)
701 $(QUIET)$(VBOX_XSLTPROC) $(VBOX_XSLTPROC_OPTS) --xinclude --nonet -o $@ $< $(VBOX_DOC_XIDL_SRC_TMP)
702
703$(evalcall2 def_vbox_replace_stuff_in_xml,/en_US/SDKRef.xml,/en_US)
704$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.xml: $(VBOX_MANUAL_APIREF_TMP)
705
706# Turn SDKRef.xml into latex.
707$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex: \
708 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
709 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
710 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE_CURRENT) | $$(dir $$@)
711 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
712 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_SDKREF_LATEX_FILES_TARGET))
713## check it for validity first.
714#if defined(VBOX_HAVE_XMLLINT) && defined(VBOX_PATH_DOCBOOK_DTD)
715# $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
716#endif
717# generate TeX source from processed docbook and store it in SDKRef.tex.tmp
718 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
719 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
720# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
721# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
722 $(QUIET)$(SED) \
723 -e 's|^\\QUOTE{}|\\OQ{}|g' \
724 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
725 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
726 --output $@ [email protected]
727 $(QUIET)$(RM) -f [email protected]
728
729# Turn SDKRef.tex into a PDF.
730$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf: \
731 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex \
732 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
733 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
734 $(call MSG_L1,pdflatex $< (three passes))
735 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
736 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
737 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
738 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
739 $(QUIET)$(SED) -n \
740 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
741 $(basename $<).log
742 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
743
744
745# Handy aliases.
746validate-sdkref:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.xml
747sdkref:: $(VBOX_PATH_SDK)/docs/SDKRef.pdf
748
749
750
751#
752# Accessibility.pdf
753#
754
755$(evalcall2 def_vbox_replace_stuff_in_xml,/en_US/Accessibility.xml,/en_US)
756
757# Turn Accessibility.xml into latex.
758$(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex: \
759 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
760 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
761 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE_CURRENT) | $$(dir $$@)
762 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
763 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET))
764# check it for validity first.
765if defined(VBOX_HAVE_XMLLINT) && defined(VBOX_PATH_DOCBOOK_DTD)
766 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
767endif
768# generate TeX source from processed docbook and store it in Accessibility.tex.tmp
769 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
770 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
771# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
772# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
773 $(QUIET)$(SED) \
774 -e 's|^\\QUOTE{}|\\OQ{}|g' \
775 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
776 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
777 --output $@ [email protected]
778 $(QUIET)$(RM) -f [email protected]
779
780# Turn Accessibility.tex into a PDF.
781$(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf: \
782 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex \
783 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
784 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
785 $(call MSG_L1,pdflatex $< (three passes))
786 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
787 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
788 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
789 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
790 $(QUIET)$(SED) -n \
791 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
792 $(basename $<).log
793 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
794
795$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html: \
796 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
797 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
798 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
799 | $$(dir $$@)
800 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
801 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
802 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html \
803 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
804 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.xml
805
806# Handy aliases.
807validate-accessibility:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.xml
808accessibility:: $(PATH_STAGE_BIN)/Accessibility.pdf
809accessibility-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
810
811
812ifdef VBOX_WITH_DOCS_CHM
813 #
814 # VirtualBox.chm
815 #
816 # We first generate a .hhp help source file from the preprocessed
817 # DocBook XML files, as defined above, then feed that into the
818 # Microsoft Help Compiler.
819 #
820 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-htmlhelp-formatcfg.xsl,/$(lang)))
821
822 # Manual formatcfg dependencies for the above.
823 $(foreach lang,$(VBOX_MANUAL_LANGUAGES), $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/docbook-htmlhelp-formatcfg.xsl): \
824 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
825 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
826
827 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/VirtualBox.chm): \
828 $(VBOX_PATH_MANUAL_OUTBASE)/%/VirtualBox.chm: \
829 $(VBOX_PATH_MANUAL_OUTBASE)/%/HTMLHelp/htmlhelp.hhp \
830 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(f))))
831 $(call MSG_L1,hhc $<,=> $@)
832 $(QUIET)$(RM) -f $@
833 $(QUIET)$(VBOX_HHC) $(subst /,\\,$<)
834 $(call MSG_L1,Fresh CHM is now at $@)
835
836 # Prepare the XSL file for our title page, htmlhelp variant.
837 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/titlepage-htmlhelp.xsl): \
838 $(VBOX_PATH_MANUAL_SRC)/titlepage-htmlhelp.xml $(MAKEFILE_CURRENT) | $$(dir $$@)
839 $(call MSG_L1,xsltproc $<)
840 $(QUIET)$(RM) -f [email protected] $@
841 $(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet -o [email protected] $(VBOX_PATH_DOCBOOK)/template/titlepage.xsl $<
842 $(QUIET)$(MV) -f [email protected] $@
843
844 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/htmlhelp.hhp): \
845 $(VBOX_PATH_MANUAL_OUTBASE)/%/HTMLHelp/htmlhelp.hhp: \
846 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.xml \
847 $(VBOX_PATH_MANUAL_OUTBASE)/%/docbook-htmlhelp-formatcfg.xsl \
848 $(VBOX_PATH_MANUAL_OUTBASE)/%/titlepage-htmlhelp.xsl \
849 $(VBOX_PATH_MANUAL_OUTBASE)/%/validatemanual.run \
850 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/%/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
851 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK)
852 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
853 $(QUIET)$(RM) -f $@
854 $(QUIET)$(MKDIR) -p $(@D)
855 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output $(@D)/ \
856 --stringparam htmlhelp.chm \
857 $(subst /,\\,$(@D)/../VirtualBox.chm) \
858 $(HTMLHELPOPTS) $(@D)/../docbook-htmlhelp-formatcfg.xsl \
859 $<
860
861 # copy the PNG files.
862 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
863 define def_vbox_cp_images_html
864 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/HTMLHelp
865 $$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
866 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
867 $$(call MSG_L1,Copying temporary $$< => $$@)
868 $$(QUIET)$$(CP) -f $$< $$@
869 endef
870
871 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_html)))
872
873 # Packing the docs into a zip file
874 $(PATH_STAGE_BIN)/VBoxDocumentation.zip: $(VBOX_MANUAL_PACK)
875 $(call MSG_L1,Packing documentation $@)
876 $(QUIET)$(RM) -f $@
877 $(QUIET)$(REDIRECT) -C $(PATH_STAGE_BIN) -- $(VBOX_ZIP) -9 $@ $(notdir $^)
878
879endif # VBOX_WITH_DOCS_CHM
880
881
882##########################################################################################
883#
884# UserManual.html
885#
886##########################################################################################
887$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-html-one-page-formatcfg.xsl,/en_US)
888$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-html-chunks-formatcfg.xsl,/en_US)
889
890# Manual formatcfg dependencies.
891$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
892$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl: \
893 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
894 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
895
896$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html: \
897 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
898 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
899 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
900 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatemanual.run,) \
901 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
902 | $$(dir $$@)
903 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
904 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
905 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
906 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
907 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml
908
909$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html: \
910 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl \
911 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
912 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
913 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatemanual.run,) \
914 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
915 | $$(dir $$@)
916 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
917 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
918 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html \
919 --stringparam chunk.section.depth 0 \
920 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl \
921 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml
922
923$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip: \
924 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
925 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
926 $(call MSG_L1,Packing documentation $@)
927 $(QUIET)$(RM) -f $@
928 $(QUIET)$(REDIRECT) -C $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ -- $(VBOX_ZIP) \
929 -9 -r $@ html-single html-chunks $(VBOX_MANUAL_PNG_FILES_en_US)
930
931html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
932html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
933html-zip:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
934
935
936#
937# ChangeLog.html
938#
939# This XSLT rule depends on $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml, which is build by the complex rule
940# $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/user_ChangeLog.xml): ...
941# much further above. That rule takes en_US/user_ChangeLog.xml and replaces $VIRTUALBOX_CHANGELOG_IMPL
942# with the actual change log contained in user_ChangeLogImpl.xml
943#
944$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-changelog-formatcfg.xsl,/en_US)
945$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html: \
946 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-changelog-formatcfg.xsl \
947 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml \
948 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) | $$(dir $$@)
949 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
950 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" "$<" $(filter %.xml,$^)
951 $(call MSG_L1,Fresh ChangeLog.html is now at $@)
952
953cl-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html
954
955
956
957endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
958
959
960#
961# VBoxManage man pages (parts also required by VBoxManage built-in help).
962#
963$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-manpage.xsl,)
964
965##
966# Emits rules for preprocessing refentry sources (applying remarks element),
967# and for producing the actual man pages.
968# $(evalcall2 def_vbox_refentry_to_manpage)
969# @param 1 The language
970# @param 2 The file name (no path).
971define def_vbox_refentry_to_manpage
972$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2): \
973 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
974 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl \
975 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) \
976 $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
977 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
978 $$(QUIET)$$(RM) -f "$$@"
979 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ \
980 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl $$<
981if defined(VBOX_HAVE_XMLLINT) && "$(USER)" == "bird" # Effing stuff happends on build servers, probably kmk related...
982 $$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$@
983endif
984
985$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(patsubst man_%,%.1,$(basename $(2))): \
986 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2) \
987 $$(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-manpage.xsl \
988 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) \
989 $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
990 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
991 $$(QUIET)$$(RM) -f "$$@"
992 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-manpage.xsl $$<
993endef
994$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
995, $(evalcall2 def_vbox_refentry_to_manpage,$(lang),$(file))))
996
997
998# Handy aliases.
999validate-manpages:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_REFENTRY_FILES))
1000man-experiment:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
1001 ,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/$(patsubst man_%,%.1,$(basename $(file)))))
1002
1003
1004#
1005# VBoxManage built-in help.
1006#
1007# Note! Generating the stuff here is a bit annoying, but currently the most
1008# practical way I can come up with.
1009#
1010OTHERS += \
1011 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \
1012 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h
1013OTHER_CLEAN += \
1014 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \
1015 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp.ts \
1016 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h \
1017 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h.ts
1018help-experiment:: \
1019 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \
1020 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h
1021
1022$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-C-help.xsl,)
1023$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-H-help.xsl,)
1024
1025$(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl: $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl # manual dependency.
1026
1027$(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp.ts \
1028+| $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp: \
1029 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl \
1030 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
1031 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@)
1032 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(filter %.xml,$^),$(patsubst %.ts,%,$@))
1033 $(QUIET)$(APPEND) -tn "$@" \
1034 '/* Autogenerated by $<, do not edit! */' \
1035 '' \
1036 '#include <iprt/types.h>' \
1037 '#include "VBoxManageBuiltInHelp.h"' \
1038 ''
1039 $(foreach refentry,$(filter %.xml,$^) \
1040 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") $< $(refentry))
1041 $(QUIET)$(APPEND) -n "$@" \
1042 '' \
1043 'PCREFENTRY g_apHelpEntries[] = ' \
1044 '{'
1045 $(foreach refentry,$(filter %.xml,$^) \
1046 ,$(NLTAB)$(QUIET)$(APPEND) -n "$@" \
1047 ' &g_$(subst -,_,$(tolower $(patsubst man_%,%,$(notdir $(basename $(refentry)))))), ')
1048 $(QUIET)$(APPEND) -n "$@" \
1049 '};' \
1050 'const uint32_t g_cHelpEntries = RT_ELEMENTS(g_apHelpEntries);' \
1051 ''
1052 $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)"
1053# The above APPEND stuff trigger some kind of problem on some boxes when not split up...
1054# update: Fixed in SVN (strcpy -> memmove in new_job(), job.c - r2591). Just need to rebuild all platforms.
1055
1056$(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h.ts \
1057+| $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h: \
1058 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-H-help.xsl \
1059 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
1060 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@)
1061 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(filter %.xml,$^),$(patsubst %.ts,%,$@))
1062 $(QUIET)$(APPEND) -tn "$@" \
1063 '/* Autogenerated by $<, do not edit! */' \
1064 '' \
1065 '#ifndef ___VBoxManageBuiltInHelp_h___' \
1066 '#define ___VBoxManageBuiltInHelp_h___' \
1067 '' \
1068 '#include <VBox/refentry.h>' \
1069 '' \
1070 'RT_C_DECLS_BEGIN' \
1071 '' \
1072 'typedef enum HELP_CMD_VBOXMANAGE' \
1073 '{' \
1074 ' HELP_CMD_VBOXMANAGE_INVALID = 0,'
1075 $(foreach refentry,$(filter %.xml,$^) \
1076 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") \
1077 --stringparam 'g_sMode' 'cmd' $< $(refentry))
1078 $(QUIET)$(APPEND) -n "$@" \
1079 ' HELP_CMD_VBOXMANAGE_END' \
1080 '} HELP_CMD_VBOXMANAGE;'
1081 $(foreach refentry,$(filter %.xml,$^) \
1082 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") \
1083 --stringparam 'g_sMode' 'subcmd' $< $(refentry))
1084 $(QUIET)$(APPEND) -n "$@" \
1085 '' \
1086 'extern PCREFENTRY g_apHelpEntries[];' \
1087 'extern const uint32_t g_cHelpEntries;' \
1088 '' \
1089 'RT_C_DECLS_END' \
1090 '' \
1091 '#endif' \
1092 ''
1093 $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)"
1094
1095
1096include $(FILE_KBUILD_SUB_FOOTER)
1097
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette