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.
This commit is contained in:
Max Khon 2009-10-18 11:28:31 +00:00
parent 33c89765f1
commit ab5f4f723d

View File

@ -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);