Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make meta_oodate: rename ignoreOODATE to needOODATE.



details:   https://anonhg.NetBSD.org/src/rev/804619cc0215
branches:  trunk
changeset: 784126:804619cc0215
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sat Jan 19 04:23:37 2013 +0000

description:
meta_oodate: rename ignoreOODATE to needOODATE.
if target uses ${.OODATE} in its script;
1. we canno compare commands
2. if we decide it is out-of-date .OODATE must not be empty.
   The only option is to set it to .ALLSRC

diffstat:

 usr.bin/make/meta.c |  26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diffs (69 lines):

diff -r d0a3a2b3c8d6 -r 804619cc0215 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Sat Jan 19 01:22:12 2013 +0000
+++ b/usr.bin/make/meta.c       Sat Jan 19 04:23:37 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.25 2012/06/27 17:22:58 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.26 2013/01/19 04:23:37 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -843,7 +843,7 @@
     static size_t cwdlen = 0;
     static size_t tmplen = 0;
     FILE *fp;
-    Boolean ignoreOODATE = FALSE;
+    Boolean needOODATE = FALSE;
     Lst missingFiles;
     
     if (oodate)
@@ -1197,15 +1197,15 @@
                } else {
                    char *cmd = (char *)Lst_Datum(ln);
 
-                   if (!ignoreOODATE) {
+                   if (!needOODATE) {
                        if (strstr(cmd, "$?"))
-                           ignoreOODATE = TRUE;
+                           needOODATE = TRUE;
                        else if ((cp = strstr(cmd, ".OODATE"))) {
                            /* check for $[{(].OODATE[)}] */
                            if (cp > cmd + 2 && cp[-2] == '$')
-                               ignoreOODATE = TRUE;
+                               needOODATE = TRUE;
                        }
-                       if (ignoreOODATE && DEBUG(META))
+                       if (needOODATE && DEBUG(META))
                            fprintf(debug_file, "%s: %d: cannot compare commands using .OODATE\n", fname, lineno);
                    }
                    cmd = Var_Subst(NULL, cmd, gn, TRUE);
@@ -1235,7 +1235,7 @@
                        if (buf[x - 1] == '\n')
                            buf[x - 1] = '\0';
                    }
-                   if (!ignoreOODATE &&
+                   if (!needOODATE &&
                        !(gn->type & OP_NOMETA_CMP) &&
                        strcmp(p, cmd) != 0) {
                        if (DEBUG(META))
@@ -1279,14 +1279,16 @@
            oodate = TRUE;
        }
     }
-    if (oodate && ignoreOODATE) {
+    if (oodate && needOODATE) {
        /*
-        * Target uses .OODATE, so we need to re-compute it.
-        * We need to clean up what Make_DoAllVar() did.
+        * Target uses .OODATE which is empty; or we wouldn't be here.
+        * We have decided it is oodate, so .OODATE needs to be set.
+        * All we can sanely do is set it to .ALLSRC.
         */
-       Var_Delete(ALLSRC, gn);
        Var_Delete(OODATE, gn);
-       gn->flags &= ~DONE_ALLSRC;
+       Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn, 0);
+       if (cp)
+           free(cp);
     }
     return oodate;
 }



Home | Main Index | Thread Index | Old Index