summaryrefslogtreecommitdiff
path: root/lib/unicore/mktables
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unicore/mktables')
-rw-r--r--lib/unicore/mktables60
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/unicore/mktables b/lib/unicore/mktables
index 58092f19c5..4988e9669f 100644
--- a/lib/unicore/mktables
+++ b/lib/unicore/mktables
@@ -1,3 +1,6 @@
+## !!!!!!!!!!!!!! IF YOU MODIFY THIS FILE !!!!!!!!!!!!!!!!!!!!!!!!!
+## Any files created or read by this program should be listed in 'mktables.lst'
+
#!/usr/bin/perl -w
require 5.008; # Needs pack "U". Probably safest to run on 5.8.x
use strict;
@@ -47,6 +50,63 @@ while (@ARGV)
}
}
+if (!$AlwaysWrite) {
+ print "Reading file list...\n"
+ if $Verbose;
+ open my $fh,"<","mktables.lst"
+ or die "Failed to read mktables.lst:$!";
+ my @input =( $0 );
+ my @output;
+ for my $list ( \@input, \@output ) {
+ while (<$fh>) {
+ s/^ \s+ | \s+ $//xg;
+ next if /^ \s* (?: \# .* )? $/x;
+ last if /^ =+ $/x;
+ my ( $file ) = split /\t/, $_;
+ push @$list, $file;
+ }
+ my %dupe;
+ @$list = grep !$dupe{ $_ }++, @$list;
+ }
+ close $fh;
+ die "No input or output files in mktables.lst!"
+ if !@input or !@output;
+ if ( $Verbose ) {
+ print "Expecting ".scalar( @input )." input files. ",
+ "Checking ".scalar( @output )." output files.\n";
+ }
+ my $maxtime = 0;
+ foreach my $in (@input) {
+ my $time = -M $in;
+ die "Missing input file '$in'" unless defined $time;
+ $maxtime = $time if $maxtime < $time;
+ }
+
+ my $ok = 1;
+ foreach my $out (@output) {
+ if ( ! -e $out ) {
+ print "'$out' is missing.\n"
+ if $Verbose;
+ $ok = 0;
+ last;
+ }
+ if ( -M $out > $maxtime ) {
+ print "'$out' is too old.\n"
+ if $Verbose;
+ $ok = 0;
+ last;
+ }
+ }
+ if ($ok) {
+ print "Files seem to be ok, not bothering to rebuild.\n";
+ exit(0);
+ }
+ print "Must rebuild tables.\n"
+ if $Verbose;
+} elsif ($Verbose) {
+ print "Not checking file list as -w option set.\n";
+}
+
foreach my $lib ('To', 'lib',
map {File::Spec->catdir("lib",$_)}
qw(gc_sc dt bc hst ea jt lb nt ccc)) {