Commit | Line | Data |
36bb303b |
1 | #!/usr/bin/perl -w |
9ad884cb |
2 | require 5.003; # keep this compatible, an old perl is all we may have before |
3 | # we build the new one |
36bb303b |
4 | |
9ad884cb |
5 | # The idea is to move the regen_headers target out of the Makefile so that |
6 | # it is possible to rebuild the headers before the Makefile is available. |
7 | # (and the Makefile is unavailable until after Configure is run, and we may |
8 | # wish to make a clean source tree but with current headers without running |
9 | # anything else. |
36bb303b |
10 | |
9ad884cb |
11 | use strict; |
12 | my $perl = $^X; |
36bb303b |
13 | |
9ad884cb |
14 | require 'regen_lib.pl'; |
15 | # keep warnings.pl in sync with the CPAN distribution by not requiring core |
16 | # changes |
17 | safer_unlink ("warnings.h", "lib/warnings.pm"); |
36bb303b |
18 | |
9ad884cb |
19 | my %gen = ( |
20 | 'autodoc.pl' => [qw[pod/perlapi.pod pod/perlintern.pod]], |
de125441 |
21 | 'bytecode.pl' => [qw[ext/B/B/Asmdata.pm]], |
9ad884cb |
22 | 'embed.pl' => [qw[proto.h embed.h embedvar.h global.sym |
23 | perlapi.h perlapi.c]], |
24 | 'keywords.pl' => [qw[keywords.h]], |
25 | 'opcode.pl' => [qw[opcode.h opnames.h pp_proto.h pp.sym]], |
26 | 'regcomp.pl' => [qw[regnodes.h]], |
0bfd2b7f |
27 | 'warnings.pl' => [qw[warnings.h lib/warnings.pm]], |
8c798f87 |
28 | 'reentr.pl' => [qw[reentr.c reentr.h]], |
29 | 'overload.pl' => [qw[overload.h]], |
9ad884cb |
30 | ); |
36bb303b |
31 | |
9ad884cb |
32 | sub do_cksum { |
33 | my $pl = shift; |
34 | my %cksum; |
35 | for my $f (@{ $gen{$pl} }) { |
36 | local *FH; |
37 | if (open(FH, $f)) { |
38 | local $/; |
39 | $cksum{$f} = unpack("%32C*", <FH>); |
40 | close FH; |
41 | } else { |
42 | warn "$0: $f: $!\n"; |
43 | } |
44 | } |
45 | return %cksum; |
36bb303b |
46 | } |
47 | |
9ad884cb |
48 | foreach my $pl (qw (keywords.pl opcode.pl embed.pl bytecode.pl |
0bfd2b7f |
49 | regcomp.pl warnings.pl autodoc.pl reentr.pl)) { |
9ad884cb |
50 | print "$^X $pl\n"; |
51 | my %cksum0; |
52 | %cksum0 = do_cksum($pl) unless $pl eq 'warnings.pl'; # the files were removed |
53 | system "$^X $pl"; |
54 | next if $pl eq 'warnings.pl'; # the files were removed |
55 | my %cksum1 = do_cksum($pl); |
56 | my @chg; |
57 | for my $f (@{ $gen{$pl} }) { |
58 | push(@chg, $f) |
59 | if !defined($cksum0{$f}) || |
60 | !defined($cksum1{$f}) || |
61 | $cksum0{$f} ne $cksum1{$f}; |
62 | } |
63 | print "Changed: @chg\n" if @chg; |
36bb303b |
64 | } |