blob: 1298db104b7d0d3bc478737cfe491120e1345be0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# file : doc/buildfile
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
define html: file
html{*}: extension = html
define doxygen: file
doxygen{*}: extension = doxygen
define doxytag: file
doxytag{*}: extension = doxytag
doxygen_doc = $config.libxsd.doxygen
if $doxygen_doc
import! doxygen = doxygen%exe{doxygen}
./: cxx/tree/reference/doxytag{libxsd}: include = $doxygen_doc
cxx/tree/reference/
{
headers = buffer types date-time elements element-map exceptions
<doxytag{libxsd}>: doxygen{libxsd} \
html{footer} \
$src_root/xsd/cxx/tree/hxx{$headers} \
$doxygen
%
if $doxygen_doc
{{
o = $directory($>[0]) # Target output directory.
c = $path($<[0]) # Doxygen config file.
t = $path($>[0]).t # Temp dir.
tc = $t/"$leaf($c)" # Temp doxygen config file.
d = $t/$name($>[0]).d # Dep file (target list).
# Describe the dynamic targets for better diagnostics.
#
dyndep_options = --target-what 'generated doxygen'
# Doxygen doesn't provide any way to list the would-be-generated HTML
# files so the best we can do is to generate them, get their list, and
# throw them away. Note that this code is inspired by the hello-thrift
# example (see its buildfile for details).
#
# Note: fsdir{} could have been static prerequisite but let's keep it
# dynamic in case we want to turn this into a rule one day.
#
depdb dyndep --dyn-target $dyndep_options --format lines --file $d -- \
mkdir -p $t && \
sed -e "s%^\\s*\(HTML_OUTPUT\\s*=\).*\$%\\1 $t/html%" \
-e "s%^\\s*\(GENERATE_TAGFILE\\s*=\).*\$%\\1%" $c >$tc && \
$doxygen $tc &$t/html/*** && \
find $t/html -type f >$d && \
sed -e "s%[/\\\\]$path.leaf($t)%%g" -i $d && \
echo '' >>$d && \
echo $path.representation([dir_path] $o/html) >>$d
diag doxygen ($<[0]) -> ($>[0]) $o/fsdir{html/}
rm -rf $o/html # Note: doxygen doesn't clean it up itself.
# @@ It's unclear if it would be beneficial (or even possible) to list
# relative inputs in doxygen{libxsd} and then adjust the CWD here. Note
# that while relative header paths are used in libxsd.doxygen for
# make-based build system, absolute paths still end up in
# libxsd.doxytag.
#
$doxygen $c
}}
doxygen{libxsd}: in{libxsd}
{
in.symbol = '%'
input = $regex.merge($headers, \
'^(.*)$', \
"$src_root/xsd/cxx/tree/\\1.hxx", \
' ')
}
html{footer}: in{footer}
{
# Extract the copyright notice from the LICENSE file.
#
# Note that cat is a builtin which means this is both portable and fast.
#
copyright = $process.run_regex(cat $src_root/LICENSE, \
'Copyright \(c\) (.+)\.', \
'\1')
}
}
|