bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] pattern-specific variable expansion


From: Noel Yap
Subject: Re: [PATCH] pattern-specific variable expansion
Date: Mon, 19 Apr 2004 17:42:52 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

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
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-make




reply via email to

[Prev in Thread] Current Thread [Next in Thread]