Fix documentation dependency generation.
[git.git] / Documentation / build-docdep.perl
1 #!/usr/bin/perl
2
3 my %include = ();
4
5 for my $text (<git-*.txt>) {
6     open I, '<', $text || die "cannot read: $text";
7     (my $base = $text) =~ s/\.txt$//;
8     while (<I>) {
9         if (/^include::/) {
10             chomp;
11             s/^include::\s*//;
12             s/\[\]//;
13             $include{$base}{$_} = 1;
14         }
15     }
16     close I;
17 }
18
19 # Do we care about chained includes???
20
21 while (my ($base, $included) = each %include) {
22     my ($suffix) = '1';
23     if ($base eq 'git') {
24         $suffix = '7'; # yuck...
25     }
26     print "$base.html $base.$suffix : ", join(" ", keys %$included), "\n";
27 }
28