]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com> |
2 | # Copyright (c) 2016 Rene Rivera | |
3 | # | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
5 | # (See accompanying file LICENSE_1_0.txt or copy at | |
6 | # http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | project boost/doc | |
9 | : requirements | |
10 | <xsl:param>boost.libraries=../../libs/libraries.htm | |
11 | <format>html:<xsl:param>chunker.output.doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" | |
12 | <format>html:<xsl:param>chunker.output.doctype-system="http://www.w3.org/TR/html4/loose.dtd" | |
13 | ; | |
14 | ||
15 | import boostbook : boostbook ; | |
16 | import project ; | |
17 | import targets ; | |
18 | import print ; | |
19 | import type ; | |
20 | import generators ; | |
21 | import sequence ; | |
22 | import path ; | |
23 | import "class" : is-a ; | |
24 | ||
25 | path-constant BOOST_DOC : . ; | |
26 | ||
27 | local lib-docs = [ path.glob [ path.glob $(BOOST_DOC)/../libs : */doc ] | |
28 | : [ modules.peek project : JAMFILE ] ] ; | |
29 | ||
30 | local rule find-target-of-class-or-type ( root-target : klass ? : type ? ) | |
31 | { | |
32 | local result ; | |
33 | if ! $(result) && $(klass) && [ is-a $(root-target) : $(klass) ] | |
34 | { | |
35 | result ?= $(root-target) $(klass) ; | |
36 | } | |
37 | if ! $(result) && $(type) && $(type:U) = [ modules.peek $(root-target) : self.type ] | |
38 | { | |
39 | result ?= $(root-target) $(type:U) ; | |
40 | } | |
41 | local alternatives = [ modules.peek $(root-target) : self.alternatives ] ; | |
42 | if ! $(result) | |
43 | { | |
44 | for local alternative in $(alternatives) | |
45 | { | |
46 | if $(result) { break ; } | |
47 | result ?= [ find-target-of-class-or-type $(alternative) : $(klass) : $(type) ] ; | |
48 | } | |
49 | } | |
50 | if ! $(result) | |
51 | { | |
52 | for local alternative in $(alternatives) | |
53 | { | |
54 | if $(result) { break ; } | |
55 | local sources = [ modules.peek $(alternative) : self.sources ] ; | |
56 | for local source in [ $(alternative).sources ] | |
57 | { | |
58 | if $(result) { break ; } | |
59 | result ?= [ find-target-of-class-or-type $(source) : $(klass) : $(type) ] ; | |
60 | } | |
61 | } | |
62 | } | |
63 | return $(result) ; | |
64 | } | |
65 | ||
66 | local rule docbook-target-spec ( main-target ) | |
67 | { | |
68 | local spec ; | |
69 | local doc-sub-target | |
70 | = [ find-target-of-class-or-type $(main-target) : boostbook-target-class : XML ] ; | |
71 | if $(doc-sub-target) | |
72 | { | |
73 | #ECHO *** $(main-target) ; | |
74 | #ECHO " ::" [ $(main-target).full-name ] ; | |
75 | #ECHO " ::" $(doc-sub-target) :: [ $(doc-sub-target[0]).full-name ] ; | |
76 | local full-name = [ $(doc-sub-target[0]).full-name ] ; | |
77 | local target-path = $(full-name:D) ; | |
78 | local target-name = $(full-name:B) ; | |
79 | local this-path = [ path.root [ project.attribute $(__name__) location ] [ path.pwd ] ] ; | |
80 | target-path = [ path.relative-to $(this-path) $(target-path) ] ; | |
81 | #ECHO " ::" $(target-path) :: $(target-name) ; | |
82 | spec = $(target-path)//$(target-name) ; | |
83 | } | |
84 | return $(spec) ; | |
85 | } | |
86 | ||
87 | local lib-doc-boostdoc-refs ; | |
88 | local lib-doc-boostrelease-refs ; | |
89 | ||
90 | local this-path = [ path.root [ project.attribute $(__name__) location ] [ path.pwd ] ] ; | |
91 | for local lib-doc in $(lib-docs) | |
92 | { | |
93 | #ECHO === $(lib-doc) ... ; | |
94 | local doc-project = $(lib-doc:D) ; | |
95 | local doc-module = [ project.find $(doc-project) | |
96 | : [ project.attribute $(__name__) location ] ] ; | |
97 | local doc-target = [ project.target $(doc-module) ] ; | |
98 | $(doc-target).build-main-targets ; | |
99 | local boostrelease-target = [ $(doc-target).main-target boostrelease ] ; | |
100 | if $(boostrelease-target) | |
101 | { | |
102 | local full-name = [ $(boostrelease-target).full-name ] ; | |
103 | local target-path = [ path.relative-to $(this-path) $(full-name:D) ] ; | |
104 | lib-doc-boostrelease-refs += $(target-path)//boostrelease ; | |
105 | #ECHO " ::" $(target-path)//boostrelease ; | |
106 | } | |
107 | local boostdoc-target = [ $(doc-target).main-target boostdoc ] ; | |
108 | if $(boostdoc-target) | |
109 | { | |
110 | local full-name = [ $(boostdoc-target).full-name ] ; | |
111 | local target-path = [ path.relative-to $(this-path) $(full-name:D) ] ; | |
112 | lib-doc-boostdoc-refs += $(target-path)//boostdoc ; | |
113 | #ECHO " ::" $(target-path)//boostdoc ; | |
114 | } | |
115 | } | |
116 | ||
117 | # Build non-integrated library docs for release. | |
118 | if "--release-build" in [ modules.peek : ARGV ] | |
119 | { | |
120 | alias release-build : $(lib-doc-boostrelease-refs) ; | |
121 | } | |
122 | ||
123 | local rule component-order ( x y ) | |
124 | { | |
125 | local a = [ MATCH "(/libs/[^/]+)" "(/tools/[^/]+)" : $(x:G) $(x:G=) ] ; | |
126 | local b = [ MATCH "(/libs/[^/]+)" "(/tools/[^/]+)" : $(y:G) $(y:G=) ] ; | |
127 | if $(a[1]) < $(b[1]) | |
128 | { | |
129 | return true ; | |
130 | } | |
131 | else if $(a[1]) = $(b[1]) && $(x) < $(y) | |
132 | { | |
133 | return true ; | |
134 | } | |
135 | } | |
136 | ||
137 | rule xinclude-generator ( target : sources * : properties * ) | |
138 | { | |
139 | print.output $(target) ; | |
140 | local includes ; | |
141 | sources = [ sequence.insertion-sort $(sources) : component-order ] ; | |
142 | locate = [ path.root [ on $(target) return $(LOCATE) ] [ path.pwd ] ] ; | |
143 | for local xml in $(sources) | |
144 | { | |
145 | local dir ; | |
146 | dir ?= [ on $(xml) return $(LOCATE) ] ; | |
147 | dir ?= [ on $(xml) return $(SEARCH) ] ; | |
148 | dir ?= "" ; | |
149 | dir = [ path.root $(dir[1]) [ path.pwd ] ] ; | |
150 | dir = [ path.relative-to $(locate) $(dir) ] ; | |
151 | includes += "<xi:include href=\"$(dir[1])/$(xml:G=)\"/>" ; | |
152 | } | |
153 | print.text | |
154 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | |
155 | "<xml xmlns:xi=\"http://www.w3.org/2003/XInclude\">" | |
156 | $(includes) | |
157 | "</xml>" | |
158 | : overwrite ; | |
159 | } | |
160 | type.register XINCLUDE_XML : xinclude : XML ; | |
161 | generators.register-composing $(__name__).xinclude-generator : XML : XINCLUDE_XML ; | |
162 | ||
163 | rule xinclude ( name : sources * : requirements * : default-build * : usage-requirements * ) | |
164 | { | |
165 | targets.create-typed-target XINCLUDE_XML | |
166 | : [ project.current ] | |
167 | : $(name) | |
168 | : $(sources) | |
169 | : $(requirements) | |
170 | : $(default-build) | |
171 | : $(usage-requirements) | |
172 | ; | |
173 | } | |
174 | ||
175 | xinclude libraries : | |
176 | $(lib-doc-boostdoc-refs) | |
177 | ; | |
178 | explicit libraries ; | |
179 | ||
180 | xinclude tools : | |
181 | ../tools/build/doc//jam_docs | |
182 | ../tools/quickbook/doc//quickbook | |
183 | ../tools/boostbook/doc/boostbook.xml | |
184 | ../tools/build/doc/src/userman.xml | |
185 | ; | |
186 | explicit tools ; | |
187 | ||
188 | boostbook doc | |
189 | : | |
190 | src/boost.xml | |
191 | : | |
192 | <use>$(lib-doc-boostdoc-refs) | |
193 | <dependency>libraries | |
194 | <implicit-dependency>libraries | |
195 | <dependency>tools | |
196 | <implicit-dependency>tools | |
197 | ||
198 | <dependency>images | |
199 | <dependency>callouts | |
200 | <xsl:path>$(BOOST_DOC) | |
201 | ; | |
202 | ||
203 | install images : [ glob src/images/*.png ] : <location>html/images ; | |
204 | explicit images ; | |
205 | install callouts : [ glob src/images/callouts/*.png ] : <location>html/images/callouts ; | |
206 | explicit callouts ; |