From: Jarkko Hietaniemi Date: Wed, 2 Jan 2002 00:35:15 +0000 (+0000) Subject: Once more try to get the PPPort Makefile right. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=90e434f8137374c16423b24d56379f90ac2ff006;p=p5sagit%2Fp5-mst-13.2.git Once more try to get the PPPort Makefile right. p4raw-id: //depot/perl@14009 --- diff --git a/ext/Devel/PPPort/Makefile.PL b/ext/Devel/PPPort/Makefile.PL index b7fb31c..674ee4c 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 4031981..5a695d2 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 = if open(FH, "ppport.h"); close FH; + $new = if open(FH, "ppport.tmp"); close FH; + if ($old ne $new) { + unlink("ppport.h"); + rename("ppport.tmp", "ppport.h"); + } + unlink("ppport.tmp"); +} +