[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: appending target-specific variables: make 3.79 bug or feature?
From: |
Paul D. Smith |
Subject: |
Re: appending target-specific variables: make 3.79 bug or feature? |
Date: |
Mon, 20 Nov 2000 16:34:13 -0500 |
%% "William F. Dowling" <address@hidden> writes:
wfd> I have come across a difference between gnu make 3.78 and 3.79 that
wfd> may be a bug, and is certainly an incompatibility. Consider this
wfd> Makefile:
wfd> foo : a += b
wfd> foo : a += c
wfd> foo :
wfd> @echo $(a)
wfd> In 3.78 and earlier, the output of make is 'b c'; in 3.79 it is 'c'.
Did I reply to this already? I can't recall.
Anyway, this is a known bug, and it's been fixed in the development
sources. Unfortunately, there was some work done on the FSF's servers
and the web-based bug database browser hasn't come back up yet, so you
can't go find the patch there.
I'll include it below; it might not apply cleanly but you should be able
to apply it by hand if not (it's not very big).
--- make-3.79.1/variable.c Fri May 19 12:36:08 2000
+++ make/variable.c Mon Aug 21 02:18:36 2000
@@ -201,9 +201,6 @@
sptr = value;
scnt = 0;
- if (listp)
- *listp = current_variable_set_list;
-
while ((sptr = strchr (sptr, '$')))
{
scnt++;
@@ -903,19 +900,23 @@
value = p;
break;
case f_append:
- /* If we have += but we're in a target variable context, defer the
- append until the context expansion. */
+ {
+ struct variable_set_list *saved_next = current_variable_set_list->next;
+
+ /* If we have += but we're in a target variable context, we want to
+ append only with other variables in the context of this target. */
if (target_var)
{
append = 1;
- flavor = f_recursive;
- value = p;
- break;
+ current_variable_set_list->next = 0;
}
/* An appending variable definition "var += value".
Extract the old value and append the new one. */
v = lookup_variable (expanded_name, strlen (expanded_name));
+
+ current_variable_set_list->next = saved_next;
+
if (v == 0)
{
/* There was no old value.
@@ -931,7 +932,7 @@
if (v->recursive)
/* The previous definition of the variable was recursive.
- The new value comes from the unexpanded old and new values. */
+ The new value is the unexpanded old and new values. */
flavor = f_recursive;
else
/* The previous definition of the variable was simple.
@@ -949,6 +950,7 @@
bcopy (p, &value[oldlen + 1], newlen + 1);
}
}
+ }
#ifdef __MSDOS__
/* Many Unix Makefiles include a line saying "SHELL=/bin/sh", but
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist