summaryrefslogtreecommitdiffstats
path: root/Configurations/windows-makefile.tmpl
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-05-24 14:19:38 +0200
committerRichard Levitte <levitte@openssl.org>2021-05-26 15:11:01 +0200
commit6dd07a9328950ff8bf3f95ad35caf3a4e1e33a15 (patch)
treeed3218501f790d55fbb98bd39da0cb45c8ccd6af /Configurations/windows-makefile.tmpl
parentRework how providers/fipsmodule.cnf is produced (diff)
downloadopenssl-6dd07a9328950ff8bf3f95ad35caf3a4e1e33a15.tar.xz
openssl-6dd07a9328950ff8bf3f95ad35caf3a4e1e33a15.zip
Build file templates: rework how general dependencies are computed
For some types of targets, we pretty much know what kinds of files all the dependencies are. For some, however, we can't assume anything, and are faced with dependencies in platform agnostic form. We need to find those in diverse places in %unified_info, and deduce from there how they should be converted to a platform specific form. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15436)
Diffstat (limited to '')
-rw-r--r--Configurations/windows-makefile.tmpl54
1 files changed, 24 insertions, 30 deletions
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 984693d817..37f623a4bd 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -669,6 +669,17 @@ reconfigure reconf:
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs file_name_is_absolute/;
+ # Helper function to convert dependencies in platform agnostic form to
+ # dependencies in platform form.
+ sub compute_platform_depends {
+ map { my $x = $_;
+
+ grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
+ or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
+ or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
+ or platform->convertext($x); } @_;
+ }
+
# Helper function to figure out dependencies on libraries
# It takes a list of library names and outputs a list of dependencies
sub compute_lib_depends {
@@ -680,7 +691,7 @@ reconfigure reconf:
sub generatetarget {
my %args = @_;
- my $deps = join(" ", @{$args{deps}});
+ my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
return <<"EOF";
$args{target}: $deps
EOF
@@ -698,11 +709,10 @@ EOF
my $gen_incs = join("", map { " -I\"$_\"" } @{$args{generator_incs}});
my $incs = join("", map { " -I\"$_\"" } @{$args{incs}});
my $defs = join("", map { " -D".$_ } @{$args{defs}});
- my $deps = @{$args{deps}} ?
- join(' ',
- map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
- (@{$args{generator_deps}}, @{$args{deps}}))
- : '';
+ my $deps = join(' ',
+ map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
+ compute_platform_depends(@{$args{generator_deps}},
+ @{$args{deps}}));
if ($args{src} =~ /\.html$/) {
#
@@ -781,38 +791,22 @@ EOF
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
"util", "dofile.pl")),
rel2abs($config{builddir}));
- my @modules = ( 'configdata.pm',
- grep { $_ =~ m|\.pm$| } @{$args{deps}} );
- my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
- $deps = join(' ', $deps, @modules);
- @modules = map { "-M".basename($_, '.pm') } @modules;
- my $modules = join(' ', '', sort keys %moduleincs, @modules);
+ my @perlmodules = ( 'configdata.pm',
+ grep { $_ =~ m|\.pm$| } @{$args{deps}} );
+ my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
+ $deps = join(' ', $deps, compute_platform_depends(@perlmodules));
+ @perlmodules = map { "-M".basename($_, '.pm') } @perlmodules;
+ my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
return <<"EOF";
$args{src}: "$gen0" $deps
- "\$(PERL)"$modules "$dofile" "-o$target{build_file}" "$gen0"$gen_args > \$@
+ "\$(PERL)"$perlmodules "$dofile" "-o$target{build_file}" "$gen0"$gen_args > \$@
EOF
} elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
#
# Generic generator using OpenSSL programs
#
- # Redo $deps, because programs aren't expected to have deps of their
- # own. This is a little more tricky, though, because running programs
- # may have dependencies on all sorts of files, so we search through
- # our database of programs and modules to see if our dependencies
- # are one of those.
- $deps = join(' ', map { my $x = $_;
- if (grep { $x eq $_ }
- @{$unified_info{programs}}) {
- platform->bin($x);
- } elsif (grep { $x eq $_ }
- @{$unified_info{modules}}) {
- platform->dso($x);
- } else {
- $x;
- }
- } @{$args{deps}});
- # Also redo $gen0, to ensure that we have the proper extension.
+ # Redo $gen0, to ensure that we have the proper extension.
$gen0 = platform->bin($gen0);
return <<"EOF";
$args{src}: $gen0 $deps "\$(BLDDIR)\\util\\wrap.pl"