diff options
-rw-r--r-- | ext/Devel/PPPort/Makefile.PL | 16 | ||||
-rw-r--r-- | ext/Devel/PPPort/ppport_h.PL | 18 |
2 files changed, 20 insertions, 14 deletions
diff --git a/ext/Devel/PPPort/Makefile.PL b/ext/Devel/PPPort/Makefile.PL index b7fb31c77a..674ee4c80d 100644 --- a/ext/Devel/PPPort/Makefile.PL +++ b/ext/Devel/PPPort/Makefile.PL @@ -10,22 +10,16 @@ WriteMakefile( OBJECT => 'PPPort$(OBJ_EXT) module2$(OBJ_EXT) module3$(OBJ_EXT)', XSPROTOARG => '-noprototypes', 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }, - 'clean' => { FILES => 'ppport.h'}, + 'clean' => { FILES => [qw(ppport.h ppport_h)]}, ); sub MY::postamble { + return <<"EOM"; - my $pmfile = 'PPPort.pm' ; +ppport.h: ppport_h + \$(TOUCH) ppport_h - my $retval = <<"EOM"; - -ppport.h: ppport_h.PL - \$(PERL) "-I\$(PERL_ARCHLIB)" "-I\$(PERL_LIB)" ppport_h.PL - -PPPort.xs module2.\$(OBJ_EXT) module3.\$(OBJ_EXT) : ppport.h - -\$(TOUCH) \$@ +PPPort.xs module2\$(OBJ_EXT) module3\$(OBJ_EXT): ppport.h EOM - - return $retval; } diff --git a/ext/Devel/PPPort/ppport_h.PL b/ext/Devel/PPPort/ppport_h.PL index 403198199c..5a695d2aa0 100644 --- a/ext/Devel/PPPort/ppport_h.PL +++ b/ext/Devel/PPPort/ppport_h.PL @@ -1,5 +1,17 @@ -my $pmfile = 'PPPort.pm'; package Devel::PPPort; sub bootstrap {}; -require qq[$pmfile]; -WriteFile(qq[ppport.h]); +require "PPPort.pm"; +WriteFile("ppport.tmp"); +{ + local $/; + my $old = ''; + my $new = ''; + $old = <FH> if open(FH, "ppport.h"); close FH; + $new = <FH> if open(FH, "ppport.tmp"); close FH; + if ($old ne $new) { + unlink("ppport.h"); + rename("ppport.tmp", "ppport.h"); + } + unlink("ppport.tmp"); +} + |