Module Name:    src
Committed By:   christos
Date:           Thu Nov 25 21:31:09 UTC 2010

Modified Files:
        src/usr.bin/make: arch.c compat.c make.c make.h targ.c

Log Message:
Instead of keeping around the mtime of the youngest child, keep a pointer
to it, so that we can print it when we do the out of date determination.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/make/arch.c
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/compat.c
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/make/make.c
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/make/make.h
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/make/targ.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.59 src/usr.bin/make/arch.c:1.60
--- src/usr.bin/make/arch.c:1.59	Fri Jan 23 16:58:27 2009
+++ src/usr.bin/make/arch.c	Thu Nov 25 16:31:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.59 2009/01/23 21:58:27 dsl Exp $	*/
+/*	$NetBSD: arch.c,v 1.60 2010/11/25 21:31:08 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.59 2009/01/23 21:58:27 dsl Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.60 2010/11/25 21:31:08 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.59 2009/01/23 21:58:27 dsl Exp $");
+__RCSID("$NetBSD: arch.c,v 1.60 2010/11/25 21:31:08 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1212,7 +1212,7 @@
  *	A library will be considered out-of-date for any of these reasons,
  *	given that it is a target on a dependency line somewhere:
  *	    Its modification time is less than that of one of its
- *	    	  sources (gn->mtime < gn->cmtime).
+ *	    	  sources (gn->mtime < gn->cmgn->mtime).
  *	    Its modification time is greater than the time at which the
  *	    	  make began (i.e. it's been modified in the course
  *	    	  of the make, probably by archiving).
@@ -1245,8 +1245,8 @@
 	oodate = TRUE;
     } else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) {
 	oodate = FALSE;
-    } else if ((!Lst_IsEmpty(gn->children) && gn->cmtime == 0) ||
-	       (gn->mtime > now) || (gn->mtime < gn->cmtime)) {
+    } else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) ||
+	       (gn->mtime > now) || (gn->mtime < gn->cmgn->mtime)) {
 	oodate = TRUE;
     } else {
 #ifdef RANLIBMAG
@@ -1261,7 +1261,7 @@
 	    if (DEBUG(ARCH) || DEBUG(MAKE)) {
 		fprintf(debug_file, "%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC));
 	    }
-	    oodate = (gn->cmtime > modTimeTOC);
+	    oodate = (gn->cmgn == NULL || gn->gngm->mtime > modTimeTOC);
 	} else {
 	    /*
 	     * A library w/o a table of contents is out-of-date

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.81 src/usr.bin/make/compat.c:1.82
--- src/usr.bin/make/compat.c:1.81	Mon Sep 13 11:36:57 2010
+++ src/usr.bin/make/compat.c	Thu Nov 25 16:31:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.81 2010/09/13 15:36:57 sjg Exp $	*/
+/*	$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.81 2010/09/13 15:36:57 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.81 2010/09/13 15:36:57 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -527,10 +527,10 @@
 	}
 
 	/*
-	 * All the children were made ok. Now cmtime contains the modification
-	 * time of the newest child, we need to find out if we exist and when
-	 * we were modified last. The criteria for datedness are defined by the
-	 * Make_OODate function.
+	 * All the children were made ok. Now cmgn->mtime contains the
+	 * modification time of the newest child, we need to find out if we
+	 * exist and when we were modified last. The criteria for datedness
+	 * are defined by the Make_OODate function.
 	 */
 	if (DEBUG(MAKE)) {
 	    fprintf(debug_file, "Examining %s...", gn->name);

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.82 src/usr.bin/make/make.c:1.83
--- src/usr.bin/make/make.c:1.82	Mon Sep 13 11:36:57 2010
+++ src/usr.bin/make/make.c	Thu Nov 25 16:31:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.82 2010/09/13 15:36:57 sjg Exp $	*/
+/*	$NetBSD: make.c,v 1.83 2010/11/25 21:31:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.82 2010/09/13 15:36:57 sjg Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.83 2010/11/25 21:31:09 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.82 2010/09/13 15:36:57 sjg Exp $");
+__RCSID("$NetBSD: make.c,v 1.83 2010/11/25 21:31:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -94,12 +94,12 @@
  *
  *	Make_Update	    	Update all parents of a given child. Performs
  *	    	  	    	various bookkeeping chores like the updating
- *	    	  	    	of the cmtime field of the parent, filling
+ *	    	  	    	of the cmgn field of the parent, filling
  *	    	  	    	of the IMPSRC context variable, etc. It will
  *	    	  	    	place the parent on the toBeMade queue if it
  *	    	  	    	should be.
  *
- *	Make_TimeStamp	    	Function to set the parent's cmtime field
+ *	Make_TimeStamp	    	Function to set the parent's cmgn field
  *	    	  	    	based on a child's modification time.
  *
  *	Make_DoAllVar	    	Set up the various local variables for a
@@ -154,7 +154,7 @@
 /*-
  *-----------------------------------------------------------------------
  * Make_TimeStamp --
- *	Set the cmtime field of a parent node based on the mtime stamp in its
+ *	Set the cmgn field of a parent node based on the mtime stamp in its
  *	child. Called from MakeOODate via Lst_ForEach.
  *
  * Input:
@@ -165,15 +165,15 @@
  *	Always returns 0.
  *
  * Side Effects:
- *	The cmtime of the parent node will be changed if the mtime
+ *	The cmgn of the parent node will be changed if the mtime
  *	field of the child is greater than it.
  *-----------------------------------------------------------------------
  */
 int
 Make_TimeStamp(GNode *pgn, GNode *cgn)
 {
-    if (cgn->mtime > pgn->cmtime) {
-	pgn->cmtime = cgn->mtime;
+    if (pgn->cmgn == NULL || cgn->mtime > pgn->cmgn->mtime) {
+	pgn->cmgn = cgn;
     }
     return (0);
 }
@@ -207,7 +207,7 @@
  *	TRUE if the node is out of date. FALSE otherwise.
  *
  * Side Effects:
- *	The mtime field of the node and the cmtime field of its parents
+ *	The mtime field of the node and the cmgn field of its parents
  *	will/may be changed.
  *-----------------------------------------------------------------------
  */
@@ -265,7 +265,7 @@
 	 * or non-existent.
 	 */
 	oodate = (gn->mtime == 0 || Arch_LibOODate(gn) || 
-		  (gn->cmtime == 0 && (gn->type & OP_DOUBLEDEP)));
+		  (gn->cmgn == NULL && (gn->type & OP_DOUBLEDEP)));
     } else if (gn->type & OP_JOIN) {
 	/*
 	 * A target with the .JOIN attribute is only considered
@@ -293,21 +293,22 @@
 	    }
 	}
 	oodate = TRUE;
-    } else if (gn->mtime < gn->cmtime ||
-	       (gn->cmtime == 0 &&
+    } else if ((gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) ||
+	       (gn->cmgn == NULL &&
 		((gn->mtime == 0 && !(gn->type & OP_OPTIONAL))
 		  || gn->type & OP_DOUBLEDEP)))
     {
 	/*
 	 * A node whose modification time is less than that of its
-	 * youngest child or that has no children (cmtime == 0) and
+	 * youngest child or that has no children (cmgn == NULL) and
 	 * either doesn't exist (mtime == 0) and it isn't optional
 	 * or was the object of a * :: operator is out-of-date.
 	 * Why? Because that's the way Make does it.
 	 */
 	if (DEBUG(MAKE)) {
-	    if (gn->mtime < gn->cmtime) {
-		fprintf(debug_file, "modified before source...");
+	    if (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) {
+		fprintf(debug_file, "modified before source %s...",
+		    gn->cmgn->path);
 	    } else if (gn->mtime == 0) {
 		fprintf(debug_file, "non-existent and no sources...");
 	    } else {
@@ -395,7 +396,7 @@
  *	Always returns 0
  *
  * Side Effects:
- *	The path and mtime of the node and the cmtime of the parent are
+ *	The path and mtime of the node and the cmgn of the parent are
  *	updated; the unmade children count of the parent is decremented.
  *-----------------------------------------------------------------------
  */
@@ -663,12 +664,12 @@
  *	the toBeMade queue if this field becomes 0.
  *
  * 	If the child was made, the parent's flag CHILDMADE field will be
- *	set true and its cmtime set to now.
+ *	set true.
  *
  *	If the child is not up-to-date and still does not exist,
  *	set the FORCE flag on the parents.
  *
- *	If the child wasn't made, the cmtime field of the parent will be
+ *	If the child wasn't made, the cmgn field of the parent will be
  *	altered if the child's mtime is big enough.
  *
  *	Finally, if the child is the implied source for the parent, the

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.83 src/usr.bin/make/make.h:1.84
--- src/usr.bin/make/make.h:1.83	Mon Sep 13 11:36:57 2010
+++ src/usr.bin/make/make.h	Thu Nov 25 16:31:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.83 2010/09/13 15:36:57 sjg Exp $	*/
+/*	$NetBSD: make.h,v 1.84 2010/11/25 21:31:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -187,8 +187,7 @@
     int             unmade;    	/* The number of unmade children */
 
     time_t          mtime;     	/* Its modification time */
-    time_t     	    cmtime;    	/* The modification time of its youngest
-				 * child */
+    struct GNode    *cmgn;    	/* The youngest child */
 
     Lst     	    iParents;  	/* Links to parents for which this is an
 				 * implied source, if any */

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.55 src/usr.bin/make/targ.c:1.56
--- src/usr.bin/make/targ.c:1.55	Fri Jan 23 16:26:30 2009
+++ src/usr.bin/make/targ.c	Thu Nov 25 16:31:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.55 2009/01/23 21:26:30 dsl Exp $	*/
+/*	$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.55 2009/01/23 21:26:30 dsl Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.55 2009/01/23 21:26:30 dsl Exp $");
+__RCSID("$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -248,8 +248,9 @@
     gn->centurion =    	NULL;
     gn->made = 	    	UNMADE;
     gn->flags = 	0;
-    gn->checked = 0;
-    gn->mtime = gn->cmtime = 0;
+    gn->checked =	0;
+    gn->mtime =		0;
+    gn->cmgn =		NULL;
     gn->iParents =  	Lst_Init(FALSE);
     gn->cohorts =   	Lst_Init(FALSE);
     gn->parents =   	Lst_Init(FALSE);

Reply via email to