Remove previous hack, for now just use strtoull() instead of strtoumax().
[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.24 2005/04/10 10:28:21 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 /*
59  * This code should be removed if when cross compiling from FreeBSD
60  * 4.X is no longer required
61  * March 17.     Max Okumoto.
62  */
63 #ifndef INT64_MIN
64 #define INT64_MIN       (-0x7fffffffffffffffLL-1)
65 #define NEED_STRTOUMAX
66 #include <stdlib.h>
67
68 typedef __int64_t       intmax_t;
69 typedef __uint64_t      uintmax_t;
70
71 static inline uintmax_t
72 strtoumax(const char *nptr, char **endptr, int base)
73 {
74         return strtoull(nptr, endptr, base);
75 }
76 #endif
77
78 struct GNode;
79 struct Lst;
80
81 /*
82  * The OP_ constants are used when parsing a dependency line as a way of
83  * communicating to other parts of the program the way in which a target
84  * should be made. These constants are bitwise-OR'ed together and
85  * placed in the 'type' field of each node. Any node that has
86  * a 'type' field which satisfies the OP_NOP function was never never on
87  * the lefthand side of an operator, though it may have been on the
88  * righthand side...
89  */
90 #define OP_DEPENDS      0x00000001  /* Execution of commands depends on
91                                      * kids (:) */
92 #define OP_FORCE        0x00000002  /* Always execute commands (!) */
93 #define OP_DOUBLEDEP    0x00000004  /* Execution of commands depends on kids
94                                      * per line (::) */
95 #define OP_OPMASK       (OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP)
96
97 #define OP_OPTIONAL     0x00000008  /* Don't care if the target doesn't
98                                      * exist and can't be created */
99 #define OP_USE          0x00000010  /* Use associated commands for parents */
100 #define OP_EXEC         0x00000020  /* Target is never out of date, but always
101                                      * execute commands anyway. Its time
102                                      * doesn't matter, so it has none...sort
103                                      * of */
104 #define OP_IGNORE       0x00000040  /* Ignore errors when creating the node */
105 #define OP_PRECIOUS     0x00000080  /* Don't remove the target when
106                                      * interrupted */
107 #define OP_SILENT       0x00000100  /* Don't echo commands when executed */
108 #define OP_MAKE         0x00000200  /* Target is a recurrsive make so its
109                                      * commands should always be executed when
110                                      * it is out of date, regardless of the
111                                      * state of the -n or -t flags */
112 #define OP_JOIN         0x00000400  /* Target is out-of-date only if any of its
113                                      * children was out-of-date */
114 #define OP_INVISIBLE    0x00004000  /* The node is invisible to its parents.
115                                      * I.e. it doesn't show up in the parents's
116                                      * local variables. */
117 #define OP_NOTMAIN      0x00008000  /* The node is exempt from normal 'main
118                                      * target' processing in parse.c */
119 #define OP_PHONY        0x00010000  /* Not a file target; run always */
120 /* Attributes applied by PMake */
121 #define OP_TRANSFORM    0x80000000  /* The node is a transformation rule */
122 #define OP_MEMBER       0x40000000  /* Target is a member of an archive */
123 #define OP_LIB          0x20000000  /* Target is a library */
124 #define OP_ARCHV        0x10000000  /* Target is an archive construct */
125 #define OP_HAS_COMMANDS 0x08000000  /* Target has all the commands it should.
126                                      * Used when parsing to catch multiple
127                                      * commands for a target */
128 #define OP_SAVE_CMDS    0x04000000  /* Saving commands on .END (Compat) */
129 #define OP_DEPS_FOUND   0x02000000  /* Already processed by Suff_FindDeps */
130
131 /*
132  * OP_NOP will return TRUE if the node with the given type was not the
133  * object of a dependency operator
134  */
135 #define OP_NOP(t)       (((t) & OP_OPMASK) == 0x00000000)
136
137 /*
138  * Error levels for parsing. PARSE_FATAL means the process cannot continue
139  * once the makefile has been parsed. PARSE_WARNING means it can. Passed
140  * as the first argument to Parse_Error.
141  */
142 #define PARSE_WARNING   2
143 #define PARSE_FATAL     1
144
145 /*
146  * Definitions for the "local" variables. Used only for clarity.
147  */
148 #define TARGET            "@"   /* Target of dependency */
149 #define OODATE            "?"   /* All out-of-date sources */
150 #define ALLSRC            ">"   /* All sources */
151 #define IMPSRC            "<"   /* Source implied by transformation */
152 #define PREFIX            "*"   /* Common prefix */
153 #define ARCHIVE           "!"   /* Archive in "archive(member)" syntax */
154 #define MEMBER            "%"   /* Member in "archive(member)" syntax */
155
156 #define FTARGET           "@F"  /* file part of TARGET */
157 #define DTARGET           "@D"  /* directory part of TARGET */
158 #define FIMPSRC           "<F"  /* file part of IMPSRC */
159 #define DIMPSRC           "<D"  /* directory part of IMPSRC */
160 #define FPREFIX           "*F"  /* file part of PREFIX */
161 #define DPREFIX           "*D"  /* directory part of PREFIX */
162
163 int Make_TimeStamp(struct GNode *, struct GNode *);
164 Boolean Make_OODate(struct GNode *);
165 int Make_HandleUse(struct GNode *, struct GNode *);
166 void Make_Update(struct GNode *);
167 void Make_DoAllVar(struct GNode *);
168 Boolean Make_Run(struct Lst *);
169
170 #endif /* make_h_a91074b9 */