summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-08-22 17:50:57 +0000
committerPaul Smith <psmith@gnu.org>1999-08-22 17:50:57 +0000
commit6fa76a7d153a9ec19d0f19dd19f6d456e044fcbe (patch)
treee968d88c7860b87a674111d68a932c1ff119a9ff /variable.c
parent4ff6c6245665ba7b611bd1f3ee2f5141895d9d69 (diff)
downloadgunmake-6fa76a7d153a9ec19d0f19dd19f6d456e044fcbe.tar.gz
* Various changes.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/variable.c b/variable.c
index d07b5e1..97207f1 100644
--- a/variable.c
+++ b/variable.c
@@ -780,9 +780,9 @@ try_variable_definition (flocp, line, origin)
case f_simple:
/* A simple variable definition "var := value". Expand the value.
We have to allocate memory since otherwise it'll clobber the
- variable buffer, and we still need that. */
- alloc_value = allocated_variable_expand (p);
- value = alloc_value;
+ variable buffer, and we may still need that if we're looking at a
+ target-specific variable. */
+ value = alloc_value = allocated_variable_expand (p);
break;
case f_conditional:
/* A conditional variable definition "var ?= value".
@@ -824,8 +824,10 @@ try_variable_definition (flocp, line, origin)
else
/* The previous definition of the variable was simple.
The new value comes from the old value, which was expanded
- when it was set; and from the expanded new value. */
- p = variable_expand (p);
+ when it was set; and from the expanded new value. Allocate
+ memory for the expansion as we may still need the rest of the
+ buffer if we're looking at a target-specific variable. */
+ p = alloc_value = allocated_variable_expand (p);
oldlen = strlen (v->value);
newlen = strlen (p);