VirtualBox

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

Last change on this file since 99042 was 99042, checked in by vboxsync, 21 months ago

manual: Added some clues about how to generate a single html file. bugref:10302

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 41.9 KB
Line 
1# $Id: Makefile.kmk 99042 2023-03-18 23:30:18Z vboxsync $
2## @file
3# Sub-Makefile for the VirtualBox User Manual, SDK reference and other manuals.
4#
5
6#
7# Copyright (C) 2006-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28#
29# This slightly messy makefile transforms the DocBook XML source for the
30# user manual into presentation output. We support two targets:
31#
32# -- UserManual.pdf, generated by LaTex
33#
34#
35# Both files end up in PATH_STAGE_BIN.
36#
37# Both targets indirectly depend on the XML files in this directory;
38# "indirectly" because we first copy them to PATH_TARGET and hack them
39# up a bit for variable substitution and such (see below).
40# The toolchains are roughly like this:
41#
42# -- PDF file via Apache FOP: pre-process the XML files in PATH_TARGET,
43# then create a .FO file (another XML format for "formatted objects")
44# via xsltproc, then feed the .FO file to Apache FOP to create the PDF.
45#
46# -- PDF file via LaTeX: pre-process the XML files in PATH_TARGET, then
47# run our custom "dblatex" perl script on UserManual.xml, which parses
48# the XML (using the Perl SAX parsers) and dumps a matching LaTeX file
49# to UserManual.tex. This is then regularly processed by pdflatex to
50# generate PDF.
51#
52#
53
54SUB_DEPTH = ../..
55include $(KBUILD_PATH)/subheader.kmk
56
57ifndef VBOX_DOC_MANUAL_CONFIG_KMK_INCLUDED
58 include $(PATH_SUB_CURRENT)/Config.kmk
59endif
60
61
62
63#
64# Globals
65#
66
67# Error out if someone tries to override old globals.
68ifdef HTMLHELPOPTS
69 $(error HTMLHELPOPTS was renamed to VBOX_HTMLHELP_OPTS!)
70endif
71ifdef DOCBOOKPATH
72 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
73endif
74ifdef DOCBOOKPATH
75 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
76endif
77ifdef XML_CATALOG
78 $(error XML_CATALOG was renamed to VBOX_XML_CATALOG!)
79endif
80ifdef XML_CATALOG_DOCBOOK
81 $(error XML_CATALOG_DOCBOOK was renamed to VBOX_XML_CATALOG_DOCBOOK!)
82endif
83ifdef PDFLATEX_INTERACTION
84 $(error PDFLATEX_INTERACTION was renamed to VBOX_PDFLATEX_INTERACTION!)
85endif
86ifdef PDFLATEX
87 $(error PDFLATEX was renamed to VBOX_PDFLATEX_CMD!)
88endif
89ifdef HHC
90 $(error HHC was renamed to VBOX_HHC!)
91endif
92
93VBOX_DITA_PATH = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-1.8.5
94
95VBOX_QHELP_OUTPUT_FILES = \
96 UserManual.qch \
97 UserManual.qhc
98
99# VBOX_PDFLATEX_INTERACTION = errorstopmode - Use this when you wants to figure out build failures
100# without catting the log a million times.
101VBOX_PDFLATEX_INTERACTION ?= batchmode
102ifeq ($(KBUILD_HOST),win)
103 ifndef VBOX_PDFLATEX
104 VBOX_PDFLATEX := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/miktex-portable/*/miktex/bin/pdflatex.exe)))
105 ifneq ($(VBOX_PDFLATEX),)
106 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION)
107 endif
108 endif
109 ifndef VBOX_PDFLATEX
110 # Tell MiKTeX to automatically download packages if system wide install.
111 VBOX_PDFLATEX := pdflatex
112 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION) --enable-installer
113 endif
114else
115 VBOX_PDFLATEX ?= pdflatex
116 VBOX_PDFLATEX_HALT = $(shell ( $(VBOX_PDFLATEX) -version | head -1 | grep 141592 > /dev/null ) && echo -halt-on-error )
117 VBOX_PDFLATEX_CMD = pdflatex $(VBOX_PDFLATEX_HALT) -interaction $(VBOX_PDFLATEX_INTERACTION)
118endif
119
120# Windows HTML Help Workshop compiler (stupid thing always returns an error!)
121VBOX_HHC = -$(EXEC_X86_WIN32) $(VBOX_PATH_HTML_HELP_WORKSHOP)/hhc.exe
122
123
124# Additional xsltproc options when generating
125VBOX_HTMLHELP_OPTS ?=
126
127# SDK related globals.
128VBOX_MANUAL_APIREF_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef_apiref.xml
129VBOX_DOC_XIDL_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
130VBOX_DOC_XIDL_SRC_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.xidl.tmp
131
132
133#
134# Targets
135#
136
137BLDDIRS += $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, $(VBOX_MANUAL_LANGUAGES))
138
139if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
140 if defined(VBOX_ONLY_SDK) || defined(VBOX_WITH_DOCS_SDKREF)
141 INSTALLS += VBox-docs-sdkref
142 endif
143
144 ifdef VBOX_WITH_DOCS_HTML
145 INSTALLS += VBox-docs-usermanual-html
146 VBOX_PATH_BIN_HTML = $(PATH_STAGE_BIN)/UserManual-html.zip
147 else # Do not build html.
148 VBOX_PATH_BIN_HTML =
149 endif
150
151 ifdef VBOX_WITH_DOCS_QHELP
152 INSTALLS += VBox-docs-usermanual-qhelp
153 ifdef VBOX_WITH_QT6
154 USES += qt6
155 QHELPGENERATOR = $(PATH_TOOL_QT6_LIBEXEC)/qhelpgenerator
156 else # Qt5
157 USES += qt5
158 QHELPGENERATOR_VERSION_MINOR = $(shell $(REDIRECT) -E QT_QPA_PLATFORM_PLUGIN_PATH=$(PATH_SDK_QT5)/plugins -- $(PATH_TOOL_QT5_BIN)/qhelpgenerator -v 2>/dev/null | $(SED) -ne 's/.*(Qt [1-9][0-9]*\.\([1-9][0-9]*\)\.[1-9][0-9]*).*$$/\1/p')
159 QHELPGENERATOR = $(PATH_TOOL_QT5_BIN)/$(if-expr $(QHELPGENERATOR_VERSION_MINOR) >= 12,qhelpgenerator,qcollectiongenerator)
160 endif
161 endif
162 ifdef VBOX_WITH_DOCS_QHELP_PACKING
163 VBOX_PATH_BIN_QHELP = \
164 $(PATH_STAGE_BIN)/UserManual.qch \
165 $(PATH_STAGE_BIN)/UserManual.qhc
166 else # Do not install/pack qhelp.
167 VBOX_PATH_BIN_QHELP :=
168 endif
169
170 ## @todo r=bird: Explanations for all of this is required!
171 .NOTPARALLEL: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/UserManual.qch \
172 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.qhc \
173 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf \
174 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
175
176 ifndef VBOX_ONLY_SDK
177 VBOX_MANUAL_PACK += \
178 $(PATH_STAGE_BIN)/UserManual.pdf \
179 $(VBOX_PATH_BIN_HTML) \
180 $(VBOX_PATH_BIN_QHELP)
181 INSTALLS += VBox-docs-usermanual
182
183 ifdef VBOX_WITH_DOCS_TRANSLATIONS
184 INSTALLS += VBox-docs-usermanual-l10n
185 VBOX_MANUAL_PACK += \
186 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf)
187 endif
188 endif # !VBOX_ONLY_SDK
189
190 ifdef VBOX_WITH_DOCS_ACCESSIBILITY
191 INSTALLS += \
192 VBox-docs-accessibility \
193 VBox-docs-accessibility-html
194 endif
195
196 ifdef VBOX_ONLY_DOCS
197 PACKING += $(PATH_STAGE_BIN)/VBoxDocumentation.zip
198 endif
199
200 ifdef VBOX_WITH_DOCS_TRANSLATIONS
201 VBOX_MANUAL_LANGUAGES += $(VBOX_MANUAL_ADD_LANGUAGES)
202 endif
203
204 $(foreach lang,$(VBOX_MANUAL_LANGUAGES), \
205 $(eval VBOX_MANUAL_XML_FILES_GENERATED_$$(lang) := \
206 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
207 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/overview_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
208 $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_man_VBoxHeadless.xml \
209 $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_man_vboximg-mount.xml \
210 $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_isomakercmd-man.xml))
211
212 VBOX_SDKREF_XML_FILES = \
213 SDKRef.xml
214
215 VBOX_ACCESSIBILITY_XML_FILES = \
216 Accessibility.xml
217
218
219 # Wildcard the images path for every supported language
220 $(foreach f,$(VBOX_MANUAL_LANGUAGES), \
221 $(eval VBOX_MANUAL_PNG_FILES_$$(f) := $$(patsubst $$(VBOX_PATH_MANUAL_SRC)/$$(f)/%,%,$$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$$(f)/images/*.png))))
222
223 VBOX_MANUAL_TEX_UNICODE_FILES = \
224 $(wildcard $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/*)
225
226 VBOX_MANUAL_LATEX_FILES_TARGET = \
227 $(addprefix UserManual.,aux log out toc tex)
228
229 VBOX_SDKREF_LATEX_FILES_TARGET = \
230 $(addprefix SDKRef.,aux log out toc tex)
231
232 VBOX_ACCESSIBILITY_LATEX_FILES_TARGET = \
233 $(addprefix Accessibility.,aux log out toc tex)
234
235 BLDDIRS += \
236 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, \
237 $(addsuffix /images, $(VBOX_MANUAL_LANGUAGES)) \
238 $(addsuffix /html-single, $(VBOX_MANUAL_LANGUAGES)) \
239 $(addsuffix /html-chunks, $(VBOX_MANUAL_LANGUAGES)) \
240 $(addsuffix /qhelp, $(VBOX_MANUAL_LANGUAGES)) \
241 $(addsuffix /qhelp/images, $(VBOX_MANUAL_LANGUAGES)) \
242 $(addsuffix /HTMLHelp, $(VBOX_MANUAL_LANGUAGES)) \
243 $(addsuffix /HTMLHelp/images, $(VBOX_MANUAL_LANGUAGES)) \
244 )
245
246 # Explicit cleaning has some overlap with default cleaning rules, since this
247 # Makefile is using very complex conditionals for selectively creating
248 # specific files, and not everyone remembers to use the same with "kmk clean".
249 OTHER_CLEAN += \
250 $(VBOX_XML_CATALOG) \
251 $(VBOX_XML_CATALOG_DOCBOOK) \
252 $(VBOX_XML_CATALOG_MANUAL) \
253 $(VBOX_XML_ENTITIES) \
254 $(foreach lang, $(VBOX_MANUAL_LANGUAGES) \
255 ,$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/, \
256 $(VBOX_XML_XREF_TO_TEXT) \
257 $(VBOX_XML_XREF_TO_TEXT).cat \
258 $(addprefix user_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
259 $(VBOX_MANUAL_XML_REFENTRY_FILES) \
260 $(patsubst man_%,%.1,$(basename $(VBOX_MANUAL_XML_REFENTRY_FILES))) \
261 man_VBoxHeadless.xml \
262 user_man_VBoxHeadless.xml \
263 man_vboximg-mount.xml \
264 user_man_vboximg-mount.xml \
265 isomakercmd-man.xml \
266 user_isomakercmd-man.xml \
267 $(VBOX_MANUAL_LATEX_FILES_TARGET) \
268 $(VBOX_MANUAL_PNG_FILES_$(lang)) \
269 $(notdir $(VBOX_MANUAL_TEX_UNICODE_FILES)) \
270 $(addprefix HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(lang))) \
271 $(addprefix qhelp/, $(VBOX_MANUAL_PNG_FILES_$(lang))) \
272 html-single/UserManual.html \
273 $(addprefix qhelp/, UserManual.qhp UserManual.qhcp $(VBOX_QHELP_OUTPUT_FILES)) \
274 $(addprefix HTMLHelp/, index.html go01.html) \
275 $(addprefix qhelp/, index.html go01.html) \
276 $(addprefix html-chunks/, index.html go01.html) \
277 $(foreach n,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 \
278 ,html-chunks/ch$(n).html \
279 html-chunks/re$(n).html \
280 HTMLHelp/ch$(n).html \
281 HTMLHelp/re$(n).html \
282 $(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)) \
283 qhelp/ch$(n).html \
284 qhelp/re$(n).html \
285 $(foreach d2,0 1 2 3 4 5 6 7 8 9,$(foreach d1,0 1 2 3 4 5 6 7 8 9,qhelp/ch$(n)s$(d2)$(d1).html)) ) \
286 $(foreach n,a b c \
287 ,html-chunks/ap$(n).html \
288 HTMLHelp/ap$(n).html \
289 $(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) \
290 qhelp/ap$(n).html \
291 $(foreach s,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20,qhelp/ap$(n)s$(s).html) ) \
292 $(foreach n,01 02 03 04 05 \
293 ,html-chunks/pr$(n).html \
294 HTMLHelp/pr$(n).html \
295 $(foreach s,01 02 03 04 05 06 07 08,HTMLHelp/pr$(n)s$(s).html) \
296 qhelp/pr$(n).html \
297 $(foreach s,01 02 03 04 05 06 07 08,qhelp/pr$(n)s$(s).html) ) \
298 HTMLHelp/toc.hhc \
299 HTMLHelp/htmlhelp.hhp \
300 qhelp/toc.hhc \
301 qhelp/htmlhelp.hhp \
302 UserManual.pdf \
303 VirtualBox.chm \
304 $(VBOX_QHELP_OUTPUT_FILES) \
305 ChangeLog.html \
306 validatemanual.run \
307 validateaccessibility.run \
308 validatesdkref.run \
309 ) \
310 ) \
311 $(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl \
312 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
313 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf) \
314 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm) \
315 $(PATH_STAGE_BIN)/UserManual.pdf \
316 $(PATH_STAGE_BIN)/VirtualBox.chm \
317 \
318 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
319 $(VBOX_SDKREF_LATEX_FILES_TARGET) \
320 SDKRef.pdf \
321 ) \
322 $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf \
323 \
324 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
325 $(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET) \
326 html-single/Accessibility.html \
327 Accessibility.pdf \
328 ) \
329 $(PATH_STAGE_BIN)/Accessibility.html \
330 $(PATH_STAGE_BIN)/Accessibility.pdf \
331 \
332 $(VBOX_DOC_XIDL_SRC_TMP) \
333 $(VBOX_MANUAL_APIREF_TMP)
334
335endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
336
337#
338# target for installing UserManual.pdf
339#
340VBox-docs-usermanual_INST = $(INST_BIN)
341VBox-docs-usermanual_MODE = a+r,u+w
342VBox-docs-usermanual_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf
343
344VBox-docs-usermanual-qhelp_INST = $(INST_BIN)
345VBox-docs-usermanual-qhelp_MODE = a+r,u+w
346VBox-docs-usermanual-qhelp_SOURCES = \
347 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/UserManual.qhc \
348 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/UserManual.qch
349
350#
351# target for installing translated UserManual_*.pdf
352#
353VBox-docs-usermanual-l10n_INST = $(INST_BIN)
354VBox-docs-usermanual-l10n_MODE = a+r,u+w
355VBox-docs-usermanual-l10n_SOURCES = $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(f)/UserManual.pdf=>UserManual_$(f).pdf)
356
357#
358# target for installing the chunked HTML docs
359#
360VBox-docs-usermanual-html_INST = $(INST_BIN)
361VBox-docs-usermanual-html_MODE = a+r,u+w
362VBox-docs-usermanual-html_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip=>UserManual-html.zip
363
364#
365# target for installing SDKRef.pdf
366#
367VBox-docs-sdkref_INST = $(INST_SDK)docs/
368VBox-docs-sdkref_MODE = a+r,u+w
369VBox-docs-sdkref_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf
370
371#
372# target for installing Accessibility.pdf
373#
374VBox-docs-accessibility_INST = $(INST_BIN)
375VBox-docs-accessibility_MODE = a+r,u+w
376VBox-docs-accessibility_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf
377
378#
379# target for installing Accessibility.html
380#
381VBox-docs-accessibility-html_INST = $(INST_BIN)
382VBox-docs-accessibility-html_MODE = a+r,u+w
383VBox-docs-accessibility-html_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
384
385if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
386
387 ##
388 # Morph man pages into manual sections.
389 # $(evalcall2 def_vbox_refentry_to_user_sect1)
390 # @param 1 Language.
391 # @param 2 the refentry xml base file name.
392 # @param 3 the full refentry xml file path.
393 define def_vbox_refentry_to_user_sect1
394 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/user_$(2): $(3) \
395 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl \
396 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
397 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
398 $$(call MSG_TOOL,xsltproc $$(notdir $$(filter %.xsl,$$^)),,$$(filter %.xml,$$^),$$@)
399 $$(QUIET)$$(RM) -f "$$@"
400 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl $$<
401 endef
402 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
403man_VBoxHeadless.xml \
404man_vboximg-mount.xml \
405, $(evalcall2 def_vbox_refentry_to_user_sect1,$(lang),$(file),$(VBOX_PATH_MANUAL_SRC)/$(lang)/$(file))))
406 $(foreach lang,$(VBOX_MANUAL_LANGUAGES) \
407,$(evalcall2 def_vbox_refentry_to_user_sect1,$(lang),isomakercmd-man.xml,$(PATH_ROOT)/src/VBox/Runtime/common/fs/isomakercmd-man.xml))
408
409
410 # Generates the VBoxManage command overview include file (shared between
411 # languages) from the refsynopsisdiv section of the man pages.
412 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)): \
413 $(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-overview.xsl \
414 $$(patsubst overview_%,$$(VBOX_PATH_MANUAL_SRC)/en_US/%,$$(notdir $$@)) \
415 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
416 $(VBOX_XML_ENTITIES) | $$(dir $$@)
417 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
418 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" $< $(filter %.xml,$^)
419
420
421
422
423
424 ##########################################################################################
425 #
426 # Shared rules for PDF generation
427 #
428 ##########################################################################################
429
430 ifndef VBOX_OSE
431 # copy ucs.sty and related files
432 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/ucs.sty):
433 $(call MSG_L1,Copying unicode support for LaTeX)
434 $(QUIET)$(INSTALL_STAGING) -m0644 -- $(VBOX_MANUAL_TEX_UNICODE_FILES) "$(@D)"
435 endif
436
437 # copy the PNG files.
438 # Note: out_dir referenced with double $$ to delay expansion to the eval step when out_dir has been defined.
439 define def_vbox_cp_images_pdf
440 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
441 $(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
442 $$(out_dir)/% : $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
443 $$(call MSG_L1,Copying temporary $$< => $$@)
444 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
445 endef
446 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_cp_images_pdf))
447
448
449 ##########################################################################################
450 #
451 # UserManual.pdf
452 #
453 ##########################################################################################
454
455 # Useful aliases
456 usermanual UserManual.pdf:: $(PATH_STAGE_BIN)/UserManual.pdf
457
458
459 #
460 # SDKRef.pdf
461 #
462
463 # Replace <tt> tags in VirtualBox.xidl.
464 $(VBOX_DOC_XIDL_SRC_TMP): $(VBOX_DOC_XIDL_SRC) $(MAKEFILE_CURRENT) | $$(dir $$@)
465 $(call MSG_L1,Generating $@)
466 $(QUIET)$(SED) -e 's|@a \+\(\w\+\)|<tt>\1</tt>|g' \
467 -e 's|@c \+\(\w\+\)|<tt>\1</tt>|g' \
468 --output $@ $<
469
470 # Generate SDKRef_apiref.xml as a docbook file excerpt that will be referenced from the SDKRef.xml.
471 $(VBOX_MANUAL_APIREF_TMP): $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl $(VBOX_DOC_XIDL_SRC_TMP)
472 $(call MSG_L1,Generating $@)
473 $(QUIET)$(VBOX_XSLTPROC) $(VBOX_XSLTPROC_OPTS) --xinclude --nonet -o $@ $< $(VBOX_DOC_XIDL_SRC_TMP)
474
475 # Turn SDKRef.xml into LaTeX.
476 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex: \
477 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
478 $(VBOX_MANUAL_APIREF_TMP) \
479 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
480 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run,) \
481 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
482 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
483 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
484 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_SDKREF_LATEX_FILES_TARGET))
485 # generate TeX source from processed docbook and store it in SDKRef.tex.tmp
486 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
487 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
488 # for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
489 # the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
490 $(QUIET)$(SED) \
491 -e 's|^\\QUOTE{}|\\OQ{}|g' \
492 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
493 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
494 --output $@ [email protected]
495 $(QUIET)$(RM) -f [email protected]
496
497 # Turn SDKRef.tex into a PDF.
498 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf: \
499 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex \
500 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
501 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
502 $(call MSG_L1,pdflatex $< (three passes))
503 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
504 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
505 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
506 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
507 $(QUIET)$(SED) -n \
508 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
509 $(basename $<).log
510 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
511
512 # Validating SDKRef.xml. It is invoked automatically at build time,
513 # but can also be manually invoked via the 'validate-sdkref' alias.
514 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run: \
515 $(VBOX_PATH_MANUAL_SRC)/en_US/SDKRef.xml \
516 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
517 $(VBOX_MANUAL_APIREF_TMP) \
518 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
519 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
520 $(call MSG_L1,Validating $<)
521 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
522 $(QUIET)$(APPEND) -t "$@" "done"
523
524
525 # Handy aliases.
526 validate-sdkref:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run
527 sdkref:: $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf
528
529
530
531 #
532 # Accessibility.pdf
533 #
534
535 # Turn Accessibility.xml into LaTeX.
536 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex: \
537 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
538 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
539 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run,) \
540 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
541 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
542 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
543 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET))
544 # generate TeX source from processed docbook and store it in Accessibility.tex.tmp
545 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
546 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
547 # for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
548 # the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
549 $(QUIET)$(SED) \
550 -e 's|^\\QUOTE{}|\\OQ{}|g' \
551 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
552 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
553 --output $@ [email protected]
554 $(QUIET)$(RM) -f [email protected]
555
556 # Turn Accessibility.tex into a PDF.
557 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf: \
558 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex \
559 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
560 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
561 $(call MSG_L1,pdflatex $< (three passes))
562 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
563 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
564 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
565 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
566 $(QUIET)$(SED) -n \
567 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
568 $(basename $<).log
569 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
570
571 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html: \
572 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
573 $(VBOX_DOCBOOK_HTML_ONE_PAGE_FORMATCFG) \
574 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
575 $(VBOX_XML_ENTITIES) | $$(dir $$@)
576 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
577 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
578 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html \
579 $(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl \
580 $<
581
582 # Validating Accessibility.xml. It is invoked automatically at build time,
583 # but can also be manually invoked via the 'validate-accessibility' alias.
584 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run: \
585 $(VBOX_PATH_MANUAL_SRC)/en_US/Accessibility.xml \
586 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
587 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
588 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
589 $(call MSG_L1,Validating $<)
590 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
591 $(QUIET)$(APPEND) -t "$@" "done"
592
593
594 # Handy aliases.
595 validate-accessibility:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run
596 accessibility:: $(PATH_STAGE_BIN)/Accessibility.pdf
597 accessibility-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
598
599
600 # A few things which are shared between htmlhelp and qhelp docs.
601 VBOX_DOCBOOK_HTMLHELP_FORMATCFG = \
602 $(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl \
603 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
604 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
605
606 # Prepare the XSL file for our title page, htmlhelp and qhelp variant.
607 $(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl: \
608 $(VBOX_PATH_MANUAL_SRC)/titlepage-htmlhelp.xml $(MAKEFILE_CURRENT) | $$(dir $$@)
609 $(call MSG_L1,xsltproc $<)
610 $(QUIET)$(RM) -f [email protected] $@
611 $(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet -o [email protected] $(VBOX_PATH_DOCBOOK)/template/titlepage.xsl $<
612 $(QUIET)$(MV) -f [email protected] $@
613
614 # Packing the docs into a zip file
615 $(PATH_STAGE_BIN)/VBoxDocumentation.zip: $(VBOX_MANUAL_PACK)
616 $(call MSG_L1,Packing documentation $@)
617 $(QUIET)$(RM) -f $@
618 $(QUIET)$(REDIRECT) -C $(PATH_STAGE_BIN) -- $(VBOX_ZIP) -9 $@ $(notdir $^)
619
620
621 ##########################################################################################
622 #
623 # UserManual.html
624 #
625 ##########################################################################################
626
627 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip: \
628 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
629 $(call MSG_L1,Packing documentation $@)
630 $(QUIET)$(RM) -f $@
631 $(QUIET)$(REDIRECT) -C $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ -- $(VBOX_ZIP) \
632 -9 -r $@ html-chunks
633
634 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html: \
635 $(VBOX_PATH_MANUAL_OUTBASE)/dita_common
636 $(call MSG_L1,Building html chunks $@)
637 $(QUIET)$(call VBOX_DITA_ENV_SETUP) $(VBOX_JAVA) -jar $(VBOX_DITA_PATH_LIB)/dost.jar \
638 /i:$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual.ditamap \
639 /transtype:xhtml \
640 /ditadir:$(VBOX_DITA_PATH) \
641 /outdir:$(@D) \
642 /tempdir:$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/temp_xhtml
643
644 # disable for now
645 ## bird: Remove @chunk attrib from Glossary.dita topicref and add chunk="to-content" to bootmap for single html experiments.
646 ## See https://docs.oasis-open.org/dita/v1.2/os/spec/archSpec/chunking.html
647 ## and https://www.oxygenxml.com/forum/post25114.html?hilit=dita%20xhtml%20chunk#p25114
648 ## for further clues.
649 #html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
650
651 html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
652 qhelp:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/, $(VBOX_QHELP_OUTPUT_FILES))
653 html-zip:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
654
655
656 ##########################################################################################
657 #
658 # DITA stuff common to pdf, qhelp, and html outputs.
659 # - copy DITA-OT library (binaries etc) since at each run several run-time config
660 # files are updated.
661 # - create dita/topic folder and copy all user manual dita files under that.
662 # - copy all images under dita/topics/images and UserManual.ditamap under dita folder
663 # - copy all man_V*.xml docbook files under dita/topic folder.
664 # - flatten refsect1/refsect2 hierarchy in man_V*.xml docbook files by
665 # using refsect2_to_refsect1.py.
666 # - convert man_V*.xml files into dita files
667 # - mark external link in the man_V*.dita files
668 # - correct all reference targets by calling correct_references.py.
669 #
670 # Note! INSTALL_STAGING is likely to hardlink the files, thus we must use +| below
671 # when copying files as much won't change timestamp. It would in fact be a _lot_
672 # better to copy the files individually.
673 #
674 ##########################################################################################
675
676 BLDDIRS += \
677 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita \
678 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics \
679 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/images
680
681 VBOX_USER_MANUAL_STAGED_DITA_FILES := $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/, \
682 $(notdir $(wildcard $(VBOX_PATH_MANUAL_SRC)/en_US/dita/topics/*dita)))
683 VBOX_USER_MANUAL_STAGED_IMAGE_FILES := $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/images/, \
684 $(notdir $(wildcard $(VBOX_PATH_MANUAL_SRC)/en_US/dita/topics/images/*)))
685
686 $(VBOX_USER_MANUAL_STAGED_DITA_FILES) \
687 $(VBOX_USER_MANUAL_STAGED_IMAGE_FILES) \
688 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual.ditamap: \
689 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/% : \
690 $(VBOX_PATH_MANUAL_SRC)/en_US/dita/% | $$(dir $$@)
691 $(INSTALL_STAGING) -v -m 0644 -- "$<" "$(@D)/"
692
693 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/reference.dtd: | $$(dir $$@)
694 $(QUIET)$(TOUCH) -- "$@"
695
696 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/man_VBoxManage-dhcpserver-dhcpoptions.xml: \
697 $(VBOX_PATH_MANUAL_SRC)/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xml | $$(dir $$@)
698 $(QUIET)$(INSTALL_STAGING) -m 0644 -- "$<" "$(@D)/"
699
700 $(VBOX_PATH_MANUAL_OUTBASE)/dita_common: \
701 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual.ditamap \
702 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/reference.dtd \
703 $(VBOX_USER_MANUAL_STAGED_DITA_FILES) \
704 $(VBOX_USER_MANUAL_STAGED_IMAGE_FILES) \
705 $$(VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES) \
706 $(VBOX_DITA_PATH)
707 $(call MSG_L1, Ran common dita steps)
708 $(QUIET)$(TOUCH) -- "$@"
709
710
711 ##########################################################################################
712 #
713 # Docbook to Dita conversion of our refentry files
714 #
715 ##########################################################################################
716
717 # Generate a ID to FILE mapping database that def_vbox_refentry_to_dita can apply below.
718 VBOX_USER_MANUAL_ID_MAPPING_FILE := $(VBOX_PATH_MANUAL_OUTBASE)/en_US/id-mapping-file.db
719 OTHER_CLEAN += $(VBOX_USER_MANUAL_ID_MAPPING_FILE)
720 $(VBOX_USER_MANUAL_ID_MAPPING_FILE): \
721 $(VBOX_PATH_MANUAL_SRC)/build_id_to_file_mapping.py \
722 $(wildcard $(VBOX_PATH_MANUAL_SRC)/en_US/*.xml $(VBOX_PATH_MANUAL_SRC)/en_US/dita/topics/*.dita) \
723 | $(dir $@)
724 $(call MSG_L1, $<)
725 $(QUIET)$(VBOX_BLD_PYTHON) "$<" --output "$@" \
726 "$(VBOX_PATH_MANUAL_SRC)/en_US/*.xml" \
727 "$(VBOX_PATH_MANUAL_SRC)/en_US/dita/topics/*.dita"
728
729 # Accumulated list of conversion output file names used by dita_common above.
730 VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES := $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/user_isomakercmd-man.dita
731
732 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/user_isomakercmd-man.dita: \
733 $(VBOX_DITA_CONVERTER_PATH)/db2dita/docbook2dita.xsl \
734 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_isomakercmd-man.xml | $$(dir $$@)
735 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
736 --maxdepth 6000 \
737 --output "$@" \
738 "$<" \
739 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_isomakercmd-man.xml
740
741 define def_vbox_refentry_to_dita
742 VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES += $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(basename $(2)).dita
743 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(basename $(2)).dita \
744 + $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2): \
745 $$(VBOX_DITA_CONVERTER_PATH)/db2dita/docbook2dita.xsl \
746 $$(qfirstfile , $$(qwildcard , $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2)) $$(VBOX_PATH_MANUAL_SRC)/en_US/$(2)) \
747 $$(VBOX_PATH_MANUAL_SRC)/mark_external_urls.xsl \
748 $$(VBOX_PATH_MANUAL_SRC)/add_file_to_id_only_references.py \
749 $$(VBOX_USER_MANUAL_ID_MAPPING_FILE) \
750 $$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/man_VBoxManage-dhcpserver-dhcpoptions.xml \
751 $$(VBOX_XML_CATALOG) \
752 $$(VBOX_XML_CATALOG_DOCBOOK) \
753 $$(VBOX_XML_CATALOG_MANUAL) \
754 $$(VBOX_XML_ENTITIES) \
755 $$(VBOX_VERSION_STAMP) \
756 | $$$$(dir $$$$@)
757 $$(call MSG_TOOL,xsltproc docbook2dita.xsl,,$$(firstword $$(filter %.xml,$$^)),$$@)
758 $$(QUIET)$$(RM) -f "$$@"
759 $$(QUIET)$$(VBOX_BLD_PYTHON) $$(VBOX_PATH_MANUAL_SRC)/refsect2_to_refsect1.py \
760 -i $$(qfirstfile , $$(qwildcard , $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2)) $$(VBOX_PATH_MANUAL_SRC)/en_US/$(2)) \
761 -o "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2)"
762 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --maxdepth 6000 --output "$$@" \
763 "$$(VBOX_DITA_CONVERTER_PATH)/db2dita/docbook2dita.xsl" \
764 "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2)"
765 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --maxdepth 6000 --output "$$@" \
766 "$$(VBOX_PATH_MANUAL_SRC)/mark_external_urls.xsl" "$$@"
767 $$(QUIET)$$(VBOX_BLD_PYTHON) $$(VBOX_PATH_MANUAL_SRC)/add_file_to_id_only_references.py -v \
768 --mapping-file "$$(VBOX_USER_MANUAL_ID_MAPPING_FILE)" "$$@"
769 endef
770 $(foreach lang,$(VBOX_MANUAL_LANGUAGES) \
771 ,$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) man_vboximg-mount.xml man_VBoxHeadless.xml \
772 ,$(evalcall2 def_vbox_refentry_to_dita,$(lang),$(file))))
773
774
775 ##########################################################################################
776 #
777 # Use DITA-OT to create pdf/hhp out of UserManual.ditamap. See usermanual.pdf under
778 # DITA-OT-xxxxx/doc folder for details.
779 #
780 ##########################################################################################
781 # Copy the dita library under out folder since at each use the library modifies some
782 # run-time configuation files and there seems to be no way to override this.
783 ## @todo r=bird: This is _incredibly_ crude. But then, the tool is the worst with its inane
784 ## desire to modify build.xml, catalog-dita.xml and lib/org.dita.dost.platform/plugin.properties
785 ## with a fresh plugin setup (the differences seems to be down to hashing/map
786 ## ordering difference). Wonder if we can get away with a single copy
787 ## as long as we do the plugin update right after duplicating it here...
788 ## Also, I would _really_ like to symlink/hardlink as much as possible
789 ## of it to save time and storage space.
790 $(VBOX_DITA_PATH):
791 $(MKDIR) -p $(VBOX_DITA_PATH)
792 $(CP) -vR -- "$(VBOX_DITA_ORIGINAL_PATH)/" "$(VBOX_DITA_PATH)/"
793 $(RM) -vf -- "$(VBOX_DITA_PATH)/build.xml" \
794 "$(VBOX_DITA_PATH)/catalog-dita.xml" \
795 "$(VBOX_DITA_PATH)/lib/org.dita.dost.platform/plugin.properties"
796
797 VBOX_DITA_PATH_LIB ?= $(VBOX_DITA_PATH)/lib
798 VBOX_DITA_ENV_SETUP ?= $(REDIRECT) \
799 -E 'ANT_OPTS=-Xmx512m -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl' \
800 -E 'ANT_HOME=$(VBOX_DITA_PATH)/tools/ant' \
801 -E 'DITA_DIR=$(VBOX_DITA_PATH)' \
802 -E 'JAVA_HOME=$(VBOX_JAVA_HOME)' \
803 -A 'PATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH)/tools/ant/bin' \
804 -E 'CLASSPATH=$(VBOX_DITA_PATH_LIB)/dost.jar' \
805 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)' \
806 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/commons-codec-1.4.jar' \
807 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/resolver.jar' \
808 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/icu4j.jar' \
809 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/xercesImpl.jar' \
810 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/xml-apis.jar' \
811 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/saxon/saxon9.jar' \
812 -A 'CLASSPATH=$(HOST_PATH_SEP)$(VBOX_DITA_PATH_LIB)/saxon/saxon9-dom.jar' \
813 --
814
815 # Note! The /tempdir is deleted, recreated, used and deleted again for each run. So, be careful where you point it.
816 # Note! This crappy utility may fail to find files (or fail to parse the
817 # command line) and still return a successfully (0) exit code.
818 define def_ditamap_to_pdf
819 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual.pdf \
820 + $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual_pdf.log \
821 +| $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita.list \
822 +| $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita.xml.properties: \
823 $$(VBOX_MANUAL_XML_FILES_COMMON) \
824 $$(VBOX_MANUAL_XML_FILES_GENERATED_$(lang)) \
825 $$(VBOX_PATH_MANUAL_OUTBASE)/dita_common
826 $(QUIET)$(RM) -f -- "$$@"
827 $(QUIET)$(call VBOX_DITA_ENV_SETUP) $(VBOX_JAVA) -jar $(VBOX_DITA_PATH_LIB)/dost.jar \
828 /i:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/UserManual.ditamap \
829 /transtype:pdf \
830 /ditadir:$(VBOX_DITA_PATH) \
831 /outdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1) \
832 /tempdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/temp_pdf
833
834 ditamap-to-pdf: $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual.pdf
835 endef
836 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_ditamap_to_pdf,$(lang)))
837
838 #
839 # ChangeLog.html
840 #
841 # This XSLT rule formats en_US/user_ChangeLog.xml (which includes the actual change log
842 # contained in user_ChangeLogImpl.xml) as a standalone HTML file.
843 #
844 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html: \
845 $(VBOX_PATH_MANUAL_SRC)/en_US/docbook-changelog-formatcfg.xsl \
846 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml \
847 $(VBOX_XML_CATALOG) \
848 $(VBOX_XML_CATALOG_DOCBOOK) \
849 $(VBOX_XML_CATALOG_MANUAL) \
850 $(VBOX_XML_ENTITIES) | $$(dir $$@)
851 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
852 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" "$<" $(filter %.xml,$^)
853 $(call MSG_L1,Fresh ChangeLog.html is now at $@)
854
855 cl-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html
856
857
858
859endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
860
861
862#
863# VBoxManage man pages (parts also required by VBoxManage built-in help).
864#
865
866##
867# Emits rules for preprocessing refentry sources (applying remarks element),
868# and for producing the actual man pages.
869# $(evalcall2 def_vbox_refentry_to_manpage)
870# @param 1 The language
871# @param 2 The file name (no path).
872define def_vbox_refentry_to_manpage
873 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2): \
874 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
875 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl \
876 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT) \
877 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
878 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
879 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
880 $$(QUIET)$$(RM) -f "$$@"
881 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ \
882 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl $$<
883 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output [email protected] $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT) $$@
884 $$(QUIET)$$(MV) -f -- "[email protected]" "$$@"
885 if defined(VBOX_HAVE_XMLLINT)
886 $$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$@
887 endif
888
889 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(patsubst man_%,%.1,$(basename $(2))): \
890 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2) \
891 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage.xsl \
892 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
893 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
894 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
895 $$(QUIET)$$(RM) -f "$$@"
896 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --maxdepth 6000 --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage.xsl $$<
897endef
898$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
899, $(evalcall2 def_vbox_refentry_to_manpage,$(lang),$(file))))
900
901ifdef VBOX_WITH_DOCS_QHELP
902 #
903 # VirtualBox.qch/VirtualBox.qhc
904 #
905 # We first generate a .hhp help source file from the preprocessed
906 # DocBook XML files, as defined above, then feed that into a converter
907 # creating the suitable input for creating a QHelp collection file.
908
909 # Generate QCH from QHelp source
910 # Note: out_dir referenced with double $$ to delay expansion to the eval step when out_dir has been defined.
911 define def_vbox_usermanual_qhp_to_qch
912 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
913 $$(out_dir)/qhelp/UserManual.qch \
914 + $$(out_dir)/qhelp/UserManual.qhc: \
915 $$(out_dir)/qhelp/UserManual.qhcp \
916 $$(out_dir)/qhelp/UserManual.qhp \
917 $$(addprefix $$(out_dir)/qhelp/,$$(VBOX_MANUAL_PNG_FILES_$(lang))) \
918 | $$$$(dir $$$$@)
919 $$(call MSG_L1,$$(notdir $$(QHELPGENERATOR)) $$<,=> $$@)
920 $$(QUIET)$$(RM) -f $$@
921 $$(QUIET)$$(REDIRECT) -E QT_QPA_PLATFORM_PLUGIN_PATH=$$(PATH_SDK_QT5)/plugins -- $$(QHELPGENERATOR) $$<
922 $$(call MSG_L1,Fresh QCH is now at $$@)
923 endef
924 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_qhp_to_qch))
925
926 # Generate QHP from HHP for QHelp
927 # Note: out_dir referenced with double $$ to delay expansion to the eval step when out_dir has been defined.
928 define def_vbox_usermanual_hhp_qhelp_to_qhp
929 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
930 $$(out_dir)/qhelp/UserManual.qhp: \
931 $$(out_dir)/qhelp/UserManual.hhp \
932 $$(addprefix $$(out_dir)/qhelp/,$$(VBOX_MANUAL_PNG_FILES_$(lang))) \
933 | $$$$(dir $$$$@)
934 $$(call MSG_L1,htmlhelp-qthelp.py $$<,=> $$@)
935 $$(QUIET)$$(RM) -f $$@
936 $$(QUIET)$$(VBOX_BLD_PYTHON) $$(VBOX_PATH_MANUAL_SRC)/htmlhelp-qthelp.py -d $$(<D) -o $$@ -f UserManual.hhp -t UserManual.hhc
937 endef
938 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_hhp_qhelp_to_qhp))
939
940
941 define def_ditamap_to_htmlhelp
942 ditamap-to-htmlhelp: $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/qhelp/UserManual.hhp
943 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/qhelp/UserManual.hhp: \
944 $(VBOX_PATH_MANUAL_OUTBASE)/dita_common
945 $(QUIET)$(call VBOX_DITA_ENV_SETUP) $(VBOX_JAVA) -jar $(VBOX_DITA_PATH_LIB)/dost.jar \
946 /i:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/UserManual.ditamap \
947 /transtype:htmlhelp \
948 /ditadir:$(VBOX_DITA_PATH) \
949 /outdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/qhelp \
950 /tempdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/temp_htmlhelp
951
952 endef
953 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_ditamap_to_htmlhelp,$(lang)))
954
955 # copy the qhcp file.
956 define def_vbox_cp_qhcp
957 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/qhelp
958 $$(out_dir)/UserManual.qhcp: \
959 $$(out_dir)/% : $(VBOX_PATH_MANUAL_SRC)/% | $$$$(dir $$$$@)
960 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
961 endef
962 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_qhcp)))
963
964 # copy the PNG files.
965 # Note: out_dir referenced with double $$ to delay expansion to the eval step when out_dir has been defined.
966 define def_vbox_cp_images_qhelp
967 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/qhelp
968 $(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
969 $$(out_dir)/% : $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
970 $$(call MSG_L1,Copying temporary $$< => $$@)
971 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
972 endef
973 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_qhelp)))
974
975endif # VBOX_WITH_DOCS_QHELP
976
977# Handy aliases.
978validate-manpages:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_REFENTRY_FILES))
979man-experiment:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
980 ,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/$(patsubst man_%,%.1,$(basename $(file)))))
981
982#
983# Manually updating the DHCP option list taken from VirtualBox.xidl
984#
985dhcpoptions: $(PATH_ROOT)/doc/manual/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xsl \
986 $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
987 $(call VBOX_XSLTPROC) --output "$(PATH_ROOT)/doc/manual/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xml" $+
988
989
990include $(FILE_KBUILD_SUB_FOOTER)
991
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