VirtualBox

source: vbox/trunk/doc/manual/Config.kmk@ 68860

Last change on this file since 68860 was 68860, checked in by vboxsync, 7 years ago

iprt,vboxmanage,manual: Try write the iso maker docs as a docbook refentry document. Tried to generalize the vboxmanage refentry output handling, moving it to RTMsg*. Made VBoxManage and IPRT generate their C/H sources in their own Makefiles. Hacked the C/H source generation till it can deal with the rather different RTIsoMaker command structure (no sub or sub-sub command stuff).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.7 KB
Line 
1# $Id: Config.kmk 68860 2017-09-25 20:04:07Z vboxsync $
2## @file
3# kBuild Configuration file for the manual.
4#
5
6#
7# Copyright (C) 2010-2017 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# The contents of this file may alternatively be used under the terms
18# of the Common Development and Distribution License Version 1.0
19# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20# VirtualBox OSE distribution, in which case the provisions of the
21# CDDL are applicable instead of those of the GPL.
22#
23# You may elect to license modified versions of this file under the
24# terms and conditions of either the GPL or the CDDL or both.
25#
26
27ifndef VBOX_DOC_MANUAL_CONFIG_KMK_INCLUDED
28VBOX_DOC_MANUAL_CONFIG_KMK_INCLUDED = 1
29
30# Include the top-level configure file.
31ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
32 include $(PATH_ROOT)/Config.kmk
33endif
34
35
36#
37# Globals.
38#
39
40# Source location.
41VBOX_PATH_MANUAL_SRC := $(PATH_ROOT)/doc/manual
42# Output location.
43VBOX_PATH_MANUAL_OUTBASE := $(PATH_OBJ)/manual
44
45## List of refentry files (manpages).
46VBOX_MANUAL_XML_REFENTRY_FILES := \
47 man_VBoxManage-debugvm.xml \
48 man_VBoxManage-extpack.xml \
49 man_VBoxManage-unattended.xml
50
51
52# Tool locations.
53ifndef VBOX_OSE
54 # use docbook from our tools directory
55 VBOX_PATH_DOCBOOK ?= $(PATH_DEVTOOLS)/common/DocBook/v1.69.1
56 VBOX_PATH_DOCBOOK_DTD ?= $(PATH_DEVTOOLS)/common/docbook-xml/v4.3
57 VBOX_XML_CATALOG ?= $(VBOX_PATH_MANUAL_OUTBASE)/catalog
58 VBOX_XML_CATALOG_DOCBOOK ?= $(VBOX_PATH_MANUAL_OUTBASE)/docbook
59else
60 # use docbook of the build host
61 VBOX_PATH_DOCBOOK ?= http://docbook.sourceforge.net/release/xsl/current/
62endif
63
64# xsltproc with the catalog trick if applicable.
65ifdef VBOX_XML_CATALOG
66 VBOX_XSLTPROC_WITH_CAT = $(REDIRECT) -E "XML_CATALOG_FILES=$(VBOX_XML_CATALOG)" $1 -- \
67 $(VBOX_XSLTPROC) --nonet --xinclude $(VBOX_XSLTPROC_OPTS)
68 VBOX_XMLLINT_WITH_CAT = $(REDIRECT) -E "XML_CATALOG_FILES=$(VBOX_XML_CATALOG)" -- \
69 $(VBOX_XMLLINT) --nonet --xinclude --noout $(VBOX_XMLLINT_OPTS)
70else
71 VBOX_XSLTPROC_WITH_CAT = $(if $(1), $(REDIRECT) $1 --,) $(VBOX_XSLTPROC) --nonet --xinclude $(VBOX_XSLTPROC_OPTS)
72 VBOX_XMLLINT_WITH_CAT = $(VBOX_XMLLINT) --nonet --xinclude --noout $(VBOX_XMLLINT_OPTS)
73endif
74
75
76##
77# Non-pattern-rule approach to editing XSLT files.
78# $(evalcall2 def_vbox_replace_paths_in_xslt)
79# @param 1 The XSLT source file (relative to Makefile dir).
80# @param 2 Optional output subdirectory (leading slash).
81define def_vbox_replace_paths_in_xslt
82OTHER_CLEAN += $$(VBOX_PATH_MANUAL_OUTBASE)$2/$(notdir $1)
83$$(VBOX_PATH_MANUAL_OUTBASE)$2/$(notdir $1): $$(VBOX_PATH_MANUAL_SRC)/$1 | $$$$(dir $$$$@)
84 $$(call MSG_L1,Pre-processing $$(<) to $$(@))
85 $$(QUIET)$$(SED) \
86 -e 's|@VBOX_PATH_DOCBOOK@|$$(VBOX_PATH_DOCBOOK)|g' \
87 -e 's|@VBOX_PATH_MANUAL_SRC@|$$(VBOX_PATH_MANUAL_SRC)|g' \
88 -e 's|@VBOX_PATH_MANUAL_OUTBASE@|$$(VBOX_PATH_MANUAL_OUTBASE)|g' \
89 -e 's|@VBOX_PATH_MANUAL_OUT_LANG@|$$(VBOX_PATH_MANUAL_OUTBASE)$2|g' \
90 --output "$$(@)" $$<
91endef
92
93
94##
95# Emits rules for preprocessing refentry sources (applying remarks element),
96# and for producing the actual man pages.
97#
98# $(evalcall2 def_vbox_refentry_to_manpage)
99# @param 1 The output directory.
100# @param 2 The XML file name (no path).
101# @param 3 The XML file with full path.
102define def_vbox_refentry_preprocess_for_manpage
103$(1)/$(2): \
104 $(3) \
105 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl \
106 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) \
107 $$(VBOX_VERSION_STAMP) | $$$$(dir $$$$@)
108 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(firstword $$(filter %.xml,$$^)),$$@)
109 $$(QUIET)$$(RM) -f "$$@"
110 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ \
111 $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manpage-preprocessing.xsl $$<
112if defined(VBOX_HAVE_XMLLINT) && "$(USER)" == "bird" # Effing stuff happends on build servers, probably kmk related...
113 $$(VBOX_XMLLINT_WITH_CAT) --dtdvalid $$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd $$@
114endif
115endef
116
117##
118# Generate a single header file containing everything (no C file).
119#
120# @param 1 Destination file.
121# @param 2 Full source file path.
122# @param 3 Help infix.
123define def_vbox_single_refentry_to_h
124$(1).ts +| $(1): \
125 $$(VBOX_DOCBOOK_REFENTRY_TO_C_HELP) \
126 $$(VBOX_DOCBOOK_REFENTRY_TO_H_HELP) \
127 $(2) \
128 $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$$$(dir $$$$@)
129 $$(call MSG_TOOL,xsltproc $$(notdir $$(firstword $$(filter %.xsl,$$^))),,$$(filter %.xml,$$^),$$(patsubst %.ts,%,$$@))
130 $$(QUIET)$$(APPEND) -tn "$$@" \
131 '/* Autogenerated by $$(notdir $$(filter %.xsl,$$^)), do not edit! */' \
132 '' \
133 '#include <iprt/message.h>' \
134 '' \
135 'typedef enum HELP_CMD_$(3)' \
136 '{' \
137 ' HELP_CMD_INVALID = 0,'
138 $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$$@") \
139 --stringparam 'g_sMode' 'cmd' $$(VBOX_DOCBOOK_REFENTRY_TO_H_HELP) $(2)
140 $$(QUIET)$$(APPEND) -n "$$@" \
141 ' HELP_CMD_END' \
142 '} HELP_CMD_VBOXMANAGE;' \
143 ''
144 $$(NLTAB)$$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$$@") \
145 --stringparam 'g_sMode' 'subcmd' $$(VBOX_DOCBOOK_REFENTRY_TO_H_HELP) $(2)
146 $$(QUIET)$$(APPEND) -n "$$@" \
147 ''
148 $$(NLTAB)$$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$$@") $$(VBOX_DOCBOOK_REFENTRY_TO_C_HELP) $(2)
149 $$(QUIET)$$(APPEND) -n "$$@" \
150 '' \
151 '/* end of file */'
152 $$(QUIET)$$(CP) --changed -- "$$@" "$$(patsubst %.ts,%,$$@)"
153endef
154
155
156#
157# Make sure we've got a rule to make the output directory.
158#
159BLDDIRS += $(VBOX_PATH_MANUAL_OUTBASE)
160
161
162ifdef VBOX_XML_CATALOG
163 #
164 # To avoid network I/O for fetching DTDs, we generate catalogs mapping the public
165 # entity IDs to local files. (Obviously, only done when we have local files.)
166 #
167 # Create a catalog file for xsltproc that points to docbook catalog.
168 $(VBOX_XML_CATALOG): $(MAKEFILE_CURRENT) | $$(dir $$@)
169 $(call MSG_L1,Creating catalog $@)
170 $(QUIET)$(APPEND) -tn "$@" \
171 '<?xml version="1.0"?>' \
172 '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">' \
173 '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">' \
174 ' <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook XML" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>' \
175 ' <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>' \
176 ' <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>' \
177 ' <delegateURI uriStartString="http://www.oasis-open.org/docbook/" catalog="file:///$(VBOX_XML_CATALOG_DOCBOOK)"/>' \
178 '</catalog>'
179
180 # Create a docbook catalog file for xsltproc that points to the local docbook files.
181 $(VBOX_XML_CATALOG_DOCBOOK): $(MAKEFILE_CURRENT) | $$(dir $$@)
182 $(call MSG_L1,Creating catalog $@)
183 $(QUIET)$(APPEND) -tn "$@" \
184 '<?xml version="1.0"?>' \
185 '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">' \
186 '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">' \
187 ' <public publicId="-//OASIS//ELEMENTS DocBook XML Information Pool V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbpoolx.mod"/>' \
188 ' <public publicId="-//OASIS//DTD DocBook XML V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd"/>' \
189 ' <public publicId="-//OASIS//DTD DocBook XML V4.4//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/docbookx.dtd"/>' \
190 ' <public publicId="-//OASIS//ENTITIES DocBook XML Character Entities V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbcentx.mod"/>' \
191 ' <public publicId="-//OASIS//ENTITIES DocBook XML Notations V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbnotnx.mod"/>' \
192 ' <public publicId="-//OASIS//ENTITIES DocBook XML Additional General Entities V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbgenent.mod"/>' \
193 ' <public publicId="-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/dbhierx.mod"/>' \
194 ' <public publicId="-//OASIS//DTD XML Exchange Table Model 19990315//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/soextblx.dtd"/>' \
195 ' <public publicId="-//OASIS//DTD DocBook XML CALS Table Model V4.3//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/calstblx.dtd"/>' \
196 ' <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.3" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>' \
197 ' <rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.3" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>' \
198 ' <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>' \
199 ' <rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.4" rewritePrefix="file:///$(VBOX_PATH_DOCBOOK_DTD)"/>' \
200 ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsa.ent"/>' \
201 ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsb.ent"/>' \
202 ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsc.ent"/>' \
203 ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsn.ent"/>' \
204 ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amso.ent"/>' \
205 ' <public publicId="ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-amsr.ent"/>' \
206 ' <public publicId="ISO 8879:1986//ENTITIES Box and Line Drawing//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-box.ent"/>' \
207 ' <public publicId="ISO 8879:1986//ENTITIES Russian Cyrillic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-cyr1.ent"/>' \
208 ' <public publicId="ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-cyr2.ent"/>' \
209 ' <public publicId="ISO 8879:1986//ENTITIES Diacritical Marks//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-dia.ent"/>' \
210 ' <public publicId="ISO 8879:1986//ENTITIES Greek Letters//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk1.ent"/>' \
211 ' <public publicId="ISO 8879:1986//ENTITIES Monotoniko Greek//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk2.ent"/>' \
212 ' <public publicId="ISO 8879:1986//ENTITIES Greek Symbols//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk3.ent"/>' \
213 ' <public publicId="ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-grk4.ent"/>' \
214 ' <public publicId="ISO 8879:1986//ENTITIES Added Latin 1//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-lat1.ent"/>' \
215 ' <public publicId="ISO 8879:1986//ENTITIES Added Latin 2//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-lat2.ent"/>' \
216 ' <public publicId="ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-num.ent"/>' \
217 ' <public publicId="ISO 8879:1986//ENTITIES Publishing//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-pub.ent"/>' \
218 ' <public publicId="ISO 8879:1986//ENTITIES General Technical//EN" uri="file:///$(VBOX_PATH_DOCBOOK_DTD)/ent/iso-tech.ent"/>' \
219 '</catalog>'
220
221endif # VBOX_XML_CATALOG
222
223
224#
225# Generate rules for editing the refentry to C/H style sheets.
226#
227$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-C-help.xsl,)
228VBOX_DOCBOOK_REFENTRY_TO_C_HELP = $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl
229
230$(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-H-help.xsl,)
231VBOX_DOCBOOK_REFENTRY_TO_H_HELP = $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-H-help.xsl
232
233#
234# Manual dependency.
235#
236$(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl: $(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl
237
238
239endif # !defined(VBOX_DOC_MANUAL_CONFIG_KMK_INCLUDED)
240
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