VirtualBox

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

Last change on this file since 99162 was 99162, checked in by vboxsync, 2 years ago

manual: More work on the refentry to dita converter - sbr trouble and paragraph hack between syntaxdiagrams. bugref:10302

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.1 KB
Line 
1# $Id: Makefile.kmk 99162 2023-03-24 01:51: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
61if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK)) # Whole file.
62
63 #
64 # Globals
65 #
66
67 ## Combines the VBOX_MANUAL_LANGUAGES and VBOX_MANUAL_ADD_LANGUAGES lists from
68 # /Config.kmk, as per the VBOX_WITH_DOCS_TRANSLATIONS setting.
69 ifdef VBOX_WITH_DOCS_TRANSLATIONS
70 VBOX_MANUAL_ALL_LANGUAGES := $(VBOX_MANUAL_LANGUAGES) $(VBOX_MANUAL_ADD_LANGUAGES)
71 else
72 VBOX_MANUAL_ALL_LANGUAGES := $(VBOX_MANUAL_LANGUAGES)
73 endif
74
75 ## The files that should go into VBoxDocumentation.zip (must be immediately under PATH_STAGE_BIN).
76 VBOX_MANUAL_PACK =
77
78 # Various file lists (mainly needed for OTHER_CLEAN).
79 VBOX_QHELP_OUTPUT_FILES := UserManual.qch UserManual.qhc
80 VBOX_ACCESSIBILITY_XML_FILES := Accessibility.xml
81 VBOX_MANUAL_LATEX_FILES_TARGET := $(addprefix UserManual.,aux log out toc tex)
82 VBOX_SDKREF_LATEX_FILES_TARGET := $(addprefix SDKRef.,aux log out toc tex)
83 VBOX_ACCESSIBILITY_LATEX_FILES_TARGET := $(addprefix Accessibility.,aux log out toc tex)
84
85 VBOX_MANUAL_TEX_UNICODE_FILES = $(wildcard $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/*)
86
87 # Wildcard the images path for every supported language
88 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES) \
89 ,$(eval VBOX_MANUAL_PNG_FILES_$$(lang) := $$(patsubst $$(VBOX_PATH_MANUAL_SRC)/$$(lang)/%,%, \
90 $$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$$(lang)/images/*.png))))
91
92 # SDK related globals.
93 VBOX_MANUAL_APIREF_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef_apiref.xml
94 VBOX_DOC_XIDL_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
95 VBOX_DOC_XIDL_SRC_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.xidl.tmp
96
97
98 #
99 # PDF LaTeX related globals.
100 #
101
102 VBOX_PDFLATEX_INTERACTION ?= batchmode
103 # VBOX_PDFLATEX_INTERACTION = errorstopmode - Use this when you wants to figure out build failures
104 # without catting the log a million times.
105 ifeq ($(KBUILD_HOST),win)
106 ifndef VBOX_PDFLATEX
107 VBOX_PDFLATEX := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/miktex-portable/*/miktex/bin/pdflatex.exe)))
108 ifneq ($(VBOX_PDFLATEX),)
109 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION)
110 endif
111 endif
112 ifndef VBOX_PDFLATEX
113 # Tell MiKTeX to automatically download packages if system wide install.
114 VBOX_PDFLATEX := pdflatex
115 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION) --enable-installer
116 endif
117 else
118 VBOX_PDFLATEX ?= pdflatex
119 VBOX_PDFLATEX_HALT = $(shell ( $(VBOX_PDFLATEX) -version | head -1 | grep 141592 > /dev/null ) && echo -halt-on-error )
120 VBOX_PDFLATEX_CMD = pdflatex $(VBOX_PDFLATEX_HALT) -interaction $(VBOX_PDFLATEX_INTERACTION)
121 endif
122
123
124 #
125 # DITA-OT related globals.
126 #
127
128 ##
129 # Copies DITA-OT to $1, runs the dost.jar with /ditadir given and nukes $1 when done.
130 #
131 # Additional options for dost.jar can be specified following the call to VBOX_DITA_RUN_DOST
132 #
133 # @param 1 Temporary+unique DITA-OT path.
134 # @param 2 Additional kmk_redirect options.
135 # @param 3 Parameters for the invoker.
136 # @param 4 Parameters only for 1.8.5.
137 # @param 5 Parameters only for 4.0.2.
138 #
139 VBOX_DITA_RUN_DOST ?= $(REDIRECT) \
140 -E 'ANT_OPTS=-Xmx512m -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl' \
141 -E 'ANT_HOME=$1/tools/ant' \
142 -E 'DITA_DIR=$1' \
143 -E 'JAVA_HOME=$(VBOX_JAVA_HOME)' \
144 -A 'PATH=$(HOST_PATH_SEP)$1/tools/ant/bin' \
145 -E 'CLASSPATH=$1/lib/dost.jar' \
146 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib' \
147 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/commons-codec-1.4.jar' \
148 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/resolver.jar' \
149 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/icu4j.jar' \
150 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/xercesImpl.jar' \
151 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/xml-apis.jar' \
152 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/saxon/saxon9.jar' \
153 -A 'CLASSPATH=$(HOST_PATH_SEP)$1/lib/saxon/saxon9-dom.jar' \
154 $2 \
155 -- $(ASH) $(VBOX_PATH_MANUAL_SRC)/dita-ot-copy-exec.sh "$(VBOX_DITA_ORIGINAL_PATH)" "$1" \
156 -- $(VBOX_JAVA) -jar "$1/lib/dost.jar" "/ditadir:$1" $3 $4 # "/outercontrol:fail" ?
157
158 if 0 # Experiments with dita-ot v4.0.2. Requires java 17.
159 VBOX_JAVA_HOME := C:/Program Files/Java/jdk-17/
160 VBOX_DITA_ORIGINAL_PATH := D:/Tmp/dita/dita-ot-4.0.2
161 VBOX_DITA_CLASSPATH = \
162 $(subst $(SP),;,$(strip \
163 $(VBOX_DITA_ORIGINAL_PATH)/lib/ant-launcher.jar \
164 $(VBOX_DITA_ORIGINAL_PATH)/config \
165 $(VBOX_DITA_ORIGINAL_PATH)/lib \
166 $(wildcard \
167 $(VBOX_DITA_ORIGINAL_PATH)/lib/*.jar \
168 $(VBOX_DITA_ORIGINAL_PATH)/plugins/*/lib/*.jar)))
169 VBOX_DITA_RUN_DOST = $(REDIRECT) \
170 -E 'ANT_HOME=$(VBOX_DITA_ORIGINAL_PATH)' \
171 -E 'DITA_DIR=$(VBOX_DITA_ORIGINAL_PATH)' \
172 -E 'JAVA_HOME=$(VBOX_JAVA_HOME)' \
173 -E 'CLASSPATH=$(VBOX_DITA_CLASSPATH)' \
174 $2 \
175 -- \
176 $(VBOX_JAVA) \
177 "-Djava.awt.headless=true" \
178 "-Dsun.io.useCanonCaches=true" \
179 "-Dant.home=$(VBOX_DITA_ORIGINAL_PATH)" \
180 "-Ddita.dir=$(VBOX_DITA_ORIGINAL_PATH)" \
181 org.apache.tools.ant.launch.Launcher \
182 -cp "$(VBOX_DITA_CLASSPATH)" \
183 -buildfile "$(VBOX_DITA_ORIGINAL_PATH)/build.xml" \
184 -main "org.dita.dost.invoker.Main" \
185 $(patsubst "/i:%,"--input=%, \
186 $(patsubst "/transtype:%,"--format=%, \
187 $(patsubst "/outdir:%,"--output=%, \
188 $(patsubst "/tempdir:%,"--temp=%, \
189 $(patsubst "/filter:%,"--filter=%, \
190 $(patsubst "/debug","--debug",$3)))))) \
191 $5 --verbose --debug
192 endif
193
194
195 #
196 # Targets
197 #
198
199 BLDDIRS += $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, $(VBOX_MANUAL_ALL_LANGUAGES))
200
201 ifdef VBOX_ONLY_DOCS
202 PACKING += $(PATH_STAGE_BIN)/VBoxDocumentation.zip
203 endif
204
205 BLDDIRS += \
206 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita \
207 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics \
208 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/topics/images
209
210 BLDDIRS += \
211 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, \
212 $(addsuffix /images, $(VBOX_MANUAL_ALL_LANGUAGES)) \
213 $(addsuffix /html-single, $(VBOX_MANUAL_ALL_LANGUAGES)) \
214 $(addsuffix /html-chunks, $(VBOX_MANUAL_ALL_LANGUAGES)) \
215 $(addsuffix /qhelp, $(VBOX_MANUAL_ALL_LANGUAGES)) \
216 $(addsuffix /qhelp/images, $(VBOX_MANUAL_ALL_LANGUAGES)) \
217 $(addsuffix /HTMLHelp, $(VBOX_MANUAL_ALL_LANGUAGES)) \
218 $(addsuffix /HTMLHelp/images, $(VBOX_MANUAL_ALL_LANGUAGES)) \
219 )
220
221 # Explicit cleaning has some overlap with default cleaning rules, since this
222 # Makefile is using very complex conditionals for selectively creating
223 # specific files, and not everyone remembers to use the same with "kmk clean".
224 OTHER_CLEAN += \
225 $(VBOX_XML_CATALOG) \
226 $(VBOX_XML_CATALOG_DOCBOOK) \
227 $(VBOX_XML_CATALOG_MANUAL) \
228 $(VBOX_XML_ENTITIES) \
229 $(foreach lang, $(VBOX_MANUAL_ALL_LANGUAGES) \
230 ,$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/, \
231 $(VBOX_XML_XREF_TO_TEXT) \
232 $(VBOX_XML_XREF_TO_TEXT).cat \
233 $(addprefix user_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
234 $(VBOX_MANUAL_XML_REFENTRY_FILES) \
235 $(patsubst man_%,%.1,$(basename $(VBOX_MANUAL_XML_REFENTRY_FILES))) \
236 man_VBoxHeadless.xml \
237 user_man_VBoxHeadless.xml \
238 man_vboximg-mount.xml \
239 user_man_vboximg-mount.xml \
240 isomakercmd-man.xml \
241 user_isomakercmd-man.xml \
242 $(VBOX_MANUAL_LATEX_FILES_TARGET) \
243 $(VBOX_MANUAL_PNG_FILES_$(lang)) \
244 $(notdir $(VBOX_MANUAL_TEX_UNICODE_FILES)) \
245 $(addprefix HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(lang))) \
246 $(addprefix qhelp/, $(VBOX_MANUAL_PNG_FILES_$(lang))) \
247 html-single/UserManual.html \
248 $(addprefix qhelp/, UserManual.qhp UserManual.qhcp $(VBOX_QHELP_OUTPUT_FILES)) \
249 $(addprefix HTMLHelp/, index.html go01.html) \
250 $(addprefix qhelp/, index.html go01.html) \
251 $(addprefix html-chunks/, index.html go01.html) \
252 $(foreach n,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 \
253 ,html-chunks/ch$(n).html \
254 html-chunks/re$(n).html \
255 HTMLHelp/ch$(n).html \
256 HTMLHelp/re$(n).html \
257 $(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)) \
258 qhelp/ch$(n).html \
259 qhelp/re$(n).html \
260 $(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)) ) \
261 $(foreach n,a b c \
262 ,html-chunks/ap$(n).html \
263 HTMLHelp/ap$(n).html \
264 $(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) \
265 qhelp/ap$(n).html \
266 $(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) ) \
267 $(foreach n,01 02 03 04 05 \
268 ,html-chunks/pr$(n).html \
269 HTMLHelp/pr$(n).html \
270 $(foreach s,01 02 03 04 05 06 07 08,HTMLHelp/pr$(n)s$(s).html) \
271 qhelp/pr$(n).html \
272 $(foreach s,01 02 03 04 05 06 07 08,qhelp/pr$(n)s$(s).html) ) \
273 HTMLHelp/toc.hhc \
274 HTMLHelp/htmlhelp.hhp \
275 qhelp/toc.hhc \
276 qhelp/htmlhelp.hhp \
277 UserManual.pdf \
278 VirtualBox.chm \
279 $(VBOX_QHELP_OUTPUT_FILES) \
280 ChangeLog.html \
281 validatemanual.run \
282 validateaccessibility.run \
283 validatesdkref.run \
284 ) \
285 ) \
286 $(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl \
287 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
288 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf) \
289 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm) \
290 $(PATH_STAGE_BIN)/UserManual.pdf \
291 $(PATH_STAGE_BIN)/VirtualBox.chm \
292 \
293 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
294 $(VBOX_SDKREF_LATEX_FILES_TARGET) \
295 SDKRef.pdf \
296 ) \
297 $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf \
298 \
299 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
300 $(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET) \
301 html-single/Accessibility.html \
302 Accessibility.pdf \
303 ) \
304 $(PATH_STAGE_BIN)/Accessibility.html \
305 $(PATH_STAGE_BIN)/Accessibility.pdf \
306 \
307 $(VBOX_DOC_XIDL_SRC_TMP) \
308 $(VBOX_MANUAL_APIREF_TMP)
309
310
311 ifndef VBOX_ONLY_SDK
312 #
313 # target for installing UserManual.pdf
314 #
315 INSTALLS += VBox-docs-usermanual
316 VBox-docs-usermanual_INST = $(INST_BIN)
317 VBox-docs-usermanual_MODE = a+r,u+w
318 VBox-docs-usermanual_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf
319 VBOX_MANUAL_PACK += $(PATH_STAGE_BIN)/UserManual.pdf
320
321 ifdef VBOX_WITH_DOCS_TRANSLATIONS
322 #
323 # target for installing translated UserManual_*.pdf
324 #
325 INSTALLS += VBox-docs-usermanual-l10n
326 VBox-docs-usermanual-l10n_INST = $(INST_BIN)
327 VBox-docs-usermanual-l10n_MODE = a+r,u+w
328 VBox-docs-usermanual-l10n_SOURCES = \
329 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(f)/UserManual.pdf=>UserManual_$(f).pdf)
330 VBOX_MANUAL_PACK += $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf)
331 endif
332
333 ifdef VBOX_WITH_DOCS_HTML
334 #
335 # target for installing the chunked HTML docs
336 #
337 INSTALLS += VBox-docs-usermanual-html
338 VBox-docs-usermanual-html_INST = $(INST_BIN)
339 VBox-docs-usermanual-html_MODE = a+r,u+w
340 VBox-docs-usermanual-html_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip=>UserManual-html.zip
341 VBOX_MANUAL_PACK += $(PATH_STAGE_BIN)/UserManual-html.zip
342 endif
343
344 ifdef VBOX_WITH_DOCS_QHELP
345 #
346 # Installs the qhelp version of the manual.
347 #
348 INSTALLS += VBox-docs-usermanual-qhelp
349 VBox-docs-usermanual-qhelp_INST = $(INST_BIN)
350 VBox-docs-usermanual-qhelp_MODE = a+r,u+w
351 VBox-docs-usermanual-qhelp_SOURCES = \
352 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/UserManual.qhc \
353 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/UserManual.qch
354 ifdef VBOX_WITH_DOCS_QHELP_PACKING
355 VBOX_MANUAL_PACK += \
356 $(PATH_STAGE_BIN)/UserManual.qch \
357 $(PATH_STAGE_BIN)/UserManual.qhc
358 endif
359 endif
360
361 ifdef VBOX_WITH_DOCS_ACCESSIBILITY
362 #
363 # target for installing Accessibility.pdf
364 #
365 INSTALLS += VBox-docs-accessibility
366 VBox-docs-accessibility_INST = $(INST_BIN)
367 VBox-docs-accessibility_MODE = a+r,u+w
368 VBox-docs-accessibility_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf
369
370 #
371 # target for installing Accessibility.html
372 #
373 INSTALLS += VBox-docs-accessibility-html
374 VBox-docs-accessibility-html_INST = $(INST_BIN)
375 VBox-docs-accessibility-html_MODE = a+r,u+w
376 VBox-docs-accessibility-html_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
377 endif
378
379 endif # !VBOX_ONLY_SDK
380
381 if defined(VBOX_ONLY_SDK) || defined(VBOX_WITH_DOCS_SDKREF)
382 #
383 # target for installing SDKRef.pdf
384 #
385 INSTALLS += VBox-docs-sdkref
386 VBox-docs-sdkref_INST = $(INST_SDK)docs/
387 VBox-docs-sdkref_MODE = a+r,u+w
388 VBox-docs-sdkref_SOURCES = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf
389 endif
390
391
392 #
393 # Shared rules for LaTeX based PDF generation - Only used for SDK & Accessibility.
394 #
395
396 ifndef VBOX_OSE
397 # Copy ucs.sty and associated files.
398 ## @todo r=bird: This is ugly since only ucs.sty is listed as output while we're actually copying 177 other files.
399 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/ucs.sty): | $$(dir $$@)
400 $(call MSG_L1,Copying unicode support for LaTeX)
401 $(QUIET)$(INSTALL_STAGING) -m0644 -- $(VBOX_MANUAL_TEX_UNICODE_FILES) "$(@D)"
402 endif
403
404 # Copy the PNG files.
405 define def_vbox_cp_images_pdf
406 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
407 $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/% : \
408 $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
409 $$(call MSG_L1,Copying temporary $$< => $$@)
410 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
411 endef
412 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES),$(evalcall2 def_vbox_cp_images_pdf))
413
414
415 #################################################################################################################################
416 # SDKRef.pdf - xidl => Docbook => LaTeX => PDF #
417 #################################################################################################################################
418
419 VBOX_SDKREF_XML_FILES = SDKRef.xml
420
421 # Replace @a and @c with <tt> tags in VirtualBox.xidl.
422 $(VBOX_DOC_XIDL_SRC_TMP): $(VBOX_DOC_XIDL_SRC) $(MAKEFILE_CURRENT) | $$(dir $$@)
423 $(call MSG_L1,Generating $@)
424 $(QUIET)$(SED) \
425 -e 's|@a \+\(\w\+\)|<tt>\1</tt>|g' \
426 -e 's|@c \+\(\w\+\)|<tt>\1</tt>|g' \
427 --output $@ $<
428
429 # Generate SDKRef_apiref.xml as a docbook file excerpt that will be referenced from the SDKRef.xml.
430 $(VBOX_MANUAL_APIREF_TMP): $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl $(VBOX_DOC_XIDL_SRC_TMP)
431 $(call MSG_L1,Generating $@)
432 $(QUIET)$(VBOX_XSLTPROC) $(VBOX_XSLTPROC_OPTS) --xinclude --nonet -o $@ $< $(VBOX_DOC_XIDL_SRC_TMP)
433
434 # Turn SDKRef.xml into LaTeX.
435 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex: \
436 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
437 $(VBOX_MANUAL_APIREF_TMP) \
438 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
439 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run,) \
440 $(VBOX_XML_CATALOG) \
441 $(VBOX_XML_CATALOG_DOCBOOK) \
442 $(VBOX_XML_CATALOG_MANUAL) \
443 $(VBOX_XML_ENTITIES) \
444 $(MAKEFILE_CURRENT) \
445 | $$(dir $$@)
446 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
447 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_SDKREF_LATEX_FILES_TARGET))
448 # generate TeX source from processed docbook and store it in SDKRef.tex.tmp
449 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
450 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
451 # for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
452 # the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
453 $(QUIET)$(SED) \
454 -e 's|^\\QUOTE{}|\\OQ{}|g' \
455 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
456 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
457 --output $@ [email protected]
458 $(QUIET)$(RM) -f [email protected]
459
460 # Turn SDKRef.tex into a PDF.
461 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.pdf: \
462 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex \
463 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
464 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
465 | $$(dir $$@)
466 $(call MSG_L1,pdflatex $< (three passes))
467 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
468 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
469 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
470 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
471 $(QUIET)$(SED) -n \
472 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
473 $(basename $<).log
474 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
475
476 # Validating SDKRef.xml. It is invoked automatically at build time,
477 # but can also be manually invoked via the 'validate-sdkref' alias.
478 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run: \
479 $(VBOX_PATH_MANUAL_SRC)/en_US/SDKRef.xml \
480 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
481 $(VBOX_MANUAL_APIREF_TMP) \
482 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
483 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
484 $(call MSG_L1,Validating $<)
485 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
486 $(QUIET)$(APPEND) -t "$@" "done"
487
488
489 # Handy aliases.
490 validate-sdkref:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatesdkref.run
491 sdkref:: $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf
492
493
494 #################################################################################################################################
495 # Accessibility.pdf - Docbook => LaTeX => PDF #
496 #################################################################################################################################
497
498 # Turn Accessibility.xml into LaTeX.
499 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex: \
500 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
501 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
502 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run,) \
503 $(VBOX_XML_CATALOG) \
504 $(VBOX_XML_CATALOG_DOCBOOK) \
505 $(VBOX_XML_CATALOG_MANUAL) \
506 $(VBOX_XML_ENTITIES) \
507 $(MAKEFILE_CURRENT) \
508 | $$(dir $$@)
509 $(call MSG_TOOL,xsltproc $(notdir $(filter %.xsl,$^)),,$(firstword $(filter %.xml,$^)),$@)
510 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_ACCESSIBILITY_LATEX_FILES_TARGET))
511 # generate TeX source from processed docbook and store it in Accessibility.tex.tmp
512 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
513 -o [email protected] $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
514 # for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
515 # the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
516 $(QUIET)$(SED) \
517 -e 's|^\\QUOTE{}|\\OQ{}|g' \
518 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
519 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
520 --output $@ [email protected]
521 $(QUIET)$(RM) -f [email protected]
522
523 # Turn Accessibility.tex into a PDF.
524 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.pdf: \
525 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/Accessibility.tex \
526 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
527 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US))
528 $(call MSG_L1,pdflatex $< (three passes))
529 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
530 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
531 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) Accessibility.tex
532 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
533 $(QUIET)$(SED) -n \
534 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
535 $(basename $<).log
536 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
537
538 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html: \
539 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
540 $(VBOX_DOCBOOK_HTML_ONE_PAGE_FORMATCFG) \
541 $(VBOX_XML_CATALOG) \
542 $(VBOX_XML_CATALOG_DOCBOOK) \
543 $(VBOX_XML_CATALOG_MANUAL) \
544 $(VBOX_XML_ENTITIES) | $$(dir $$@)
545 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
546 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) \
547 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html \
548 $(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl \
549 $<
550
551 # Validating Accessibility.xml. It is invoked automatically at build time,
552 # but can also be manually invoked via the 'validate-accessibility' alias.
553 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run: \
554 $(VBOX_PATH_MANUAL_SRC)/en_US/Accessibility.xml \
555 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(VBOX_ACCESSIBILITY_XML_FILES)) \
556 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(VBOX_XML_CATALOG_MANUAL) \
557 $(VBOX_XML_ENTITIES) $(MAKEFILE_CURRENT) | $$(dir $$@)
558 $(call MSG_L1,Validating $<)
559 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $<
560 $(QUIET)$(APPEND) -t "$@" "done"
561
562
563 # Handy aliases.
564 validate-accessibility:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/validateaccessibility.run
565 accessibility:: $(PATH_STAGE_BIN)/Accessibility.pdf
566 accessibility-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/Accessibility.html
567
568
569 #################################################################################################################################
570 # UserManual.* - The user manual in all its output variations (DITA-OT). #
571 #################################################################################################################################
572
573 #
574 # 1. We copy/hardlink all the files under <lang>/dita/* to the corresponding
575 # VBOX_PATH_MANUAL_OUTBASE location. This is mainly to deal with DITO-OT's
576 # inability to search for topic files in more than one place, so we have to
577 # gather generated and static topic sources + the .ditamap-file(s) in one
578 # place.
579 #
580
581 # Determin the basic set of files as dictated by the en_US version of the
582 # user manual (relative to $(lang)/dita). We'll use these to supply
583 # incomplete manual translations.
584 # Note! This includes .png as well as .dita and .ditamap files.
585 VBOX_USER_MANUAL_DITA_BASIC_SRC_FILES := \
586 $(notdir $(wildcard $(VBOX_PATH_MANUAL_SRC)/en_US/dita/*.ditamap)) \
587 $(addprefix topics/,$(notdir $(wildcard $(VBOX_PATH_MANUAL_SRC)/en_US/dita/topics/*dita))) \
588 $(addprefix topics/images/,$(notdir $(wildcard $(VBOX_PATH_MANUAL_SRC)/en_US/dita/topics/images/*png)))
589
590 ##
591 # Produce copying rules for one language and defining the variable
592 # VBOX_USER_MANUAL_DITA_STAGED_FILES_<lang> for use in prerequisite to
593 # anything producing a version of the user manual.
594 #
595 # @param 1 lang
596 define def_vbox_copy_manual_dita_src_files
597 VBOX_USER_MANUAL_DITA_SRC_FILES_$(1) := \
598 $$(notdir $$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$1/dita/*.ditamap)) \
599 $$(addprefix topics/,$$(notdir $$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$1/dita/topics/*dita))) \
600 $$(addprefix topics/images/,$$(notdir $$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$1/dita/topics/images/*png)))
601 VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)_FALLBACK := \
602 $$(filter-out $$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)), $$(VBOX_USER_MANUAL_DITA_BASIC_SRC_FILES))
603
604 VBOX_USER_MANUAL_DITA_STAGED_FILES_$(1) = \
605 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$1/dita/, \
606 $$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)) \
607 $$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)_FALLBACK) )
608
609 ifneq ($$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)),)
610 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$1/dita/,$$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1))): \
611 $$(VBOX_PATH_MANUAL_OUTBASE)/$1/dita/% : \
612 $$(VBOX_PATH_MANUAL_SRC)/$1/dita/% | $$$$(dir $$$$@)
613 $$(QUIET)$$(INSTALL_STAGING) -m 0644 -- "$$<" "$$(@D)/"
614 endif
615
616 ifneq ($$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)_FALLBACK),)
617 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$1/dita/,$$(VBOX_USER_MANUAL_DITA_SRC_FILES_$(1)_FALLBACK)): \
618 $$(VBOX_PATH_MANUAL_OUTBASE)/$1/dita/% : \
619 $$(VBOX_PATH_MANUAL_SRC)/en_US/dita/% | $$$$(dir $$$$@)
620 $$(QUIET)$$(INSTALL_STAGING) -m 0644 -- "$$<" "$$(@D)/"
621 endif
622
623 endef
624 $(foreach lang, $(VBOX_MANUAL_ALL_LANGUAGES),$(evalcall2 def_vbox_copy_manual_dita_src_files,$(lang)))
625
626
627 #
628 # 2. Convert the manpages from Docbook refentry files to DITA reference files.
629 #
630 # In DITA links needs proper href values, with both file and ID. Since the
631 # source only has IDs, we scan all topics and refentry-files alike and
632 # generate a mapping database before we start converting them. This DB is
633 # then used at the end of each conversion to fix the hrefs.
634 #
635 # Steps taken converting individual Docbook refentry files:
636 # 1. refsect2_to_refsect1.py flattens the refsect1/refsect2 hierarchy,
637 # creating a .xml version next to the final dita file.
638 # 2. docbook2dita.xsl takes that and produces a .dita-file.
639 # 3. mark_external_urls.xsl marks external links in the .dita-file.
640 # 4. add_file_to_id_only_references.py converts ID-only hrefs into
641 # href="filename.dita#ID" using the mapping DB.
642
643 ##
644 # Do per-language stuff for the refentry -> dita file conversion.
645 #
646 # The variable VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_<lang> is defined
647 # by this define and should be expaneded as a prerequisite for any rule
648 # producing a version of the user manual.
649 #
650 # @param 1 Language.
651 #
652 define def_vbox_refentry_to_dita
653 # Generate a ID to FILE mapping database that def_vbox_refentry_to_dita can apply below.
654 VBOX_USER_MANUAL_ID_MAPPING_FILE_$(1) := $$(VBOX_PATH_MANUAL_OUTBASE)/$1/id-mapping-file.db
655 OTHER_CLEAN += $(VBOX_USER_MANUAL_ID_MAPPING_FILE_$(1))
656 $$(VBOX_USER_MANUAL_ID_MAPPING_FILE_$(1)) + $$(VBOX_USER_MANUAL_ID_MAPPING_FILE_$(1)).lst: \
657 $$(VBOX_PATH_MANUAL_SRC)/build_id_to_file_mapping.py \
658 $$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$1/*.xml) \
659 $$(filter %.dita,$$(VBOX_USER_MANUAL_DITA_STAGED_FILES_$(1))) \
660 | $$$$(dir $$$$@)
661 $$(call MSG_L1, $$<)
662 $$(APPEND) -nt "[email protected]" $$(filter-out %.py,$$^)
663 $$(QUIET)$$(VBOX_BLD_PYTHON) "$$<" --output "$$@" @"[email protected]"
664
665 # Accumulated list of conversion output file names to be used as a
666 # prerequisite in rules producing a version of the user manual.
667 VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_$1 :=
668
669 endef # def_vbox_refentry_to_dita
670
671 ## Convert a single refentry file to dita.
672 # @param 1 Language
673 # @param 2 Filename w/o extension.
674 # @param 3 Alternative fallback filename (for isomakercmd-man.xml).
675 define def_vbox_refentry_file_to_dita
676 VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_$1 += $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).dita
677 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).dita \
678 + $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).xml: \
679 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-dita-pre.xsl \
680 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-dita.xsl \
681 $$(VBOX_PATH_MANUAL_SRC)/add_file_to_id_only_references.py \
682 $$(VBOX_USER_MANUAL_ID_MAPPING_FILE_$1) \
683 $$(qfirstfile , $$(qwildcard , $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2).xml) $(3) $$(VBOX_PATH_MANUAL_SRC)/en_US/$(2).xml) \
684 $$(VBOX_XML_CATALOG) \
685 $$(VBOX_XML_CATALOG_DOCBOOK) \
686 $$(VBOX_XML_CATALOG_MANUAL) \
687 $$(VBOX_XML_ENTITIES) \
688 $$(VBOX_VERSION_STAMP) \
689 | $$$$(dir $$$$@)
690 $$(call MSG_TOOL,xsltproc docbook-refentry-to-manual-dita[-pre].xsl,,$$(firstword $$(filter %.xml,$$^)),$$@)
691 $$(QUIET)$$(RM) -f -- "$$@" "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).xml"
692 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) \
693 --output "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).xml" \
694 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-dita-pre.xsl \
695 $$(qfirstfile , $$(qwildcard , $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2).xml) $(3) $$(VBOX_PATH_MANUAL_SRC)/en_US/$(2).xml)
696 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) \
697 --output "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).dita" \
698 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-dita.xsl \
699 "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/topics/$(2).xml"
700 $$(QUIET)$$(VBOX_BLD_PYTHON) $$(VBOX_PATH_MANUAL_SRC)/add_file_to_id_only_references.py \
701 --mapping-file "$$(VBOX_USER_MANUAL_ID_MAPPING_FILE_$1)" "$$@"
702 endef # def_vbox_refentry_file_to_dita
703
704 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES) \
705 ,$(evalcall2 def_vbox_refentry_to_dita,$(lang)) \
706 $(foreach file, $(basename $(VBOX_MANUAL_XML_REFENTRY_FILES) man_vboximg-mount man_VBoxHeadless) \
707 ,$(evalcall2 def_vbox_refentry_file_to_dita,$(lang),$(file))) \
708 $(evalcall2 def_vbox_refentry_file_to_dita,$(lang),user_isomakercmd-man, \
709 $(PATH_ROOT)/src/VBox/Runtime/common/fs/isomakercmd-man.xml))
710
711 ## @todo Make use of docbook-refentry-to-manual-overview.xsl again (after dita conversion)?
712
713
714 #
715 # 3a. UserManual.pdf - Run dost.jar from DITA-OT to produce the PDF version.
716 #
717 # Note! The /tempdir is deleted, recreated, used and deleted again for each
718 # run. So, be careful where you point it.
719 # Note! This crappy utility may fail to find files (or fail to parse the
720 # command line) and still return a successfully (0) exit code.
721 #
722 define def_ditamap_to_pdf
723 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual.pdf \
724 + $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual_pdf.log \
725 +| $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita.list \
726 +| $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita.xml.properties: \
727 $$(VBOX_MANUAL_XML_FILES_COMMON) \
728 $$(VBOX_MANUAL_XML_FILES_GENERATED_$(lang)) \
729 $$(VBOX_USER_MANUAL_DITA_STAGED_FILES_$(lang)) \
730 $$(VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_$(lang))
731 $$(QUIET)$$(RM) -f -- "$$@" "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual_pdf.log"
732 $$(QUIET)$$(RM) -Rf -- "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita-ot-pdf/"
733 $$(QUIET)$$(call VBOX_DITA_RUN_DOST,$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita-ot-pdf,, \
734 "/i:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/UserManual.ditamap" \
735 "/transtype:pdf" \
736 "/filter:$$(VBOX_PATH_MANUAL_SRC)/$(1)/dita/ohc.ditaval" \
737 "/outdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)" \
738 "/tempdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/temp_pdf", \
739 ,,"--logfile=$$(@D)/UserManual_pdf.log")
740
741 ditamap-to-pdf: $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/UserManual.pdf
742 endef
743 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES),$(evalcall2 def_ditamap_to_pdf,$(lang)))
744
745 # Useful aliases
746 usermanual UserManual.pdf:: $(PATH_STAGE_BIN)/UserManual.pdf
747
748
749 #
750 # 3b. UserManual.html - Run dost.jar from DITA-OT to produce the HTML versions.
751 #
752 # We produce both chunked and singled paged HTML versions of the en_US manual
753 # mainly for uploading to virtualbox.org. The docs build box produces a zip
754 # including these.
755 #
756
757 ## @todo front page
758 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html: \
759 $(VBOX_USER_MANUAL_DITA_STAGED_FILES_en_US) \
760 $(VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_en_US)
761 $(call MSG_L1,Building html chunks $@)
762 $(QUIET)$(RM) -Rf -- "$(@D)" "$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-html-chunks/"
763 $(QUIET)$(MKDIR) -- "$(@D)"
764 $(QUIET)$(call VBOX_DITA_RUN_DOST,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-html-chunks,, \
765 "/i:$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual.ditamap" \
766 "/transtype:xhtml" \
767 "/filter:$(VBOX_PATH_MANUAL_SRC)/en_US/dita/htmlhelp.ditaval" \
768 "/outdir:$(@D)" \
769 "/tempdir:$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/temp_xhtml_chunks" \
770 ,,"--logfile=$(@D)/UserManual_xhtml.log")
771
772 html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
773
774 # We must modify UserManual.ditamap here, removing all chunk attributes and put
775 # a chunk="to-content" on the root element (bookmap). For clues see:
776 # https://docs.oasis-open.org/dita/v1.2/os/spec/archSpec/chunking.html
777 # https://www.oxygenxml.com/forum/post25114.html?hilit=dita%20xhtml%20chunk#p25114
778 # We stich the index.html and UserManual-Single.html files together using
779 # SED since we haven't been able to convince DITA-OT to combine them.
780 ## @todo front page
781 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html: \
782 $(VBOX_USER_MANUAL_DITA_STAGED_FILES_en_US) \
783 $(VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_en_US)
784 $(call MSG_L1,Building html chunks $@)
785 $(QUIET)$(RM) -f -- "$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual-Single.ditamap"
786 $(SED) -r -e 's/ chunk=["][^"]+["]//g' -e 's/<bookmap /<bookmap chunk="to-content" /' \
787 --output "$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual-Single.ditamap" \
788 "$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual.ditamap"
789 $(QUIET)$(RM) -Rf -- "$(@D)" "$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-html-single/"
790 $(QUIET)$(MKDIR) -- "$(@D)"
791 $(QUIET)$(call VBOX_DITA_RUN_DOST,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-html-single,, \
792 "/i:$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/UserManual-Single.ditamap" \
793 "/transtype:xhtml" \
794 "/outdir:$(@D)" \
795 "/tempdir:$(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita/temp_xhtml_single" \
796 ,,"--logfile=$(@D)/UserManual-Single_xhtml.log")
797 $(SED) -ne '1,/<body>/{p}' \
798 --output "$@" "$(@D)/UserManual-Single.html"
799 $(APPEND) -n "$@" "<!-- index inject: -->"
800 $(SED) -ne '/<body>/,/<\/body>/{/<body>/d;/<\/body>/d;s/UserManual-Single.html/UserManual.html/g;p}' \
801 --append "$@" "$(@D)/index.html"
802 $(APPEND) -n "$@" "<!-- resuming main file: -->"
803 $(SED) -ne '/<body>/,99999999{/<body>/d;s/UserManual-Single.html/UserManual.html/g;p}' \
804 --append "$@" "$(@D)/UserManual-Single.html"
805
806 html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
807
808 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip: \
809 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html \
810 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
811 $(call MSG_L1,Packing documentation $@)
812 $(QUIET)$(RM) -f $@
813 $(QUIET)$(REDIRECT) -C $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ -- $(VBOX_ZIP) \
814 -9 -r "$@" \
815 "html-chunks" \
816 "html-single" \
817 -x "html-chunks/dita.list" \
818 -x "html-chunks/dita.xml.properties" \
819 -x "html-chunks/UserManual_xhtml.log" \
820 -x "html-single/dita.list" \
821 -x "html-single/dita.xml.properties" \
822 -x "html-single/UserManual-Single_xhtml.log" \
823 -x "html-single/index.html" \
824 -x "html-single/UserManual-Single.html"
825
826 html-zip:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
827
828
829 #
830 # A few things which are shared between htmlhelp and qhelp docs.
831 # TODO: This is Docbook related work. Left here in case we can reuse some of
832 # the ideas from it for DITA-OT.
833 #
834
835 VBOX_DOCBOOK_HTMLHELP_FORMATCFG = \
836 $(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl \
837 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
838 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
839
840 # Prepare the XSL file for our title page, htmlhelp and qhelp variant.
841 $(VBOX_PATH_MANUAL_OUTBASE)/titlepage-htmlhelp.xsl: \
842 $(VBOX_PATH_MANUAL_SRC)/titlepage-htmlhelp.xml $(MAKEFILE_CURRENT) | $$(dir $$@)
843 $(call MSG_L1,xsltproc $<)
844 $(QUIET)$(RM) -f [email protected] $@
845 $(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet -o [email protected] $(VBOX_PATH_DOCBOOK)/template/titlepage.xsl $<
846 $(QUIET)$(MV) -f [email protected] $@
847
848 # end old stuff.
849
850 if defined(VBOX_WITH_DOCS_QHELP) && !defined(VBOX_ONLY_SDK)
851 #
852 # 3c. VirtualBox.qch + VirtualBox.qhc - Qt compressed help and collection file.
853 #
854 # See usermanual.pdf under DITA-OT-xxxxx/doc folder for details.
855 #
856
857 # Enable Qt and locate the Qt help generator.
858 ifdef VBOX_WITH_QT6
859 USES += qt6
860 VBOX_QHELPGENERATOR = $(PATH_TOOL_QT6_LIBEXEC)/qhelpgenerator
861 else
862 USES += qt5
863 VBOX_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')
864 VBOX_QHELPGENERATOR = $(PATH_TOOL_QT5_BIN)/$(if-expr $(VBOX_QHELPGENERATOR_VERSION_MINOR) >= 12,qhelpgenerator,qcollectiongenerator)
865 endif
866
867 ## Build QHelp version of manual for given language.
868 # @param 1 Language
869 # @param 2 The language specific qhelp output directory.
870 define def_vbox_usermanual_as_qhelp
871
872 # 1. Generate UserManual.hpp using DITA-OT.
873 #
874 # Setting HHCDIR here so that it fails to locate hcc.exe and always skips the
875 # compilation step that produces the .chm-file, since we don't need it and it
876 # mangles the path so it always fails anyway.
877 ## @todo front page.
878 $(2)/UserManual.hhp: \
879 $(VBOX_USER_MANUAL_DITA_STAGED_FILES_$(1)) \
880 $(VBOX_USER_MANUAL_CONVERTED_REFENTRY_DITA_FILES_$(1))
881 $$(QUIET)$$(RM) -Rf -- "$$(@D)" "$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita-ot-qhelp/"
882 $$(QUIET)$$(MKDIR) -- "$$(@D)"
883 $$(QUIET)$$(call VBOX_DITA_RUN_DOST,$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita-ot-qhelp, -EHHCDIR="$$(@D)", \
884 "/i:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/UserManual.ditamap" \
885 "/transtype:htmlhelp" \
886 "/filter:$$(VBOX_PATH_MANUAL_SRC)/$(1)/dita/htmlhelp.ditaval" \
887 "/outdir:$(2)" \
888 "/tempdir:$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/dita/temp_qhelp" \
889 ,,"--logfile=$(2)/UserManual_htmlhelp.log")
890
891
892 ditamap-to-htmlhelp: $(2)/UserManual.hhp
893
894 # 2. Generate a Qt Help Project file (QHP) using htmlhelp-qthelp.py.
895 $(2)/UserManual.qhp: \
896 $(2)/UserManual.hhp \
897 $$(VBOX_PATH_MANUAL_SRC)/htmlhelp-qthelp.py \
898 | $$$$(dir $$$$@)
899 $$(call MSG_L1,htmlhelp-qthelp.py $$<,=> $$@)
900 $$(QUIET)$$(RM) -f -- "$$@"
901 $$(QUIET)$$(VBOX_BLD_PYTHON) $$(VBOX_PATH_MANUAL_SRC)/htmlhelp-qthelp.py \
902 -d "$$(<D)" -o "$$@" -f UserManual.hhp -t UserManual.hhc
903
904 # 3. Copy the Qt help configuration file from source to the output dir.
905 $(2)/UserManual.qhcp: \
906 $$(VBOX_PATH_MANUAL_SRC)/UserManual.qhcp \
907 | $(2)/UserManual.hhp # (Must not run parallel to UserManual.hpp, so it can safely nuke the output dir.)
908 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
909
910 # 4. Run the Qt help generator to produce the .qhp and .qch files.
911 $(2)/UserManual.qch \
912 + $(2)/UserManual.qhc: \
913 $(2)/UserManual.qhcp \
914 $(2)/UserManual.qhp \
915 | $$$$(dir $$$$@)
916 $$(call MSG_L1,$$(notdir $$(VBOX_QHELPGENERATOR)) $$<,=> $$@)
917 $$(QUIET)$$(RM) -f $$@
918 ifdef VBOX_WITH_QT6
919 $$(QUIET)$$(REDIRECT) -- $$(VBOX_QHELPGENERATOR) $$<
920 else
921 $$(QUIET)$$(REDIRECT) -E QT_QPA_PLATFORM_PLUGIN_PATH=$$(PATH_SDK_QT5)/plugins -- $$(VBOX_QHELPGENERATOR) $$<
922 endif
923 $$(call MSG_L1,Fresh QCH is now at $$@)
924
925 endef # def_vbox_usermanual_as_qhelp
926
927 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES) \
928 ,$(evalcall2 def_vbox_usermanual_as_qhelp,$(lang),$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/qhelp))
929
930 qhelp:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/qhelp/, $(VBOX_QHELP_OUTPUT_FILES))
931
932 endif # VBOX_WITH_DOCS_QHELP && !VBOX_ONLY_SDK
933
934
935 #################################################################################################################################
936 # Miscellaneous #
937 #################################################################################################################################
938
939 #
940 # ChangeLog.html
941 #
942 # This XSLT rule formats en_US/user_ChangeLog.xml (which includes the actual change log
943 # contained in user_ChangeLogImpl.xml) as a standalone HTML file.
944 #
945 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html: \
946 $(VBOX_PATH_MANUAL_SRC)/en_US/docbook-changelog-formatcfg.xsl \
947 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml \
948 $(VBOX_XML_CATALOG) \
949 $(VBOX_XML_CATALOG_DOCBOOK) \
950 $(VBOX_XML_CATALOG_MANUAL) \
951 $(VBOX_XML_ENTITIES) | $$(dir $$@)
952 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(firstword $(filter %.xml,$^)),$@)
953 $(QUIET)$(call VBOX_XSLTPROC_WITH_CAT) --output "$@" "$<" $(filter %.xml,$^)
954 $(call MSG_L1,Fresh ChangeLog.html is now at $@)
955
956 cl-html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html
957
958
959 #
960 # VBoxManage man pages (parts also required by VBoxManage built-in help).
961 #
962
963 ##
964 # Emits rules for preprocessing refentry sources (applying remarks element),
965 # and for producing the actual man pages.
966 # $(evalcall2 def_vbox_refentry_to_manpage)
967 # @param 1 The language
968 # @param 2 The file name (no path).
969 define def_vbox_refentry_to_manpage
970 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2): \
971 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
972 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl \
973 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT) \
974 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
975 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(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 $$@ \
979 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl $$<
980 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output [email protected] $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT) $$@
981 $$(QUIET)$$(MV) -f -- "[email protected]" "$$@"
982 if defined(VBOX_HAVE_XMLLINT)
983 $$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$@
984 endif
985
986 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(patsubst man_%,%.1,$(basename $(2))): \
987 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2) \
988 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage.xsl \
989 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \
990 $$(VBOX_XML_ENTITIES) $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
991 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
992 $$(QUIET)$$(RM) -f "$$@"
993 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --maxdepth 6000 --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage.xsl $$<
994 endef
995 $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
996 , $(evalcall2 def_vbox_refentry_to_manpage,$(lang),$(file))))
997
998 # Handy aliases.
999 validate-manpages:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_REFENTRY_FILES))
1000 man-experiment:: $(foreach lang,$(VBOX_MANUAL_ALL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
1001 ,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/$(patsubst man_%,%.1,$(basename $(file)))))
1002
1003 #
1004 # Manually updating the DHCP option list taken from VirtualBox.xidl
1005 #
1006 dhcpoptions: $(PATH_ROOT)/doc/manual/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xsl \
1007 $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
1008 $(call VBOX_XSLTPROC) --output "$(PATH_ROOT)/doc/manual/en_US/man_VBoxManage-dhcpserver-dhcpoptions.xml" $^
1009
1010
1011 #
1012 # Packing the docs into a zip file (part of the packing pass on the docs build box).
1013 #
1014 ifneq ($(VBOX_MANUAL_PACK),)
1015 $(PATH_STAGE_BIN)/VBoxDocumentation.zip: $(VBOX_MANUAL_PACK)
1016 $(call MSG_L1,Packing documentation $@)
1017 $(QUIET)$(RM) -f $@
1018 $(QUIET)$(REDIRECT) -C $(PATH_STAGE_BIN) -- $(VBOX_ZIP) -9 $@ $(notdir $^)
1019 endif
1020
1021endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
1022
1023include $(FILE_KBUILD_SUB_FOOTER)
1024
Note: See TracBrowser for help on using the repository browser.

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