Commit ecc95515 authored by Orgad Shaneh's avatar Orgad Shaneh
Browse files

Configure: Improve incremental build time



When Makefile/opensslconf.h is unchanged, don't write it at all.

Currently every time Configure is executed, these files are overwritten.
Makefile leads to regeneration of buildinf.h, and opensslconf.h is itself
a central header.

As a result, Configure triggers full rebuild, even if nothing is changed.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)
parent 8ac70bef
Loading
Loading
Loading
Loading
+24 −5
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ eval 'exec perl -S $0 ${1+"$@"}'

require 5.000;
use strict;
use File::Compare;

# see INSTALL for instructions.

@@ -1792,8 +1793,16 @@ while (<IN>)
	}
close(IN);
close(OUT);
if ((compare($Makefile, "$Makefile.new"))
	or file_newer('Configure', $Makefile)
	or file_newer('config', $Makefile)
	or file_newer('Makefile.org', $Makefile))
	{
	rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
	rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
	}
else
	{ unlink("$Makefile.new"); }

print "CC            =$cc\n";
print "CFLAG         =$cflags\n";
@@ -1985,9 +1994,13 @@ print OUT "#ifdef __cplusplus\n";
print OUT "}\n";
print OUT "#endif\n";
close(OUT);
if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h"))
	{
	rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
	rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";

	}
else
	{ unlink("crypto/opensslconf.h.new"); }

# Fix the date

@@ -2289,3 +2302,9 @@ sub test_sanity
	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
	return $errorcnt;
	}

sub file_newer
	{
	my ($file1, $file2) = @_;
	return (stat($file1))[9] > (stat($file2))[9]
	}