summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-11-23 20:53:24 +0000
committerRoland McGrath <roland@redhat.com>1992-11-23 20:53:24 +0000
commita3254ad7b34cb19e29142fac2c3338239cfe63cc (patch)
tree2f75f360b2c2673d451b3e1d544431e075d204ee /variable.c
parentb8b8ba69d4cf084f870e1a1f5fde15b3f9b2be77 (diff)
downloadmake-a3254ad7b34cb19e29142fac2c3338239cfe63cc.tar.gz
Formerly variable.c.~13~
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/variable.c b/variable.c
index 46b691e..60daf81 100644
--- a/variable.c
+++ b/variable.c
@@ -500,9 +500,7 @@ target_environment (file)
return result;
}
-/* Try to interpret LINE (a null-terminated string)
- as a variable definition. If it is one, define the
- variable and return 1. Otherwise return 0.
+/* Try to interpret LINE (a null-terminated string) as a variable definition.
ORIGIN may be o_file, o_override, o_env, o_env_override,
or o_command specifying that the variable definition comes
@@ -528,9 +526,9 @@ try_variable_definition (line, origin)
register char *beg;
register char *end;
register int recursive;
+ char *name, *expanded_name;
+ struct variable *v;
- if (*p == '\t')
- return 0;
while (1)
{
c = *p++;
@@ -560,9 +558,18 @@ try_variable_definition (line, origin)
--end;
p = next_token (p);
- return define_variable (beg, end - beg,
- recursive ? p : variable_expand (p),
- origin, recursive);
+ /* Expand the name, so "$(foo)bar = baz" works. */
+ name = savestring (beg, end - beg);
+ expanded_name = allocated_variable_expand (name);
+ free (name);
+
+ v = define_variable (expanded_name, strlen (expanded_name),
+ recursive ? p : variable_expand (p),
+ origin, recursive);
+
+ free (expanded_name);
+
+ return v;
}
/* Print information for variable V, prefixing it with PREFIX. */