VirtualBox

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

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

manual/Makefile.kmk: Cleaning up html and qhelp outputting. The latter doesn't need an extra copy of the Docbook version of the images, since DITA-OT copies the necessary images to qhelp/topics/images/. [fix] bugref:10348 bugref:10302

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