VirtualBox

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

Last change on this file since 99272 was 99268, checked in by vboxsync, 20 months ago

manual: Theme for DITA-OT 4.0.x. bugref:10302

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