patch-7.96
[dragonfly.git] / usr.bin / make / make.h
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  *      from: @(#)make.h        8.3 (Berkeley) 6/13/95
39  * $FreeBSD: src/usr.bin/make/make.h,v 1.29 2005/02/01 10:50:36 harti Exp $
40  * $DragonFly: src/usr.bin/make/make.h,v 1.21 2005/02/15 01:01:18 okumoto Exp $
41  */
42
43 #ifndef make_h_a91074b9
44 #define make_h_a91074b9
45
46 /*-
47  * make.h --
48  *      The global definitions for pmake
49  */
50
51 #include "sprite.h"
52
53 /* buildworld needs this on FreeBSD */
54 #ifndef __arysize
55 #define __arysize(ary)          (sizeof(ary)/sizeof((ary)[0]))
56 #endif
57
58 struct GNode;
59 struct Lst;
60
61 /*
62  * The OP_ constants are used when parsing a dependency line as a way of
63  * communicating to other parts of the program the way in which a target
64  * should be made. These constants are bitwise-OR'ed together and
65  * placed in the 'type' field of each node. Any node that has
66  * a 'type' field which satisfies the OP_NOP function was never never on
67  * the lefthand side of an operator, though it may have been on the
68  * righthand side...
69  */
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 kids
74                                      * per line (::) */
75 #define OP_OPMASK       (OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP)
76
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  /* Use associated commands for parents */
80 #define OP_EXEC         0x00000020  /* Target is never out of date, but always
81                                      * execute commands anyway. Its time
82                                      * doesn't matter, so it has none...sort
83                                      * of */
84 #define OP_IGNORE       0x00000040  /* Ignore errors when creating the node */
85 #define OP_PRECIOUS     0x00000080  /* Don't remove the target when
86                                      * interrupted */
87 #define OP_SILENT       0x00000100  /* Don't echo commands when executed */
88 #define OP_MAKE         0x00000200  /* Target is a recurrsive make so its
89                                      * commands should always be executed when
90                                      * it is out of date, regardless of the
91                                      * state of the -n or -t flags */
92 #define OP_JOIN         0x00000400  /* Target is out-of-date only if any of its
93                                      * children was out-of-date */
94 #define OP_INVISIBLE    0x00004000  /* The node is invisible to its parents.
95                                      * I.e. it doesn't show up in the parents's
96                                      * local variables. */
97 #define OP_NOTMAIN      0x00008000  /* The node is exempt from normal 'main
98                                      * target' processing in parse.c */
99 #define OP_PHONY        0x00010000  /* Not a file target; run always */
100 /* Attributes applied by PMake */
101 #define OP_TRANSFORM    0x80000000  /* The node is a transformation rule */
102 #define OP_MEMBER       0x40000000  /* Target is a member of an archive */
103 #define OP_LIB          0x20000000  /* Target is a library */
104 #define OP_ARCHV        0x10000000  /* Target is an archive construct */
105 #define OP_HAS_COMMANDS 0x08000000  /* Target has all the commands it should.
106                                      * Used when parsing to catch multiple
107                                      * commands for a target */
108 #define OP_SAVE_CMDS    0x04000000  /* Saving commands on .END (Compat) */
109 #define OP_DEPS_FOUND   0x02000000  /* Already processed by Suff_FindDeps */
110
111 /*
112  * OP_NOP will return TRUE if the node with the given type was not the
113  * object of a dependency operator
114  */
115 #define OP_NOP(t)       (((t) & OP_OPMASK) == 0x00000000)
116
117 /*
118  * Error levels for parsing. PARSE_FATAL means the process cannot continue
119  * once the makefile has been parsed. PARSE_WARNING means it can. Passed
120  * as the first argument to Parse_Error.
121  */
122 #define PARSE_WARNING   2
123 #define PARSE_FATAL     1
124
125 /*
126  * Definitions for the "local" variables. Used only for clarity.
127  */
128 #define TARGET            "@"   /* Target of dependency */
129 #define OODATE            "?"   /* All out-of-date sources */
130 #define ALLSRC            ">"   /* All sources */
131 #define IMPSRC            "<"   /* Source implied by transformation */
132 #define PREFIX            "*"   /* Common prefix */
133 #define ARCHIVE           "!"   /* Archive in "archive(member)" syntax */
134 #define MEMBER            "%"   /* Member in "archive(member)" syntax */
135
136 #define FTARGET           "@F"  /* file part of TARGET */
137 #define DTARGET           "@D"  /* directory part of TARGET */
138 #define FIMPSRC           "<F"  /* file part of IMPSRC */
139 #define DIMPSRC           "<D"  /* directory part of IMPSRC */
140 #define FPREFIX           "*F"  /* file part of PREFIX */
141 #define DPREFIX           "*D"  /* directory part of PREFIX */
142
143 int Make_TimeStamp(struct GNode *, struct GNode *);
144 Boolean Make_OODate(struct GNode *);
145 int Make_HandleUse(struct GNode *, struct GNode *);
146 void Make_Update(struct GNode *);
147 void Make_DoAllVar(struct GNode *);
148 Boolean Make_Run(struct Lst *);
149
150 #endif /* make_h_a91074b9 */