Annotation of src/usr.bin/make/make.h, Revision 1.124
1.124 ! rillig 1: /* $NetBSD: make.h,v 1.123 2020/08/22 21:42:38 rillig Exp $ */
1.6 christos 2:
1.1 cgd 3: /*
1.6 christos 4: * Copyright (c) 1988, 1989, 1990, 1993
5: * The Regents of the University of California. All rights reserved.
1.47 agc 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. Neither the name of the University nor the names of its contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
34: * from: @(#)make.h 8.3 (Berkeley) 6/13/95
35: */
36:
37: /*
1.1 cgd 38: * Copyright (c) 1989 by Berkeley Softworks
39: * All rights reserved.
40: *
41: * This code is derived from software contributed to Berkeley by
42: * Adam de Boor.
43: *
44: * Redistribution and use in source and binary forms, with or without
45: * modification, are permitted provided that the following conditions
46: * are met:
47: * 1. Redistributions of source code must retain the above copyright
48: * notice, this list of conditions and the following disclaimer.
49: * 2. Redistributions in binary form must reproduce the above copyright
50: * notice, this list of conditions and the following disclaimer in the
51: * documentation and/or other materials provided with the distribution.
52: * 3. All advertising materials mentioning features or use of this software
53: * must display the following acknowledgement:
54: * This product includes software developed by the University of
55: * California, Berkeley and its contributors.
56: * 4. Neither the name of the University nor the names of its contributors
57: * may be used to endorse or promote products derived from this software
58: * without specific prior written permission.
59: *
60: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70: * SUCH DAMAGE.
71: *
1.11 christos 72: * from: @(#)make.h 8.3 (Berkeley) 6/13/95
1.1 cgd 73: */
74:
75: /*-
76: * make.h --
77: * The global definitions for pmake
78: */
79:
1.116 rillig 80: #ifndef MAKE_MAKE_H
81: #define MAKE_MAKE_H
1.1 cgd 82:
83: #include <sys/types.h>
1.13 christos 84: #include <sys/param.h>
1.44 wiz 85:
1.123 rillig 86: #include <assert.h>
1.44 wiz 87: #include <ctype.h>
1.97 christos 88: #include <fcntl.h>
1.3 cgd 89: #include <stdio.h>
1.44 wiz 90: #include <stdlib.h>
1.1 cgd 91: #include <string.h>
1.44 wiz 92: #include <unistd.h>
1.12 christos 93:
1.19 tv 94: #ifdef BSD4_4
1.12 christos 95: # include <sys/cdefs.h>
1.4 glass 96: #endif
1.12 christos 97:
1.97 christos 98: #ifndef FD_CLOEXEC
99: #define FD_CLOEXEC 1
100: #endif
101:
1.52 yamt 102: #if defined(__GNUC__)
1.89 joerg 103: #define MAKE_GNUC_PREREQ(x, y) \
1.52 yamt 104: ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
105: (__GNUC__ > (x)))
106: #else /* defined(__GNUC__) */
1.90 dholland 107: #define MAKE_GNUC_PREREQ(x, y) 0
1.52 yamt 108: #endif /* defined(__GNUC__) */
109:
1.89 joerg 110: #if MAKE_GNUC_PREREQ(2, 7)
111: #define MAKE_ATTR_UNUSED __attribute__((__unused__))
1.51 jmc 112: #else
1.89 joerg 113: #define MAKE_ATTR_UNUSED /* delete */
1.51 jmc 114: #endif
1.89 joerg 115:
116: #if MAKE_GNUC_PREREQ(2, 5)
117: #define MAKE_ATTR_DEAD __attribute__((__noreturn__))
118: #elif defined(__GNUC__)
119: #define MAKE_ATTR_DEAD __volatile
120: #else
121: #define MAKE_ATTR_DEAD /* delete */
1.51 jmc 122: #endif
1.44 wiz 123:
1.89 joerg 124: #if MAKE_GNUC_PREREQ(2, 7)
125: #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) \
126: __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
127: #else
128: #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
1.87 joerg 129: #endif
130:
1.1 cgd 131: #include "sprite.h"
132: #include "lst.h"
1.22 mycroft 133: #include "hash.h"
1.1 cgd 134: #include "config.h"
1.3 cgd 135: #include "buf.h"
1.78 dsl 136: #include "make_malloc.h"
1.1 cgd 137:
1.119 rillig 138: typedef enum {
139: UNMADE, /* Not examined yet */
140: DEFERRED, /* Examined once (building child) */
141: REQUESTED, /* on toBeMade list */
142: BEINGMADE, /* Target is already being made.
143: * Indicates a cycle in the graph. */
144: MADE, /* Was out-of-date and has been made */
145: UPTODATE, /* Was already up-to-date */
146: ERROR, /* An error occurred while it was being
147: * made (used only in compat mode) */
148: ABORTED /* The target was aborted due to an error
149: * making an inferior (compat). */
150: } GNodeMade;
1.1 cgd 151:
1.120 rillig 152: /* The OP_ constants are used when parsing a dependency line as a way of
153: * communicating to other parts of the program the way in which a target
154: * should be made.
155: *
156: * These constants are bitwise-OR'ed together and placed in the 'type' field
157: * of each node. Any node that has a 'type' field which satisfies the OP_NOP
158: * function was never never on the left-hand side of an operator, though it
159: * may have been on the right-hand side... */
160: typedef enum {
161: /* Execution of commands depends on children (:) */
162: OP_DEPENDS = 1 << 0,
163: /* Always execute commands (!) */
164: OP_FORCE = 1 << 1,
165: /* Execution of commands depends on children per line (::) */
166: OP_DOUBLEDEP = 1 << 2,
167:
168: OP_OPMASK = OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP,
169:
170: /* Don't care if the target doesn't exist and can't be created */
171: OP_OPTIONAL = 1 << 3,
172: /* Use associated commands for parents */
173: OP_USE = 1 << 4,
174: /* Target is never out of date, but always execute commands anyway.
175: * Its time doesn't matter, so it has none...sort of */
176: OP_EXEC = 1 << 5,
177: /* Ignore errors when creating the node */
178: OP_IGNORE = 1 << 6,
179: /* Don't remove the target when interrupted */
180: OP_PRECIOUS = 1 << 7,
181: /* Don't echo commands when executed */
182: OP_SILENT = 1 << 8,
183: /* Target is a recursive make so its commands should always be executed
184: * when it is out of date, regardless of the state of the -n or -t flags */
185: OP_MAKE = 1 << 9,
186: /* Target is out-of-date only if any of its children was out-of-date */
187: OP_JOIN = 1 << 10,
188: /* Assume the children of the node have been already made */
189: OP_MADE = 1 << 11,
190: /* Special .BEGIN, .END, .INTERRUPT */
191: OP_SPECIAL = 1 << 12,
192: /* Like .USE, only prepend commands */
193: OP_USEBEFORE = 1 << 13,
194: /* The node is invisible to its parents. I.e. it doesn't show up in the
195: * parents' local variables. */
196: OP_INVISIBLE = 1 << 14,
197: /* The node is exempt from normal 'main target' processing in parse.c */
198: OP_NOTMAIN = 1 << 15,
199: /* Not a file target; run always */
200: OP_PHONY = 1 << 16,
201: /* Don't search for file in the path */
202: OP_NOPATH = 1 << 17,
203: /* .WAIT phony node */
204: OP_WAIT = 1 << 18,
205: /* .NOMETA do not create a .meta file */
206: OP_NOMETA = 1 << 19,
207: /* .META we _do_ want a .meta file */
208: OP_META = 1 << 20,
209: /* Do not compare commands in .meta file */
210: OP_NOMETA_CMP = 1 << 21,
211: /* Possibly a submake node */
212: OP_SUBMAKE = 1 << 22,
213:
214: /* Attributes applied by PMake */
215:
216: /* The node is a transformation rule */
217: OP_TRANSFORM = 1 << 31,
218: /* Target is a member of an archive */
219: OP_MEMBER = 1 << 30,
220: /* Target is a library */
221: OP_LIB = 1 << 29,
222: /* Target is an archive construct */
223: OP_ARCHV = 1 << 28,
224: /* Target has all the commands it should. Used when parsing to catch
225: * multiple commands for a target. */
226: OP_HAS_COMMANDS = 1 << 27,
227: /* Saving commands on .END (Compat) */
228: OP_SAVE_CMDS = 1 << 26,
229: /* Already processed by Suff_FindDeps */
230: OP_DEPS_FOUND = 1 << 25,
231: /* Node found while expanding .ALLSRC */
232: OP_MARK = 1 << 24
233: } GNodeType;
234:
1.119 rillig 235: typedef enum {
236: REMAKE = 0x0001, /* this target needs to be (re)made */
237: CHILDMADE = 0x0002, /* children of this target were made */
238: FORCE = 0x0004, /* children don't exist, and we pretend made */
239: DONE_WAIT = 0x0008, /* Set by Make_ProcessWait() */
240: DONE_ORDER = 0x0010, /* Build requested by .ORDER processing */
241: FROM_DEPEND = 0x0020, /* Node created from .depend */
242: DONE_ALLSRC = 0x0040, /* We do it once only */
243: CYCLE = 0x1000, /* Used by MakePrintStatus */
244: DONECYCLE = 0x2000, /* Used by MakePrintStatus */
245: INTERNAL = 0x4000 /* Internal use only */
246: } GNodeFlags;
1.1 cgd 247:
1.119 rillig 248: /* A graph node represents a target that can possibly be made, including its
249: * relation to other targets and a lot of other details. */
250: typedef struct GNode {
251: /* The target's name, such as "clean" or "make.c" */
252: char *name;
253: /* The unexpanded name of a .USE node */
254: char *uname;
255: /* The full pathname of the file belonging to the target.
256: * XXX: What about .PHONY targets? These don't have an associated path. */
257: char *path;
258:
259: /* The type of operator used to define the sources (see the OP flags below).
260: * XXX: This looks like a wild mixture of type and flags. */
1.124 ! rillig 261: GNodeType type;
1.119 rillig 262: /* whether it is involved in this invocation of make */
263: GNodeFlags flags;
264:
265: /* The state of processing on this node */
266: GNodeMade made;
267: int unmade; /* The number of unmade children */
268:
269: time_t mtime; /* Its modification time */
270: struct GNode *cmgn; /* The youngest child */
271:
272: /* Links to parents for which this is an implied source. May be empty.
273: * Nodes that depend on this, as gleaned from the transformation rules. */
274: Lst iParents;
275:
276: /* Other nodes of the same name for the :: operator. */
277: Lst cohorts;
278:
279: /* The nodes that depend on this one, or in other words, the nodes for
280: * which this is a source. */
281: Lst parents;
282: /* The nodes on which this one depends. */
283: Lst children;
284:
285: /* .ORDER nodes we need made. The nodes that must be made (if they're
286: * made) before this node can be made, but that do not enter into the
287: * datedness of this node. */
288: Lst order_pred;
289: /* .ORDER nodes who need us. The nodes that must be made (if they're made
290: * at all) after this node is made, but that do not depend on this node,
291: * in the normal sense. */
292: Lst order_succ;
293:
294: /* #n for this cohort */
295: char cohort_num[8];
296: /* The number of unmade instances on the cohorts list */
297: int unmade_cohorts;
298: /* Pointer to the first instance of a :: node; only set when on a cohorts
299: * list */
300: struct GNode *centurion;
301:
1.122 rillig 302: /* Last time (sequence number) we tried to make this node */
303: unsigned int checked;
1.119 rillig 304:
305: /* The "local" variables that are specific to this target and this target
306: * only, such as $@, $<, $?. */
307: Hash_Table context;
308:
309: /* The commands to be given to a shell to create this target. */
310: Lst commands;
311:
312: /* Suffix for the node (determined by Suff_FindDeps and opaque to everyone
313: * but the Suff module) */
314: struct Suff *suffix;
315:
316: /* filename where the GNode got defined */
317: const char *fname;
318: /* line number where the GNode got defined */
319: int lineno;
1.1 cgd 320: } GNode;
321:
1.31 sommerfe 322: #define NoExecute(gn) ((gn->type & OP_MAKE) ? noRecursiveExecute : noExecute)
1.1 cgd 323: /*
324: * OP_NOP will return TRUE if the node with the given type was not the
325: * object of a dependency operator
326: */
327: #define OP_NOP(t) (((t) & OP_OPMASK) == 0x00000000)
1.16 christos 328:
1.95 joerg 329: #define OP_NOTARGET (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)
1.1 cgd 330:
331: /*
332: * The TARG_ constants are used when calling the Targ_FindNode and
333: * Targ_FindList functions in targ.c. They simply tell the functions what to
334: * do if the desired node(s) is (are) not found. If the TARG_CREATE constant
335: * is given, a new, empty node will be created for the target, placed in the
336: * table of all targets and its address returned. If TARG_NOCREATE is given,
1.76 dsl 337: * a NULL pointer will be returned.
1.1 cgd 338: */
1.64 dsl 339: #define TARG_NOCREATE 0x00 /* don't create it */
1.1 cgd 340: #define TARG_CREATE 0x01 /* create node if not found */
1.64 dsl 341: #define TARG_NOHASH 0x02 /* don't look in/add to hash table */
1.1 cgd 342:
343: /*
344: * Error levels for parsing. PARSE_FATAL means the process cannot continue
345: * once the makefile has been parsed. PARSE_WARNING means it can. Passed
346: * as the first argument to Parse_Error.
347: */
1.104 sjg 348: #define PARSE_INFO 3
1.1 cgd 349: #define PARSE_WARNING 2
350: #define PARSE_FATAL 1
351:
352: /*
353: * Values returned by Cond_Eval.
354: */
1.113 rillig 355: typedef enum {
356: COND_PARSE, /* Parse the next lines */
357: COND_SKIP, /* Skip the next lines */
358: COND_INVALID /* Not a conditional statement */
359: } CondEvalResult;
1.1 cgd 360:
361: /*
362: * Definitions for the "local" variables. Used only for clarity.
363: */
364: #define TARGET "@" /* Target of dependency */
365: #define OODATE "?" /* All out-of-date sources */
366: #define ALLSRC ">" /* All sources */
367: #define IMPSRC "<" /* Source implied by transformation */
368: #define PREFIX "*" /* Common prefix */
369: #define ARCHIVE "!" /* Archive in "archive(member)" syntax */
370: #define MEMBER "%" /* Member in "archive(member)" syntax */
371:
372: #define FTARGET "@F" /* file part of TARGET */
373: #define DTARGET "@D" /* directory part of TARGET */
374: #define FIMPSRC "<F" /* file part of IMPSRC */
375: #define DIMPSRC "<D" /* directory part of IMPSRC */
376: #define FPREFIX "*F" /* file part of PREFIX */
377: #define DPREFIX "*D" /* directory part of PREFIX */
378:
379: /*
1.11 christos 380: * Global Variables
1.1 cgd 381: */
382: extern Lst create; /* The list of target names specified on the
383: * command line. used to resolve #if
384: * make(...) statements */
385: extern Lst dirSearchPath; /* The list of directories to search when
386: * looking for targets */
387:
1.3 cgd 388: extern Boolean compatMake; /* True if we are make compatible */
1.1 cgd 389: extern Boolean ignoreErrors; /* True if should ignore all errors */
390: extern Boolean beSilent; /* True if should print no commands */
391: extern Boolean noExecute; /* True if should execute nothing */
1.31 sommerfe 392: extern Boolean noRecursiveExecute; /* True if should execute nothing */
1.1 cgd 393: extern Boolean allPrecious; /* True if every target is precious */
1.101 dholland 394: extern Boolean deleteOnError; /* True if failed targets should be deleted */
1.1 cgd 395: extern Boolean keepgoing; /* True if should continue on unaffected
396: * portions of the graph when have an error
397: * in one portion */
398: extern Boolean touchFlag; /* TRUE if targets should just be 'touched'
399: * if out of date. Set by the -t flag */
400: extern Boolean queryFlag; /* TRUE if we aren't supposed to really make
401: * anything, just see if the targets are out-
402: * of-date */
1.71 dsl 403: extern Boolean doing_depend; /* TRUE if processing .depend */
1.1 cgd 404:
405: extern Boolean checkEnvFirst; /* TRUE if environment should be searched for
406: * variables before the global context */
407:
1.32 christos 408: extern Boolean parseWarnFatal; /* TRUE if makefile parsing warnings are
409: * treated as errors */
1.45 thorpej 410:
411: extern Boolean varNoExportEnv; /* TRUE if we should not export variables
412: * set on the command line to the env. */
1.32 christos 413:
1.1 cgd 414: extern GNode *DEFAULT; /* .DEFAULT rule */
415:
1.92 sjg 416: extern GNode *VAR_INTERNAL; /* Variables defined internally by make
417: * which should not override those set by
418: * makefiles.
419: */
1.1 cgd 420: extern GNode *VAR_GLOBAL; /* Variables defined in a global context, e.g
421: * in the Makefile itself */
422: extern GNode *VAR_CMD; /* Variables defined on the command line */
1.26 mycroft 423: extern GNode *VAR_FOR; /* Iteration variables */
1.1 cgd 424: extern char var_Error[]; /* Value returned by Var_Parse when an error
425: * is encountered. It actually points to
426: * an empty string, so naive callers needn't
427: * worry about it. */
428:
429: extern time_t now; /* The time at the start of this whole
430: * process */
431:
432: extern Boolean oldVars; /* Do old-style variable substitution */
1.9 christos 433:
434: extern Lst sysIncPath; /* The system include path. */
1.38 tv 435: extern Lst defIncPath; /* The default include path. */
1.32 christos 436:
1.85 joerg 437: extern char curdir[]; /* Startup directory */
1.32 christos 438: extern char *progname; /* The program name */
1.80 sjg 439: extern char *makeDependfile; /* .depend */
1.88 sjg 440: extern char **savedEnv; /* if we replaced environ this will be non-NULL */
1.30 sommerfe 441:
1.111 rillig 442: extern int makelevel;
443:
1.82 sjg 444: /*
445: * We cannot vfork() in a child of vfork().
446: * Most systems do not enforce this but some do.
447: */
448: #define vFork() ((getpid() == myPid) ? vfork() : fork())
449: extern pid_t myPid;
450:
1.30 sommerfe 451: #define MAKEFLAGS ".MAKEFLAGS"
1.35 sjg 452: #define MAKEOVERRIDES ".MAKEOVERRIDES"
1.70 sjg 453: #define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */
454: #define MAKE_EXPORTED ".MAKE.EXPORTED" /* variables we export */
455: #define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all the makefiles we read */
1.79 sjg 456: #define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
1.80 sjg 457: #define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
458: #define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */
459: #define MAKE_MODE ".MAKE.MODE"
1.91 sjg 460: #ifndef MAKE_LEVEL_ENV
461: # define MAKE_LEVEL_ENV "MAKELEVEL"
462: #endif
1.1 cgd 463:
464: /*
465: * debug control:
466: * There is one bit per module. It is up to the module what debug
467: * information to print.
468: */
1.117 rillig 469: extern FILE *debug_file; /* Output is written here - default stderr */
1.1 cgd 470: extern int debug;
1.75 christos 471: #define DEBUG_ARCH 0x00001
472: #define DEBUG_COND 0x00002
473: #define DEBUG_DIR 0x00004
474: #define DEBUG_GRAPH1 0x00008
475: #define DEBUG_GRAPH2 0x00010
476: #define DEBUG_JOB 0x00020
477: #define DEBUG_MAKE 0x00040
478: #define DEBUG_SUFF 0x00080
479: #define DEBUG_TARG 0x00100
480: #define DEBUG_VAR 0x00200
481: #define DEBUG_FOR 0x00400
482: #define DEBUG_SHELL 0x00800
483: #define DEBUG_ERROR 0x01000
484: #define DEBUG_LOUD 0x02000
1.83 sjg 485: #define DEBUG_META 0x04000
1.110 sjg 486: #define DEBUG_HASH 0x08000
1.83 sjg 487:
1.72 sjg 488: #define DEBUG_GRAPH3 0x10000
1.55 jmc 489: #define DEBUG_SCRIPT 0x20000
1.57 dsl 490: #define DEBUG_PARSE 0x40000
1.75 christos 491: #define DEBUG_CWD 0x80000
1.1 cgd 492:
1.112 sjg 493: #define DEBUG_LINT 0x100000
494:
1.1 cgd 495: #define CONCAT(a,b) a##b
496:
497: #define DEBUG(module) (debug & CONCAT(DEBUG_,module))
498:
499: #include "nonints.h"
500:
1.44 wiz 501: int Make_TimeStamp(GNode *, GNode *);
502: Boolean Make_OODate(GNode *);
1.64 dsl 503: void Make_ExpandUse(Lst);
1.44 wiz 504: time_t Make_Recheck(GNode *);
505: void Make_HandleUse(GNode *, GNode *);
506: void Make_Update(GNode *);
507: void Make_DoAllVar(GNode *);
508: Boolean Make_Run(Lst);
1.108 sjg 509: int dieQuietly(GNode *, int);
1.80 sjg 510: void PrintOnError(GNode *, const char *);
1.44 wiz 511: void Main_ExportMAKEFLAGS(Boolean);
1.102 christos 512: Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
1.81 sjg 513: int mkTempFile(const char *, char **);
1.86 sjg 514: int str2Lst_Append(Lst, char *, const char *);
1.100 sjg 515: int cached_lstat(const char *, void *);
516: int cached_stat(const char *, void *);
1.46 christos 517:
518: #ifdef __GNUC__
519: #define UNCONST(ptr) ({ \
520: union __unconst { \
521: const void *__cp; \
522: void *__p; \
523: } __d; \
524: __d.__cp = ptr, __d.__p; })
525: #else
1.74 christos 526: #define UNCONST(ptr) (void *)(ptr)
1.49 sjg 527: #endif
528:
529: #ifndef MIN
530: #define MIN(a, b) ((a < b) ? a : b)
531: #endif
532: #ifndef MAX
533: #define MAX(a, b) ((a > b) ? a : b)
1.46 christos 534: #endif
1.3 cgd 535:
1.96 pooka 536: /* At least GNU/Hurd systems lack hardcoded MAXPATHLEN/PATH_MAX */
537: #include <limits.h>
538: #ifndef MAXPATHLEN
539: #define MAXPATHLEN 4096
540: #endif
541: #ifndef PATH_MAX
542: #define PATH_MAX MAXPATHLEN
543: #endif
544:
1.103 sjg 545: #if defined(SYSV)
546: #define KILLPG(pid, sig) kill(-(pid), (sig))
547: #else
548: #define KILLPG(pid, sig) killpg((pid), (sig))
549: #endif
550:
1.116 rillig 551: #endif /* MAKE_MAKE_H */
CVSweb <webmaster@jp.NetBSD.org>