1SUBDIRS = man1
2
3{-
4 use File::Spec::Functions qw(:DEFAULT abs2rel rel2abs);
5 use File::Basename;
6
7 my $sourcedir = catdir($config{sourcedir}, 'doc');
8
9 foreach my $section ((1, 3, 5, 7)) {
10     my @imagefiles = ();
11     my @htmlfiles = ();
12     my @manfiles = ();
13     my %pngfiles =
14         map { $_ => 1 } glob catfile($sourcedir, "man$section", "img", "*.png");
15     my %podfiles =
16         map { $_ => 1 } glob catfile($sourcedir, "man$section", "*.pod");
17     my %podinfiles =
18         map { $_ => 1 } glob catfile($sourcedir, "man$section", "*.pod.in");
19
20     foreach (keys %podinfiles) {
21         (my $p = $_) =~ s|\.in$||i;
22         $podfiles{$p} = 1;
23     }
24
25     foreach my $p (sort keys %podfiles) {
26         my $podfile = abs2rel($p, $sourcedir);
27         my $podname = basename($podfile, '.pod');
28         my $podinfile = $podinfiles{"$p.in"} ? "$podfile.in" : undef;
29
30         my $podname = basename($podfile, ".pod");
31
32         my $htmlfile = abs2rel(catfile($buildtop, "doc", "html", "man$section",
33                                        "$podname.html"),
34                                catdir($buildtop, "doc"));
35         my $manfile = abs2rel(catfile($buildtop, "doc", "man", "man$section",
36                                       "$podname.$section"),
37                               catdir($buildtop, "doc"));
38
39         # The build.info format requires file specs to be in Unix format.
40         # Especially, since VMS file specs use [ and ], the build.info parser
41         # will otherwise get terribly confused.
42         if ($^O eq 'VMS') {
43             $htmlfile = VMS::Filespec::unixify($htmlfile);
44             $manfile = VMS::Filespec::unixify($manfile);
45             $podfile = VMS::Filespec::unixify($podfile);
46             $podinfile = VMS::Filespec::unixify($podinfile)
47                 if defined $podinfile;
48         } elsif ($^O eq 'MSWin32') {
49             $htmlfile =~ s|\\|/|g;
50             $manfile =~ s|\\|/|g;
51             $podfile =~ s|\\|/|g;
52             $podinfile =~ s|\\|/|g
53                 if defined $podinfile;
54         }
55         push @htmlfiles, $htmlfile;
56         push @manfiles, $manfile;
57         $OUT .= << "_____";
58DEPEND[$htmlfile]=$podfile
59GENERATE[$htmlfile]=$podfile
60DEPEND[$manfile]=$podfile
61GENERATE[$manfile]=$podfile
62_____
63         $OUT .= << "_____" if $podinfile;
64DEPEND[$podfile]{pod}=$podinfile
65GENERATE[$podfile]=$podinfile
66_____
67     }
68
69     foreach my $p (sort keys %pngfiles) {
70         my $relpath = abs2rel($p, $sourcedir);
71         my $imagefile = abs2rel(catfile($buildtop, "doc", "$relpath"),
72                                 catdir($buildtop, "doc"));
73         push @imagefiles, $imagefile;
74     }
75
76     $OUT .= "IMAGEDOCS[man$section]=" . join(" \\\n", @imagefiles) . "\n";
77     $OUT .= "HTMLDOCS[man$section]=" . join(" \\\n", @htmlfiles) . "\n";
78     $OUT .= "MANDOCS[man$section]=" . join(" \\\n", @manfiles) . "\n";
79 }
80 -}
81