Make per target manifest files and a single global catalog files, so that one can have multiple boostbook targets in one project.

[SVN r39506]
This commit is contained in:
Rene Rivera 2007-09-24 13:24:23 +00:00
parent c42e01f88d
commit 6587f9cb97

View File

@ -1,6 +1,6 @@
# Copyright 2003, 2004, 2005 Dave Abrahams
# Copyright 2003, 2004, 2005 Douglas Gregor
# Copyright 2005, 2006 Rene Rivera
# Copyright 2005, 2006, 2007 Rene Rivera
# Copyright 2003, 2004, 2005 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@ -28,6 +28,11 @@ import build-system ;
import xsltproc : xslt xslt-dir ;
# Make this module into a project.
project.initialize $(__name__) ;
project boostbook ;
feature.feature format : html xhtml htmlhelp onehtml man pdf ps docbook fo tests
: incidental implicit composite propagated ;
@ -254,11 +259,42 @@ rule generate-xml-catalog ( target : sources * : properties * )
print.text "</catalog>" ;
}
rule xml-catalog ( )
{
if ! $(.xml-catalog)
{
# The target is created as part of the root project. But ideally
# it would be created as part of the boostbook project. This is not
# current possible as such global projects don't inherit things like
# the build directory.
# Find the root project.
local root-project = [ project.current ] ;
root-project = [ $(root-project).project-module ] ;
while
[ project.attribute $(root-project) parent-module ] &&
[ project.attribute $(root-project) parent-module ] != user-config
{
root-project = [ project.attribute $(root-project) parent-module ] ;
}
.xml-catalog = [ new file-target boostbook_catalog
: XML
: [ project.target $(root-project) ]
: [ new action : boostbook.generate-xml-catalog ]
:
] ;
.xml-catalog-file = [ $(.xml-catalog).path ] [ $(.xml-catalog).name ] ;
.xml-catalog-file = $(.xml-catalog-file:J=/) ;
}
return $(.xml-catalog) $(.xml-catalog-file) ;
}
class boostbook-generator : generator
{
import feature ;
import virtual-target ;
import generators ;
import boostbook ;
rule __init__ ( * : * )
@ -268,21 +304,13 @@ class boostbook-generator : generator
rule run ( project name ? : property-set : sources * : multiple ? )
{
# Generate the catalog
local catalog = [ new file-target catalog
: XML
: $(project)
: [ new action
: boostbook.generate-xml-catalog
: $(property-set) ] ] ;
# catalog = [ virtual-target.register $(catalog) ] ;
# Generate the catalog, but only once...
local global-catalog = [ boostbook.xml-catalog ] ;
local catalog = $(global-catalog[1]) ;
local catalog-file = $(global-catalog[2]) ;
# Add the catalog to the property set
local catalog-path = [ $(catalog).path ] ;
property-set = [ $(property-set).add-raw <catalog>$(catalog-path)/catalog.xml ] ;
# local targets = $(catalog) ;
property-set = [ $(property-set).add-raw <catalog>$(catalog-file) ] ;
local type = none ;
local manifest ;
@ -302,7 +330,6 @@ class boostbook-generator : generator
case htmlhelp :
{
type = HTMLHELP ;
#manifest = HTML.manifest ;
}
case onehtml : type = HTML ;
@ -329,8 +356,11 @@ class boostbook-generator : generator
$(base-target).depends $(catalog) ;
# Generate HTML/PDF/PS from DOCBOOK.
local target = [ generators.construct $(project) $(manifest)
: $(type) : $(property-set) : $(base-target) ] ;
local target = [ generators.construct $(project) $(name)_$(manifest)
: $(type)
: [ $(property-set).add-raw
<xsl:param>manifest=$(name)_$(manifest) ]
: $(base-target) ] ;
local name = [ $(property-set).get <name> ] ;
name ?= $(format) ;
$(target[2]).set-path $(name) ;