From 7a9d7128d87d1572a0b7f99ff7b19d704395c8db Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 31 Jul 2016 09:18:22 +0300 Subject: [PATCH] mklink: Do not needlessly overwrite linked files... ... on systems with symlinks. Creating or overwriting a symlink sets the file ctime to the current time. This causes needless rebuilds because the time of all the headers is changed, and apparently make considers the link's time rather than the time of the target. Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/1370) --- util/mklink.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/mklink.pl b/util/mklink.pl index 2df0453a17..a937606ea5 100755 --- a/util/mklink.pl +++ b/util/mklink.pl @@ -55,8 +55,10 @@ if ($^O eq "msys") { $symlink_exists=0 }; foreach $file (@files) { my $err = ""; if ($symlink_exists) { - unlink "$from/$file"; - symlink("$to/$file", "$from/$file") or $err = " [$!]"; + if (!-l "$from/$file") { + unlink "$from/$file"; + symlink("$to/$file", "$from/$file") or $err = " [$!]"; + } } elsif (-d "$from" && (!-f "$from/$file" || ((stat("$file"))[9] > (stat("$from/$file"))[9]))) { unlink "$from/$file"; open (OLD, "<$file") or die "Can't open $file: $!"; -- 2.50.1