Configure, build.info: make it possible to use variables in indexes
authorRichard Levitte <levitte@openssl.org>
Mon, 19 Aug 2019 06:54:00 +0000 (08:54 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 26 Sep 2019 20:41:47 +0000 (22:41 +0200)
That will make it possible to assign different goals for translation
units depending on need.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9637)

Configure

index 4415e1d6bccdea55c700182f8a393e5309f7e784..7e6091e633de1e75e095181f39950415f83fe5d5 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1742,11 +1742,19 @@ if ($builder eq "unified") {
             my $value = '';
             my $value_rest = shift;
 
+            if ($ENV{CONFIGURE_DEBUG_VARIABLE_EXPAND}) {
+                print STDERR
+                    "DEBUG[\$expand_variables] Parsed '$value_rest' into:\n"
+            }
             while ($value_rest =~ /(?<!\\)${variable_re}/) {
                 $value .= $`;
                 $value .= $variables{$1};
                 $value_rest = $';
             }
+            if ($ENV{CONFIGURE_DEBUG_VARIABLE_EXPAND}) {
+                print STDERR
+                    "DEBUG[\$expand_variables] ... '$value$value_rest'\n";
+            }
             return $value . $value_rest;
         };
 
@@ -1899,26 +1907,31 @@ if ($builder eq "unified") {
             },
 
             qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/,
-            => sub { push @{$ordinals{$1}}, tokenize($expand_variables->($2))
+            => sub { push @{$ordinals{$expand_variables->($1)}},
+                         tokenize($expand_variables->($2))
                          if !@skip || $skip[$#skip] > 0 },
             qr/^\s*SOURCE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
-            => sub { push @{$sources{$1}}, tokenize($expand_variables->($2))
+            => sub { push @{$sources{$expand_variables->($1)}},
+                         tokenize($expand_variables->($2))
                          if !@skip || $skip[$#skip] > 0 },
             qr/^\s*SHARED_SOURCE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
-            => sub { push @{$shared_sources{$1}},
+            => sub { push @{$shared_sources{$expand_variables->($1)}},
                          tokenize($expand_variables->($2))
                          if !@skip || $skip[$#skip] > 0 },
             qr/^\s*INCLUDE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
-            => sub { push @{$includes{$1}}, tokenize($expand_variables->($2))
+            => sub { push @{$includes{$expand_variables->($1)}},
+                         tokenize($expand_variables->($2))
                          if !@skip || $skip[$#skip] > 0 },
-            qr/^\s*DEFINE\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
-            => sub { push @{$defines{$1}}, tokenize($expand_variables->($2))
+            qr/^\s*DEFINE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
+            => sub { push @{$defines{$expand_variables->($1)}},
+                         tokenize($expand_variables->($2))
                          if !@skip || $skip[$#skip] > 0 },
             qr/^\s*DEPEND\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
-            => sub { push @{$depends{$1}}, tokenize($expand_variables->($2))
+            => sub { push @{$depends{$expand_variables->($1)}},
+                         tokenize($expand_variables->($2))
                          if !@skip || $skip[$#skip] > 0 },
             qr/^\s*GENERATE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
-            => sub { push @{$generate{$1}}, $2
+            => sub { push @{$generate{$expand_variables->($1)}}, $2
                          if !@skip || $skip[$#skip] > 0 },
             qr/^\s*(?:#.*)?$/ => sub { },
             "OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" },