Due to races clean blocks can remain cached, remove a conditional from
[dragonfly.git] / usr.bin / make / GNode.h
blob0a7b570b79b60450ffbbfa6d3af62fe6820f123b
1 /*-
2 * Copyright (c) 1988, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1989 by Berkeley Softworks
5 * All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
38 * $DragonFly: src/usr.bin/make/GNode.h,v 1.8 2005/08/03 19:48:44 okumoto Exp $
41 #ifndef GNode_h_39503bf2
42 #define GNode_h_39503bf2
44 #include <stdbool.h>
46 #include "lst.h"
48 struct Suff;
51 * The structure for an individual graph node. Each node has several
52 * pieces of data associated with it.
54 typedef struct GNode {
55 char *name; /* The target's name */
56 char *path; /* The full pathname of the target file */
59 * The type of operator used to define the sources (qv. parse.c)
61 * The OP_ constants are used when parsing a dependency line as a way of
62 * communicating to other parts of the program the way in which a target
63 * should be made. These constants are bitwise-OR'ed together and
64 * placed in the 'type' field of each node. Any node that has
65 * a 'type' field which satisfies the OP_NOP function was never never on
66 * the lefthand side of an operator, though it may have been on the
67 * righthand side...
69 int type;
70 #define OP_DEPENDS 0x00000001 /* Execution of commands depends on
71 * kids (:) */
72 #define OP_FORCE 0x00000002 /* Always execute commands (!) */
73 #define OP_DOUBLEDEP 0x00000004 /* Execution of commands depends on
74 * kids per line (::) */
75 #define OP_OPMASK (OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP)
77 #define OP_OPTIONAL 0x00000008 /* Don't care if the target doesn't
78 * exist and can't be created */
79 #define OP_USE 0x00000010 /*
80 * Use associated commands for
81 * parents
83 #define OP_EXEC 0x00000020 /* Target is never out of date, but
84 * always execute commands anyway.
85 * Its time doesn't matter, so it has
86 * none...sort of
88 #define OP_IGNORE 0x00000040 /*
89 * Ignore errors when creating the node
91 #define OP_PRECIOUS 0x00000080 /* Don't remove the target when
92 * interrupted */
93 #define OP_SILENT 0x00000100 /* Don't echo commands when executed */
94 #define OP_MAKE 0x00000200 /*
95 * Target is a recurrsive make so its
96 * commands should always be executed
97 * when it is out of date, regardless
98 * of the state of the -n or -t flags
100 #define OP_JOIN 0x00000400 /* Target is out-of-date only if any of
101 * its children was out-of-date */
102 #define OP_INVISIBLE 0x00004000 /* The node is invisible to its parents.
103 * I.e. it doesn't show up in the
104 * parents's local variables. */
105 #define OP_NOTMAIN 0x00008000 /* The node is exempt from normal 'main
106 * target' processing in parse.c */
107 #define OP_PHONY 0x00010000 /* Not a file target; run always */
108 /* Attributes applied by PMake */
109 #define OP_TRANSFORM 0x80000000 /* The node is a transformation rule */
110 #define OP_MEMBER 0x40000000 /* Target is a member of an archive */
111 #define OP_LIB 0x20000000 /* Target is a library */
112 #define OP_ARCHV 0x10000000 /* Target is an archive construct */
113 #define OP_HAS_COMMANDS 0x08000000 /* Target has all the commands it
114 * should. Used when parsing to catch
115 * multiple commands for a target */
116 #define OP_SAVE_CMDS 0x04000000 /* Saving commands on .END (Compat) */
117 #define OP_DEPS_FOUND 0x02000000 /* Already processed by Suff_FindDeps */
120 * OP_NOP will return true if the node with the given type was not the
121 * object of a dependency operator
123 #define OP_NOP(t) (((t) & OP_OPMASK) == 0x00000000)
125 int order; /* Its wait weight */
127 bool make; /* true if this target needs to be remade */
129 /* Set to reflect the state of processing on this node */
130 enum {
131 UNMADE, /* Not examined yet */
134 * Target is already being made. Indicates a cycle in the graph.
135 * (compat mode only)
137 BEINGMADE,
139 MADE, /* Was out-of-date and has been made */
140 UPTODATE, /* Was already up-to-date */
143 * An error occured while it was being
144 * made (used only in compat mode)
146 ERROR,
149 * The target was aborted due to an
150 * error making an inferior (compat).
152 ABORTED,
155 * Marked as potentially being part of a graph cycle. If we
156 * come back to a node marked this way, it is printed and
157 * 'made' is changed to ENDCYCLE.
159 CYCLE,
162 * The cycle has been completely printed. Go back and
163 * unmark all its members.
165 ENDCYCLE
166 } made;
168 /* true if one of this target's children was made */
169 bool childMade;
171 int unmade; /* The number of unmade children */
172 int mtime; /* Its modification time */
173 int cmtime; /* Modification time of its youngest child */
176 * Links to parents for which this is an implied source, if any. (nodes
177 * that depend on this, as gleaned from the transformation rules.
179 Lst iParents;
181 /* List of nodes of the same name created by the :: operator */
182 Lst cohorts;
184 /* Lst of nodes for which this is a source (that depend on this one) */
185 Lst parents;
187 /* List of nodes on which this depends */
188 Lst children;
191 * List of nodes that must be made (if they're made) after this node is,
192 * but that do not depend on this node, in the normal sense.
194 Lst successors;
197 * List of nodes that must be made (if they're made) before this node
198 * can be, but that do no enter into the datedness of this node.
200 Lst preds;
203 * List of ``local'' variables that are specific to this target
204 * and this target only (qv. var.c [$@ $< $?, etc.])
206 Lst context;
209 * List of strings that are commands to be given to a shell
210 * to create this target.
212 Lst commands;
214 /* current command executing in compat mode */
215 LstNode *compat_command;
218 * Suffix for the node (determined by Suff_FindDeps and opaque to
219 * everyone but the Suff module)
221 struct Suff *suffix;
222 } GNode;
224 #endif /* GNode_h_39503bf2 */