Hi,

Here is a patch (against GNU make 3.79.1, sorry) which fixes Gregoire's
problem. However, I'm not used to GNU make, so I certainly overlooked
something.

The idea is that every RM_DONTCARE file gets its dontcare flag set,
even if we already saw that file in some other rule.

Then, the condition for failing or not when a file can't be remade is to
look if the "top" file (oldest ancestor) in the chain currently being made
has its "dontcare" flag set, instead of looking at the current file.

I believe all the files which have the 'dontcare' flag set come from
"-include" directives, or MAKEFILES variable, and are thus such "top-level"
targets.

OTOH, files which have the "dontcare" bit set, but which appear in the
dependencies of a target that must be remade will trigger an error if
they can't be generated.

I think other solutions would be much more intrusive.

Regards,
 Aymeric

PS: please CC me if you answer; I'm not on this list.

diff -ur make-3.79.1/read.c make/read.c
--- make-3.79.1/read.c  Wed Jun 21 21:33:30 2000
+++ make/read.c Thu Dec  5 00:04:56 2002
@@ -386,11 +386,11 @@
   deps->name = 0;
   deps->file = lookup_file (filename);
   if (deps->file == 0)
-    {
       deps->file = enter_file (xstrdup (filename));
-      if (flags & RM_DONTCARE)
-       deps->file->dontcare = 1;
-    }
+
+  if (flags & RM_DONTCARE)
+    deps->file->dontcare = 1;
+
   if (filename != passed_filename)
     free (filename);
   filename = deps->file->name;
diff -ur make-3.79.1/remake.c make/remake.c
--- make-3.79.1/remake.c        Tue Jun 20 16:00:17 2000
+++ make/remake.c       Thu Dec  5 00:12:18 2002
@@ -977,9 +977,13 @@
             = _("%sNo rule to make target `%s'%s");
           const char *msg_parent
             = _("%sNo rule to make target `%s', needed by `%s'%s");
+         struct file *top_target = file;
+
+         while (top_target->parent != 0)
+           top_target = top_target->parent;
 
           /* This is a dependency file we cannot remake.  Fail.  */
-          if (!keep_going_flag && !file->dontcare)
+          if (!keep_going_flag && !top_target->dontcare)
             {
               if (file->parent == 0)
                 fatal (NILF, msg_noparent, "", file->name, "");
@@ -987,7 +991,7 @@
               fatal (NILF, msg_parent, "", file->name, file->parent->name, "");
             }
 
-          if (!file->dontcare)
+          if (!top_target->dontcare)
             {
               if (file->parent == 0)
                 error (NILF, msg_noparent, "*** ", file->name, ".");


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

Reply via email to