VirtualBox

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

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

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