version 1.14, 2000/03/26 16:21:32 |
version 1.15, 2000/06/10 01:32:23 |
|
|
* is non-zero when Job_Empty() returns |
* is non-zero when Job_Empty() returns |
* TRUE, there's a cycle in the graph */ |
* TRUE, there's a cycle in the graph */ |
|
|
static int MakeAddChild __P((ClientData, ClientData)); |
static void MakeAddChild __P((ClientData, ClientData)); |
static int MakeAddAllSrc __P((ClientData, ClientData)); |
static void MakeAddAllSrc __P((ClientData, ClientData)); |
static int MakeTimeStamp __P((ClientData, ClientData)); |
static void MakeTimeStamp __P((ClientData, ClientData)); |
static int MakeHandleUse __P((ClientData, ClientData)); |
static void MakeHandleUse __P((ClientData, ClientData)); |
static Boolean MakeStartJobs __P((void)); |
static Boolean MakeStartJobs __P((void)); |
static int MakePrintStatus __P((ClientData, ClientData)); |
static void MakePrintStatus __P((ClientData, ClientData)); |
/*- |
/*- |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
* Make_TimeStamp -- |
* Make_TimeStamp -- |
|
|
* field of the child is greater than it. |
* field of the child is greater than it. |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
int |
void |
Make_TimeStamp (pgn, cgn) |
Make_TimeStamp(pgn, cgn) |
GNode *pgn; /* the current parent */ |
GNode *pgn; /* the current parent */ |
GNode *cgn; /* the child we've just examined */ |
GNode *cgn; /* the child we've just examined */ |
{ |
{ |
if (cgn->mtime > pgn->cmtime) { |
if (cgn->mtime > pgn->cmtime) |
pgn->cmtime = cgn->mtime; |
pgn->cmtime = cgn->mtime; |
} |
|
return (0); |
|
} |
} |
|
|
static int |
static void |
MakeTimeStamp (pgn, cgn) |
MakeTimeStamp(pgn, cgn) |
ClientData pgn; /* the current parent */ |
ClientData pgn; /* the current parent */ |
ClientData cgn; /* the child we've just examined */ |
ClientData cgn; /* the child we've just examined */ |
{ |
{ |
return Make_TimeStamp((GNode *) pgn, (GNode *) cgn); |
Make_TimeStamp((GNode *)pgn, (GNode *)cgn); |
} |
} |
|
|
/*- |
/*- |
|
|
* have their mtime stay below their children's mtime to keep parents from |
* have their mtime stay below their children's mtime to keep parents from |
* thinking they're out-of-date. |
* thinking they're out-of-date. |
*/ |
*/ |
if (!oodate) { |
if (!oodate) |
Lst_ForEach(gn->parents, MakeTimeStamp, gn); |
Lst_ForEach(gn->parents, MakeTimeStamp, gn); |
} |
|
|
|
return (oodate); |
return (oodate); |
} |
} |
|
|
* Function used by Make_Run to add a child to the list l. |
* Function used by Make_Run to add a child to the list l. |
* It will only add the child if its make field is FALSE. |
* It will only add the child if its make field is FALSE. |
* |
* |
* Results: |
|
* Always returns 0 |
|
* |
|
* Side Effects: |
* Side Effects: |
* The given list is extended |
* The given list is extended |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static int |
static void |
MakeAddChild (gnp, lp) |
MakeAddChild(gnp, lp) |
ClientData gnp; /* the node to add */ |
ClientData gnp; /* the node to add */ |
ClientData lp; /* the list to which to add it */ |
ClientData lp; /* the list to which to add it */ |
{ |
{ |
GNode *gn = (GNode *) gnp; |
GNode *gn = (GNode *)gnp; |
Lst l = (Lst) lp; |
Lst l = (Lst)lp; |
|
|
if (!gn->make && !(gn->type & OP_USE)) { |
if (!gn->make && !(gn->type & OP_USE)) |
Lst_EnQueue(l, gn); |
Lst_EnQueue(l, gn); |
} |
|
return (0); |
|
} |
} |
|
|
/*- |
/*- |
|
|
* its commands are always added to the target node, even if the |
* its commands are always added to the target node, even if the |
* target already has commands. |
* target already has commands. |
* |
* |
* Results: |
|
* returns 0. |
|
* |
|
* Side Effects: |
* Side Effects: |
* Children and commands may be added to the parent and the parent's |
* Children and commands may be added to the parent and the parent's |
* type may be changed. |
* type may be changed. |
* |
* |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
int |
void |
Make_HandleUse (cgn, pgn) |
Make_HandleUse(cgn, pgn) |
register GNode *cgn; /* The .USE node */ |
GNode *cgn; /* The .USE node */ |
register GNode *pgn; /* The target of the .USE node */ |
GNode *pgn; /* The target of the .USE node */ |
{ |
{ |
register GNode *gn; /* A child of the .USE node */ |
GNode *gn; /* A child of the .USE node */ |
register LstNode ln; /* An element in the children list */ |
LstNode ln; /* An element in the children list */ |
|
|
if (cgn->type & (OP_USE|OP_TRANSFORM)) { |
if (cgn->type & (OP_USE|OP_TRANSFORM)) { |
if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) { |
if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) { |
|
|
pgn->unmade--; |
pgn->unmade--; |
} |
} |
} |
} |
return (0); |
|
} |
} |
static int |
static void |
MakeHandleUse (pgn, cgn) |
MakeHandleUse(pgn, cgn) |
ClientData pgn; /* the current parent */ |
ClientData pgn; /* the current parent */ |
ClientData cgn; /* the child we've just examined */ |
ClientData cgn; /* the child we've just examined */ |
{ |
{ |
return Make_HandleUse((GNode *) pgn, (GNode *) cgn); |
Make_HandleUse((GNode *)pgn, (GNode *)cgn); |
} |
} |
|
|
/*- |
/*- |
|
|
* variable if it was actually made (since .JOIN nodes don't have |
* variable if it was actually made (since .JOIN nodes don't have |
* modification times, the comparison is rather unfair...).. |
* modification times, the comparison is rather unfair...).. |
* |
* |
* Results: |
|
* Always returns 0 |
|
* |
|
* Side Effects: |
* Side Effects: |
* The ALLSRC variable for the given node is extended. |
* The ALLSRC variable for the given node is extended. |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static int |
static void |
MakeAddAllSrc (cgnp, pgnp) |
MakeAddAllSrc(cgnp, pgnp) |
ClientData cgnp; /* The child to add */ |
ClientData cgnp; /* The child to add */ |
ClientData pgnp; /* The parent to whose ALLSRC variable it should be */ |
ClientData pgnp; /* The parent to whose ALLSRC variable it should be */ |
/* added */ |
/* added */ |
|
|
Var_Append(OODATE, child, pgn); |
Var_Append(OODATE, child, pgn); |
} |
} |
} |
} |
return (0); |
|
} |
} |
|
|
/*- |
/*- |
|
|
* Print the status of a top-level node, viz. it being up-to-date |
* Print the status of a top-level node, viz. it being up-to-date |
* already or not created due to an error in a lower level. |
* already or not created due to an error in a lower level. |
* Callback function for Make_Run via Lst_ForEach. |
* Callback function for Make_Run via Lst_ForEach. |
* |
|
* Results: |
|
* Always returns 0. |
|
* |
|
* Side Effects: |
|
* A message may be printed. |
|
* |
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static int |
static void |
MakePrintStatus(gnp, cyclep) |
MakePrintStatus(gnp, cyclep) |
ClientData gnp; /* Node to examine */ |
ClientData gnp; /* Node to examine */ |
ClientData cyclep; /* True if gn->unmade being non-zero implies |
ClientData cyclep; /* True if gn->unmade being non-zero implies |
|
|
printf ("`%s' not remade because of errors.\n", gn->name); |
printf ("`%s' not remade because of errors.\n", gn->name); |
} |
} |
} |
} |
return (0); |
|
} |
} |
|
|
|
|
|
|
} |
} |
} |
} |
|
|
Lst_Destroy (examine, NOFREE); |
Lst_Destroy(examine, NOFREE); |
|
|
if (queryFlag) { |
if (queryFlag) { |
/* |
/* |