version 1.32, 2019/12/21 15:29:59 |
version 1.33, 2019/12/21 15:31:54 |
|
|
#include <assert.h> |
#include <assert.h> |
|
|
/*- |
/*- |
* The structure for an individual graph node. Each node has several |
* The structure for an individual graph node. Each node has a lot of |
* pieces of data associated with it. |
* of data associated with it. |
* 1) the name of the target it describes |
* 1) the *name*of the target it describes (at end because ohash) |
* 2) the location of the target file in the file system. |
* 2) the *path* to the target file |
* 3) the type of operator used to define its sources (cf parse.c) |
* 3) the *type* of operator used to define its sources |
* 4) whether it is involved in this invocation of make |
* (cf parse.c, mostly : :: ! but...) |
* 5) whether the target has been rebuilt |
* 4) *must_make*: whether it is involved in this invocation of make |
* 6) whether any of its children has been rebuilt |
* 5) *built_status*: has the target been rebuilt/is up-to-date... |
* 7) the number of its children that are, as yet, not built |
* 6) *child_rebuild*: at least one of its children has been rebuilt |
* 8) its modification time |
* 7) *children_left*: number of children still to consider |
* 9) the modification time of its youngest child (qv. make.c) |
* 8) *mtime*: node's modification time |
* 10) a list of nodes for which this is a source |
* 9) *youngest*: youngest child (cf make.c) |
* 11) a list of nodes on which this depends |
* 10) *parents*: list of nodes for which this is a dependency |
* 12) a list of nodes that depend on this, as gleaned from the |
* 11) *children*: list of nodes on which this depends |
* transformation rules. |
* 12) *cohorts*: list of nodes of the same name created by the :: operator |
* 13) a list of nodes of the same name created by the :: operator |
* 13) *predecessors*: list of nodes, result of .ORDER: |
* 14) a list of predecessors nodes, result of .ORDER: |
|
* if considered for building, they should be built before this node. |
* if considered for building, they should be built before this node. |
* 15) a list of successors nodes, result of .ORDER: |
* 14) *successors*: list of nodes, result of .ORDER: |
* if considered for building, they should be built after this node. |
* if considered for building, they should be built after this node. |
* 16) a Lst of ``local'' variables that are specific to this target |
* 15) *localvars*: ``local'' variables specific to this target |
* and this target only (qv. var.c [$@ $< $?, etc.]) |
* and this target only (cf var.c [$@ $< $?, etc.]) |
* 17) a Lst of strings that are commands to be given to a shell |
* 16) *commands*: the actual LIST of strings to pass to the shell |
* to create this target. |
* to create this target. |
*/ |
*/ |
|
|
#define SPECIAL_NONE 0U |
#define SPECIAL_NONE 0U |
#define SPECIAL_PATH 21U |
#define SPECIAL_PATH 21U |
#define SPECIAL_MASK 63U |
#define SPECIAL_MASK 63U |
#define SPECIAL_TARGET 64U |
#define SPECIAL_TARGET 64U |
|
|
#define SPECIAL_EXPENSIVE 33U |
#define SPECIAL_EXPENSIVE 33U |
|
|
struct GNode_ { |
struct GNode_ { |
unsigned int special_op; /* special op to apply */ |
unsigned int type; /* node type (see the OP flags, below) */ |
unsigned char special; /* type of special node */ |
unsigned int special_op; /* special op to apply (only used in parse.c) */ |
|
unsigned char special; /* type of special node or SPECIAL_NONE */ |
bool must_make; /* true if this target needs building */ |
bool must_make; /* true if this target needs building */ |
bool child_rebuilt; /* true if at least one child was rebuilt, |
bool child_rebuilt; /* true if at least one child was rebuilt, |
* thus triggering timestamps changes */ |
* thus triggering timestamps changes */ |
|
|
* making an inferior */ |
* making an inferior */ |
#define NOSUCHNODE 6 /* error from run_gnode */ |
#define NOSUCHNODE 6 /* error from run_gnode */ |
#define HELDBACK 7 /* Another target in the same group is |
#define HELDBACK 7 /* Another target in the same group is |
* currently building, avoid race conditions */ |
* currently building, avoid race conditions |
|
* Only used in the parallel engine make.c */ |
|
|
char *path; /* The full pathname of the file */ |
char *path; /* full pathname of the file */ |
unsigned int type; /* Its type (see the OP flags, below) */ |
int order; /* wait weight (see .ORDER/predecessors/successors) */ |
int order; /* Its wait weight */ |
|
|
|
int children_left; /* The number of children left to build */ |
int children_left; /* number of children left to build */ |
int in_cycle; /* cycle detection */ |
|
|
|
struct timespec mtime; /* Node's modification time */ |
struct timespec mtime; /* Node's modification time */ |
GNode *youngest; /* Node's youngest child */ |
GNode *youngest; /* Node's youngest child */ |
|
|
GNode *impliedsrc; |
GNode *impliedsrc; /* found by suff, to help with localvars */ |
LIST cohorts; /* Other nodes for the :: operator */ |
LIST cohorts; /* Other nodes for the :: operator */ |
LIST parents; /* Nodes that depend on this one */ |
LIST parents; /* Nodes that depend on this one */ |
LIST children; /* Nodes on which this one depends */ |
LIST children; /* Nodes on which this one depends */ |
LIST predecessors; |
LIST predecessors; |
LIST successors; |
LIST successors; |
|
|
SymTable context; /* The local variables */ |
SymTable localvars; |
LIST commands; /* Creation commands */ |
LIST commands; /* Creation commands */ |
Suff *suffix; /* Suffix for the node (determined by |
Suff *suffix; /* Suffix for the node (determined by |
* Suff_FindDeps and opaque to everyone |
* Suff_FindDeps and opaque to everyone |
* but the Suff module) */ |
* but the Suff module) */ |
GNode *sibling; /* equivalent targets */ |
GNode *groupling; /* target lists, for HELDBACK: do not build two |
GNode *groupling; /* target lists */ |
* at the same time */ |
GNode *watched; /* the node currently building */ |
GNode *watched; /* the node currently building for HELDBACK */ |
/* stuff for target name equivalence */ |
|
|
/* stuff for target name equivalence: */ |
|
GNode *sibling; /* equivalent targets (not complete yet) */ |
char *basename; /* pointer to name stripped of path */ |
char *basename; /* pointer to name stripped of path */ |
GNode *next; |
GNode *next; |
|
|
|
bool in_cycle; /* cycle detection */ |
char name[1]; /* The target's name */ |
char name[1]; /* The target's name */ |
}; |
}; |
|
|