GNode.h revision 143411
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.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
9 *
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.
25 *
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.
37 *
38 * $FreeBSD: head/usr.bin/make/GNode.h 143411 2005-03-11 12:57:25Z harti $
39 */
40
41#ifndef GNode_h_39503bf2
42#define	GNode_h_39503bf2
43
44#include "sprite.h"
45#include "lst.h"
46
47struct Suff;
48
49/*
50 * The structure for an individual graph node. Each node has several
51 * pieces of data associated with it.
52 */
53typedef struct GNode {
54	char	*name;	/* The target's name */
55	char	*path;	/* The full pathname of the target file */
56
57	/*
58	 * The type of operator used to define the sources (qv. parse.c)
59	 * See OP_ flags in make.h
60	 */
61	int	type;
62
63	int	order;	/* Its wait weight */
64
65	Boolean	make;	/* TRUE if this target needs to be remade */
66
67	/* Set to reflect the state of processing on this node */
68	enum {
69		UNMADE,		/* Not examined yet */
70
71		/*
72		 * Target is already being made. Indicates a cycle in the graph.
73		 * (compat mode only)
74		 */
75		BEINGMADE,
76
77		MADE,		/* Was out-of-date and has been made */
78		UPTODATE,	/* Was already up-to-date */
79
80		/*
81		 * An error occured while it was being
82		 * made (used only in compat mode)
83		 */
84		ERROR,
85
86		/*
87		 * The target was aborted due to an
88		 * error making an inferior (compat).
89		 */
90		ABORTED,
91
92		/*
93		 * Marked as potentially being part of a graph cycle.  If we
94		 * come back to a node marked this way, it is printed and
95		 * 'made' is changed to ENDCYCLE.
96		 */
97		CYCLE,
98
99		/*
100		 * The cycle has been completely printed.  Go back and
101		 * unmark all its members.
102		 */
103		ENDCYCLE
104	} made;
105
106	/* TRUE if one of this target's children was made */
107	Boolean	childMade;
108
109	int	unmade;		/* The number of unmade children */
110	int	mtime;		/* Its modification time */
111	int	cmtime;		/* Modification time of its youngest child */
112
113	/*
114	 * Links to parents for which this is an implied source, if any. (nodes
115	 * that depend on this, as gleaned from the transformation rules.
116	 */
117	Lst	iParents;
118
119	/* List of nodes of the same name created by the :: operator */
120	Lst	cohorts;
121
122	/* Lst of nodes for which this is a source (that depend on this one) */
123	Lst	parents;
124
125 	/* List of nodes on which this depends */
126	Lst	children;
127
128	/*
129	 * List of nodes that must be made (if they're made) after this node is,
130	 * but that do not depend on this node, in the normal sense.
131	 */
132	Lst	successors;
133
134	/*
135	 * List of nodes that must be made (if they're made) before this node
136	 * can be, but that do no enter into the datedness of this node.
137	 */
138	Lst	preds;
139
140	/*
141	 * List of ``local'' variables that are specific to this target
142	 * and this target only (qv. var.c [$@ $< $?, etc.])
143	 */
144	Lst	context;
145
146	/*
147	 * List of strings that are commands to be given to a shell
148	 * to create this target.
149	 */
150	Lst	commands;
151
152	/* current command executing in compat mode */
153	LstNode	*compat_command;
154
155	/*
156	 * Suffix for the node (determined by Suff_FindDeps and opaque to
157	 * everyone but the Suff module)
158	 */
159	struct Suff	*suffix;
160} GNode;
161
162#endif /* GNode_h_39503bf2 */
163