summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST4
-rw-r--r--Makefile.SH20
-rw-r--r--autodoc.pl2
-rw-r--r--bytecode.pl2
-rwxr-xr-xembed.pl2
-rwxr-xr-xkeywords.pl2
-rwxr-xr-xopcode.pl2
-rw-r--r--regcomp.pl2
-rw-r--r--regen.pl91
-rw-r--r--regen_headers.pl23
-rw-r--r--regen_lib.pl45
11 files changed, 118 insertions, 77 deletions
diff --git a/MANIFEST b/MANIFEST
index 767b6dc20e..6fec033605 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2369,8 +2369,8 @@ regcomp.c Regular expression compiler
regcomp.h Private declarations for above
regcomp.pl Builder of regnodes.h
regcomp.sym Data for regnodes.h
-regen.pl Common file routines for generator scripts
-regen_headers.pl Run all scripts that (re)generate files
+regen.pl Run all scripts that (re)generate files
+regen_lib.pl Common file routines for generator scripts
regexec.c Regular expression evaluator
regexp.h Public declarations for the above
regnodes.h Description of nodes of RE engine
diff --git a/Makefile.SH b/Makefile.SH
index cd18ffb49f..23ebd77fa4 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -812,20 +812,20 @@ SYMH = perlvars.h intrpvar.h thrdvar.h
CHMOD_W = chmod +w
# The following files are generated automatically
-# keywords.pl: keywords.h
-# opcode.pl: opcode.h opnames.h pp_proto.h pp.sym
-# [* embed.pl needs pp.sym generated by opcode.pl! *]
-# embed.pl: proto.h embed.h embedvar.h global.sym
-# perlapi.h perlapi.c pod/perlintern.pod
-# pod/perlapi.pod
+# autodoc.pl: pod/perlapi.pod pod/perlintern.pod
# bytecode.pl: ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
# ext/B/B/Asmdata.pm
+# embed.pl: proto.h embed.h embedvar.h global.sym
+# perlapi.h perlapi.c
+# [* embed.pl needs pp.sym generated by opcode.pl! *]
+# keywords.pl: keywords.h
+# opcode.pl: opcode.h opnames.h pp_proto.h pp.sym
# regcomp.pl: regnodes.h
# warnings.pl: warnings.h lib/warnings.pm
# The correct versions should be already supplied with the perl kit,
# in case you don't have perl available.
# To force them to be regenerated, run
-# perl regen_headers.pl
+# perl regen.pl
# with your existing copy of perl
# (make regen_headers is kept for backwards compatibility)
@@ -838,13 +838,13 @@ AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
.PHONY: regen_headers regen_pods regen_all
-regen_headers: FORCE
- -perl regen_headers.pl
+regen regen_headers: FORCE
+ -perl regen.pl
regen_pods: FORCE
-cd pod; $(LDLIBPTH) $(MAKE) regen_pods
-regen_all: $(PERLYVMS) regen_headers regen_pods
+regen_all: $(PERLYVMS) regen regen_pods
# Extensions:
# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
diff --git a/autodoc.pl b/autodoc.pl
index 2044dab5c1..503fc5e104 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -5,7 +5,7 @@ require 5.003; # keep this compatible, an old perl is all we may have before
BEGIN {
push @INC, 'lib';
- require 'regen.pl';
+ require 'regen_lib.pl';
} # glob() below requires File::Glob
diff --git a/bytecode.pl b/bytecode.pl
index 0c921d4d1a..569d28e9fc 100644
--- a/bytecode.pl
+++ b/bytecode.pl
@@ -1,6 +1,6 @@
BEGIN {
push @INC, './lib';
- require 'regen.pl';
+ require 'regen_lib.pl';
}
use strict;
my %alias_to = (
diff --git a/embed.pl b/embed.pl
index 8a1f2a0268..a8a2da727e 100755
--- a/embed.pl
+++ b/embed.pl
@@ -5,7 +5,7 @@ require 5.003; # keep this compatible, an old perl is all we may have before
BEGIN {
# Get function prototypes
- require 'regen.pl';
+ require 'regen_lib.pl';
}
#
diff --git a/keywords.pl b/keywords.pl
index c804620cf8..09e8debb97 100755
--- a/keywords.pl
+++ b/keywords.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-require 'regen.pl';
+require 'regen_lib.pl';
safer_unlink ("keywords.h");
open(KW, ">keywords.h") || die "Can't create keywords.h: $!\n";
select KW;
diff --git a/opcode.pl b/opcode.pl
index 09c20b1392..4035cc6002 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
BEGIN {
# Get function prototypes
- require 'regen.pl';
+ require 'regen_lib.pl';
}
$opcode_new = 'opcode.h-new';
diff --git a/regcomp.pl b/regcomp.pl
index 225882a576..1809da3b25 100644
--- a/regcomp.pl
+++ b/regcomp.pl
@@ -1,6 +1,6 @@
BEGIN {
# Get function prototypes
- require 'regen.pl';
+ require 'regen_lib.pl';
}
#use Fatal qw(open close rename chmod unlink);
open DESC, 'regcomp.sym';
diff --git a/regen.pl b/regen.pl
index 1c830a2cdc..5d4c1df2b3 100644
--- a/regen.pl
+++ b/regen.pl
@@ -1,45 +1,64 @@
#!/usr/bin/perl -w
-use strict;
-use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write);
-use Config; # Remember, this is running using an existing perl
-
-# Common functions needed by the regen scripts
-
-$Is_W32 = $^O eq 'MSWin32';
-$Is_OS2 = $^O eq 'os2';
-$Is_Cygwin = $^O eq 'cygwin';
-$Is_NetWare = $Config{osname} eq 'NetWare';
-if ($Is_NetWare) {
- $Is_W32 = 0;
-}
+require 5.003; # keep this compatible, an old perl is all we may have before
+ # we build the new one
-$Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
+# The idea is to move the regen_headers target out of the Makefile so that
+# it is possible to rebuild the headers before the Makefile is available.
+# (and the Makefile is unavailable until after Configure is run, and we may
+# wish to make a clean source tree but with current headers without running
+# anything else.
-sub safer_unlink {
- my @names = @_;
- my $cnt = 0;
+use strict;
+my $perl = $^X;
- my $name;
- foreach $name (@names) {
- next unless -e $name;
- chmod 0777, $name if $Needs_Write;
- ( CORE::unlink($name) and ++$cnt
- or warn "Couldn't unlink $name: $!\n" );
- }
- return $cnt;
-}
+require 'regen_lib.pl';
+# keep warnings.pl in sync with the CPAN distribution by not requiring core
+# changes
+safer_unlink ("warnings.h", "lib/warnings.pm");
-sub safer_rename_silent {
- my ($from, $to) = @_;
+my %gen = (
+ 'autodoc.pl' => [qw[pod/perlapi.pod pod/perlintern.pod]],
+ 'bytecode.pl' => [qw[ext/ByteLoader/byterun.h
+ ext/ByteLoader/byterun.c
+ ext/B/B/Asmdata.pm]],
+ 'embed.pl' => [qw[proto.h embed.h embedvar.h global.sym
+ perlapi.h perlapi.c]],
+ 'keywords.pl' => [qw[keywords.h]],
+ 'opcode.pl' => [qw[opcode.h opnames.h pp_proto.h pp.sym]],
+ 'regcomp.pl' => [qw[regnodes.h]],
+ 'warnings.pl' => [qw[warnings.h lib/warnings.pm]]
+ );
- # Some dosish systems can't rename over an existing file:
- safer_unlink $to;
- chmod 0600, $from if $Needs_Write;
- rename $from, $to;
+sub do_cksum {
+ my $pl = shift;
+ my %cksum;
+ for my $f (@{ $gen{$pl} }) {
+ local *FH;
+ if (open(FH, $f)) {
+ local $/;
+ $cksum{$f} = unpack("%32C*", <FH>);
+ close FH;
+ } else {
+ warn "$0: $f: $!\n";
+ }
+ }
+ return %cksum;
}
-sub safer_rename {
- my ($from, $to) = @_;
- safer_rename_silent($from, $to) or die "renaming $from to $to: $!";
+foreach my $pl (qw (keywords.pl opcode.pl embed.pl bytecode.pl
+ regcomp.pl warnings.pl autodoc.pl)) {
+ print "$^X $pl\n";
+ my %cksum0;
+ %cksum0 = do_cksum($pl) unless $pl eq 'warnings.pl'; # the files were removed
+ system "$^X $pl";
+ next if $pl eq 'warnings.pl'; # the files were removed
+ my %cksum1 = do_cksum($pl);
+ my @chg;
+ for my $f (@{ $gen{$pl} }) {
+ push(@chg, $f)
+ if !defined($cksum0{$f}) ||
+ !defined($cksum1{$f}) ||
+ $cksum0{$f} ne $cksum1{$f};
+ }
+ print "Changed: @chg\n" if @chg;
}
-1;
diff --git a/regen_headers.pl b/regen_headers.pl
deleted file mode 100644
index 2f405bb7ce..0000000000
--- a/regen_headers.pl
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/perl -w
-require 5.003; # keep this compatible, an old perl is all we may have before
- # we build the new one
-
-# The idea is to move the regen_headers target out of the Makefile so that
-# it is possible to rebuild the headers before the Makefile is available.
-# (and the Makefile is unavailable until after Configure is run, and we may
-# wish to make a clean source tree but with current headers without running
-# anything else.
-
-use strict;
-my $perl = $^X;
-
-require 'regen.pl';
-# keep warnings.pl in sync with the CPAN distribution by not requiring core
-# changes
-safer_unlink ("warnings.h", "lib/warnings.pm");
-
-foreach (qw (keywords.pl opcode.pl embed.pl bytecode.pl regcomp.pl
- warnings.pl autodoc.pl)) {
- print "$^X $_\n";
- system "$^X $_";
-}
diff --git a/regen_lib.pl b/regen_lib.pl
new file mode 100644
index 0000000000..1c830a2cdc
--- /dev/null
+++ b/regen_lib.pl
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -w
+use strict;
+use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write);
+use Config; # Remember, this is running using an existing perl
+
+# Common functions needed by the regen scripts
+
+$Is_W32 = $^O eq 'MSWin32';
+$Is_OS2 = $^O eq 'os2';
+$Is_Cygwin = $^O eq 'cygwin';
+$Is_NetWare = $Config{osname} eq 'NetWare';
+if ($Is_NetWare) {
+ $Is_W32 = 0;
+}
+
+$Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
+
+sub safer_unlink {
+ my @names = @_;
+ my $cnt = 0;
+
+ my $name;
+ foreach $name (@names) {
+ next unless -e $name;
+ chmod 0777, $name if $Needs_Write;
+ ( CORE::unlink($name) and ++$cnt
+ or warn "Couldn't unlink $name: $!\n" );
+ }
+ return $cnt;
+}
+
+sub safer_rename_silent {
+ my ($from, $to) = @_;
+
+ # Some dosish systems can't rename over an existing file:
+ safer_unlink $to;
+ chmod 0600, $from if $Needs_Write;
+ rename $from, $to;
+}
+
+sub safer_rename {
+ my ($from, $to) = @_;
+ safer_rename_silent($from, $to) or die "renaming $from to $to: $!";
+}
+1;