File: build

package info (click to toggle)
sdf 2.001%2B1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,284 kB
  • sloc: perl: 18,543; sh: 31; makefile: 29
file content (90 lines) | stat: -rwxr-xr-x 2,490 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/perl
#
# >>Title::     Build Documentation
#
# >>Copyright::
# Copyright (c) 1992-1996, Ian Clatworthy (ianc@mincom.com).
# You may distribute under the terms specified in the LICENSE file.
#
# >>History::
# -----------------------------------------------------------------------
# Date      Who     Change
# 30-Oct-98 ianc    Added local mode
# 29-Feb-96 ianc    SDF 2.000
# -----------------------------------------------------------------------
#

use Cwd;
!require "sdf/name.pl";

# The root directory for documents
$DOC_ROOT = cwd();

# The formats to build for each document
%FMTS = (
    "paper/sdfintro",   ['pdf', 'html'],
    "quickref/qr_sdf",  ['pdf', 'html'],
    "user/ug_sdf",      ['book -zpdf', 'topics'],
    "guru/gg_sdf",      ['book -zpdf', 'topics'],
    "ref/re_sdf",       ['book -zpdf', 'topics'],
    "genhtml/index",    ['pdf', 'html'],
    "podusers/index",   ['pdf', 'html'],
    "release/rn_sdf",   ['pdf', 'topics'],
    "faq/faq",          ['pdf', 'html'],
);

# Symbolic names for sets of documents
%TAGS = (
    "all",      [sort keys %FMTS],
);

# Check the usage
unless (@ARGV) {
    print "usage: build all          - all the documents\n";
    print "       build list_of_docs - some documents\n";
    print "       build local        - just home & catalog for local use\n";
    exit 1;
}

# Check for local mode
if ($ARGV[0] eq 'local') {
    print "EXECUTING: sdf -2html -DLOCAL_DOCS home catalog\n";
    system("sdf -2html -DLOCAL_DOCS home catalog");
    exit();
}

# Generate the documents
while (defined($doc = shift(@ARGV))) {

    # Expand symbolic names
    if ($TAGS{$doc}) {
        unshift(@ARGV, @{$TAGS{$doc}});
        next;
    }

    # Get the formats to generate for this document
    @fmts = @{$FMTS{$doc}};
    unless (@fmts) {
        print "error: unknown document '$doc'\n";
        next;
    }

    # Change to the directory holding the document
    ($dir, $file) = &NameSplit($doc);
    chdir "$DOC_ROOT/$dir";
    print "CHANGED TO: ", `pwd`;

    # Generate the required outputs
    for $fmt (@fmts) {
        print "EXECUTING: sdf -2$fmt $file\n";
        system("sdf -2$fmt $file");
    }
}

# Update the home page, document catalog and INSTALL notes
chdir $DOC_ROOT;
print "CHANGED TO: ", `pwd`;
print "EXECUTING: sdf -2html home catalog\n";
system("sdf -2html home catalog");
print "EXECUTING: sdf -2txt -o- -csdf user/in_insta.sdf > ../INSTALL\n";
system("sdf -2txt -o- -csdf user/in_insta.sdf > ../INSTALL");