tech-toolchain archive

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

Re: make: ignore stale .depend



Ok, reduced the patch a bit further, avoids touching anything but
gn->path (which was NULL, else we wouldn't be there), and only for nodes
which are implicit sources:

Index: dir.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/dir.c,v
retrieving revision 1.61
diff -u -p -r1.61 dir.c
--- dir.c       24 Jan 2009 10:59:09 -0000      1.61
+++ dir.c       27 Nov 2010 01:48:41 -0000
@@ -1434,6 +1434,31 @@ Dir_MTime(GNode *gn)
            fullName = NULL;
        else {
            fullName = Dir_FindFile(gn->name, Suff_FindPath(gn));
+           if (fullName == NULL && gn->flags & FROM_DEPEND &&
+               !Lst_IsEmpty(gn->iParents)) {
+               char *cp;
+
+               cp = strrchr(gn->name, '/');
+               if (cp) {
+                   /*
+                    * This is an implied source, and it may have moved,
+                    * see if we can find it via the current .PATH
+                    */
+                   cp++;
+                       
+                   fullName = Dir_FindFile(cp, Suff_FindPath(gn));
+                   if (fullName) {
+                       /*
+                        * Put the found file in gn->path
+                        * so that we give that to the compiler.
+                        */
+                       gn->path = bmake_strdup(fullName);
+                       fprintf(stdout,
+                               "%s: ignoring stale %s for %s, found %s\n",
+                               progname, makeDependfile, gn->name, fullName);
+                   }
+               }
+           }
            if (DEBUG(DIR))
                fprintf(debug_file, "Found '%s' as '%s'\n",
                        gn->name, fullName ? fullName : "(not found)" );


Home | Main Index | Thread Index | Old Index