Hmmm, I ran into something similar in which:

a := A

bar:
        @echo $a

a := B


would output B.


Does this patch fix this as well?

Thanks,
Noel

Boris Kolpackov wrote:

Good day,

The following makefile prints 'B' instead of 'A'.

a := A

%bar : arg := $a
%bar : ; @echo $(arg)

a := B

foobar:

Patch is attached for those who find this behavior surprising.

Also note that this patch does not address the following cases:


%bar : a := a
%bar : $a_b := a_b # doesn't work, equivalent to _b := a_b
%bar : a := a
%bar : a_b := $a_b # doesn't work, equivalent to a_b := _b


comments are welcome,
-boris






------------------------------------------------------------------------


Index: read.c
===================================================================
RCS file: /cvsroot/make/make/read.c,v
retrieving revision 1.131
diff -u -r1.131 read.c
--- read.c 22 Mar 2004 15:11:49 -0000 1.131
+++ read.c 9 Apr 2004 18:47:48 -0000
@@ -1686,9 +1686,19 @@
p = create_pattern_var (name, percent);
p->variable.fileinfo = *flocp;
v = parse_variable_definition (&p->variable, defn);
- v->value = xstrdup (v->value);
+
if (!v)
error (flocp, _("Malformed pattern-specific variable definition"));
+
+ if (v->flavor == f_simple)
+ {
+ v->value = allocated_variable_expand (v->value);
+ }
+ else
+ {
+ v->value = xstrdup (v->value);
+ }
+ fname = p->target;
}
else



------------------------------------------------------------------------


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to