Configuration: Simplify generating list of generated files in build file templates
Computing the value of the GENERATED variable in the build file
templates is somewhat overcomplicated, and because of possible
duplication errors, changes are potentially error prone.
Looking more closely at how this list is determined, it can be
observed that the exact list of files to check is consistently
available in all the values found in the %unified_info tables
'depends', 'sources' and 'shared_sources', and all that's needed is to
filter those values so only those present as keys in the 'generate'
table are left.
This computation is also common for all build files, so due to its
apparent complexity, we move it to common0.tmpl, with the result left
in a global variable (@generated), to be consumed by all build file
templates.
common0.tmpl is included among the files to process when creating
build files, but unlike common.tmpl, it comes first of all.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5930)
2018-04-11 11:13:22 +00:00
|
|
|
{- # -*- Mode: perl -*-
|
|
|
|
|
|
|
|
# Commonly used list of generated files
|
|
|
|
# The reason for the complexity is that the build.info files provide
|
|
|
|
# GENERATE rules for *all* platforms without discrimination, while the
|
|
|
|
# build files only want those for a particular build. Therefore, we
|
|
|
|
# need to extrapolate exactly what we need to generate. The way to do
|
|
|
|
# that is to extract all possible source files from diverse tables and
|
|
|
|
# filter out all that are not generated
|
|
|
|
my %generatables =
|
|
|
|
map { $_ => 1 }
|
|
|
|
( # The sources of stuff may be generated
|
|
|
|
( map { @{$unified_info{sources}->{$_}} }
|
|
|
|
keys %{$unified_info{sources}} ),
|
|
|
|
$disabled{shared}
|
|
|
|
? ()
|
|
|
|
: ( map { @{$unified_info{shared_sources}->{$_}} }
|
|
|
|
keys %{$unified_info{shared_sources}} ),
|
2018-09-20 10:23:27 +00:00
|
|
|
# Things we explicitly depend on are usually generated
|
Configuration: Simplify generating list of generated files in build file templates
Computing the value of the GENERATED variable in the build file
templates is somewhat overcomplicated, and because of possible
duplication errors, changes are potentially error prone.
Looking more closely at how this list is determined, it can be
observed that the exact list of files to check is consistently
available in all the values found in the %unified_info tables
'depends', 'sources' and 'shared_sources', and all that's needed is to
filter those values so only those present as keys in the 'generate'
table are left.
This computation is also common for all build files, so due to its
apparent complexity, we move it to common0.tmpl, with the result left
in a global variable (@generated), to be consumed by all build file
templates.
common0.tmpl is included among the files to process when creating
build files, but unlike common.tmpl, it comes first of all.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5930)
2018-04-11 11:13:22 +00:00
|
|
|
( map { $_ eq "" ? () : @{$unified_info{depends}->{$_}} }
|
|
|
|
keys %{$unified_info{depends}} ));
|
|
|
|
our @generated =
|
|
|
|
sort ( ( grep { defined $unified_info{generate}->{$_} }
|
|
|
|
sort keys %generatables ),
|
2019-07-02 08:04:04 +00:00
|
|
|
# Scripts are assumed to be generated, so add them too
|
Configuration: Simplify generating list of generated files in build file templates
Computing the value of the GENERATED variable in the build file
templates is somewhat overcomplicated, and because of possible
duplication errors, changes are potentially error prone.
Looking more closely at how this list is determined, it can be
observed that the exact list of files to check is consistently
available in all the values found in the %unified_info tables
'depends', 'sources' and 'shared_sources', and all that's needed is to
filter those values so only those present as keys in the 'generate'
table are left.
This computation is also common for all build files, so due to its
apparent complexity, we move it to common0.tmpl, with the result left
in a global variable (@generated), to be consumed by all build file
templates.
common0.tmpl is included among the files to process when creating
build files, but unlike common.tmpl, it comes first of all.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5930)
2018-04-11 11:13:22 +00:00
|
|
|
( grep { defined $unified_info{sources}->{$_} }
|
|
|
|
@{$unified_info{scripts}} ) );
|
|
|
|
|
|
|
|
# Avoid strange output
|
|
|
|
"";
|
|
|
|
-}
|