version 1.72, 2017/06/22 17:08:20 |
version 1.73, 2017/06/22 17:09:10 |
|
|
static bool randomize_queue; |
static bool randomize_queue; |
long random_delay = 0; |
long random_delay = 0; |
|
|
bool |
bool |
no_jobs_left() |
no_jobs_left() |
{ |
{ |
return Array_IsEmpty(&toBeMade); |
return Array_IsEmpty(&toBeMade); |
|
|
/* no random delay in the new engine for now */ |
/* no random delay in the new engine for now */ |
#if 0 |
#if 0 |
if (Var_Definedi("RANDOM_DELAY", NULL)) |
if (Var_Definedi("RANDOM_DELAY", NULL)) |
random_delay = strtonum(Var_Value("RANDOM_DELAY"), 0, 1000, |
random_delay = strtonum(Var_Value("RANDOM_DELAY"), 0, 1000, |
NULL) * 1000000; |
NULL) * 1000000; |
#endif |
#endif |
|
|
|
|
|
|
if (pgn->must_make && pgn->built_status == UNKNOWN) { |
if (pgn->must_make && pgn->built_status == UNKNOWN) { |
if (DEBUG(MAKE)) |
if (DEBUG(MAKE)) |
printf("predecessor %s not made yet.\n", |
printf("predecessor %s not made yet.\n", |
pgn->name); |
pgn->name); |
return true; |
return true; |
} |
} |
|
|
for (ln = Lst_First(&gn->successors); ln != NULL; ln = Lst_Adv(ln)) { |
for (ln = Lst_First(&gn->successors); ln != NULL; ln = Lst_Adv(ln)) { |
GNode *succ = Lst_Datum(ln); |
GNode *succ = Lst_Datum(ln); |
|
|
if (succ->must_make && succ->unmade == 0 |
if (succ->must_make && succ->unmade == 0 |
&& succ->built_status == UNKNOWN) |
&& succ->built_status == UNKNOWN) |
Array_PushNew(&toBeMade, succ); |
Array_PushNew(&toBeMade, succ); |
} |
} |
|
|
j--; |
j--; |
heldBack.a[i]->built_status = UNKNOWN; |
heldBack.a[i]->built_status = UNKNOWN; |
if (DEBUG(HELDJOBS)) |
if (DEBUG(HELDJOBS)) |
printf("%s finished, releasing: %s\n", |
printf("%s finished, releasing: %s\n", |
gn->name, heldBack.a[i]->name); |
gn->name, heldBack.a[i]->name); |
Array_Push(&toBeMade, heldBack.a[i]); |
Array_Push(&toBeMade, heldBack.a[i]); |
continue; |
continue; |
|
|
if (noExecute || is_out_of_date(Dir_MTime(cgn))) |
if (noExecute || is_out_of_date(Dir_MTime(cgn))) |
clock_gettime(CLOCK_REALTIME, &cgn->mtime); |
clock_gettime(CLOCK_REALTIME, &cgn->mtime); |
if (DEBUG(MAKE)) |
if (DEBUG(MAKE)) |
printf("update time: %s\n", |
printf("update time: %s\n", |
time_to_string(&cgn->mtime)); |
time_to_string(&cgn->mtime)); |
} |
} |
|
|
|
|
pgn->unmade--; |
pgn->unmade--; |
if (pgn->must_make) { |
if (pgn->must_make) { |
if (DEBUG(MAKE)) |
if (DEBUG(MAKE)) |
printf("%s--=%d ", |
printf("%s--=%d ", |
pgn->name, pgn->unmade); |
pgn->name, pgn->unmade); |
|
|
if ( ! (cgn->type & (OP_EXEC|OP_USE))) { |
if ( ! (cgn->type & (OP_EXEC|OP_USE))) { |
|
|
gn->built_status = HELDBACK; |
gn->built_status = HELDBACK; |
if (DEBUG(HELDJOBS)) |
if (DEBUG(HELDJOBS)) |
printf("Holding back job %s, " |
printf("Holding back job %s, " |
"groupling to %s\n", |
"groupling to %s\n", |
gn->name, gn2->name); |
gn->name, gn2->name); |
Array_Push(&heldBack, gn); |
Array_Push(&heldBack, gn); |
return false; |
return false; |
|
|
gn->built_status = HELDBACK; |
gn->built_status = HELDBACK; |
if (DEBUG(HELDJOBS)) |
if (DEBUG(HELDJOBS)) |
printf("Holding back job %s, " |
printf("Holding back job %s, " |
"sibling to %s\n", |
"sibling to %s\n", |
gn->name, gn2->name); |
gn->name, gn2->name); |
Array_Push(&heldBack, gn); |
Array_Push(&heldBack, gn); |
return false; |
return false; |
|
|
Make_HandleUse(cgn, pgn); |
Make_HandleUse(cgn, pgn); |
} |
} |
|
|
/* Add stuff to the toBeMade queue. we try to sort things so that stuff |
/* Add stuff to the toBeMade queue. we try to sort things so that stuff |
* that can be done directly is done right away. This won't be perfect, |
* that can be done directly is done right away. This won't be perfect, |
* since some dependencies are only discovered later (e.g., SuffFindDeps). |
* since some dependencies are only discovered later (e.g., SuffFindDeps). |
*/ |
*/ |
|
|
bool cycle = false; |
bool cycle = false; |
bool first = true; |
bool first = true; |
|
|
for (gn = ohash_first(&targets, &i); gn != NULL; |
for (gn = ohash_first(&targets, &i); gn != NULL; |
gn = ohash_next(&targets, &i)) { |
gn = ohash_next(&targets, &i)) { |
if (has_been_built(gn)) |
if (has_been_built(gn)) |
continue; |
continue; |
|
|
if (gn->built_status == UPTODATE) |
if (gn->built_status == UPTODATE) |
continue; |
continue; |
if (gn->unmade != 0) { |
if (gn->unmade != 0) { |
GNode *c; |
GNode *c; |
|
|
gn->in_cycle = true; |
gn->in_cycle = true; |
Array_Push(cycle, gn); |
Array_Push(cycle, gn); |