# --- Global variables ---
# @Subjects Existing subjects
# $filename The name of the current info file
+# $filename{TOPIC}
+# TOPIC's info file name
# $chapter{TOPIC} TOPIC's chapter (first arg to .TH)
# $see_also{TOPIC}
# TOPIC's SEE ALSO items (.SA argument)
use Errno qw(ENOENT);
-our (%chapter, %see_also, %sanr);
+our (%filename, %chapter, %see_also, %sanr);
our ($filename, %subjfil);
# Get known subjects
our @Subjects = split(' ', read_make_var("subjects", "subjects.mk", ""));
-# Get source directory
-my $srcdir = read_make_var("srcdir", "GNUmakefile");
# Parse the .t files
for my $f (@ARGV) {
# Update subjects.mk
open(F, ">subjects.mk")
or die "Can't open subjects.mk for writing: $!";
+print F "# DO NOT EDIT THIS FILE. It was automatically generated by findsubj.pl\n";
print F "subjects := " . join(' ', @Subjects) . "\n";
for my $t (@Subjects) {
print F "info/$t.t:$subjfil{$t}\n";
$topic = $filename;
$topic =~ s,.*/([^/]*)\.t$,$1,;
-
+ $filename{$topic} = $filename;
+
open(F, "<$filename")
or die "Can't open $filename: $!";
my $found; # found a subject?
$wanted = undef if $wanted eq 'Concept' or $wanted eq 'Command';
- $filename = "$srcdir/$topic";
+ $filename = $filename{$topic};
for (@see_also) {
if (!exists $see_also{$_}) { # is this entry a subject?