summaryrefslogtreecommitdiffstats
path: root/doc/Conscript
blob: 28418157858a07270de18b077fa0ea9593c7b813 (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
#
#
#

Import qw(
    date
    env
    revision
    version
);

#
$verfile = SourcePath("version.sgml");
open(FILE, ">$verfile") || die "Cannot open '$verfile': $!";
print FILE <<_EOF_;
<!--
THIS IS AN AUTOMATICALLY-GENERATED FILE.  DO NOT EDIT.
-->
<!ENTITY build_date "$date">
<!ENTITY build_version "$version">
<!ENTITY build_revision "$revision">
_EOF_
close(FILE);

Ignore("#$verfile");

#
#
#

@doc_dirs = qw(
    design
);

# Find internal dependencies in .sgml files:
#
#	<!entity bground SYSTEM "bground.sgml">
#	<graphic fileref="file.jpg">
#
# This only finds one per line, and assumes that anything
# defined as a SYSTEM entity is, in fact, a file included
# somewhere in the document.
sub scansgml {
    my @includes = ();
    do {
	if (/<!entity\s+(?:%\s+)?(?:\S+)\s+SYSTEM\s+"([^"]*)">/i) {
	    push(@includes, $1);
  	} elsif (/<graphic[^>]*\sfileref="([^"]*)"/) {
	    push(@includes, "design/$1");
	}
    } while (<scan::quickscan::SCAN>);
    @includes;
}

$env->QuickScan(\&scansgml, "scons.mod");
$env->QuickScan(\&scansgml, "copyright.sgml");

foreach $doc (@doc_dirs) {
    my $main = "$doc/main.sgml";
    my $out = "main.out";

    $env->QuickScan(\&scansgml, $main);

    $env->Command("HTML/$doc/book1.html", $main,
	qq(jw -b html -o %>:d %<));

    $env->Command("PS/$doc.ps", $main,
	[qq(jw -b ps -o %>:d %<),
	 qq(mv %>:d/main.ps %>),
	]);

    $env->Command("PDF/$doc.pdf", $main,
	[qq(jw -b pdf -o %>:d %<),
	 qq(mv %>:d/main.pdf %>),
#	 qq(rm -f %>:d/$out),
	]);
}