RE: [PATCH] compress 2.018
[p5sagit/p5-mst-13.2.git] / regen.pl
CommitLineData
36bb303b 1#!/usr/bin/perl -w
9ad884cb 2require 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 11use strict;
12my $perl = $^X;
36bb303b 13
9ad884cb 14# keep warnings.pl in sync with the CPAN distribution by not requiring core
b6b9a099 15# changes. Um, what ?
16# safer_unlink ("warnings.h", "lib/warnings.pm");
36bb303b 17
523b3031 18# We no longer need the values on this mapping, as the "changed" message is
19# now generated by regen_lib.pl, so should we just drop them?
20
9ad884cb 21my %gen = (
22 'autodoc.pl' => [qw[pod/perlapi.pod pod/perlintern.pod]],
9ad884cb 23 'embed.pl' => [qw[proto.h embed.h embedvar.h global.sym
24 perlapi.h perlapi.c]],
25 'keywords.pl' => [qw[keywords.h]],
26 'opcode.pl' => [qw[opcode.h opnames.h pp_proto.h pp.sym]],
27 'regcomp.pl' => [qw[regnodes.h]],
0bfd2b7f 28 'warnings.pl' => [qw[warnings.h lib/warnings.pm]],
8c798f87 29 'reentr.pl' => [qw[reentr.c reentr.h]],
cd387eed 30 'overload.pl' => [qw[overload.c overload.h]],
9ad884cb 31 );
36bb303b 32
9ad884cb 33sub do_cksum {
34 my $pl = shift;
35 my %cksum;
36 for my $f (@{ $gen{$pl} }) {
37 local *FH;
38 if (open(FH, $f)) {
39 local $/;
40 $cksum{$f} = unpack("%32C*", <FH>);
41 close FH;
42 } else {
43 warn "$0: $f: $!\n";
44 }
45 }
46 return %cksum;
36bb303b 47}
48
523b3031 49# this puts autodoc.pl last, which can be useful as it reads reentr.c
50foreach my $pl (reverse sort keys %gen) {
95aa0565 51 my @command = ($^X, $pl, @ARGV);
52 print "@command\n";
95aa0565 53 system @command;
36bb303b 54}