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;