# $Id: Makefile.kmk 33555 2010-10-28 12:44:41Z vboxsync $
## @file
# Sub-Makefile for the VBox User Manual.
#
#
# Copyright (C) 2006-2007 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
#
# This slightly messy makefile transforms the DocBook XML source for the
# user manual into presentation output. We support two targets:
#
# -- UserManual.pdf, generated by LaTex
#
# -- VirtualBox.chm
#
# Both files end up in PATH_BIN.
#
# Both targets indirectly depend on the XML files in this directory;
# "indirectly" because we first copy them to PATH_TARGET and hack them
# up a bit for variable substitution and such (see below).
# The toolchains are roughly like this:
#
# -- PDF file via Apache FOP: pre-process the XML files in PATH_TARGET,
# then create a .FO file (another XML format for "formatted objects")
# via xsltproc, then feed the .FO file to Apache FOP to create the PDF.
#
# -- PDF file via LaTeX: pre-process the XML files in PATH_TARGET, then
# run our custom "dblatex" perl script on UserManual.xml, which parses
# the XML (using the Perl SAX parsers) and dumps a matching latex file
# to UserManual.tex. This is then regularly processed by pdflatex to
# generate PDF.
#
# -- CHM file: again, pre-process the XML files in PATH_TARGET, then use
# xsltproc to create a .HHP file for the Microsoft Help Compiler, then
# feed that file to it.
#
SUB_DEPTH = ../..
include $(KBUILD_PATH)/subheader.kmk
##########################################################################################
#
# Globals
#
##########################################################################################
VBOX_PATH_MANUAL_SRC := $(PATH_SUB_CURRENT)
VBOX_PATH_MANUAL_OUTBASE := $(PATH_TARGET)/manual
BLDDIRS += $(VBOX_PATH_MANUAL_OUTBASE)
##########################################################################################
#
# Main targets
#
##########################################################################################
ifdef VBOX_WITH_DOCS
# Default language
VBOX_MANUAL_ADD_LANGUAGES = en_US fr_FR
if defined(VBOX_ONLY_SDK) || defined(VBOX_WITH_DOCS_SDKREF)
## @todo make this an install target, drop the BLDDIRS.
OTHERS += \
$(VBOX_PATH_SDK)/docs/SDKRef.pdf
BLDDIRS += \
$(VBOX_PATH_SDK)/docs
endif
ifdef VBOX_WITH_DOCS_CHM
VBOX_PATH_BIN_CHM = $(PATH_BIN)/VirtualBox.chm
else
VBOX_PATH_BIN_CHM =
# do not build
endif # !VBOX_WITH_DOCS_CHM
ifndef VBOX_ONLY_SDK
VBOX_MANUAL_PACK += \
$(PATH_BIN)/UserManual.pdf \
$(VBOX_PATH_BIN_CHM)
OTHERS += \
$(PATH_BIN)/UserManual.pdf
OTHERS.win += \
$(VBOX_PATH_BIN_CHM)
OTHERS.linux += \
$(VBOX_PATH_BIN_CHM)
ifdef VBOX_WITH_DOCS_TRANSLATIONS
OTHERS += \
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/UserManual_$(f).pdf)
ifdef VBOX_WITH_DOCS_CHM
OTHERS.win += \
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/VirtualBox_$(f).chm)
OTHERS.linux += \
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/VirtualBox_$(f).chm)
endif
endif
endif # !VBOX_ONLY_SDK
ifdef VBOX_ONLY_DOCS
PACKING += $(PATH_BIN)/VBoxDocumentation.zip
endif
VBOX_MANUAL_LANGUAGES += $(VBOX_MANUAL_ADD_LANGUAGES)
VBOX_MANUAL_XML_CHANGELOG = \
user_ChangeLogImpl.xml
VBOX_MANUAL_XML_FILES = \
UserManual.xml \
user_AdvancedTopics.xml \
user_BasicConcepts.xml \
user_ChangeLog.xml \
user_Glossary.xml \
user_Frontends.xml \
user_Installation.xml \
user_GuestAdditions.xml \
user_Introduction.xml \
user_KnownIssues.xml \
user_PrivacyPolicy.xml \
user_Technical.xml \
user_ThirdParty.xml \
user_Troubleshooting.xml \
user_VBoxManage.xml \
user_VirtualBoxAPI.xml \
user_Storage.xml \
user_Networking.xml
VBOX_SDKREF_XML_FILES = \
SDKRef.xml
# Wildcard the images path for every supported language
$(foreach f,$(VBOX_MANUAL_LANGUAGES), \
$(eval VBOX_MANUAL_PNG_FILES_$$(f) := $$(patsubst $$(VBOX_PATH_MANUAL_SRC)/$$(f)/%,%,$$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$$(f)/images/*.png))))
VBOX_MANUAL_TEX_UNICODE_FILES = \
$(wildcard $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/*)
VBOX_MANUAL_LATEX_FILES_TARGET = \
$(addprefix UserManual.,aux log out toc tex)
VBOX_SDKREF_LATEX_FILES_TARGET = \
$(addprefix SDKRef.,aux log out toc tex)
BLDDIRS += \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/,\
$(VBOX_MANUAL_LANGUAGES) \
$(addsuffix /images, $(VBOX_MANUAL_LANGUAGES)) \
$(addsuffix /html-single, $(VBOX_MANUAL_LANGUAGES)) \
$(addsuffix /html-chunks, $(VBOX_MANUAL_LANGUAGES)) \
$(addsuffix /HTMLHelp, $(VBOX_MANUAL_LANGUAGES)) \
$(addsuffix /HTMLHelp/images, $(VBOX_MANUAL_LANGUAGES)) \
)
ifdef VBOX_WITH_DOCS_CHM
VBOX_MANUAL_PACK += \
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/UserManual_$(f).pdf $(PATH_BIN)/VirtualBox_$(f).chm)
endif
OTHER_CLEAN += \
$(foreach f,$(VBOX_MANUAL_LANGUAGES), $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_MANUAL_XML_FILES))) \
$(foreach f,en_US, $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_SDKREF_XML_FILES))) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES), $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_MANUAL_LATEX_FILES_TARGET))) \
$(foreach f,en_US, $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_SDKREF_LATEX_FILES_TARGET))) \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/, \
catalog docbook \
UserManual.fo) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES), $(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/, \
docbook-htmlhelp-formatcfg.xsl \
docbook-html-one-page-formatcfg.xsl \
docbook-html-chunks-formatcfg.xsl \
titlepage-htmlhelp.xsl )) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_MANUAL_PNG_FILES_$(f)))) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/,$(VBOX_MANUAL_PNG_FILES_$(f)))) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.pdf) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/VirtualBox.chm) \
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/UserManual_$(f).pdf) \
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/VirtualBox_$(f).chm) \
$(PATH_BIN)/UserManual.pdf \
$(PATH_BIN)/VirtualBox.chm \
$(foreach f,en_US,$(VBOX_PATH_MANUAL_OUTBASE)/$f/SDKRef.pdf) \
$(PATH_BIN)/sdk/docs/SDKRef.pdf \
$(wildcard $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/*.h*)) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES),\
$(patsubst $(VBOX_PATH_MANUAL_SRC)/texfiles/unicode/%,$(VBOX_PATH_MANUAL_OUTBASE)/$f/%, \
$(VBOX_MANUAL_TEX_UNICODE_FILES))) \
$(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG)
endif # VBOX_WITH_DOCS
##########################################################################################
#
# Options
#
##########################################################################################
HTMLHELPOPTS =
##########################################################################################
#
# Preparations
#
##########################################################################################
# tool locations
ifndef VBOX_OSE
# use docbook from our tools directory
DOCBOOKPATH ?= $(PATH_DEVTOOLS)/common/DocBook/v1.69.1
DOCBOOKDTDPATH ?= $(PATH_DEVTOOLS)/common/docbook-xml/v4.3
XML_CATALOG ?= $(VBOX_PATH_MANUAL_OUTBASE)/catalog
XML_CATALOG_DOCBOOK ?= $(VBOX_PATH_MANUAL_OUTBASE)/docbook
else
# use docbook of the build host
DOCBOOKPATH ?= http://docbook.sourceforge.net/release/xsl/current/
endif
VBOXMANAGEPATH ?= $(PATH_BIN)/VBoxManage$(SUFF_EXE)
ifeq ($(KBUILD_HOST),win)
# tell MiKTeX to automatically download packages
PDFLATEX = pdflatex -halt-on-error -interaction batchmode --enable-installer
else
PDFLATEX_HALT = $(shell \
( pdflatex -version | head -1 | grep 141592 > /dev/null ) && echo -halt-on-error )
PDFLATEX = pdflatex $(PDFLATEX_HALT) -interaction batchmode
endif
# Windows HTML Help Workshop compiler (stupid thing always returns an error!)
HHC = -$(EXEC_X86_WIN32) $(VBOX_PATH_HTML_HELP_WORKSHOP)/hhc.exe
##########################################################################################
#
# Rules: Preprocess DocBook XML files
# (preliminary step for both CHM and PDF generation)
#
##########################################################################################
#
# The following rules for $(VBOX_PATH_MANUAL_OUTBASE)/*.xml process the XML files
# in doc/manual to allow for some magic variable replacements. The PDF and CHM
# targets do not depend on the XML files in doc/manual, but those in
# $(VBOX_PATH_MANUAL_OUTBASE) instead, which we copy there from here, after that magic
# processing.
#
# So, before copying, the following steps are performed:
#
# -- $VBOX_VERSION_* strings are replaced with the actual current VBox version.
# -- $VBOX_MANAGE_OUTPUT (in VBoxManage.xml) is replaced with the current
# output of the actual VBoxManage program, to save us from having to
# update the manual all the time.
#
# Only one changelog for all languages
$(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG): $(VBOX_PATH_MANUAL_SRC)/$(VBOX_MANUAL_XML_CHANGELOG) | $$(dir $$@)
$(QUIET)$(INSTALL) -m 0644 $< $@
# intermediate step to do some variable replacement in the document
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(filter-out user_VBoxManage.xml,$(VBOX_MANUAL_XML_FILES)))): \
$(VBOX_PATH_MANUAL_OUTBASE)/% : $(VBOX_PATH_MANUAL_SRC)/% $(VBOX_VERSION_STAMP) | $$(dir $$@)
$(call MSG_L1,Pre-processing [1] $(@F) to $@)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(SED) -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
-e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
-e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
-e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
-e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
-e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
-e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
--output $@.tmp $<
$(QUIET)$(MV) -f $@.tmp $@
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/user_VBoxManage.xml): \
$(VBOX_PATH_MANUAL_OUTBASE)/% : \
$(VBOX_PATH_MANUAL_SRC)/% \
$(VBOXMANAGEPATH) | $$(dir $$@)
$(call MSG_L1,Pre-processing [2] $(@F) to $@)
$(QUIET)$(RM) -f $@ $@.tmp $@.tmp2
$(QUIET)$(SED) -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
-e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
-e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
-e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
-e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
-e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
-e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
--output $@.tmp $<
$(QUIET)$(SED) -e '1,/\$$VBOX_MANAGE_OUTPUT/!d' \
-e 's/\$$VBOX_MANAGE_OUTPUT.*//' \
--output $@ $@.tmp
$(QUIET)$(REDIRECT) -wo $@.tmp2 -E 'VBOX_LOG_FLAGS=disabled' -E 'VBOX_LOG_DEST=nofile' \
$(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
-- \
$(VBOXMANAGEPATH) --dumpopts
$(QUIET)$(SED) -e 's/\</g' -e 's/>/\>/g' --append $@ $@.tmp2
$(QUIET)$(SED) -e '/\$$VBOX_MANAGE_OUTPUT/,$$!d' \
-e 's/.*\$$VBOX_MANAGE_OUTPUT//' --append $@ $@.tmp
$(QUIET)$(RM) -f $@.tmp $@.tmp2
VBOX_MANUAL_APIREF_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef_apiref.xml
VBOX_DOC_XIDL_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
VBOX_DOC_XIDL_SRC_TMP = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/VirtualBox.xidl.tmp
$(VBOX_DOC_XIDL_SRC_TMP): $(VBOX_DOC_XIDL_SRC) $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Generating $@)
$(QUIET)$(SED) -e 's|@a \+\(\w\+\)|\1|g' \
-e 's|@c \+\(\w\+\)|\1|g' \
--output $@ $<
# generate SDKRef_apiref.xml as a docbook file excerpt that will be referenced from the SDKRef.xml.
$(VBOX_MANUAL_APIREF_TMP): $(VBOX_DOC_XIDL_SRC_TMP) $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl
$(call MSG_L1,Generating $@)
$(QUIET)$(VBOX_XSLTPROC) --xinclude -o $@ $(VBOX_PATH_MANUAL_SRC)/xidl2docbook.xsl $(VBOX_DOC_XIDL_SRC_TMP)
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.xml: \
$(VBOX_PATH_MANUAL_SRC)/en_US/SDKRef.xml $(VBOX_MANUAL_APIREF_TMP) \
| $$(dir $$@)
$(call MSG_L1,Pre-processing [2] $(@F) to $@)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(SED) -e 's/\$$VBOX_VERSION_MAJOR/$(VBOX_VERSION_MAJOR)/g' \
-e 's/\$$VBOX_VERSION_MINOR/$(VBOX_VERSION_MINOR)/g' \
-e 's/\$$VBOX_VERSION_BUILD/$(VBOX_VERSION_BUILD)/g' \
-e 's/\$$VBOX_VERSION_STRING/$(VBOX_VERSION_STRING)/g' \
-e 's/\$$VBOX_VENDOR/$(VBOX_VENDOR)/g' \
-e 's/\$$VBOX_PRODUCT/$(VBOX_PRODUCT)/g' \
-e 's/\$$VBOX_C_YEAR/$(VBOX_C_YEAR)/g' \
--output $@.tmp $<
$(QUIET)$(SED) -e '1,//!d' \
-e 's///' \
--output $@ $@.tmp
$(QUIET)$(SED) -e 's///g' --append $@ $(VBOX_MANUAL_APIREF_TMP)
$(QUIET)$(SED) -e '//,$$!d' \
-e 's///' --append $@ $@.tmp
# $(QUIET)$(MV) -f $@.tmp $@
##########################################################################################
#
# Rules: Create or preprocess files for xsltproc
# (preliminary step for both CHM and PDF generation)
#
##########################################################################################
# Create a catalog file for xsltproc that points to docbook catalog.
ifneq ($(XML_CATALOG),)
$(XML_CATALOG): $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Creating catalog $@)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(MV) -f $@.tmp $@
# Create a docbook catalog file for xsltproc that points to the local docbook files.
$(XML_CATALOG_DOCBOOK): $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Creating catalog $@)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ' '
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(MV) -f $@.tmp $@
endif
# intermediate step to do some variable replacement in the XSL configuration
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/docbook-htmlhelp-formatcfg.xsl): \
$(VBOX_PATH_MANUAL_SRC)/docbook-htmlhelp-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Pre-processing $(@F) to $@)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(DOCBOOKPATH)|g' \
-e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
-e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
$(QUIET)$(MV) -f $@.tmp $@
# Prepare the XSL file for our title page, htmlhelp variant.
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/titlepage-htmlhelp.xsl): \
$(VBOX_PATH_MANUAL_SRC)/titlepage-htmlhelp.xml $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,xsltproc $<)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet -o $@.tmp $(DOCBOOKPATH)/template/titlepage.xsl $<
$(QUIET)$(MV) -f $@.tmp $@
##########################################################################################
#
# Shared rules for PDF generation
#
##########################################################################################
ifndef VBOX_OSE
# copy ucs.sty and related files
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/ucs.sty):
$(call MSG_L1,Copying unicode support for LaTeX)
$(QUIET)$(CP) $(VBOX_MANUAL_TEX_UNICODE_FILES) $(@D)
endif
# copy the PNG files.
# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
define def_vbox_cp_images_pdf
local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)
$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
$$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
$$(call MSG_L1,Copying temporary $$< => $$@)
$$(QUIET)$$(CP) -f $$< $$@
endef
$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_pdf)))
##########################################################################################
#
# UserManual.pdf
#
##########################################################################################
## @todo INSTALLS target for this!
$(PATH_BIN)/UserManual.pdf: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.pdf | $$(dir $$@)
$(QUIET)$(CP) $< $@
$(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
$(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(PATH_BIN)/UserManual_$(f).pdf): \
$(PATH_BIN)/UserManual_%.pdf : $(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.pdf
$(QUIET)$(CP) $< $@
$(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.pdf): \
$(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.pdf : \
$(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.tex \
$(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/%/ucs.sty) \
$(foreach f,$(VBOX_MANUAL_LANGUAGES),\
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/$f/,$(VBOX_MANUAL_PNG_FILES_$(f)))) | $$(dir $$@)
# PDF generation via Latex: generate the .tex file
$(call MSG_L1,pdflatex $< (three passes) -> $@)
$(QUIET)$(REDIRECT) -C $(@D) -- $(PDFLATEX) UserManual.tex
$(QUIET)$(REDIRECT) -C $(@D) -- $(PDFLATEX) UserManual.tex
$(QUIET)$(REDIRECT) -C $(@D) -- $(PDFLATEX) UserManual.tex
$(QUIET)$(REDIRECT) -C $(@D) -- $(PDFLATEX) UserManual.tex
##@todo restore this when above has been converted to INSTALLS target. $(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
# generate temporary LaTeX source from processed XML
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.tex): \
$(VBOX_PATH_MANUAL_OUTBASE)/%/UserManual.tex : \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/%/,$(VBOX_MANUAL_XML_FILES)) \
$(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG) \
$(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl \
$(MAKEFILE_CURRENT)
$(call MSG_L1,Generating $@ from DocBook XML)
$(QUIET)$(RM) -f $(addprefix $(@D)/,$(VBOX_MANUAL_LATEX_FILES_TARGET))
# generate TeX source from processed docbook and store it in UserManual.tex.tmp;
# pass current language to xsltproc in TARGETLANG variable (extract it from the
# current directory, should become "de_DE" or the like)
$(QUIET)$(VBOX_XSLTPROC) $(XSLTPROC_VERBOSE) --xinclude --nonet --stringparam TARGETLANG $(notdir $(@D)) -o $@.tmp $(VBOX_PATH_MANUAL_SRC)/docbook2latex.xsl $<
# for pretty quotes, replace " with `` or '' depending on whether it's at the start of a word;
# the \QUOTE{} was inserted by docbook2latex.xsl for all quotes _outside_ of screen sections
$(QUIET)$(SED) \
-e 's|^\\QUOTE{}|\\OQ{}|g' \
-e 's|\(\W\)\\QUOTE{}|\1\\OQ{}|g' \
-e 's|\(\w\)\\QUOTE{}|\1\\CQ{}|g' \
--output $@ $@.tmp
$(QUIET)$(RM) -f $@.tmp
##########################################################################################
#
# SDKRef.pdf
#
##########################################################################################
$(VBOX_PATH_SDK)/docs/SDKRef.pdf: \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/SDKRef.tex \
$(if $(VBOX_OSE),,$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ucs.sty) \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) | $$(dir $$@)
# PDF generation via Latex: generate the .tex file
$(QUIET)$(MKDIR) -p $(VBOX_PATH_SDK)/docs
$(call MSG_L1,pdflatex $< (three passes))
$(QUIET)$(REDIRECT) -C $( $@)
$(QUIET)$(RM) -f $@
$(QUIET)$(HHC) $(subst /,\\,$<)
$(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/HTMLHelp/htmlhelp.hhp): \
$(VBOX_PATH_MANUAL_OUTBASE)/%/HTMLHelp/htmlhelp.hhp: \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/%/,$(VBOX_MANUAL_XML_FILES)) \
$(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG) \
$(VBOX_PATH_MANUAL_OUTBASE)/%/docbook-htmlhelp-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/%/titlepage-htmlhelp.xsl \
$(XML_CATALOG) \
$(XML_CATALOG_DOCBOOK)
$(call MSG_L1,xsltproc $<,=> $@)
$(QUIET)$(RM) -f $@
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(if $(XML_CATALOG),XML_CATALOG_FILES=$(XML_CATALOG)) \
$(VBOX_XSLTPROC) --xinclude --nonet --output $(@D)/ \
--stringparam htmlhelp.chm \
$(subst /,\\,$(@D)/../VirtualBox.chm) \
$(HTMLHELPOPTS) $(@D)/../docbook-htmlhelp-formatcfg.xsl \
$<
# copy the PNG files.
# Note: out_dir needs to be referenced with an escaped $ so it doesn't expand as eval expands it input.
define def_vbox_cp_images_html
local out_dir := $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/HTMLHelp
$$(addprefix $$(out_dir)/,$(VBOX_MANUAL_PNG_FILES_$(lang))): \
$$(out_dir)/%: $(VBOX_PATH_MANUAL_SRC)/$(lang)/% | $$$$(dir $$$$@)
$$(call MSG_L1,Copying temporary $$< => $$@)
$$(QUIET)$$(CP) -f $$< $$@
endef
$(foreach lang,$(VBOX_MANUAL_LANGUAGES),$(eval $(def_vbox_cp_images_html)))
# Packing the docs into a zip file
$(PATH_BIN)/VBoxDocumentation.zip: $(VBOX_MANUAL_PACK)
$(call MSG_L1,Packing documentation $@)
$(QUIET)$(RM) -f $@
$(QUIET)$(REDIRECT) -C $(PATH_BIN) -- zip$(HOSTSUFF_EXE) -9 $@ $(notdir $^)
endif # VBOX_WITH_DOCS_CHM
##########################################################################################
#
# UserManual.html
#
##########################################################################################
# intermediate step to do some variable replacement in the XSL configuration
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl: \
$(VBOX_PATH_MANUAL_SRC)/docbook-html-one-page-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Pre-processing $(@F) to $@)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(DOCBOOKPATH)|g' \
-e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
-e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
$(QUIET)$(MV) -f $@.tmp $@
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl: \
$(VBOX_PATH_MANUAL_SRC)/docbook-html-chunks-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Pre-processing $(@F) to $@)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(DOCBOOKPATH)|g' \
-e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
-e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
$(QUIET)$(MV) -f $@.tmp $@
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html: \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_FILES)) \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
$(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG)
$(call MSG_L1,xsltproc $<)
$(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet \
--output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html: \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_XML_FILES)) \
$(addprefix $(VBOX_PATH_MANUAL_OUTBASE)/en_US/,$(VBOX_MANUAL_PNG_FILES_en_US)) \
$(VBOX_PATH_MANUAL_OUTBASE)/$(VBOX_MANUAL_XML_CHANGELOG)
$(call MSG_L1,xsltproc $<)
$(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet \
--output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html \
--stringparam chunk.section.depth 0 \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.xml
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip: \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
$(call MSG_L1,Packing documentation $@)
$(QUIET)$(RM) -f $@
$(QUIET)$(REDIRECT) -C $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ -- zip$(HOSTSUFF_EXE) \
-9 -r $@ html-single html-chunks $(VBOX_MANUAL_PNG_FILES_en_US)
html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-single/UserManual.html
html:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/html-chunks/index.html
html-zip:: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/UserManual.zip
##########################################################################################
#
# ChangeLog.html
#
##########################################################################################
# intermediate step to do some variable replacement in the XSL configuration
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-changelog-formatcfg.xsl: \
$(VBOX_PATH_MANUAL_SRC)/docbook-changelog-formatcfg.xsl $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_L1,Pre-processing $(@F) to $@)
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(SED) -e 's|\$$DOCBOOKPATH|$(DOCBOOKPATH)|g' \
-e 's|\$$CFGPATH|$(VBOX_PATH_MANUAL_SRC)|g' \
-e 's|\$$TARGETPATH|$(@D)|g' --output $@.tmp $<
$(QUIET)$(MV) -f $@.tmp $@
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.xml: ChangeLog.xml
$(QUIET)$(CP) $< $@
$(VBOX_PATH_MANUAL_OUTBASE)/user_ChangeLogImpl_1.xml: $(VBOX_PATH_MANUAL_SRC)/user_ChangeLogImpl.xml
$(QUIET)$(RM) -f $@.tmp $@
$(QUIET)$(SED) -e 's|para|simpara|g' \
--output $@.tmp $<
$(QUIET)$(MV) -f $@.tmp $@
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html: \
$(VBOX_PATH_MANUAL_OUTBASE)/user_ChangeLogImpl_1.xml \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-changelog-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.xml
$(QUIET)$(VBOX_XSLTPROC) --xinclude --nonet --output $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html \
$(@D)/docbook-changelog-formatcfg.xsl \
$(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.xml
$(PATH_BIN)/ChangeLog.html: $(VBOX_PATH_MANUAL_OUTBASE)/en_US/ChangeLog.html
$(QUIET)$(CP) $< $@
$(call MSG_L1,Fresh ChangeLog.html is now at $@)
cl-html: $(PATH_BIN)/ChangeLog.html
include $(KBUILD_PATH)/subfooter.kmk