VirtualBox

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

Last change on this file since 56533 was 56533, checked in by vboxsync, 9 years ago

VBoxManage generated help updates, manual/Makefile.kmk hacking, related stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 49.4 KB
Line 
1# $Id: Makefile.kmk 56533 2015-06-18 18:15:51Z vboxsync $
2## @file
3# Sub-Makefile for the VBox User Manual.
4#
5
6#
7# Copyright (C) 2006-2015 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18#
19# This slightly messy makefile transforms the DocBook XML source for the
20# user manual into presentation output. We support two targets:
21#
22# -- UserManual.pdf, generated by LaTex
23#
24# -- VirtualBox.chm
25#
26# Both files end up in PATH_STAGE_BIN.
27#
28# Both targets indirectly depend on the XML files in this directory;
29# "indirectly" because we first copy them to PATH_TARGET and hack them
30# up a bit for variable substitution and such (see below).
31# The toolchains are roughly like this:
32#
33# -- PDF file via Apache FOP: pre-process the XML files in PATH_TARGET,
34# then create a .FO file (another XML format for "formatted objects")
35# via xsltproc, then feed the .FO file to Apache FOP to create the PDF.
36#
37# -- PDF file via LaTeX: pre-process the XML files in PATH_TARGET, then
38# run our custom "dblatex" perl script on UserManual.xml, which parses
39# the XML (using the Perl SAX parsers) and dumps a matching latex file
40# to UserManual.tex. This is then regularly processed by pdflatex to
41# generate PDF.
42#
43# -- CHM file: again, pre-process the XML files in PATH_TARGET, then use
44# xsltproc to create a .HHP file for the Microsoft Help Compiler, then
45# feed that file to it.
46#
47
48SUB_DEPTH = ../..
49include $(KBUILD_PATH)/subheader.kmk
50
51
52#
53# Globals
54#
55
56# Error out if someone tries to override old globals.
57ifdef HTMLHELPOPTS
58 $(error HTMLHELPOPTS was renamed to VBOX_HTMLHELP_OPTS!)
59endif
60ifdef DOCBOOKPATH
61 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
62endif
63ifdef DOCBOOKPATH
64 $(error DOCBOOKPATH was renamed to VBOX_PATH_DOCBOOK!)
65endif
66ifdef XML_CATALOG
67 $(error XML_CATALOG was renamed to VBOX_XML_CATALOG!)
68endif
69ifdef VBOX_XML_CATALOG_DOCBOOK
70 $(error XML_CATALOG_DOCBOOK was renamed to VBOX_XML_CATALOG_DOCBOOK!)
71endif
72ifdef VBOXMANAGEPATH
73 $(error VBOXMANAGEPATH was renamed to VBOXMANAGEHELP_PATH!)
74endif
75ifdef PDFLATEX_INTERACTION
76 $(error PDFLATEX_INTERACTION was renamed to VBOX_PDFLATEX_INTERACTION!)
77endif
78ifdef PDFLATEX
79 $(error PDFLATEX was renamed to VBOX_PDFLATEX_CMD!)
80endif
81ifdef HHC
82 $(error HHC was renamed to VBOX_HHC!)
83endif
84
85# Source and output locations.
86VBOX_PATH_MANUAL_SRC := $(PATH_SUB_CURRENT)
87VBOX_PATH_MANUAL_OUTBASE := $(PATH_TARGET)/manual
88
89# tool locations
90ifndef VBOX_OSE
91 # use docbook from our tools directory
92 VBOX_PATH_DOCBOOK ?= $(PATH_DEVTOOLS)/common/DocBook/v1.69.1
93 VBOX_PATH_DOCBOOK_DTD ?= $(PATH_DEVTOOLS)/common/docbook-xml/v4.3
94 VBOX_XML_CATALOG ?= $(VBOX_PATH_MANUAL_OUTBASE)/catalog
95 VBOX_XML_CATALOG_DOCBOOK ?= $(VBOX_PATH_MANUAL_OUTBASE)/docbook
96else
97 # use docbook of the build host
98 VBOX_PATH_DOCBOOK ?= http://docbook.sourceforge.net/release/xsl/current/
99endif
100
101# xsltproc with the catalog trick if applicable.
102ifdef VBOX_XML_CATALOG
103 VBOX_XSLTPROC_WITH_CAT = $(REDIRECT) -E "XML_CATALOG_FILES=$(VBOX_XML_CATALOG)" -- \
104 $(VBOX_XSLTPROC) --nonet --xinclude $(VBOX_XSLTPROC_OPTS)
105 VBOX_XMLLINT_WITH_CAT = $(REDIRECT) -E "XML_CATALOG_FILES=$(VBOX_XML_CATALOG)" -- \
106 $(VBOX_XMLLINT) --nonet --xinclude --noout $(VBOX_XMLLINT_OPTS)
107else
108 VBOX_XSLTPROC_WITH_CAT = $(VBOX_XSLTPROC) --nonet --xinclude $(VBOX_XSLTPROC_OPTS)
109 VBOX_XMLLINT_WITH_CAT = $(VBOX_XMLLINT) --nonet --xinclude --noout $(VBOX_XMLLINT_OPTS)
110endif
111
112VBOXMANAGEHELP_PATH ?= $(PATH_STAGE_BIN)/VBoxManageHelp$(SUFF_EXE)
113
114 # VBOX_PDFLATEX_INTERACTION = errorstopmode - Use this when you wants to figure out build failures
115 # without catting the log a million times.
116VBOX_PDFLATEX_INTERACTION ?= batchmode
117ifeq ($(KBUILD_HOST),win)
118 ifndef VBOX_PDFLATEX
119 VBOX_PDFLATEX := $(firstword $(rsort $(wildcard $(PATH_DEVTOOLS)/win.x86/miktex-portable/*/miktex/bin/pdflatex.exe)))
120 ifneq ($(VBOX_PDFLATEX),)
121 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION)
122 endif
123 endif
124 ifndef VBOX_PDFLATEX
125 # Tell MiKTeX to automatically download packages if system wide install.
126 VBOX_PDFLATEX := pdflatex
127 VBOX_PDFLATEX_CMD = $(VBOX_PDFLATEX) -halt-on-error -interaction $(VBOX_PDFLATEX_INTERACTION) --enable-installer
128 endif
129else
130 VBOX_PDFLATEX ?= pdflatex
131 VBOX_PDFLATEX_HALT = $(shell ( $(VBOX_PDFLATEX) -version | head -1 | grep 141592 > /dev/null ) && echo -halt-on-error )
132 VBOX_PDFLATEX_CMD = pdflatex $(VBOX_PDFLATEX_HALT) -interaction $(VBOX_PDFLATEX_INTERACTION)
133endif
134
135# Windows HTML Help Workshop compiler (stupid thing always returns an error!)
136VBOX_HHC = -$(EXEC_X86_WIN32) $(VBOX_PATH_HTML_HELP_WORKSHOP)/hhc.exe
137
138
139# Additional xsltproc options when generating
140VBOX_HTMLHELP_OPTS ?=
141
142# SDK related globals.
143VBOX_MANUAL_APIREF_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef_apiref.xml
144VBOX_DOC_XIDL_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
145VBOX_DOC_XIDL_SRC_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.xidl.tmp
146
147##
148# Non-pattern-rule approach to editing XSLT files.
149# $(evalcall2 def_vbox_replace_paths_in_xslt)
150# @param 1 The XSLT source file (relative to Makefile dir).
151# @param 2 Optional output subdirectory.
152define def_vbox_replace_paths_in_xslt
153OTHER_CLEAN += $$(VBOX_PATH_MANUAL_OUTBASE)/$2$(notdir $1)
154$$(VBOX_PATH_MANUAL_OUTBASE)/$2$(notdir $1): $$(VBOX_PATH_MANUAL_SRC)/$1 | $$$$(dir $$$$@)
155 $$(call MSG_GENERATE,,$$@,$$<)
156 $$(QUIET)$$(SED) \
157 -e 's|@VBOX_PATH_DOCBOOK@|$$(VBOX_PATH_DOCBOOK)|g' \
158 -e 's|@VBOX_PATH_MANUAL_SRC@|$$(VBOX_PATH_MANUAL_SRC)|g' \
159 -e 's|@VBOX_PATH_MANUAL_OUTBASE@|$$(VBOX_PATH_MANUAL_OUTBASE)|g' \
160 \
161 -e 's|@CFGPATH@|$$(VBOX_PATH_MANUAL_SRC)|g' \
162 -e 's|@TARGETPATH@|$$(@D)|g' \
163 --output "$$(@)" $$<
164endef
165
166
167## List of refentry files (manpages).
168VBOX_MANUAL_XML_REFENTRY_FILES = \
169 man_VBoxManage-debugvm.xml \
170 man_VBoxManage-extpack.xml
171
172
173#
174# Targets
175#
176
177BLDDIRS += $(VBOX_PATH_MANUAL_OUTBASE)
178
179if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
180 if defined(VBOX_ONLY_SDK) || defined(VBOX_WITH_DOCS_SDKREF)
181 ## @todo make this an install target, drop the BLDDIRS.
182 OTHERS += \
183 $(VBOX_PATH_SDK)/docs/SDKRef.pdf
184 BLDDIRS += \
185 $(VBOX_PATH_SDK)/docs
186 endif
187
188 ifdef VBOX_WITH_DOCS_CHM
189 VBOX_PATH_BIN_CHM = $(PATH_STAGE_BIN)/VirtualBox.chm
190 else # Do not build chm.
191 VBOX_PATH_BIN_CHM =
192 endif
193
194 ifndef VBOX_ONLY_SDK
195 VBOX_MANUAL_PACK += \
196 $(PATH_STAGE_BIN)/UserManual.pdf \
197 $(VBOX_PATH_BIN_CHM)
198 OTHERS += \
199 $(PATH_STAGE_BIN)/UserManual.pdf
200 OTHERS.win += \
201 $(VBOX_PATH_BIN_CHM)
202 OTHERS.linux += \
203 $(VBOX_PATH_BIN_CHM)
204
205 ifdef VBOX_WITH_DOCS_TRANSLATIONS
206 OTHERS += \
207 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf)
208 ifdef VBOX_WITH_DOCS_CHM
209 OTHERS.win += \
210 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm)
211 OTHERS.linux += \
212 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm)
213 endif
214 endif
215 endif # !VBOX_ONLY_SDK
216 ifdef VBOX_ONLY_DOCS
217 PACKING += $(PATH_STAGE_BIN)/VBoxDocumentation.zip
218 endif
219
220 ifdef VBOX_WITH_DOCS_TRANSLATIONS
221 VBOX_MANUAL_LANGUAGES += $(VBOX_MANUAL_ADD_LANGUAGES)
222 endif
223
224 VBOX_MANUAL_XML_CHANGELOG = \
225 user_ChangeLogImpl.xml
226
227 VBOX_MANUAL_XML_FILES = \
228 UserManual.xml \
229 user_AdvancedTopics.xml \
230 user_BasicConcepts.xml \
231 user_Glossary.xml \
232 user_Frontends.xml \
233 user_Installation.xml \
234 user_GuestAdditions.xml \
235 user_Introduction.xml \
236 user_KnownIssues.xml \
237 user_PrivacyPolicy.xml \
238 user_Security.xml \
239 user_Technical.xml \
240 user_ThirdParty.xml \
241 user_Troubleshooting.xml \
242 user_VBoxManage.xml \
243 user_VirtualBoxAPI.xml \
244 user_Storage.xml \
245 user_Networking.xml
246
247 VBOX_MANUAL_XML_FILES_INCL_CHANGELOG = $(VBOX_MANUAL_XML_FILES) \
248 user_ChangeLog.xml
249
250 VBOX_SDKREF_XML_FILES = \
251 SDKRef.xml
252
253 # Wildcard the images path for every supported language
254 $(foreach f,$(VBOX_MANUAL_LANGUAGES), \
255 $(eval VBOX_MANUAL_PNG_FILES_$$(f) := $$(patsubst $$(VBOX_PATH_MANUAL_SRC)/$$(f)/%,%,$$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$$(f)/images/*.png))))
256
257 VBOX_MANUAL_TEX_UNICODE_FILES = \
258 $(wildcard $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/*)
259
260 VBOX_MANUAL_LATEX_FILES_TARGET = \
261 $(addprefix UserManual.,aux log out toc tex)
262
263 VBOX_SDKREF_LATEX_FILES_TARGET = \
264 $(addprefix SDKRef.,aux log out toc tex)
265
266 BLDDIRS += \
267 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/,\
268 $(VBOX_MANUAL_LANGUAGES) \
269 $(addsuffix /images, $(VBOX_MANUAL_LANGUAGES)) \
270 $(addsuffix /html-single, $(VBOX_MANUAL_LANGUAGES)) \
271 $(addsuffix /html-chunks, $(VBOX_MANUAL_LANGUAGES)) \
272 $(addsuffix /HTMLHelp, $(VBOX_MANUAL_LANGUAGES)) \
273 $(addsuffix /HTMLHelp/images, $(VBOX_MANUAL_LANGUAGES)) \
274 )
275
276 ifdef VBOX_WITH_DOCS_CHM
277 VBOX_MANUAL_PACK += \
278 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf $(PATH_STAGE_BIN)/VirtualBox_$(f).chm)
279 endif
280
281 OTHER_CLEAN += \
282 $(VBOX_XML_CATALOG) \
283 $(VBOX_XML_CATALOG_DOCBOOK) \
284 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/, \
285 $(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG) \
286 $(VBOX_MANUAL_XML_REFENTRY_FILES) \
287 $(addprefix user_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
288 $(patsubst man_%,%.1,$(basename $(VBOX_MANUAL_XML_REFENTRY_FILES))) \
289 $(VBOX_MANUAL_LATEX_FILES_TARGET) \
290 $(VBOX_MANUAL_PNG_FILES_$(lang)) \
291 $(notdir $(VBOX_MANUAL_TEX_UNICODE_FILES)) \
292 $(addprefix HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(lang))) \
293 html-single/UserManual.html \
294 $(addprefix HTMLHelp/, index.html go01.html) \
295 $(addprefix html-chunks/, index.html go01.html) \
296 $(foreach n,01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 \
297 ,html-chunks/ch$(n).html \
298 html-chunks/re$(n).html \
299 HTMLHelp/ch$(n).html \
300 HTMLHelp/re$(n).html \
301 $(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)) ) \
302 $(foreach n,a b c \
303 ,html-chunks/ap$(n).html \
304 HTMLHelp/ap$(n).html \
305 $(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) ) \
306 HTMLHelp/toc.hhc \
307 HTMLHelp/htmlhelp.hhp \
308 docbook-htmlhelp-formatcfg.xsl \
309 docbook-html-one-page-formatcfg.xsl \
310 docbook-html-chunks-formatcfg.xsl \
311 titlepage-htmlhelp.xsl \
312 UserManual.pdf \
313 VirtualBox.chm \
314 validatemanual.run \
315 )) \
316 $(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG) \
317 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
318 $(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml \
319 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf) \
320 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm) \
321 $(PATH_STAGE_BIN)/UserManual.pdf \
322 $(PATH_STAGE_BIN)/VirtualBox.chm \
323 \
324 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/, \
325 $(VBOX_SDKREF_XML_FILES) \
326 $(VBOX_SDKREF_LATEX_FILES_TARGET) \
327 SDKRef.pdf \
328 ) \
329 $(VBOX_DOC_XIDL_SRC_TMP) \
330 $(VBOX_MANUAL_APIREF_TMP) \
331 $(PATH_STAGE_BIN)/sdk/docs/SDKRef.pdf
332
333endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
334
335
336
337#
338# To avoid network I/O for fetching DTDs, we generate catalogs mapping the public
339# entity IDs to local files. (Obviously, only done when we have local files.)
340#
341ifdef VBOX_XML_CATALOG
342# Create a catalog file for xsltproc that points to docbook catalog.
343$(VBOX_XML_CATALOG): $(MAKEFILE_CURRENT) | $$(dir $$@)
344 $(call MSG_L1,Creating catalog $@)
345 $(QUIET)$(RM) -f $@.tmp $@
346 $(QUIET)$(APPEND) $@.tmp '<?xml version="1.0"?>'
347 $(QUIET)$(APPEND) $@.tmp '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">'
348 $(QUIET)$(APPEND) $@.tmp '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">'
349 $(QUIET)$(APPEND) $@.tmp ' <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook XML" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
350 $(QUIET)$(APPEND) $@.tmp ' <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
351 $(QUIET)$(APPEND) $@.tmp ' <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
352 $(QUIET)$(APPEND) $@.tmp ' <delegateURI uriStartString="http://www.oasis-open.org/docbook/" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>'
353 $(QUIET)$(APPEND) $@.tmp '</catalog>'
354 $(QUIET)$(MV) -f $@.tmp $@
355
356# Create a docbook catalog file for xsltproc that points to the local docbook files.
357$(VBOX_XML_CATALOG_DOCBOOK): $(MAKEFILE_CURRENT) | $$(dir $$@)
358 $(call MSG_L1,Creating catalog $@)
359 $(QUIET)$(RM) -f $@.tmp $@
360 $(QUIET)$(APPEND) $@.tmp '<?xml version="1.0"?>'
361 $(QUIET)$(APPEND) $@.tmp '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">'
362 $(QUIET)$(APPEND) $@.tmp '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">'
363 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//ELEMENTS DocBook XML Information Pool V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbpoolx.mod"/>'
364 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//DTD DocBook XML V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd"/>'
365 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//DTD DocBook XML V4.4//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd"/>'
366 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//ENTITIES DocBook XML Character Entities V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbcentx.mod"/>'
367 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//ENTITIES DocBook XML Notations V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbnotnx.mod"/>'
368 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//ENTITIES DocBook XML Additional General Entities V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbgenent.mod"/>'
369 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbhierx.mod"/>'
370 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//DTD XML Exchange Table Model 19990315//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/soextblx.dtd"/>'
371 $(QUIET)$(APPEND) $@.tmp ' <public publicId="-//OASIS//DTD DocBook XML CALS Table Model V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/calstblx.dtd"/>'
372 $(QUIET)$(APPEND) $@.tmp ' <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.3" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
373 $(QUIET)$(APPEND) $@.tmp ' <rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.3" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
374 $(QUIET)$(APPEND) $@.tmp ' <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
375 $(QUIET)$(APPEND) $@.tmp ' <rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.4" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>'
376 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsa.ent"/>'
377 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsb.ent"/>'
378 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsc.ent"/>'
379 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsn.ent"/>'
380 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amso.ent"/>'
381 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsr.ent"/>'
382 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Box and Line Drawing//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-box.ent"/>'
383 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Russian Cyrillic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-cyr1.ent"/>'
384 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-cyr2.ent"/>'
385 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Diacritical Marks//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-dia.ent"/>'
386 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Greek Letters//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk1.ent"/>'
387 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Monotoniko Greek//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk2.ent"/>'
388 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Greek Symbols//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk3.ent"/>'
389 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk4.ent"/>'
390 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Latin 1//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-lat1.ent"/>'
391 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Added Latin 2//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-lat2.ent"/>'
392 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-num.ent"/>'
393 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES Publishing//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-pub.ent"/>'
394 $(QUIET)$(APPEND) $@.tmp ' <public publicId="ISO 8879:1986//ENTITIES General Technical//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-tech.ent"/>'
395 $(QUIET)$(APPEND) $@.tmp '</catalog>'
396 $(QUIET)$(MV) -f $@.tmp $@
397endif
398
399
400if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
401
402
403##########################################################################################
404#
405# Rules: Preprocess DocBook XML files
406# (preliminary step for both CHM and PDF generation)
407#
408##########################################################################################
409
410#
411# The following rules for $(VBOX_PATH_MANUAL_OUTBASE)/*.xml process the XML files
412# in doc/manual to allow for some magic variable replacements. The PDF and CHM
413# targets do not depend on the XML files in doc/manual, but those in
414# $(VBOX_PATH_MANUAL_OUTBASE) instead, which we copy there from here, after that magic
415# processing.
416#
417# So, before copying, the following steps are performed:
418#
419# -- $VBOX_VERSION_* strings are replaced with the actual current VBox version.
420# -- $VBOX_MANAGE_OUTPUT (in VBoxManage.xml) is replaced with the current
421# output of the actual VBoxManage program, to save us from having to
422# update the manual all the time.
423#
424
425# Only one changelog for all languages
426# $(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG): $(VBOX_PATH_MANUAL_SRC)/$(VBOX_MANUAL_XML_CHANGELOG) | $$(dir $$@)
427# $(QUIET)$(INSTALL) -m 0644 $< $@
428
429# intermediate step to do some variable replacement in the document
430$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(filter-out user_VBoxManage.xml,$(VBOX_MANUAL_XML_FILES)))): \
431 $(VBOX_PATH_MANUAL_OUTBASE)/% : $(VBOX_PATH_MANUAL_SRC)/% $(VBOX_VERSION_STAMP) | $$(dir $$@)
432 $(call MSG_L1,Pre-processing [1] $(@F) to $@)
433 $(QUIET)$(RM) -f $@ $@.tmp
434 $(QUIET)$(SED) -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
435 -e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
436 -e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
437 -e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
438 -e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
439 -e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
440 -e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
441 --output $@.tmp $<
442 $(QUIET)$(MV) -f $@.tmp $@
443
444$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/user_ChangeLog.xml): \
445 $(VBOX_PATH_MANUAL_OUTBASE)/% : \
446 $(VBOX_PATH_MANUAL_SRC)/% $(VBOX_PATH_MANUAL_SRC)/user_ChangeLogImpl.xml | $$(dir $$@)
447 $(call MSG_L1,Pre-processing [3] $(@F) to $@)
448 $(QUIET)$(RM) -f $@ $@.tmp $@.tmp2
449 $(QUIET)$(SED) -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
450 -e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
451 -e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
452 -e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
453 -e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
454 -e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
455 -e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
456 --output $@.tmp $<
457 $(QUIET)$(SED) -e '1,/<!--\$$VIRTUALBOX_CHANGELOG_IMPL-->/!d' \
458 -e 's/<!--\$$VIRTUALBOX_CHANGELOG_IMPL-->//' \
459 --output $@ $@.tmp
460 var=`$(SED) -n '/!--\$$VIRTUALBOX_CHANGELOG_IMPL-->/p' $<`; \
461 test -n "$${var}" \
462 && $(SED) -e 's/<?xml version=\"1.0\" encoding=\"UTF-8\"?>//g' \
463 --append $@ $(VBOX_PATH_MANUAL_SRC)/user_ChangeLogImpl.xml; \
464 true
465 $(QUIET)$(SED) -e '/<!--\$$VIRTUALBOX_CHANGELOG_IMPL-->/,$$!d' \
466 -e 's/<!--\$$VIRTUALBOX_CHANGELOG_IMPL-->//' --append $@ $@.tmp
467 $(QUIET)$(RM) -f -- "$@.tmp"
468
469# TODO: figure why the rule below doesn't cause kmk to rebuild the manual when a man page changes!
470$(foreach lang,$(VBOX_MANUAL_LANGUAGES), \
471$(eval $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/user_VBoxManage.xml: $(VBOX_PATH_MANUAL_SRC)/$(lang)/user_VBoxManage.xml \
472 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/user_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
473 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/overview_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
474 $(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml ))
475
476# user_VBoxManage.xml currently needs some extra processing to stitch in the VBoxManage usage blob.
477$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/user_VBoxManage.xml): \
478 $(VBOX_PATH_MANUAL_OUTBASE)/% : \
479 $(VBOX_PATH_MANUAL_SRC)/% \
480 $$(addprefix $$(@D)/user_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
481 $$(addprefix $$(@D)/overview_,$$(filter man_VBoxManage%,$$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
482 $(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml \
483 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
484 $(VBOXMANAGEHELP_PATH) | $$(dir $$@)
485 $(call MSG_L1,Pre-processing [2] $(@F) to $@)
486 $(QUIET)$(RM) -f $@ $@.dumpopts $@.screen
487 $(QUIET)$(REDIRECT) -wo $@.dumpopts -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
488 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
489 -- \
490 $(VBOXMANAGEHELP_PATH) --dumpopts
491 $(QUIET)$(SED) \
492 -e ':a' \
493 -e 'N' \
494 -e '$(DOLLAR)!ba' \
495 -e 's/</\&lt\;/g' \
496 -e 's/>/\&gt\;/g' \
497 -e 's/\n*$(DOLLAR)/<\/screen>/' \
498 -e 's/^/<screen>/' \
499 --output $@.screen $@.dumpopts
500 $(QUIET)$(SED) \
501 -e '/@VBOX_MANAGE_OUTPUT@/{' -e 'r $@.screen' -e 'd' -e '}' \
502 \
503 -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
504 -e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
505 -e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
506 -e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
507 -e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
508 -e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
509 -e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
510 -e 's|@VBOX_PATH_DOCBOOK@|$(VBOX_PATH_DOCBOOK)|g' \
511 -e 's|@VBOX_PATH_MANUAL_SRC@|$(VBOX_PATH_MANUAL_SRC)|g' \
512 --output "$@" \
513 "$<"
514 $(QUIET)$(RM) -f $@.dumpopts $@.screen
515
516##
517# Morph man pages into manual sections.
518# $(evalcall2 def_vbox_refentry_to_user_sect1)
519# @param 1 The XSLT source file (relative to Makefile dir).
520# @param 2 Optional output subdirectory.
521define def_vbox_refentry_to_user_sect1
522$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/user_$(2): \
523 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
524 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl \
525 $$(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
526 $$(VBOX_VERSION_STAMP) | $$(dir $$@)
527 $$(call MSG_GENERATE,,$$@,$$<)
528 $$(QUIET)$$(RM) -f "$$@"
529 $$(QUIET)$$(VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl $$<
530endef
531$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
532, $(evalcall2 def_vbox_refentry_to_user_sect1,$(lang),$(file))))
533
534
535$(VBOX_DOC_XIDL_SRC_TMP): $(VBOX_DOC_XIDL_SRC) $(MAKEFILE_CURRENT) | $$(dir $$@)
536 $(call MSG_L1,Generating $@)
537 $(QUIET)$(SED) -e 's|@a \+\(\w\+\)|<tt>\1</tt>|g' \
538 -e 's|@c \+\(\w\+\)|<tt>\1</tt>|g' \
539 --output $@ $<
540
541# Generates the VBoxManage command overview include file (shared between
542# languages) from the refsynopsisdiv section of the man pages.
543$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/overview_,$(VBOX_MANUAL_XML_REFENTRY_FILES)): \
544 $(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-overview.xsl \
545 $$(patsubst overview_%,$$(VBOX_PATH_MANUAL_SRC)/en_US/%,$$(notdir $$@)) \
546 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
547 | $$(dir $$@)
548 $(call MSG_GENERATE,,$@,$(filter %.xml,$^))
549 $(QUIET)$(VBOX_XSLTPROC_WITH_CAT) --output "$@" $< $(filter %.xml,$^)
550
551$(VBOX_PATH_MANUAL_OUTBASE)/user_VBoxManage_CommandsOverview.xml: $(MAKEFILE_CURRENT) | $$(dir $$@)
552 $(call MSG_GENERATE,,$@,)
553 $(QUIET)$(APPEND) -tn "$@" \
554 '<?xml version="1.0" encoding="UTF-8"?>' \
555 '<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">' \
556 '<remark role="VBoxManage-overview">' \
557 $(foreach refentry, $(filter man_VBoxManage%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
558 , ' <xi:include href="overview_$(refentry)" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />') \
559 '</remark>'
560
561
562
563# generate SDKRef_apiref.xml as a docbook file excerpt that will be referenced from the SDKRef.xml.
564$(VBOX_MANUAL_APIREF_TMP): $(VBOX_DOC_XIDL_SRC_TMP) $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl
565 $(call MSG_L1,Generating $@)
566 $(QUIET)$(VBOX_XSLTPROC) --xinclude -o $@ $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl $(VBOX_DOC_XIDL_SRC_TMP)
567
568$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.xml: \
569 $(VBOX_PATH_MANUAL_SRC)/en_US/SDKRef.xml $(VBOX_MANUAL_APIREF_TMP) \
570 | $$(dir $$@)
571 $(call MSG_L1,Pre-processing [2] $(@F) to $@)
572 $(QUIET)$(RM) -f $@ $@.tmp
573 $(QUIET)$(SED) -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
574 -e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
575 -e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
576 -e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
577 -e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
578 -e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
579 -e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
580 --output $@.tmp $<
581 $(QUIET)$(SED) -e '1,/<!--\$$VIRTUALBOX_MAIN_API_REFERENCE-->/!d' \
582 -e 's/<!--\$$VIRTUALBOX_MAIN_API_REFERENCE-->//' \
583 --output $@ $@.tmp
584 $(QUIET)$(SED) -e 's/<?xml version=\"1.0\" encoding=\"utf-8\"?>//g' --append $@ $(VBOX_MANUAL_APIREF_TMP)
585 $(QUIET)$(SED) -e '/<!--\$$VIRTUALBOX_MAIN_API_REFERENCE-->/,$$!d' \
586 -e 's/<!--\$$VIRTUALBOX_MAIN_API_REFERENCE-->//' --append $@ $@.tmp
587# $(QUIET)$(MV) -f $@.tmp $@
588 $(QUIET)$(RM) -f -- "$@.tmp"
589
590
591##########################################################################################
592#
593# Shared rules for PDF generation
594#
595##########################################################################################
596
597ifndef VBOX_OSE
598# copy ucs.sty and related files
599$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/ucs.sty):
600 $(call MSG_L1,Copying unicode support for LaTeX)
601 $(QUIET)$(INSTALL_STAGING) -m0644 -- $(VBOX_MANUAL_TEX_UNICODE_FILES) "$(@D)"
602endif
603
604# copy the PNG files.
605# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
606define def_vbox_cp_images_pdf
607local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
608$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
609 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
610 $$(call MSG_L1,Copying temporary $$< => $$@)
611 $$(QUIET)$$(INSTALL_STAGING) -m0644 -- '$$<' '$$(@D)'
612endef
613
614$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_cp_images_pdf))
615
616
617##########################################################################################
618#
619# UserManual.pdf
620#
621##########################################################################################
622
623## @todo INSTALLS target for this!
624$(PATH_STAGE_BIN)/UserManual.pdf: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf | $$(dir $$@)
625 $(QUIET)$(CP) $< $@
626 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
627
628$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/UserManual_$(f).pdf): \
629 $(PATH_STAGE_BIN)/UserManual_%.pdf : $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.pdf
630 $(QUIET)$(CP) $< $@
631 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
632
633$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.pdf): \
634 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.pdf : \
635 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.tex \
636 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/%/ucs.sty) \
637 $(foreach f,$(VBOX_MANUAL_LANGUAGES),\
638 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_MANUAL_PNG_FILES_$(f)))) | $$(dir $$@)
639# PDF generation via Latex: generate the .tex file
640 $(call MSG_L1,pdflatex $< (four passes) -> $@)
641 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
642 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
643 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
644 $(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(VBOX_PDFLATEX_CMD) UserManual.tex
645 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
646 $(QUIET)$(SED) -n \
647 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
648 $(basename $@).log
649
650##@todo restore this when above has been converted to INSTALLS target. $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
651
652# generate temporary LaTeX source from processed XML
653$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.tex): \
654 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.tex : \
655 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.xml \
656 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
657 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/%/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
658 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/%/validatemanual.run,) \
659 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE_CURRENT)
660 $(call MSG_L1,Generating $@ from DocBook XML)
661 $(QUIET)$(RM) -f $(addprefix $(@D)/,$(VBOX_MANUAL_LATEX_FILES_TARGET))
662# generate TeX source from processed docbook and store it in UserManual.tex.tmp;
663# pass current language to xsltproc in TARGETLANG variable (extract it from the
664# current directory, should become "de_DE" or the like)
665 $(QUIET)$(VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG $(notdir $(@D)) \
666 -o $@.tmp $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
667# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
668# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
669 $(QUIET)$(SED) \
670 -e 's|^\\QUOTE{}|\\OQ{}|g' \
671 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
672 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
673 --output $@ $@.tmp
674 $(QUIET)$(RM) -f $@.tmp
675
676# Useful aliases
677usermanual UserManual.pdf:: $(PATH_STAGE_BIN)/UserManual.pdf
678
679debug-usermanual:
680 $(MAKE) --pretty-command-printing -j1 VBOX_PDFLATEX_INTERACTION=errorstopmode $(PATH_STAGE_BIN)/UserManual.pdf
681
682#
683# Generate rules for validating the UserManual.xml. These are invoked
684# automatically at build time, but can also be manually invoked via the
685# 'validatemanual' and 'validatemanual_<lang>' aliases.
686#
687define def_vbox_validate_xml
688validatemanual_$(lang):: $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/validatemanual.run
689$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/validatemanual.run: \
690 $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/UserManual.xml \
691 $$(addprefix $$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/,$$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
692 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(MAKEFILE_CURRENT) | $$$$(dir $$$$@)
693 $$(call MSG_L1,Validating $$<)
694 $$(QUIET)$$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$<
695 $$(QUIET)$$(APPEND) -t "$$@" "done"
696endef
697$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(evalcall2 def_vbox_validate_xml))
698validatemanual:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),validatemanual_$(lang))
699
700
701
702#
703# SDKRef.pdf
704#
705$(VBOX_PATH_SDK)/docs/SDKRef.pdf: \
706 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex \
707 $(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
708 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
709# PDF generation via Latex: generate the .tex file
710 $(QUIET)$(MKDIR) -p $(VBOX_PATH_SDK)/docs
711 $(call MSG_L1,pdflatex $< (three passes))
712 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
713 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
714 $(QUIET)$(REDIRECT) -C $(<D) -- $(VBOX_PDFLATEX_CMD) SDKRef.tex
715 $(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
716 $(QUIET)$(SED) -n \
717 -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
718 $(basename $<).log
719 $(QUIET)$(CP) $(<D)/SDKRef.pdf $@
720 $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
721
722# generate temporary LaTeX source from processed XML
723$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
724 $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
725 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE_CURRENT)
726 $(call MSG_L1,Generating $@ from DocBook XML)
727 $(QUIET)$(RM) -f $(addprefix $(@D/),$(VBOX_SDKREF_LATEX_FILES_TARGET))
728# generate TeX source from processed docbook and store it in SDKRef.tex.tmp
729 $(QUIET)$(VBOX_XSLTPROC_WITH_CAT) --stringparam TARGETLANG en_US \
730 -o $@.tmp $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
731# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
732# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
733 $(QUIET)$(SED) \
734 -e 's|^\\QUOTE{}|\\OQ{}|g' \
735 -e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
736 -e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
737 --output $@ $@.tmp
738 $(QUIET)$(RM) -f $@.tmp
739
740
741# validate SDK manual
742validatesdkref: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_SDKREF_XML_FILES)) \
743 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE_CURRENT)
744 $(call MSG_L1,Validating $(filter %.xml,$^))
745 $(QUIET)$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $(filter %.xml,$^)
746
747
748
749ifdef VBOX_WITH_DOCS_CHM
750 #
751 # VirtualBox.chm
752 #
753 # We first generate a .hhp help source file from the preprocessed
754 # DocBook XML files, as defined above, then feed that into the
755 # Microsoft Help Compiler.
756 #
757 $(PATH_STAGE_BIN)/VirtualBox.chm: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.chm
758 $(QUIET)$(CP) $< $@
759 $(call MSG_L1,Fresh CHM is now at $@)
760
761 $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_STAGE_BIN)/VirtualBox_$(f).chm): \
762 $(PATH_STAGE_BIN)/VirtualBox_%.chm : $(VBOX_PATH_MANUAL_OUTBASE)/%/VirtualBox.chm
763 $(QUIET)$(CP) $< $@
764 $(call MSG_L1,Fresh CHM is now at $@)
765
766 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/VirtualBox.chm): \
767 $(VBOX_PATH_MANUAL_OUTBASE)/%/VirtualBox.chm: \
768 $(VBOX_PATH_MANUAL_OUTBASE)/%/HTMLHelp/htmlhelp.hhp \
769 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(f))))
770 $(call MSG_L1,hhc $<,=> $@)
771 $(QUIET)$(RM) -f $@
772 $(QUIET)$(VBOX_HHC) $(subst /,\\,$<)
773
774
775 # intermediate step to do some variable replacement in the XSL configuration
776 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/docbook-htmlhelp-formatcfg.xsl): \
777 $(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
778 $(call MSG_GENERATE,,$@,$<)
779 $(QUIET)$(RM) -f $@
780 $(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(VBOX_PATH_DOCBOOK)|g' \
781 -e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
782 -e 's|\$$TARGETPATH|$(@D)|g' --output $@ $<
783
784 # Manual formatcfg dependencies.
785 $(foreach lang,$(VBOX_MANUAL_LANGUAGES), $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/docbook-htmlhelp-formatcfg.xsl): \
786 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
787 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
788
789 # Prepare the XSL file for our title page, htmlhelp variant.
790 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/titlepage-htmlhelp.xsl): \
791 $(VBOX_PATH_MANUAL_SRC)/titlepage-htmlhelp.xml $(MAKEFILE_CURRENT) | $$(dir $$@)
792 $(call MSG_L1,xsltproc $<)
793 $(QUIET)$(RM) -f $@.tmp $@
794 $(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet -o $@.tmp $(VBOX_PATH_DOCBOOK)/template/titlepage.xsl $<
795 $(QUIET)$(MV) -f $@.tmp $@
796
797
798 $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/htmlhelp.hhp): \
799 $(VBOX_PATH_MANUAL_OUTBASE)/%/HTMLHelp/htmlhelp.hhp: \
800 $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.xml \
801 $(VBOX_PATH_MANUAL_OUTBASE)/%/docbook-htmlhelp-formatcfg.xsl \
802 $(VBOX_PATH_MANUAL_OUTBASE)/%/titlepage-htmlhelp.xsl \
803 $(VBOX_PATH_MANUAL_OUTBASE)/%/validatemanual.run \
804 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/%/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
805 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK)
806 $(call MSG_L1,xsltproc $<,=> $@)
807 $(QUIET)$(RM) -f $@
808 $(QUIET)$(MKDIR) -p $(@D)
809 $(QUIET)$(VBOX_XSLTPROC_WITH_CAT) --output $(@D)/ \
810 --stringparam htmlhelp.chm \
811 $(subst /,\\,$(@D)/../VirtualBox.chm) \
812 $(HTMLHELPOPTS) $(@D)/../docbook-htmlhelp-formatcfg.xsl \
813 $<
814
815 # copy the PNG files.
816 # Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
817 define def_vbox_cp_images_html
818 local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/HTMLHelp
819 $$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
820 $$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
821 $$(call MSG_L1,Copying temporary $$< => $$@)
822 $$(QUIET)$$(CP) -f $$< $$@
823 endef
824
825 $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_html)))
826
827 # Packing the docs into a zip file
828 $(PATH_STAGE_BIN)/VBoxDocumentation.zip: $(VBOX_MANUAL_PACK)
829 $(call MSG_L1,Packing documentation $@)
830 $(QUIET)$(RM) -f $@
831 $(QUIET)$(REDIRECT) -C $(PATH_STAGE_BIN) -- zip$(HOSTSUFF_EXE) -9 $@ $(notdir $^)
832
833endif # VBOX_WITH_DOCS_CHM
834
835
836##########################################################################################
837#
838# UserManual.html
839#
840##########################################################################################
841
842# Manual formatcfg dependencies.
843$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
844$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl: \
845 $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
846 $(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
847
848# intermediate step to do some variable replacement in the XSL configuration
849$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl: \
850 $(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
851 $(call MSG_L1,Pre-processing $(@F) to $@)
852 $(QUIET)$(RM) -f $@.tmp $@
853 $(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(VBOX_PATH_DOCBOOK)|g' \
854 -e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
855 -e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
856 $(QUIET)$(MV) -f $@.tmp $@
857
858$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl: \
859 $(VBOX_PATH_MANUAL_SRC)/docbook-html-chunks-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
860 $(call MSG_L1,Pre-processing $(@F) to $@)
861 $(QUIET)$(RM) -f $@.tmp $@
862 $(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(VBOX_PATH_DOCBOOK)|g' \
863 -e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
864 -e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
865 $(QUIET)$(MV) -f $@.tmp $@
866
867$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html: \
868 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
869 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
870 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
871 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatemanual.run,) \
872 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
873 | $$(dir $$@)
874 $(call MSG_L1,xsltproc $<)
875 $(QUIET)$(VBOX_XSLTPROC_WITH_CAT) \
876 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
877 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
878 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml
879
880$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html: \
881 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl \
882 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_FILES_INCL_CHANGELOG)) \
883 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
884 $(if $(VBOX_HAVE_XMLLINT),$(VBOX_PATH_MANUAL_OUTBASE)/en_US/validatemanual.run,) \
885 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
886 | $$(dir $$@)
887 $(call MSG_L1,xsltproc $<)
888 $(QUIET)$(VBOX_XSLTPROC_WITH_CAT) \
889 --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html \
890 --stringparam chunk.section.depth 0 \
891 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl \
892 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml
893
894$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip: \
895 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
896 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
897 $(call MSG_L1,Packing documentation $@)
898 $(QUIET)$(RM) -f $@
899 $(QUIET)$(REDIRECT) -C $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ -- zip$(HOSTSUFF_EXE) \
900 -9 -r $@ html-single html-chunks $(VBOX_MANUAL_PNG_FILES_en_US)
901
902html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
903
904html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
905
906html-zip:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
907
908
909##########################################################################################
910#
911# ChangeLog.html
912#
913##########################################################################################
914
915# intermediate step to do some variable replacement in the XSL configuration
916$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-changelog-formatcfg.xsl: \
917 $(VBOX_PATH_MANUAL_SRC)/docbook-changelog-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
918 $(call MSG_L1,Pre-processing $(@F) to $@)
919 $(QUIET)$(RM) -f $@.tmp $@
920 $(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(VBOX_PATH_DOCBOOK)|g' \
921 -e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
922 -e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
923 $(QUIET)$(MV) -f $@.tmp $@
924
925# This XSLT rule depends on $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml, which is build by the complex rule
926# $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/user_ChangeLog.xml): ...
927# much further above. That rule takes en_US/user_ChangeLog.xml and replaces $VIRTUALBOX_CHANGELOG_IMPL
928# with the actual change log contained in user_ChangeLogImpl.xml
929$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html: \
930 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-changelog-formatcfg.xsl \
931 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml
932 $(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html \
933 $(@D)/docbook-changelog-formatcfg.xsl \
934 $(VBOX_PATH_MANUAL_OUTBASE)/en_US/user_ChangeLog.xml
935 $(call MSG_L1,Fresh ChangeLog.html is now at $@)
936
937cl-html: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html
938
939
940
941endif # if defined(VBOX_WITH_DOCS) && (!defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_DOCS) || defined(VBOX_ONLY_SDK))
942
943
944#
945# VBoxManage man pages (parts also required by VBoxManage build-in help).
946#
947$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-manpage.xsl,)
948
949##
950# Emits rules for preprocessing refentry sources (applying remarks element),
951# and for producing the actual man pages.
952# $(evalcall2 def_vbox_refentry_to_manpage)
953# @param 1 The language
954# @param 2 The file name (no path).
955define def_vbox_refentry_to_manpage
956$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2): \
957 $$(VBOX_PATH_MANUAL_SRC)/$(1)/$(2) \
958 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl \
959 $$(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
960 $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
961 $$(call MSG_GENERATE,,$$@,$$<)
962 $$(QUIET)$$(RM) -f "$$@"
963 $$(QUIET)$$(VBOX_XSLTPROC_WITH_CAT) --output $$@ \
964 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl $$<
965 ifdef VBOX_WITH_XMLLINT
966 $$(QUIET)$$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$@
967 endif
968
969$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(patsubst man_%,%.1,$(basename $(2))): \
970 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$(2) \
971 $$(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-manpage.xsl \
972 $$(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) \
973 $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
974 $$(call MSG_GENERATE,,$$@,$$<)
975 $$(QUIET)$$(RM) -f "$$@"
976 $$(QUIET)$$(VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-manpage.xsl $$<
977endef
978$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
979, $(evalcall2 def_vbox_refentry_to_manpage,$(lang),$(file))))
980
981
982# Handy aliases.
983validate-manpages:: $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_REFENTRY_FILES))
984man-experiment:: $(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(foreach file,$(VBOX_MANUAL_XML_REFENTRY_FILES) \
985 ,$$(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/$(patsubst man_%,%.1,$(basename $(file)))))
986
987
988#
989# VBoxManage built-in help.
990#
991# Note! Generating the stuff here is a bit annoying, but currently the most
992# practical way I can come up with.
993#
994OTHERS += \
995 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \
996 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h
997OTHER_CLEAN += \
998 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \
999 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h
1000help-experiment: \
1001 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \
1002 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h
1003
1004$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-C-help.xsl,)
1005$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-H-help.xsl,)
1006
1007$(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp: \
1008 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl \
1009 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
1010 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@)
1011 $(call MSG_GENERATE,,$@,$<)
1012 $(QUIET)$(APPEND) -tn "$@" \
1013 '/* Autogenerated by $<, do not edit! */' \
1014 '' \
1015 '#include <iprt/types.h>' \
1016 '#include "VBoxManageBuiltInHelp.h"' \
1017 ''
1018 $(foreach refentry,$(filter %.xml,$^) \
1019 ,$(NLTAB)$(QUIET)$(REDIRECT) -a+to "$@" -- $(VBOX_XSLTPROC_WITH_CAT) $< $(refentry))
1020 $(QUIET)$(APPEND) -n "$@" \
1021 '' \
1022 'PCREFENTRY g_apHelpEntries[] = ' \
1023 '{' \
1024 $(foreach refentry,$(filter %.xml,$^) \
1025 , ' &g_$(subst -,_,$(tolower $(patsubst man_%,%,$(notdir $(basename $(refentry)))))), ') \
1026 '};' \
1027 'const uint32_t g_cHelpEntries = RT_ELEMENTS(g_apHelpEntries);' \
1028 ''
1029
1030$(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h: \
1031 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-H-help.xsl \
1032 $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
1033 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@)
1034 $(call MSG_GENERATE,,$@,$<)
1035 $(QUIET)$(APPEND) -tn "$@" \
1036 '/* Autogenerated by $<, do not edit! */' \
1037 '' \
1038 '#ifndef ___VBoxManageBuiltInHelp_h___' \
1039 '#define ___VBoxManageBuiltInHelp_h___' \
1040 '' \
1041 '#include <VBox/refentry.h>' \
1042 '' \
1043 'RT_C_DECLS_BEGIN' \
1044 '' \
1045 'typedef enum HELP_CMD_VBOXMANAGE' \
1046 '{' \
1047 ' HELP_CMD_VBOXMANAGE_INVALID = 0,'
1048 $(foreach refentry,$(filter %.xml,$^) \
1049 ,$(NLTAB)$(QUIET)$(REDIRECT) -a+to "$@" -- $(VBOX_XSLTPROC_WITH_CAT) \
1050 --stringparam 'g_sMode' 'cmd' $< $(refentry))
1051 $(QUIET)$(APPEND) -n "$@" \
1052 ' HELP_CMD_VBOXMANAGE_END' \
1053 '} HELP_CMD_VBOXMANAGE;'
1054 $(foreach refentry,$(filter %.xml,$^) \
1055 ,$(NLTAB)$(QUIET)$(REDIRECT) -a+to "$@" -- $(VBOX_XSLTPROC_WITH_CAT) \
1056 --stringparam 'g_sMode' 'subcmd' $< $(refentry))
1057 $(QUIET)$(APPEND) -n "$@" \
1058 '' \
1059 'extern PCREFENTRY g_apHelpEntries[];' \
1060 'extern const uint32_t g_cHelpEntries;' \
1061 '' \
1062 'RT_C_DECLS_END' \
1063 '' \
1064 '#endif' \
1065 ''
1066
1067
1068include $(FILE_KBUILD_SUB_FOOTER)
1069
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