svn commit: r198199 - head/usr.bin/make

Max Khon fjoe at FreeBSD.org
Sun Oct 18 11:28:32 UTC 2009


Author: fjoe
Date: Sun Oct 18 11:28:31 2009
New Revision: 198199
URL: http://svn.freebsd.org/changeset/base/198199

Log:
  Reset UPTODATE gnodes after remaking makefiles when make
  is not going to be restarted: such nodes could be marked UPTODATE
  without doing rebuild due to remakingMakefiles being TRUE.

Modified:
  head/usr.bin/make/main.c

Modified: head/usr.bin/make/main.c
==============================================================================
--- head/usr.bin/make/main.c	Sun Oct 18 11:27:34 2009	(r198198)
+++ head/usr.bin/make/main.c	Sun Oct 18 11:28:31 2009	(r198199)
@@ -706,6 +706,7 @@ Main_AddSourceMakefile(const char *name)
 static void
 Remake_Makefiles(void)
 {
+	Lst cleanup;
 	LstNode *ln;
 	int error_cnt = 0;
 	int remade_cnt = 0;
@@ -716,6 +717,7 @@ Remake_Makefiles(void)
 			Fatal("Failed to change directory to %s.", curdir);
 	}
 
+	Lst_Init(&cleanup);
 	LST_FOREACH(ln, &source_makefiles) {
 		LstNode *ln2;
 		struct GNode *gn;
@@ -791,21 +793,7 @@ Remake_Makefiles(void)
 			    gn->name);
 			error_cnt++;
 		} else if (gn->made == UPTODATE) {
-			Lst examine;
-
-			Lst_Init(&examine);
-			Lst_EnQueue(&examine, gn);
-			while (!Lst_IsEmpty(&examine)) {
-				LstNode	*eln;
-				GNode *egn = Lst_DeQueue(&examine);
-
-				egn->make = FALSE;
-				LST_FOREACH(eln, &egn->children) {
-					GNode *cgn = Lst_Datum(eln);
-
-					Lst_EnQueue(&examine, cgn);
-				}
-			}
+			Lst_EnQueue(&cleanup, gn);
 		}
 	}
 
@@ -827,6 +815,24 @@ Remake_Makefiles(void)
 		}
 	}
 
+	while (!Lst_IsEmpty(&cleanup)) {
+		GNode *gn = Lst_DeQueue(&cleanup);
+
+		gn->unmade = 0;
+		gn->make = FALSE;
+		gn->made = UNMADE;
+		gn->childMade = FALSE;
+		gn->mtime = gn->cmtime = 0;
+		gn->cmtime_gn = NULL;
+
+		LST_FOREACH(ln, &gn->children) {
+			GNode *cgn = Lst_Datum(ln);
+
+			gn->unmade++;
+			Lst_EnQueue(&cleanup, cgn);
+		}
+	}
+
 	if (curdir != objdir) {
 		if (chdir(objdir) < 0)
 			Fatal("Failed to change directory to %s.", objdir);


More information about the svn-src-head mailing list