From acd6227b3117912ce56dbd979d43fa1267f987ef Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 12 May 2011 19:11:28 -0700 Subject: [PATCH] Fix build.pl optimization error when Makefile doesn't exist. --- build.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.pl b/build.pl index 084388b3c..6aa967dd9 100755 --- a/build.pl +++ b/build.pl @@ -372,9 +372,11 @@ sub gen_target_makefile { sub set_file_contents { my ($fn, $new) = @_; - open(my $fh, $fn) or die; - my $cur = do { local $/; <$fh> }; - return if $new eq $cur; + if (-e $fn) { + open(my $fh, $fn) or die "Failed to write to $fn: $!"; + my $cur = do { local $/; <$fh> }; + return if $new eq $cur; + } open(my $fh, ">$fn") or die; print $fh $new; close($fh) or die;