summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-11-07 22:23:16 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-11-08 00:33:03 -0800
commit0f0d5355d61bc4f2a5913d289b94e1b2e16bea31 (patch)
treed3d0856ec1e4e2499aba37007508f201508e28e9
parent710b427f06fc8860948ab350c617766ec710b158 (diff)
downloadperl-0f0d5355d61bc4f2a5913d289b94e1b2e16bea31.tar.gz
Make B constants depend on perl headers
Making the Makefile depend on the headers where the constants are found will force Makefile.PL to be re-run, and it is Makefile.PL that generates the constants.
-rw-r--r--ext/B/Makefile.PL15
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/B/Makefile.PL b/ext/B/Makefile.PL
index e70e8fd36e..cc16ad9812 100644
--- a/ext/B/Makefile.PL
+++ b/ext/B/Makefile.PL
@@ -6,12 +6,6 @@ use warnings;
my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
-WriteMakefile(
- NAME => "B",
- VERSION_FROM => "B.pm",
- realclean => {FILES=> 'const-c.inc const-xs.inc'},
-);
-
my $headerpath;
if ($core) {
$headerpath = File::Spec->catdir(File::Spec->updir, File::Spec->updir);
@@ -23,6 +17,7 @@ if ($core) {
my @names = ({ name => 'HEf_SVKEY', macro => 1, type => "IV" },
qw(SVTYPEMASK SVt_PVGV SVt_PVHV PAD_FAKELEX_ANON PAD_FAKELEX_MULTI));
+my @depend;
# First element in each tuple is the file; second is a regex snippet
# giving the prefix to limit the names of symbols to define that come
@@ -40,6 +35,7 @@ foreach my $tuple (['cop.h'],
my $file = $tuple->[0];
my $pfx = $tuple->[1] || '';
my $path = File::Spec->catfile($headerpath, $file);
+ push @depend, $path;
open my $fh, '<', $path or die "Cannot open $path: $!";
while (<$fh>) {
push @names, $1 if (/ \#define \s+ ( $pfx \w+ ) \s+
@@ -55,6 +51,13 @@ foreach my $tuple (['cop.h'],
close $fh;
}
+WriteMakefile(
+ NAME => "B",
+ VERSION_FROM => "B.pm",
+ realclean => {FILES=> 'const-c.inc const-xs.inc'},
+ depend => {'Makefile' => "@depend"},
+);
+
# Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name
# should exist, so ensure that the C compile breaks if anything does not.
WriteConstants(