2018-03-14 00:56:20 +08:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
|
|
|
|
use lib '.';
|
|
|
|
use configdata;
|
|
|
|
|
|
|
|
use File::Compare qw(compare_text);
|
|
|
|
|
|
|
|
my $buildfile = $config{build_file};
|
2018-03-14 04:55:52 +08:00
|
|
|
my $buildfile_new = "$buildfile-$$";
|
2018-03-14 00:56:20 +08:00
|
|
|
my $depext = $target{dep_extension} || ".d";
|
|
|
|
my @deps =
|
2018-03-14 19:39:45 +08:00
|
|
|
sort
|
2018-03-14 02:38:04 +08:00
|
|
|
grep { -f $_ }
|
2018-03-14 00:56:20 +08:00
|
|
|
map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
|
|
|
|
grep { $unified_info{sources}->{$_}->[0] =~ /\.cc?$/ }
|
|
|
|
keys %{$unified_info{sources}};
|
|
|
|
|
|
|
|
open IBF, $buildfile or die "Trying to read $buildfile: $!\n";
|
|
|
|
open OBF, '>', $buildfile_new or die "Trying to write $buildfile_new: $!\n";
|
|
|
|
while (<IBF>) {
|
|
|
|
$force_rewrite = 0;
|
|
|
|
last if /^# DO NOT DELETE THIS LINE/;
|
|
|
|
print OBF or die "$!\n";
|
|
|
|
$force_rewrite = 1;
|
|
|
|
}
|
|
|
|
close IBF;
|
|
|
|
|
|
|
|
print OBF "# DO NOT DELETE THIS LINE -- make depend depends on it.\n";
|
|
|
|
|
|
|
|
foreach (@deps) {
|
|
|
|
open IBF,$_ or die "Trying to read $_: $!\n";
|
|
|
|
while (<IBF>) {
|
|
|
|
print OBF or die "$!\n";
|
|
|
|
}
|
|
|
|
close IBF;
|
|
|
|
}
|
|
|
|
close OBF;
|
|
|
|
|
|
|
|
if (compare_text($buildfile_new, $buildfile) != 0) {
|
|
|
|
rename $buildfile_new, $buildfile
|
|
|
|
or die "Trying to rename $buildfile_new -> $buildfile: $!\n";
|
|
|
|
}
|
2018-03-14 04:55:52 +08:00
|
|
|
# On VMS, we want to remove all generations of this file, in case there are
|
|
|
|
# more than one
|
|
|
|
while (unlink $buildfile_new) {}
|