1# 2# Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) 3# Copyright (c) 2020 Krystian Stasiowski (sdkrystian at gmail dot com) 4# 5# Distributed under the Boost Software License, Version 1.0. (See accompanying 6# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7# 8 9project static_string/doc ; 10 11import os ; 12import path ; 13import boostbook ; 14import quickbook ; 15import xsltproc ; 16import doxygen ; 17import modules ; 18import saxonhe ; 19import common ; 20 21#------------------------------------------------------------------------------- 22# 23# Build the list of header files that Doxygen will scan. We need 24# this list to inform the build system of the dependencies so the 25# docs can be rebuild if any of the header files change. 26# 27 28local sources = [ path.glob-tree ../include/boost/static_string : *.hpp *.ipp : detail impl ] ; 29 30# Get the configured paths to doxygen and xsltproc 31 32.doxygen = [ doxygen.name ] ; 33.doxygen ?= doxygen ; 34 35#ECHO Using doxygen from "$(.doxygen)" ; 36 37.xsltproc = [ xsltproc.name ] ; 38.xsltproc ?= xsltproc ; 39 40#ECHO Using xsltproc from "$(.xsltproc)" ; 41 42#------------------------------------------------------------------------------- 43# 44# Invoke Doxygen to process the header files and produce the XML 45# containing the description of the C++ declarations and extracted 46# Javadoc comments. 47# 48make index.xml 49 : 50 ./source.dox 51 : 52 @make_doxygen_xml 53 : 54 <dependency>$(sources) 55 ; 56 57rule make_doxygen_xml ( targets * : sources * : properties * ) 58{ 59 LIB_DIR on $(targets) = 60 [ path.native [ path.parent [ path.root 61 [ on $(sources[1]) return $(SEARCH) ] [ path.pwd ] ] ] ] ; 62} 63 64if [ os.name ] = NT 65{ 66 actions make_doxygen_xml 67 { 68 SET LIB_DIR=$(LIB_DIR) 69 SET XML_OUTPUT=$(1:D) 70 "$(.doxygen)" $(2) 71 } 72} 73else 74{ 75 actions make_doxygen_xml 76 { 77 export LIB_DIR=$(LIB_DIR) 78 export XML_OUTPUT=$(1:D) 79 "$(.doxygen)" $(2) 80 } 81} 82 83#------------------------------------------------------------------------------- 84# 85# Copy all the XSLT modules to the target directory. 86# 87# FIXME: Change this so we can just specify a directory, 88# rather than every file individually. 89# 90# Also, somehow force dependencies in a general way 91# such that the XSLT has to be executed again 92# if any of the modules change. For example, 93# if base-extract-xml-pages.xml changes, then 94# an invocation of extract-xml-pages.xsl (which 95# imports the former) must be run again. 96# 97path-constant docca : ../../../tools/docca ; 98make extract-xml-pages.xsl : $(docca)/include/docca/extract-xml-pages.xsl : @copy_script ; 99make base-extract-xml-pages.xsl : $(docca)/include/docca/base-extract-xml-pages.xsl : @copy_script ; 100make common.xsl : $(docca)/include/docca/common.xsl : @copy_script ; 101make stage1.xsl : $(docca)/include/docca/stage1.xsl : @copy_script ; 102make base-stage1.xsl : $(docca)/include/docca/base-stage1.xsl : @copy_script ; 103make stage2.xsl : $(docca)/include/docca/stage2.xsl : @copy_script ; 104make assemble-quickbook.xsl : $(docca)/include/docca/assemble-quickbook.xsl : @copy_script ; 105make emphasized-types.xsl : $(docca)/include/docca/emphasized-types.xsl : @copy_script ; 106 107make config.xsl 108 : 109 $(docca)/include/docca/config.xsl 110 xsl/config.xsl 111 xsl/class_detail.xsl 112 xsl/includes.xsl 113 : 114 @make_config 115 ; 116 117actions make_config 118{ 119 cp $(2[1]) $(1) 120 sed -i -e "/<!-- CONFIG_TEMPLATE -->/{r $(2[2])" -e "d}" $(1) 121 sed -i -e "/<!-- CLASS_DETAIL_TEMPLATE -->/{r $(2[3])" -e "d}" $(1) 122 sed -i -e "/<!-- INCLUDES_TEMPLATE -->/{r $(2[4])" -e "d}" $(1) 123} 124 125# Make a copy of the given file. 126# 127actions copy_script 128{ 129 cp $(2[1]) $(1) 130} 131 132 133# This is to initially create the directory as a side effect; I'm sure there's a better way... 134make xml-pages/directory/placeholder : index.xml : @null_action ; 135 136#------------------------------------------------------------------------------- 137# 138# Run index.xml through the first transformation stage 139# (assembling and splitting the XML into page-specific files). 140# 141make xml-pages.xml 142 : 143 index.xml 144 extract-xml-pages.xsl 145 146 # Make bjam aware of additional dependencies 147 base-extract-xml-pages.xsl 148 config.xsl 149 common.xsl 150 : 151 saxonhe.saxonhe 152 ; 153 154# This is just to make the directory eligible as a source 155make xml-pages : index.xml : @null_action ; 156 157# Not ready for prime time until I figure out how to get the xslt-visualizer code in place 158#make stage1/code-trace-enabled/stage1.xsl 159# : 160# stage1.xsl 161# xslt-visualizer/xsl/trace-enable.xsl 162# : 163# saxonhe.saxonhe 164# ; 165 166# This is to initially create the directory as a side effect; I'm sure there's a better way... 167make stage1/results/directory/placeholder : xml-pages.xml : @null_action ; 168make stage2/results/directory/placeholder : xml-pages.xml : @null_action ; 169 170# TODO: figure out why this (and the following stage) get built every time 171make stage1/results 172 : 173 xml-pages 174 stage1.xsl 175 176 # additional dependencies 177 xml-pages.xml 178 base-stage1.xsl 179 config.xsl 180 common.xsl 181 : 182 saxonhe.saxonhe_dir 183 ; 184 185make stage2/results 186 : 187 stage1/results 188 stage2.xsl 189 190 # additional dependencies 191 emphasized-types.xsl 192 : 193 saxonhe.saxonhe_dir 194 ; 195 196make reference.qbk 197 : 198 xml-pages.xml 199 assemble-quickbook.xsl 200 201 # TODO: make this input to the XSLT somehow 202 # rather than relying on it being hard-coded 203 # in the XSLT (which it is!) 204 stage2/results 205 : 206 saxonhe.saxonhe 207 ; 208 209actions make_dir 210{ 211 mkdir $(1) 212} 213 214make combine.xslt : index.xml : @null_action ; 215 216actions touch_file 217{ 218 touch $(1) ; 219} 220 221actions null_action 222{ 223 touch -c $(1) ; 224} 225 226make reference.xml 227 : 228 combine.xslt 229 index.xml 230 : 231 @call-xsltproc 232 ; 233 234actions call-xsltproc 235{ 236 "$(.xsltproc)" $(2) > $(1) 237} 238 239#------------------------------------------------------------------------------- 240# 241# Produce the reference.qbk file by running 242# the reference xml through the transform. 243# 244#make reference.qbk 245# : 246# reference.xml 247# transform.xsl 248# : 249# saxonhe.saxonhe 250# ; 251 252# We have to make a copy of reference.qbk and put it 253# in a place where the static .qbk files can find it 254# 255install qbk : reference.qbk ; 256 257#------------------------------------------------------------------------------- 258# 259# Produce the Boost.Book XML from the QuickBook 260# 261 262install images 263 : 264 : 265 <location>html/static_string/images 266 ; 267 268explicit images ; 269 270xml static_string_doc 271 : 272 qbk/main.qbk 273 : 274 <dependency>images 275 <dependency>qbk 276 ; 277 278explicit static_string_doc ; 279 280#------------------------------------------------------------------------------- 281# 282# HTML documentation for $(BOOST_ROOT)/doc/html 283# 284#------------------------------------------------------------------------------- 285 286boostbook static_string 287 : 288 static_string_doc 289 : 290 <xsl:param>boost.root=../../../.. 291 <xsl:param>chapter.autolabel=0 292 <xsl:param>chunk.section.depth=8 # Depth to which sections should be chunked 293 <xsl:param>chunk.first.sections=1 # Chunk the first top-level section? 294 <xsl:param>generate.toc="" 295 <include>../../../tools/boostbook/dtd 296 : 297 <dependency>images 298 ; 299 300#------------------------------------------------------------------------------- 301# 302# These are used to inform the build system of the 303# means to build the integrated and stand-alone docs. 304# 305 306alias boostdoc ; 307explicit boostdoc ; 308 309alias boostrelease : static_string ; 310explicit boostrelease ; 311