This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
srand: change to return its seed
[perl5.git] / regen.pl
1 #!/usr/bin/perl -w
2 #
3 # regen.pl - a wrapper that runs all *.pl scripts to to autogenerate files
4
5 require 5.003;  # keep this compatible, an old perl is all we may have before
6                 # we build the new one
7
8 # The idea is to move the regen_headers target out of the Makefile so that
9 # it is possible to rebuild the headers before the Makefile is available.
10 # (and the Makefile is unavailable until after Configure is run, and we may
11 # wish to make a clean source tree but with current headers without running
12 # anything else.
13
14 use strict;
15 my $perl = $^X;
16
17 # keep warnings.pl in sync with the CPAN distribution by not requiring core
18 # changes.  Um, what ?
19 # safer_unlink ("warnings.h", "lib/warnings.pm");
20
21 # Which scripts to run. Note the ordering: embed.pl must run after
22 # opcode.pl, since it depends on pp.sym
23
24 my @scripts = qw(
25 keywords.pl
26 opcode.pl
27 overload.pl
28 reentr.pl
29 regcomp.pl
30 warnings.pl
31
32 embed.pl
33 );
34
35 # Which files are (re)generated by each script.
36 # *** We no longer need these values, as the "changed" message is
37 # now generated by regen_lib.pl, so should we just drop them?
38
39 my %gen = (
40            'embed.pl'    => [qw[proto.h embed.h embedvar.h global.sym
41                                 perlapi.h perlapi.c]],
42            'keywords.pl' => [qw[keywords.h]],
43            'opcode.pl'   => [qw[opcode.h opnames.h pp_proto.h pp.sym]],
44            'regcomp.pl'  => [qw[regnodes.h]],
45            'warnings.pl' => [qw[warnings.h lib/warnings.pm]],
46            'reentr.pl'   => [qw[reentr.c reentr.h]],
47            'overload.pl' => [qw[overload.c overload.h lib/overload/numbers.pm]],
48            );
49
50 sub do_cksum {
51     my $pl = shift;
52     my %cksum;
53     for my $f (@{ $gen{$pl} }) {
54         local *FH;
55         if (open(FH, $f)) {
56             local $/;
57             $cksum{$f} = unpack("%32C*", <FH>);
58             close FH;
59         } else {
60             warn "$0: $f: $!\n";
61         }
62     }
63     return %cksum;
64 }
65
66 foreach my $pl (@scripts) {
67   my @command =  ($^X, $pl, @ARGV);
68   print "@command\n";
69   system @command;
70 }