bug-make
[Top][All Lists]
Advanced

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

Re: [PATCH] order-only prerequisite ends up in $<


From: Noel Yap
Subject: Re: [PATCH] order-only prerequisite ends up in $<
Date: Mon, 19 Apr 2004 17:37:53 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

Once this patch is installed, does "gmake -npqr | grep '%r:'" output the proper 
thing?  If so, I suspect this patch will fix much of the odd behaviour I've seen with 
regards to implicit rules and order rules.

Thanks,
Noel

Boris Kolpackov wrote:

Good day,

The following makefile prints "baz foo baz" instead of "foo foo baz".

%r: | baz
        @echo $< $^ $|

bar: foo

foo:;@:

baz:;@:


In command.c in function set_file_variables $< is initialized with the first prerequisite. While in most cases this would be a normal prerequisite in case of an implicit rules it could be an order-only one. Patch is
attached.


hth,
-boris

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

Index: commands.c
===================================================================
RCS file: /cvsroot/make/make/commands.c,v
retrieving revision 1.55
diff -u -r1.55 commands.c
--- commands.c  24 Feb 2004 13:50:20 -0000      1.55
+++ commands.c  19 Apr 2004 20:55:21 -0000
@@ -42,6 +42,7 @@
 set_file_variables (struct file *file)
 {
   char *at, *percent, *star, *less;
+  struct dep *d;
#ifndef NO_ARCHIVES
   /* If the target is an archive member `lib(member)',
@@ -105,8 +106,17 @@
     }
   star = file->stem;
- /* $< is the first dependency. */
-  less = file->deps != 0 ? dep_name (file->deps) : "";
+  /* $< is the first not order-only dependency.  */
+  less = "";
+
+  for (d = file->deps; d != 0; d = d->next)
+    if (!d->ignore_mtime)
+      {
+        less = dep_name (d);
+        break;
+      }
+
+
if (file->cmds == default_file->cmds)
     /* This file got its commands from .DEFAULT.
@@ -134,7 +144,6 @@
     char *caret_value;
     char *qp;
     char *bp;
-    struct dep *d;
     unsigned int len;
/* Compute first the value for $+, which is supposed to contain


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

_______________________________________________
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]