VirtualBox

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

Last change on this file since 93812 was 93812, checked in by vboxsync, 3 years ago

doc/manual: Fix for "clean".

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.2 KB
Line 
1# $Id: Makefile.kmk 93812 2022-02-16 21:39:17Z vboxsync $
2## @file
3# Sub-Makefile for the VirtualBox User Manual, SDK reference and other manuals.
4#
5
6#
7# Copyright (C) 2006-2022 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
51ifndef VBOX_DOC_MANUAL_CONFIG_KMK_INCLUDED
52 include $(PATH_SUB_CURRENT)/Config.kmk
53endif
54
55
56#
57# Globals
58#
59
60# Error out if someone tries to override old globals.
61ifdef HTMLHELPOPTS
62 $(error HTMLHELPOPTS was renamed to VBOX_HTMLHELP_OPTS!)
63endif
64ifdef DOCBOOKPATH
65 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
66endif
67ifdef DOCBOOKPATH
68 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
69endif
70ifdef XML_CATALOG
71 $(error XML_CATALOG was renamed to VBOX_XML_CATALOG!)
72endif
73ifdef XML_CATALOG_DOCBOOK
74 $(error XML_CATALOG_DOCBOOK was renamed to VBOX_XML_CATALOG_DOCBOOK!)
75endif
76ifdef VBOXMANAGEPATH
77 $(error VBOXMANAGEPATH was renamed to VBOXMANAGEHELP_PATH!)
78endif
79ifdef PDFLATEX_INTERACTION
80 $(error PDFLATEX_INTERACTION was renamed to VBOX_PDFLATEX_INTERACTION!)
81endif
82ifdef PDFLATEX
83 $(error PDFLATEX was renamed to VBOX_PDFLATEX_CMD!)
84endif
85ifdef HHC
86 $(error HHC was renamed to VBOX_HHC!)
87endif
88
89VBOX_QHELP_OUTPUT_FILES = \
90 UserManual.qch \
91 UserManual.qhc
92
93VBOXMANAGEHELP_PATH ?= $(PATH_STAGE_BIN)/VBoxManageHelp$(SUFF_EXE)
94
95 # VBOX_PDFLATEX_INTERACTION = errorstopmode - Use this when you wants to figure out build failures
96 # without catting the log a million times.
97VBOX_PDFLATEX_INTERACTION ?= batchmode
98ifeq ($(KBUILD_HOST),win)
99 ifndef VBOX_PDFLATEX
100 VBOX_PDFLATEX := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/miktex-portable/*/miktex/bin/pdflatex.exe)))
101 ifneq ($(VBOX_PDFLATEX),)
102 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION)
103 endif
104 endif
105 ifndef VBOX_PDFLATEX
106 # Tell MiKTeX to automatically download packages if system wide install.
107 VBOX_PDFLATEX := pdflatex
108 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION) --enable-installer
109 endif
110else
111 VBOX_PDFLATEX ?= pdflatex
112 VBOX_PDFLATEX_HALT = $(shell ( $(VBOX_PDFLATEX) -version | head -1 | grep 141592 > /dev/null ) && echo -halt-on-error )
113 VBOX_PDFLATEX_CMD = pdflatex $(VBOX_PDFLATEX_HALT) -interaction $(VBOX_PDFLATEX_INTERACTION)
114endif
115
116# Windows HTML Help Workshop compiler (stupid thing always returns an error!)
117VBOX_HHC = -$(EXEC_X86_WIN32) $(VBOX_PATH_HTML_HELP_WORKSHOP)/hhc.exe
118
119
120# Additional xsltproc options when generating
121VBOX_HTMLHELP_OPTS ?=
122
123# SDK related globals.
124VBOX_MANUAL_APIREF_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef_apiref.xml
125VBOX_DOC_XIDL_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
126VBOX_DOC_XIDL_SRC_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.xidl.tmp
127
128
129#
130# Targets
131#
132
133BLDDIRS += $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, $(VBOX_MANUAL_LANGUAGES))
134
135if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
136 if defined(VBOX_ONLY_SDK) || defined(VBOX_WITH_DOCS_SDKREF)
137 INSTALLS += VBox-docs-sdkref
138 endif
139
140 ifdef VBOX_WITH_DOCS_HTML
141 INSTALLS += VBox-docs-usermanual-html
142 VBOX_PATH_BIN_HTML = $(PATH_STAGE_BIN)/UserManual-html.zip
143 else # Do not build html.
144 VBOX_PATH_BIN_HTML =
145 endif
146
147 ifdef VBOX_WITH_DOCS_CHM
148 INSTALLS += VBox-docs-usermanual-chm
149 VBOX_PATH_BIN_CHM = $(PATH_STAGE_BIN)/VirtualBox.chm
150 else # Do not build chm.
151 VBOX_PATH_BIN_CHM =
152 endif
153
154 ifdef VBOX_WITH_DOCS_QHELP
155 USES += qt5
156 INSTALLS += VBox-docs-usermanual-qhc
157 INSTALLS += VBox-docs-usermanual-qch
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 ifdef VBOX_WITH_DOCS_QHELP_PACKING
162 VBOX_PATH_BIN_QHELP = $(PATH_STAGE_BIN)/UserManual.qch
163 VBOX_PATH_BIN_QHELP += $(PATH_STAGE_BIN)/UserManual.qhc
164 else # Do not install/pack qhelp.
165 VBOX_PATH_BIN_QHELP =
166 endif
167
168
169 ifndef VBOX_ONLY_SDK
170 VBOX_MANUAL_PACK += \
171 $(PATH_STAGE_BIN)/UserManual.pdf \
172 $(VBOX_PATH_BIN_HTML) \
173 $(VBOX_PATH_BIN_CHM) \
174 $(VBOX_PATH_BIN_QHELP)
175 INSTALLS += VBox-docs-usermanual
176
177 ifdef VBOX_WITH_DOCS_TRANSLATIONS
178 INSTALLS += VBox-docs-usermanual-l10n
179 VBOX_MANUAL_PACK += \
180 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf)
181 ifdef VBOX_WITH_DOCS_CHM
182 INSTALLS += VBox-docs-usermanual-l10n-chm
183 VBOX_MANUAL_PACK += \
184 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm)
185 endif
186 endif
187 endif # !VBOX_ONLY_SDK
188
189 ifdef VBOX_WITH_DOCS_ACCESSIBILITY
190 INSTALLS += VBox-docs-accessibility
191 INSTALLS += VBox-docs-accessibility-html
192 endif
193
194 ifdef VBOX_ONLY_DOCS
195 PACKING += $(PATH_STAGE_BIN)/VBoxDocumentation.zip
196 endif
197
198 ifdef VBOX_WITH_DOCS_TRANSLATIONS
199 VBOX_MANUAL_LANGUAGES += $(VBOX_MANUAL_ADD_LANGUAGES)
200 endif
201
202$(foreach lang,$(VBOX_MANUAL_LANGUAGES), \
203 $(eval VBOX_MANUAL_XML_FILES_GENERATED_$$(lang) := \
204 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
205 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/overview_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
206 $$(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml \
207 $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_man_VBoxHeadless.xml \
208 $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_man_vboximg-mount.xml \
209 $$(VBOX_PATH_MANUAL_OUTBASE)/$$(lang)/user_isomakercmd-man.xml))
210
211 VBOX_SDKREF_XML_FILES = \
212 SDKRef.xml
213
214 VBOX_ACCESSIBILITY_XML_FILES = \
215 Accessibility.xml
216
217
218 # Wildcard the images path for every supported language
219 $(foreach f,$(VBOX_MANUAL_LANGUAGES), \
220 $(eval VBOX_MANUAL_PNG_FILES_$$(f) := $$(patsubst $$(VBOX_PATH_MANUAL_SRC)/$$(f)/%,%,$$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$$(f)/images/*.png))))
221
222 VBOX_MANUAL_TEX_UNICODE_FILES = \
223 $(wildcard $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/*)
224
225 VBOX_MANUAL_LATEX_FILES_TARGET = \
226 $(addprefix UserManual.,aux log out toc tex)
227
228 VBOX_SDKREF_LATEX_FILES_TARGET = \
229 $(addprefix SDKRef.,aux log out toc tex)
230
231 VBOX_ACCESSIBILITY_LATEX_FILES_TARGET = \
232 $(addprefix Accessibility.,aux log out toc tex)
233
234 BLDDIRS += \
235 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/,\
236 $(addsuffix /images, $(VBOX_MANUAL_LANGUAGES)) \
237 $(addsuffix /html-single, $(VBOX_MANUAL_LANGUAGES)) \
238 $(addsuffix /html-chunks, $(VBOX_MANUAL_LANGUAGES)) \
239 $(addsuffix /qhelp, $(VBOX_MANUAL_LANGUAGES)) \
240 $(addsuffix /qhelp/images, $(VBOX_MANUAL_LANGUAGES)) \
241 $(addsuffix /HTMLHelp, $(VBOX_MANUAL_LANGUAGES)) \
242 $(addsuffix /HTMLHelp/images, $(VBOX_MANUAL_LANGUAGES)) \
243 )
244
245 # Explicit cleaning has some overlap with default cleaning rules, since this
246 # Makefile is using very complex conditionals for selectively creating
247 # specific files, and not everyone remembers to use the same with "kmk clean".
248 OTHER_CLEAN += \
249 $(VBOX_XML_CATALOG) \
250 $(VBOX_XML_CATALOG_DOCBOOK) \
251 $(VBOX_XML_CATALOG_MANUAL) \
252 $(VBOX_XML_ENTITIES) \
253 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/, \
254 $(VBOX_XML_XREF_TO_TEXT) \
255 $(VBOX_XML_XREF_TO_TEXT).cat \
256 $(addprefix user_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
257 $(VBOX_MANUAL_XML_REFENTRY_FILES) \
258 $(patsubst man_%,%.1,$(basename $(VBOX_MANUAL_XML_REFENTRY_FILES))) \
259 man_VBoxHeadless.xml \
260 user_man_VBoxHeadless.xml \
261 man_vboximg-mount.xml \
262 user_man_vboximg-mount.xml \
263 isomakercmd-man.xml \
264 user_isomakercmd-man.xml \
265 $(VBOX_MANUAL_LATEX_FILES_TARGET) \
266 $(VBOX_MANUAL_PNG_FILES_$(lang)) \
267 $(notdir $(VBOX_MANUAL_TEX_UNICODE_FILES)) \
268 $(addprefix HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(lang))) \
269 $(addprefix qhelp/, $(VBOX_MANUAL_PNG_FILES_$(lang))) \
270 html-single/UserManual.html \
271 $(addprefix qhelp/, UserManual.qhp UserManual.qhcp $(VBOX_QHELP_OUTPUT_FILES)) \
272 $(addprefix HTMLHelp/, index.html go01.html) \
273 $(addprefix qhelp/, index.html go01.html) \
274 $(addprefix html-chunks/, index.html go01.html) \
275 $(foreach n,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 \
276 ,html-chunks/ch$(n).html \
277 html-chunks/re$(n).html \
278 HTMLHelp/ch$(n).html \
279 HTMLHelp/re$(n).html \
280 $(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)) \
281 qhelp/ch$(n).html \
282 qhelp/re$(n).html \
283 $(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)) ) \
284 $(foreach n,a b c \
285 ,html-chunks/ap$(n).html \
286 HTMLHelp/ap$(n).html \
287 $(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) \
288 qhelp/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,qhelp/ap$(n)s$(s).html) ) \
290 $(foreach n,01 02 03 04 05 \
291 ,html-chunks/pr$(n).html \
292 HTMLHelp/pr$(n).html \
293 $(foreach s,01 02 03 04 05 06 07 08,HTMLHelp/pr$(n)s$(s).html) \
294 qhelp/pr$(n).html \
295 $(foreach s,01 02 03 04 05 06 07 08,qhelp/pr$(n)s$(s).html) ) \
296 HTMLHelp/toc.hhc \
297 HTMLHelp/htmlhelp.hhp \
298 qhelp/toc.hhc \
299 qhelp/htmlhelp.hhp \
300 UserManual.pdf \
301 VirtualBox.chm \
302 $(VBOX_QHELP_OUTPUT_FILES) \
303 ChangeLog.html \
304 validatemanual.run \
305 validateaccessibility.run \
306 validatesdkref.run \
307 )) \
308 $(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl \
309 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
310 $(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml \
311 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf) \
312 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm) \
313 $(PATH_STAGE_BIN)/UserManual.pdf \
314 $(PATH_STAGE_BIN)/VirtualBox.chm \
315 \
316 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
317 $(VBOX_SDKREF_LATEX_FILES_TARGET) \
318 SDKRef.pdf \
319 ) \
320 $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf \
321 \
322 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
323 $(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET) \
324 html-single/Accessibility.html \
325 Accessibility.pdf \
326 ) \
327 $(PATH_STAGE_BIN)/Accessibility.html \
328 $(PATH_STAGE_BIN)/Accessibility.pdf \
329 \
330 $(VBOX_DOC_XIDL_SRC_TMP) \
331 $(VBOX_MANUAL_APIREF_TMP)
332
333endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
334
335#
336# target for installing UserManual.pdf
337#
338VBox-docs-usermanual_INST = $(INST_BIN)
339VBox-docs-usermanual_MODE = a+r,u+w
340VBox-docs-usermanual_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf
341
342VBox-docs-usermanual-qhc_INST = $(INST_BIN)
343VBox-docs-usermanual-qhc_MODE = a+r,u+w
344VBox-docs-usermanual-qhc_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/UserManual.qhc
345
346VBox-docs-usermanual-qch_INST = $(INST_BIN)
347VBox-docs-usermanual-qch_MODE = a+r,u+w
348VBox-docs-usermanual-qch_SOURCES = $(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 VirtualBox.chm
366#
367VBox-docs-usermanual-chm_INST = $(INST_BIN)
368VBox-docs-usermanual-chm_MODE = a+r,u+w
369VBox-docs-usermanual-chm_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.chm
370
371#
372# target for installing translated VirtualBox_*.chm
373#
374VBox-docs-usermanual-l10n-chm_INST = $(INST_BIN)
375VBox-docs-usermanual-l10n-chm_MODE = a+r,u+w
376VBox-docs-usermanual-l10n-chm_SOURCES = $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(f)/VirtualBox.chm=>VirtualBox_$(f).chm)
377
378#
379# target for installing SDKRef.pdf
380#
381VBox-docs-sdkref_INST = $(INST_SDK)docs/
382VBox-docs-sdkref_MODE = a+r,u+w
383VBox-docs-sdkref_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf
384
385#
386# target for installing Accessibility.pdf
387#
388VBox-docs-accessibility_INST = $(INST_BIN)
389VBox-docs-accessibility_MODE = a+r,u+w
390VBox-docs-accessibility_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf
391
392#
393# target for installing Accessibility.html
394#
395VBox-docs-accessibility-html_INST = $(INST_BIN)
396VBox-docs-accessibility-html_MODE = a+r,u+w
397VBox-docs-accessibility-html_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
398
399if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
400
401##
402# Morph man pages into manual sections.
403# $(evalcall2 def_vbox_refentry_to_user_sect1)
404# @param 1 Language.
405# @param 2 the refentry xml base file name.
406# @param 3 the full refentry xml file path.
407define def_vbox_refentry_to_user_sect1
408$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/user_$(2): $(3) \
409 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl \
410 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
411 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
412 $$(call MSG_TOOL,xsltproc $$(notdir $$(filter %.xsl,$$^)),,$$(filter %.xml,$$^),$$@)
413 $$(QUIET)$$(RM) -f "$$@"
414 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl $$<
415endef
416$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
417man_VBoxHeadless.xml \
418man_vboximg-mount.xml \
419, $(evalcall2 def_vbox_refentry_to_user_sect1,$(lang),$(file),$(VBOX_PATH_MANUAL_SRC)/$(lang)/$(file))))
420$(foreach lang,$(VBOX_MANUAL_LANGUAGES) \
421,$(evalcall2 def_vbox_refentry_to_user_sect1,$(lang),isomakercmd-man.xml,$(PATH_ROOT)/src/VBox/Runtime/common/fs/isomakercmd-man.xml))
422
423
424# Generates the VBoxManage command overview include file (shared between
425# languages) from the refsynopsisdiv section of the man pages.
426$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)): \
427 $(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-overview.xsl \
428 $$(patsubst overview_%,$$(VBOX_PATH_MANUAL_SRC)/en_US/%,$$(notdir $$@)) \
429 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
430 $(VBOX_XML_ENTITIES) | $$(dir $$@)
431 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
432 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" $< $(filter %.xml,$^)
433
434$(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml: $(VBOXMANAGEHELP_PATH) $(MAKEFILE_CURRENT) | $$(dir $$@)
435 $(call MSG_GENERATE,,$@,)
436 $(QUIET)$(RM) -f $@ [email protected]
437 $(QUIET)$(APPEND) -tn "$@" \
438 '<?xml version="1.0" encoding="UTF-8"?>' \
439 '<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">' \
440 '<sect1> <!-- this will be skipped via xpointer in the include. --> '
441 $(QUIET)$(REDIRECT) -wo [email protected] -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
442 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
443 -- \
444 $(VBOXMANAGEHELP_PATH) --dumpopts
445 $(QUIET)$(SED) \
446 -e ':a' \
447 -e 'N' \
448 -e '$(DOLLAR)!ba' \
449 -e 's/</\&lt\;/g' \
450 -e 's/>/\&gt\;/g' \
451 -e 's/\n*$(DOLLAR)/<\/screen>/' \
452 -e 's/^/<screen>/' \
453 --append $@ [email protected]
454 $(QUIET)$(RM) -f [email protected]
455 $(QUIET)$(APPEND) -n "$@" \
456 ' <remark role="VBoxManage-overview">' \
457 $(foreach refentry, $(filter man_VBoxManage%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
458 , ' <xi:include href="overview_$(refentry)" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />') \
459 ' </remark>' \
460 '</sect1>'
461
462
463
464
465##########################################################################################
466#
467# Shared rules for PDF generation
468#
469##########################################################################################
470
471ifndef VBOX_OSE
472# copy ucs.sty and related files
473$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/ucs.sty):
474 $(call MSG_L1,Copying unicode support for LaTeX)
475 $(QUIET)$(INSTALL_STAGING) -m0644 -- $(VBOX_MANUAL_TEX_UNICODE_FILES) "$(@D)"
476endif
477
478# copy the PNG files.
479# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
480define def_vbox_cp_images_pdf
481local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
482$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
483 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
484 $$(call MSG_L1,Copying temporary $$< => $$@)
485 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
486endef
487$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_cp_images_pdf))
488
489
490##########################################################################################
491#
492# UserManual.pdf
493#
494##########################################################################################
495
496
497# Generate PDF from LaTeX
498# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
499define def_vbox_usermanual_tex_to_pdf
500local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
501$$(out_dir)/UserManual.pdf: \
502 $$(out_dir)/UserManual.tex \
503 $$(if $$(VBOX_OSE),,$$(out_dir)/ucs.sty) \
504 $$(addprefix $$(out_dir)/,$$(VBOX_MANUAL_PNG_FILES_$(lang))) | $$$$(dir $$$$@)
505# PDF generation via Latex: generate the .tex file
506 $$(call MSG_L1,pdflatex $$< (four passes) -> $$@)
507 $$(QUIET)$$(REDIRECT) -w+ti /dev/null -C $$(@D) -- $$(VBOX_PDFLATEX_CMD) UserManual.tex
508 $$(QUIET)$$(REDIRECT) -w+ti /dev/null -C $$(@D) -- $$(VBOX_PDFLATEX_CMD) UserManual.tex
509 $$(QUIET)$$(REDIRECT) -w+ti /dev/null -C $$(@D) -- $$(VBOX_PDFLATEX_CMD) UserManual.tex
510 $$(QUIET)$$(REDIRECT) -w+ti /dev/null -C $$(@D) -- $$(VBOX_PDFLATEX_CMD) UserManual.tex
511 $$(QUIET)$$(SED) -ne '/Warning: Hyper reference/p' $$(basename $$<).log
512 $$(QUIET)$$(SED) -n \
513 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
514 $$(basename $$@).log
515 $$(call MSG_L1,Fresh LaTeX-generated PDF is now at $$@)
516endef
517$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_tex_to_pdf))
518
519# Generate LaTeX from XML
520# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
521define def_vbox_usermanual_xml_to_tex
522local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
523$$(out_dir)/UserManual.tex: \
524 $$(addprefix $$(VBOX_PATH_MANUAL_SRC)/$(lang)/,$$(VBOX_MANUAL_XML_FILES)) \
525 $$(VBOX_MANUAL_XML_FILES_COMMON) \
526 $$(VBOX_MANUAL_XML_FILES_GENERATED_$(lang)) \
527 $$(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
528 $$(if $$(VBOX_HAVE_XMLLINT),$$(out_dir)/validatemanual.run,) \
529 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
530 $$(VBOX_XML_ENTITIES) $$(MAKEFILE_CURRENT) | $$$$(dir $$$$@)
531 $$(call MSG_TOOL,xsltproc $$(notdir $$(filter %.xsl,$$^)),,$$(firstword $$(filter %.xml,$$^)),$$@)
532 $$(QUIET)$$(RM) -f $$(addprefix $$(@D)/,$$(VBOX_MANUAL_LATEX_FILES_TARGET))
533# generate TeX source from processed docbook and store it in UserManual.tex.tmp;
534# pass current language to xsltproc in TARGETLANG variable
535 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG $(lang) \
536 -o [email protected] $$(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $$<
537# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
538# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
539 $$(QUIET)$$(SED) \
540 -e 's|^\\QUOTE{}|\\OQ{}|g' \
541 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
542 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
543 --output $$@ [email protected]
544 $$(QUIET)$$(RM) -f [email protected]
545endef
546$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_xml_to_tex))
547
548# Useful aliases
549usermanual UserManual.pdf:: $(PATH_STAGE_BIN)/UserManual.pdf
550
551debug-usermanual:
552 $(MAKE) --pretty-command-printing -j1 VBOX_PDFLATEX_INTERACTION=errorstopmode $(PATH_STAGE_BIN)/UserManual.pdf
553
554#
555# Generate rules for validating the UserManual.xml. These are invoked
556# automatically at build time, but can also be manually invoked via the
557# 'validatemanual' and 'validatemanual_<lang>' aliases.
558#
559define def_vbox_validate_xml
560validatemanual_$(lang):: $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/validatemanual.run
561$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/validatemanual.run: \
562 $$(addprefix $$(VBOX_PATH_MANUAL_SRC)/$(lang)/,$$(VBOX_MANUAL_XML_FILES)) \
563 $$(VBOX_MANUAL_XML_FILES_COMMON) \
564 $$(VBOX_MANUAL_XML_FILES_GENERATED_$(lang)) \
565 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
566 $$(VBOX_XML_ENTITIES) $$(MAKEFILE_CURRENT) | $$$$(dir $$$$@)
567 $$(call MSG_L1,Validating $$<)
568 $$(QUIET)$$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$<
569 $$(QUIET)$$(APPEND) -t "$$@" "done"
570endef
571$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_validate_xml))
572
573
574# Handy aliases.
575validatemanual:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),validatemanual_$(lang))
576
577
578
579#
580# SDKRef.pdf
581#
582
583# Replace <tt> tags in VirtualBox.xidl.
584$(VBOX_DOC_XIDL_SRC_TMP): $(VBOX_DOC_XIDL_SRC) $(MAKEFILE_CURRENT) | $$(dir $$@)
585 $(call MSG_L1,Generating $@)
586 $(QUIET)$(SED) -e 's|@a \+\(\w\+\)|<tt>\1</tt>|g' \
587 -e 's|@c \+\(\w\+\)|<tt>\1</tt>|g' \
588 --output $@ $<
589
590# Generate SDKRef_apiref.xml as a docbook file excerpt that will be referenced from the SDKRef.xml.
591$(VBOX_MANUAL_APIREF_TMP): $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl $(VBOX_DOC_XIDL_SRC_TMP)
592 $(call MSG_L1,Generating $@)
593 $(QUIET)$(VBOX_XSLTPROC) $(VBOX_XSLTPROC_OPTS) --xinclude --nonet -o $@ $< $(VBOX_DOC_XIDL_SRC_TMP)
594
595# Turn SDKRef.xml into LaTeX.
596$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex: \
597 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
598 $(VBOX_MANUAL_APIREF_TMP) \
599 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
600 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run,) \
601 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
602 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
603 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
604 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_SDKREF_LATEX_FILES_TARGET))
605# generate TeX source from processed docbook and store it in SDKRef.tex.tmp
606 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
607 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
608# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
609# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
610 $(QUIET)$(SED) \
611 -e 's|^\\QUOTE{}|\\OQ{}|g' \
612 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
613 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
614 --output $@ [email protected]
615 $(QUIET)$(RM) -f [email protected]
616
617# Turn SDKRef.tex into a PDF.
618$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf: \
619 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex \
620 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
621 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
622 $(call MSG_L1,pdflatex $< (three passes))
623 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
624 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
625 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
626 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
627 $(QUIET)$(SED) -n \
628 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
629 $(basename $<).log
630 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
631
632# Validating SDKRef.xml. It is invoked automatically at build time,
633# but can also be manually invoked via the 'validate-sdkref' alias.
634$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run: \
635 $(VBOX_PATH_MANUAL_SRC)/en_US/SDKRef.xml \
636 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
637 $(VBOX_MANUAL_APIREF_TMP) \
638 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
639 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
640 $(call MSG_L1,Validating $<)
641 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
642 $(QUIET)$(APPEND) -t "$@" "done"
643
644
645# Handy aliases.
646validate-sdkref:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run
647sdkref:: $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf
648
649
650
651#
652# Accessibility.pdf
653#
654
655# Turn Accessibility.xml into LaTeX.
656$(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex: \
657 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
658 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
659 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run,) \
660 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
661 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
662 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
663 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET))
664# generate TeX source from processed docbook and store it in Accessibility.tex.tmp
665 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
666 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
667# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
668# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
669 $(QUIET)$(SED) \
670 -e 's|^\\QUOTE{}|\\OQ{}|g' \
671 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
672 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
673 --output $@ [email protected]
674 $(QUIET)$(RM) -f [email protected]
675
676# Turn Accessibility.tex into a PDF.
677$(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf: \
678 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex \
679 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
680 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
681 $(call MSG_L1,pdflatex $< (three passes))
682 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
683 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
684 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
685 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
686 $(QUIET)$(SED) -n \
687 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
688 $(basename $<).log
689 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
690
691$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html: \
692 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
693 $(VBOX_DOCBOOK_HTML_ONE_PAGE_FORMATCFG) \
694 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
695 $(VBOX_XML_ENTITIES) | $$(dir $$@)
696 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
697 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
698 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html \
699 $(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl \
700 $<
701
702# Validating Accessibility.xml. It is invoked automatically at build time,
703# but can also be manually invoked via the 'validate-accessibility' alias.
704$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run: \
705 $(VBOX_PATH_MANUAL_SRC)/en_US/Accessibility.xml \
706 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
707 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
708 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
709 $(call MSG_L1,Validating $<)
710 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
711 $(QUIET)$(APPEND) -t "$@" "done"
712
713
714# Handy aliases.
715validate-accessibility:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run
716accessibility:: $(PATH_STAGE_BIN)/Accessibility.pdf
717accessibility-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
718
719
720# A few things which are shared between htmlhelp and qhelp docs.
721VBOX_DOCBOOK_HTMLHELP_FORMATCFG = \
722 $(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl \
723 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
724 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
725
726# Prepare the XSL file for our title page, htmlhelp and qhelp variant.
727$(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl: \
728 $(VBOX_PATH_MANUAL_SRC)/titlepage-htmlhelp.xml $(MAKEFILE_CURRENT) | $$(dir $$@)
729 $(call MSG_L1,xsltproc $<)
730 $(QUIET)$(RM) -f [email protected] $@
731 $(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet -o [email protected] $(VBOX_PATH_DOCBOOK)/template/titlepage.xsl $<
732 $(QUIET)$(MV) -f [email protected] $@
733
734
735ifdef VBOX_WITH_DOCS_CHM
736 #
737 # VirtualBox.chm
738 #
739 # We first generate a .hhp help source file from the preprocessed
740 # DocBook XML files, as defined above, then feed that into the
741 # Microsoft Help Compiler.
742
743 # Generate CHM from HHP
744 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
745 define def_vbox_usermanual_hhp_to_chm
746 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
747 $$(out_dir)/VirtualBox.chm: \
748 $$(out_dir)/HTMLHelp/htmlhelp.hhp \
749 $$(addprefix $$(out_dir)/HTMLHelp/,$$(VBOX_MANUAL_PNG_FILES_$(lang))) \
750 | $$$$(dir $$$$@)
751 $$(call MSG_L1,hhc $$<,=> $$@)
752 $$(QUIET)$$(RM) -f $$@
753 $$(QUIET)$$(VBOX_HHC) $$(subst /,\\,$$<)
754 $$(call MSG_L1,Fresh CHM is now at $$@)
755 endef
756 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_hhp_to_chm))
757
758 # Generate HHP from XML
759 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
760 define def_vbox_usermanual_xml_to_hhp
761 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
762 $$(out_dir)/HTMLHelp/htmlhelp.hhp: \
763 $$(addprefix $$(VBOX_PATH_MANUAL_SRC)/$(lang)/,$$(VBOX_MANUAL_XML_FILES)) \
764 $$(VBOX_MANUAL_XML_FILES_COMMON) \
765 $$(VBOX_MANUAL_XML_FILES_GENERATED_$(lang)) \
766 $$(VBOX_DOCBOOK_HTMLHELP_FORMATCFG) \
767 $$(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl \
768 $$(if $$(VBOX_HAVE_XMLLINT),$$(out_dir)/validatemanual.run,) \
769 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
770 $$(VBOX_XML_ENTITIES) | $$$$(dir $$$$@)
771 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
772 $$(QUIET)$$(RM) -f $$@
773 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$(@D)/ \
774 --stringparam htmlhelp.chm \
775 $$(subst /,\\,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/VirtualBox.chm) \
776 $$(HTMLHELPOPTS) $$(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl \
777 $$<
778 endef
779 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_xml_to_hhp))
780
781 # copy the PNG files.
782 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
783 define def_vbox_cp_images_htmlhelp
784 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/HTMLHelp
785 $(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
786 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
787 $$(call MSG_L1,Copying temporary $$< => $$@)
788 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
789 endef
790 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_htmlhelp)))
791
792endif # VBOX_WITH_DOCS_CHM
793
794
795# Packing the docs into a zip file
796$(PATH_STAGE_BIN)/VBoxDocumentation.zip: $(VBOX_MANUAL_PACK)
797 $(call MSG_L1,Packing documentation $@)
798 $(QUIET)$(RM) -f $@
799 $(QUIET)$(REDIRECT) -C $(PATH_STAGE_BIN) -- $(VBOX_ZIP) -9 $@ $(notdir $^)
800
801
802##########################################################################################
803#
804# UserManual.html
805#
806##########################################################################################
807VBOX_DOCBOOK_HTML_ONE_PAGE_FORMATCFG = \
808 $(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl \
809 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
810 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
811
812$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html: \
813 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_MANUAL_XML_FILES)) \
814 $(VBOX_MANUAL_XML_FILES_COMMON) \
815 $(VBOX_MANUAL_XML_FILES_GENERATED_en_US) \
816 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
817 $(VBOX_DOCBOOK_HTML_ONE_PAGE_FORMATCFG) \
818 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatemanual.run,) \
819 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
820 $(VBOX_XML_ENTITIES) | $$(dir $$@)
821 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
822 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
823 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
824 $(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl \
825 $<
826
827VBOX_DOCBOOK_HTML_CHUNKS_FORMATCFG = \
828 $(VBOX_PATH_MANUAL_SRC)/docbook-html-chunks-formatcfg.xsl \
829 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
830 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
831
832$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html: \
833 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_MANUAL_XML_FILES)) \
834 $(VBOX_MANUAL_XML_FILES_COMMON) \
835 $(VBOX_MANUAL_XML_FILES_GENERATED_en_US) \
836 $(VBOX_DOCBOOK_HTML_CHUNKS_FORMATCFG) \
837 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
838 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatemanual.run,) \
839 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
840 $(VBOX_XML_ENTITIES) | $$(dir $$@)
841 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
842 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
843 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html \
844 --stringparam chunk.section.depth 0 \
845 $(VBOX_PATH_MANUAL_SRC)/docbook-html-chunks-formatcfg.xsl \
846 $<
847
848$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip: \
849 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
850 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html \
851 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US))
852 $(call MSG_L1,Packing documentation $@)
853 $(QUIET)$(RM) -f $@
854 $(QUIET)$(REDIRECT) -C $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ -- $(VBOX_ZIP) \
855 -9 -r $@ html-single html-chunks $(VBOX_MANUAL_PNG_FILES_en_US)
856
857html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
858html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
859qhelp:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/, $(VBOX_QHELP_OUTPUT_FILES))
860html-zip:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
861
862#
863# ChangeLog.html
864#
865# This XSLT rule formats en_US/user_ChangeLog.xml (which includes the actual change log
866# contained in user_ChangeLogImpl.xml) as a standalone HTML file.
867#
868$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html: \
869 $(VBOX_PATH_MANUAL_SRC)/en_US/docbook-changelog-formatcfg.xsl \
870 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml \
871 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
872 $(VBOX_XML_ENTITIES) | $$(dir $$@)
873 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
874 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" "$<" $(filter %.xml,$^)
875 $(call MSG_L1,Fresh ChangeLog.html is now at $@)
876
877cl-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html
878
879
880
881endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
882
883
884#
885# VBoxManage man pages (parts also required by VBoxManage built-in help).
886#
887
888##
889# Emits rules for preprocessing refentry sources (applying remarks element),
890# and for producing the actual man pages.
891# $(evalcall2 def_vbox_refentry_to_manpage)
892# @param 1 The language
893# @param 2 The file name (no path).
894define def_vbox_refentry_to_manpage
895$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2): \
896 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
897 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl \
898 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT) \
899 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
900 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
901 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
902 $$(QUIET)$$(RM) -f "$$@"
903 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ \
904 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl $$<
905 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output [email protected] $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT) $$@
906 $$(QUIET)$$(MV) -f -- "[email protected]" "$$@"
907if defined(VBOX_HAVE_XMLLINT)
908 $$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$@
909endif
910
911$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(patsubst man_%,%.1,$(basename $(2))): \
912 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2) \
913 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage.xsl \
914 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
915 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
916 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
917 $$(QUIET)$$(RM) -f "$$@"
918 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --maxdepth 6000 --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage.xsl $$<
919endef
920$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
921, $(evalcall2 def_vbox_refentry_to_manpage,$(lang),$(file))))
922
923
924ifdef VBOX_WITH_DOCS_QHELP
925 #
926 # VirtualBox.qch/VirtualBox.qhc
927 #
928 # We first generate a .hhp help source file from the preprocessed
929 # DocBook XML files, as defined above, then feed that into a converter
930 # creating the suitable input for creating a QHelp collection file.
931
932 # Generate QCH from QHelp source
933 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
934 define def_vbox_usermanual_qhp_to_qch
935 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
936 $$(out_dir)/qhelp/UserManual.qch + \
937 $$(out_dir)/qhelp/UserManual.qhc: \
938 $$(out_dir)/qhelp/UserManual.qhcp \
939 $$(out_dir)/qhelp/UserManual.qhp \
940 $$(addprefix $$(out_dir)/qhelp/,$$(VBOX_MANUAL_PNG_FILES_$(lang))) \
941 | $$$$(dir $$$$@)
942 $$(call MSG_L1,$$(notdir $$(QHELPGENERATOR)) $$<,=> $$@)
943 $$(QUIET)$$(RM) -f $$@
944 $$(QUIET)$$(REDIRECT) -E QT_QPA_PLATFORM_PLUGIN_PATH=$$(PATH_SDK_QT5)/plugins -- $$(QHELPGENERATOR) $$<
945 $$(call MSG_L1,Fresh QCH is now at $$@)
946 endef
947 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_qhp_to_qch))
948
949 # Generate QHP from HHP for QHelp
950 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
951 define def_vbox_usermanual_hhp_qhelp_to_qhp
952 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
953 $$(out_dir)/qhelp/UserManual.qhp: \
954 $$(out_dir)/qhelp/htmlhelp.hhp \
955 $$(addprefix $$(out_dir)/qhelp/,$$(VBOX_MANUAL_PNG_FILES_$(lang))) \
956 | $$$$(dir $$$$@)
957 $$(call MSG_L1,htmlhelp-qthelp.py $$<,=> $$@)
958 $$(QUIET)$$(RM) -f $$@
959 $$(QUIET)$$(VBOX_BLD_PYTHON) $$(VBOX_PATH_MANUAL_SRC)/htmlhelp-qthelp.py -d $$(<D) -o $$@
960 endef
961 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_hhp_qhelp_to_qhp))
962
963 # Generate HHP for QHelp from XML
964 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
965 define def_vbox_usermanual_xml_to_hhp_qhelp
966 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
967 $$(out_dir)/qhelp/htmlhelp.hhp: \
968 $$(addprefix $$(VBOX_PATH_MANUAL_SRC)/$(lang)/,$$(VBOX_MANUAL_XML_FILES)) \
969 $$(VBOX_MANUAL_XML_FILES_COMMON) \
970 $$(VBOX_MANUAL_XML_FILES_GENERATED_$(lang)) \
971 $$(VBOX_DOCBOOK_HTMLHELP_FORMATCFG) \
972 $$(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl \
973 $$(if $$(VBOX_HAVE_XMLLINT),$$(out_dir)/validatemanual.run,) \
974 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
975 $$(VBOX_XML_ENTITIES) | $$$$(dir $$$$@)
976 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
977 $$(QUIET)$$(RM) -f $$@
978 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$(@D)/ \
979 --stringparam htmlhelp.chm \
980 $$(subst /,\\,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/VirtualBox.chm) \
981 $$(HTMLHELPOPTS) $$(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl \
982 $$<
983 endef
984 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_usermanual_xml_to_hhp_qhelp))
985
986 # copy the qhcp file.
987 define def_vbox_cp_qhcp
988 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/qhelp
989 $$(out_dir)/UserManual.qhcp: \
990 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/% | $$$$(dir $$$$@)
991 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
992 endef
993 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_qhcp)))
994
995 # copy the PNG files.
996 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
997 define def_vbox_cp_images_qhelp
998 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/qhelp
999 $(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
1000 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
1001 $$(call MSG_L1,Copying temporary $$< => $$@)
1002 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
1003 endef
1004 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_qhelp)))
1005
1006endif # VBOX_WITH_DOCS_QHELP
1007
1008
1009# Handy aliases.
1010validate-manpages:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_REFENTRY_FILES))
1011man-experiment:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
1012 ,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/$(patsubst man_%,%.1,$(basename $(file)))))
1013
1014#
1015# Manually updating the DHCP option list taken from VirtualBox.xidl
1016#
1017dhcpoptions: $(PATH_ROOT)/doc/manual/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xsl \
1018 $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
1019 $(call VBOX_XSLTPROC) --output "$(PATH_ROOT)/doc/manual/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xml" $+
1020
1021
1022include $(FILE_KBUILD_SUB_FOOTER)
1023
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