VirtualBox

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

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

Docs: bugref:10302. Some more comment fixes.

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

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