summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-01-25 21:42:31 +0000
committerRoland McGrath <roland@redhat.com>1993-01-25 21:42:31 +0000
commitcf197b755095494fbc705d10e83fd24bdf070c4b (patch)
treec74cb5e30b6d4abe9ed5c2b096cf8062eb3b639a /variable.c
parentc653200459d167f1bb1ebca574b432d1c2d021aa (diff)
downloadgunmake-cf197b755095494fbc705d10e83fd24bdf070c4b.tar.gz
Formerly variable.c.~17~
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/variable.c b/variable.c
index 2254639..b77293f 100644
--- a/variable.c
+++ b/variable.c
@@ -490,11 +490,18 @@ target_environment (file)
for (b = table[i]; b != 0; b = b->next)
{
register struct variable *v = b->variable;
- /* If V is recursively expanded, expand its value. */
- char *value = v->recursive ? recursively_expand (v) : v->value;
- result[nvariables++] = concat (v->name, "=", value);
- if (v->recursive)
- free (value);
+ /* If V is recursively expanded and didn't come from the environment,
+ expand its value. If it came from the environment, it should
+ go back into the environment unchanged. */
+ if (v->recursive
+ && v->origin != o_env && v->origin != o_env_override)
+ {
+ char *value = recursively_expand (v);
+ result[nvariables++] = concat (v->name, "=", value);
+ free (value);
+ }
+ else
+ result[nvariables++] = concat (v->name, "=", v->value);
}
}
result[nvariables] = (char *) xmalloc (100);