summaryrefslogtreecommitdiff
path: root/macros/texinfo/texinfo/tp/maintain/regenerate_file_lists.pl
blob: dfda976f88e8831107c62f6a8df0d02fd07eae8e (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
#! /usr/bin/env perl
# Copyright 2011-2019 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Originally written by Patrice Dumas.

use strict;

# emulates -w
BEGIN
{
  $^W = 1;
}
use File::Find;
use File::Basename;
use File::Spec;

my ($command, $mydir, $suffix) = fileparse($0);
my $parent = File::Spec->catdir($mydir, File::Spec->updir());
chdir($parent) || die "chdir $parent: $!";
-d "t" || (die "goodbye, no t directory in " . `pwd`);

my %files;
find (\&wanted, ('t'));
sub wanted 
{
  if ((/\.pl$/ and $File::Find::dir =~ m:^t/results/[^/]+:)
      or (!/^CVS$/ and !/^\.svn$/ 
          and $File::Find::dir =~ m:^t/results/[^/]+/[^/]+/res_[^/]+$:)) {
    $files{$File::Find::name} = 1;
  }
}

my %tap_files;
find (\&wanted_tap_files, ('t'));
sub wanted_tap_files
{
  if (/\.t$/ and $File::Find::dir =~ /t$/) {
    $tap_files{$File::Find::name} = 1;
  }
}

open (INCLUDE, '>Makefile.tres') or die "open(>Makefile.tres) failed: $!";
print INCLUDE <<EOH;
# Makefile.tres generated by $0.
#
EOH

print INCLUDE 'test_tap_files_generated_list =';
foreach my $file (sort(keys(%tap_files))) {
  print INCLUDE " \\\n  $file";
}
print INCLUDE "\n\n";

print INCLUDE 'test_files_generated_list = $(test_tap_files_generated_list)';
foreach my $file (sort(keys(%files))) {
  print INCLUDE " \\\n  $file";
}
print INCLUDE "\n\n";