1 /* $NetBSD: make.h,v 1.210 2020/11/16 21:53:10 rillig Exp $ */
4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
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
34 * from: @(#)make.h 8.3 (Berkeley) 6/13/95
38 * Copyright (c) 1989 by Berkeley Softworks
39 * All rights reserved.
41 * This code is derived from software contributed to Berkeley by
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions
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.
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
72 * from: @(#)make.h 8.3 (Berkeley) 6/13/95
77 * The global definitions for pmake
87 #include <sys/types.h>
88 #include <sys/param.h>
103 #include <sys/cdefs.h>
109 #if defined(__GNUC__)
110 #define MAKE_GNUC_PREREQ(x, y) \
111 ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
113 #else /* defined(__GNUC__) */
114 #define MAKE_GNUC_PREREQ(x, y) 0
115 #endif /* defined(__GNUC__) */
117 #if MAKE_GNUC_PREREQ(2, 7)
118 #define MAKE_ATTR_UNUSED __attribute__((__unused__))
120 #define MAKE_ATTR_UNUSED /* delete */
123 #if MAKE_GNUC_PREREQ(2, 5)
124 #define MAKE_ATTR_DEAD __attribute__((__noreturn__))
125 #elif defined(__GNUC__)
126 #define MAKE_ATTR_DEAD __volatile
128 #define MAKE_ATTR_DEAD /* delete */
131 #if MAKE_GNUC_PREREQ(2, 7)
132 #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) \
133 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
135 #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
138 #define MAKE_INLINE static inline MAKE_ATTR_UNUSED
141 * A boolean type is defined as an integer, not an enum, for historic reasons.
142 * The only allowed values are the constants TRUE and FALSE (1 and 0).
145 #ifdef USE_DOUBLE_BOOLEAN
146 /* During development, to find type mismatches in function declarations. */
147 typedef double Boolean;
150 #elif defined(USE_UCHAR_BOOLEAN)
151 /* During development, to find code that depends on the exact value of TRUE or
152 * that stores other values in Boolean variables. */
153 typedef unsigned char Boolean;
154 #define TRUE ((unsigned char)0xFF)
155 #define FALSE ((unsigned char)0x00)
156 #elif defined(USE_CHAR_BOOLEAN)
157 /* During development, to find code that uses a boolean as array index, via
158 * -Wchar-subscripts. */
159 typedef char Boolean;
160 #define TRUE ((char)-1)
161 #define FALSE ((char)0x00)
162 #elif defined(USE_ENUM_BOOLEAN)
163 typedef enum Boolean { FALSE, TRUE } Boolean;
177 #include "make-conf.h"
179 #include "make_malloc.h"
182 * some vendors don't have this --sjg
184 #if defined(S_IFDIR) && !defined(S_ISDIR)
185 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
188 #if defined(sun) && (defined(__svr4__) || defined(__SVR4))
189 #define POSIX_SIGNALS
192 typedef enum GNodeMade {
193 UNMADE, /* Not examined yet */
194 DEFERRED, /* Examined once (building child) */
195 REQUESTED, /* on toBeMade list */
196 BEINGMADE, /* Target is already being made.
197 * Indicates a cycle in the graph. */
198 MADE, /* Was out-of-date and has been made */
199 UPTODATE, /* Was already up-to-date */
200 ERROR, /* An error occurred while it was being
201 * made (used only in compat mode) */
202 ABORTED /* The target was aborted due to an error
203 * making an inferior (compat). */
206 /* The OP_ constants are used when parsing a dependency line as a way of
207 * communicating to other parts of the program the way in which a target
210 * Some of the OP_ constants can be combined, others cannot. */
211 typedef enum GNodeType {
214 /* The dependency operator ':' is the most common one. The commands of
215 * this node are executed if any child is out-of-date. */
217 /* The dependency operator '!' always executes its commands, even if
218 * its children are up-to-date. */
220 /* The dependency operator '::' behaves like ':', except that it allows
221 * multiple dependency groups to be defined. Each of these groups is
222 * executed on its own, independently from the others. Each individual
223 * dependency group is called a cohort. */
224 OP_DOUBLEDEP = 1 << 2,
226 /* Matches the dependency operators ':', '!' and '::'. */
227 OP_OPMASK = OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP,
229 /* Don't care if the target doesn't exist and can't be created */
230 OP_OPTIONAL = 1 << 3,
231 /* Use associated commands for parents */
233 /* Target is never out of date, but always execute commands anyway.
234 * Its time doesn't matter, so it has none...sort of */
236 /* Ignore non-zero exit status from shell commands when creating the node */
238 /* Don't remove the target when interrupted */
239 OP_PRECIOUS = 1 << 7,
240 /* Don't echo commands when executed */
242 /* Target is a recursive make so its commands should always be executed
243 * when it is out of date, regardless of the state of the -n or -t flags */
245 /* Target is out-of-date only if any of its children was out-of-date */
247 /* Assume the children of the node have been already made */
249 /* Special .BEGIN, .END, .INTERRUPT */
250 OP_SPECIAL = 1 << 12,
251 /* Like .USE, only prepend commands */
252 OP_USEBEFORE = 1 << 13,
253 /* The node is invisible to its parents. I.e. it doesn't show up in the
254 * parents' local variables (.IMPSRC, .ALLSRC). */
255 OP_INVISIBLE = 1 << 14,
256 /* The node is exempt from normal 'main target' processing in parse.c */
257 OP_NOTMAIN = 1 << 15,
258 /* Not a file target; run always */
260 /* Don't search for file in the path */
262 /* In a dependency line "target: source1 .WAIT source2", source1 is made
263 * first, including its children. Once that is finished, source2 is made,
264 * including its children. The .WAIT keyword may appear more than once in
265 * a single dependency declaration. */
267 /* .NOMETA do not create a .meta file */
269 /* .META we _do_ want a .meta file */
271 /* Do not compare commands in .meta file */
272 OP_NOMETA_CMP = 1 << 21,
273 /* Possibly a submake node */
274 OP_SUBMAKE = 1 << 22,
276 /* Attributes applied by PMake */
278 /* The node is a transformation rule, such as ".c.o". */
279 OP_TRANSFORM = 1 << 31,
280 /* Target is a member of an archive */
281 /* XXX: How does this differ from OP_ARCHV? */
283 /* The node is a library,
284 * its name has the form "-l<libname>" */
286 /* The node is an archive member,
287 * its name has the form "archive(member)" */
288 /* XXX: How does this differ from OP_MEMBER? */
290 /* Target has all the commands it should. Used when parsing to catch
291 * multiple command groups for a target. Only applies to the dependency
292 * operators ':' and '!', but not to '::'. */
293 OP_HAS_COMMANDS = 1 << 27,
294 /* The special command "..." has been seen. All further commands from
295 * this node will be saved on the .END node instead, to be executed at
297 OP_SAVE_CMDS = 1 << 26,
298 /* Already processed by Suff_FindDeps */
299 OP_DEPS_FOUND = 1 << 25,
300 /* Node found while expanding .ALLSRC */
303 OP_NOTARGET = OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM
306 typedef enum GNodeFlags {
307 REMAKE = 0x0001, /* this target needs to be (re)made */
308 CHILDMADE = 0x0002, /* children of this target were made */
309 FORCE = 0x0004, /* children don't exist, and we pretend made */
310 DONE_WAIT = 0x0008, /* Set by Make_ProcessWait() */
311 DONE_ORDER = 0x0010, /* Build requested by .ORDER processing */
312 FROM_DEPEND = 0x0020, /* Node created from .depend */
313 DONE_ALLSRC = 0x0040, /* We do it once only */
314 CYCLE = 0x1000, /* Used by MakePrintStatus */
315 DONECYCLE = 0x2000, /* Used by MakePrintStatus */
316 INTERNAL = 0x4000 /* Internal use only */
319 typedef struct List StringList;
320 typedef struct ListNode StringListNode;
322 typedef struct List GNodeList;
323 typedef struct ListNode GNodeListNode;
325 typedef struct List /* of CachedDir */ SearchPath;
327 /* A graph node represents a target that can possibly be made, including its
328 * relation to other targets and a lot of other details. */
329 typedef struct GNode {
330 /* The target's name, such as "clean" or "make.c" */
332 /* The unexpanded name of a .USE node */
334 /* The full pathname of the file belonging to the target.
335 * XXX: What about .PHONY targets? These don't have an associated path. */
338 /* The type of operator used to define the sources (see the OP flags below).
339 * XXX: This looks like a wild mixture of type and flags. */
343 /* The state of processing on this node */
345 int unmade; /* The number of unmade children */
347 /* The modification time; 0 means the node does not have a corresponding
348 * file; see GNode_IsOODate. */
350 struct GNode *youngestChild;
352 /* The GNodes for which this node is an implied source. May be empty.
353 * For example, when there is an inference rule for .c.o, the node for
354 * file.c has the node for file.o in this list. */
355 GNodeList *implicitParents;
357 /* The nodes that depend on this one, or in other words, the nodes for
358 * which this is a source. */
360 /* The nodes on which this one depends. */
363 /* .ORDER nodes we need made. The nodes that must be made (if they're
364 * made) before this node can be made, but that do not enter into the
365 * datedness of this node. */
366 GNodeList *order_pred;
367 /* .ORDER nodes who need us. The nodes that must be made (if they're made
368 * at all) after this node is made, but that do not depend on this node,
369 * in the normal sense. */
370 GNodeList *order_succ;
372 /* Other nodes of the same name, for the '::' dependency operator. */
374 /* The "#n" suffix for this cohort, or "" for other nodes */
376 /* The number of unmade instances on the cohorts list */
378 /* Pointer to the first instance of a '::' node; only set when on a
380 struct GNode *centurion;
382 /* Last time (sequence number) we tried to make this node */
383 unsigned int checked_seqno;
385 /* The "local" variables that are specific to this target and this target
386 * only, such as $@, $<, $?.
388 * Also used for the global variable scopes VAR_GLOBAL, VAR_CMDLINE,
389 * VAR_INTERNAL, which contain variables with arbitrary names. */
390 HashTable /* of Var pointer */ context;
392 /* The commands to be given to a shell to create this target. */
393 StringList *commands;
395 /* Suffix for the node (determined by Suff_FindDeps and opaque to everyone
396 * but the Suff module) */
399 /* Filename where the GNode got defined */
400 /* XXX: What is the lifetime of this string? */
402 /* Line number where the GNode got defined */
406 /* Error levels for diagnostics during parsing. */
407 typedef enum ParseErrorLevel {
408 /* Exit when the current top-level makefile has been parsed completely. */
410 /* Print "warning"; may be upgraded to fatal by the -w option. */
412 /* Informational, mainly used during development of makefiles. */
417 * Values returned by Cond_EvalLine and Cond_EvalCondition.
419 typedef enum CondEvalResult {
420 COND_PARSE, /* Parse the next lines */
421 COND_SKIP, /* Skip the next lines */
422 COND_INVALID /* Not a conditional statement */
425 /* Names of the variables that are "local" to a specific target. */
426 #define TARGET "@" /* Target of dependency */
427 #define OODATE "?" /* All out-of-date sources */
428 #define ALLSRC ">" /* All sources */
429 #define IMPSRC "<" /* Source implied by transformation */
430 #define PREFIX "*" /* Common prefix */
431 #define ARCHIVE "!" /* Archive in "archive(member)" syntax */
432 #define MEMBER "%" /* Member in "archive(member)" syntax */
438 /* True if every target is precious */
439 extern Boolean allPrecious;
440 /* True if failed targets should be deleted */
441 extern Boolean deleteOnError;
442 /* TRUE while processing .depend */
443 extern Boolean doing_depend;
445 extern GNode *defaultNode;
447 /* Variables defined internally by make which should not override those set
449 extern GNode *VAR_INTERNAL;
450 /* Variables defined in a global context, e.g in the Makefile itself. */
451 extern GNode *VAR_GLOBAL;
452 /* Variables defined on the command line. */
453 extern GNode *VAR_CMDLINE;
455 /* Value returned by Var_Parse when an error is encountered. It actually
456 * points to an empty string, so naive callers needn't worry about it. */
457 extern char var_Error[];
459 /* The time at the start of this whole process */
463 * If FALSE (the default behavior), undefined subexpressions in a variable
464 * expression are discarded. If TRUE (only during variable assignments using
465 * the ':=' assignment operator, no matter how deeply nested), they are
466 * preserved and possibly expanded later when the variable from the
467 * subexpression has been defined.
469 * Example for a ':=' assignment:
470 * CFLAGS = $(.INCLUDES)
471 * CFLAGS := -I.. $(CFLAGS)
472 * # If .INCLUDES (an undocumented special variable, by the way) is
473 * # still undefined, the updated CFLAGS becomes "-I.. $(.INCLUDES)".
475 extern Boolean preserveUndefined;
477 /* The list of directories to search when looking for targets (set by the
478 * special target .PATH). */
479 extern SearchPath *dirSearchPath;
480 /* Used for .include "...". */
481 extern SearchPath *parseIncPath;
482 /* Used for .include <...>, for the built-in sys.mk and makefiles from the
483 * command line arguments. */
484 extern SearchPath *sysIncPath;
485 /* The default for sysIncPath. */
486 extern SearchPath *defSysIncPath;
488 /* Startup directory */
489 extern char curdir[];
490 /* The basename of the program name, suffixed with [n] for sub-makes. */
491 extern char *progname;
492 /* Name of the .depend makefile */
493 extern char *makeDependfile;
494 /* If we replaced environ, this will be non-NULL. */
495 extern char **savedEnv;
497 extern int makelevel;
500 * We cannot vfork() in a child of vfork().
501 * Most systems do not enforce this but some do.
503 #define vFork() ((getpid() == myPid) ? vfork() : fork())
506 #define MAKEFLAGS ".MAKEFLAGS"
507 #define MAKEOVERRIDES ".MAKEOVERRIDES"
508 #define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */
509 #define MAKE_EXPORTED ".MAKE.EXPORTED" /* variables we export */
510 #define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all makefiles already loaded */
511 #define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
512 #define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
513 #define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */
514 #define MAKE_MODE ".MAKE.MODE"
515 #ifndef MAKE_LEVEL_ENV
516 # define MAKE_LEVEL_ENV "MAKELEVEL"
519 typedef enum DebugFlags {
525 DEBUG_ERROR = 1 << 4,
527 DEBUG_GRAPH1 = 1 << 6,
528 DEBUG_GRAPH2 = 1 << 7,
529 DEBUG_GRAPH3 = 1 << 8,
532 DEBUG_LOUD = 1 << 11,
533 DEBUG_MAKE = 1 << 12,
534 DEBUG_META = 1 << 13,
535 DEBUG_PARSE = 1 << 14,
536 DEBUG_SCRIPT = 1 << 15,
537 DEBUG_SHELL = 1 << 16,
538 DEBUG_SUFF = 1 << 17,
539 DEBUG_TARG = 1 << 18,
541 DEBUG_ALL = (1 << 20) - 1
544 #define CONCAT(a,b) a##b
546 #define DEBUG(module) (opts.debug & CONCAT(DEBUG_,module))
548 void debug_printf(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
550 #define DEBUG0(module, text) \
551 if (!DEBUG(module)) (void)0; \
552 else debug_printf("%s", text)
554 #define DEBUG1(module, fmt, arg1) \
555 if (!DEBUG(module)) (void)0; \
556 else debug_printf(fmt, arg1)
558 #define DEBUG2(module, fmt, arg1, arg2) \
559 if (!DEBUG(module)) (void)0; \
560 else debug_printf(fmt, arg1, arg2)
562 #define DEBUG3(module, fmt, arg1, arg2, arg3) \
563 if (!DEBUG(module)) (void)0; \
564 else debug_printf(fmt, arg1, arg2, arg3)
566 #define DEBUG4(module, fmt, arg1, arg2, arg3, arg4) \
567 if (!DEBUG(module)) (void)0; \
568 else debug_printf(fmt, arg1, arg2, arg3, arg4)
570 #define DEBUG5(module, fmt, arg1, arg2, arg3, arg4, arg5) \
571 if (!DEBUG(module)) (void)0; \
572 else debug_printf(fmt, arg1, arg2, arg3, arg4, arg5)
574 typedef enum PrintVarsMode {
580 /* Command line options */
581 typedef struct CmdOpts {
582 /* -B: whether we are make compatible */
585 /* -d: debug control: There is one bit per module. It is up to the
586 * module what debug information to print. */
589 /* -df: debug output is written here - default stderr */
594 * Runs make in strict mode, with additional checks and better error
598 /* -dV: for the -V option, print unexpanded variable values */
601 /* -e: check environment variables before global variables */
602 Boolean checkEnvFirst;
604 /* -f: the makefiles to read */
605 StringList *makefiles;
607 /* -i: if true, ignore all errors from shell commands */
608 Boolean ignoreErrors;
610 /* -j: the maximum number of jobs that can run in parallel;
611 * this is coordinated with the submakes */
614 /* -k: if true, continue on unaffected portions of the graph when an
615 * error occurs in one portion */
618 /* -N: execute no commands from the targets */
619 Boolean noRecursiveExecute;
621 /* -n: execute almost no commands from the targets */
624 /* -q: if true, we aren't supposed to really make anything, just see if
625 * the targets are out-of-date */
628 /* -r: raw mode, without loading the builtin rules. */
631 /* -s: don't echo the shell commands before executing them */
634 /* -t: touch the targets if they are out-of-date, but don't actually
638 /* -[Vv]: print expanded or unexpanded selected variables */
639 PrintVarsMode printVars;
640 /* -[Vv]: the variables to print */
641 StringList *variables;
643 /* -W: if true, makefile parsing warnings are treated as errors */
644 Boolean parseWarnFatal;
646 /* -w: print Entering and Leaving for submakes */
649 /* -X: if true, do not export variables set on the command line to the
651 Boolean varNoExportEnv;
653 /* The target names specified on the command line.
654 * Used to resolve .if make(...) statements. */
663 void GNode_UpdateYoungestChild(GNode *, GNode *);
664 Boolean GNode_IsOODate(GNode *);
665 void Make_ExpandUse(GNodeList *);
666 time_t Make_Recheck(GNode *);
667 void Make_HandleUse(GNode *, GNode *);
668 void Make_Update(GNode *);
669 void Make_DoAllVar(GNode *);
670 Boolean Make_Run(GNodeList *);
671 Boolean shouldDieQuietly(GNode *, int);
672 void PrintOnError(GNode *, const char *);
673 void Main_ExportMAKEFLAGS(Boolean);
674 Boolean Main_SetObjdir(Boolean, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
675 int mkTempFile(const char *, char **);
676 int str2Lst_Append(StringList *, char *);
677 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
678 Boolean GNode_ShouldExecute(GNode *gn);
680 /* See if the node was seen on the left-hand side of a dependency operator. */
682 GNode_IsTarget(const GNode *gn)
684 return (gn->type & OP_OPMASK) != 0;
687 MAKE_INLINE const char *
688 GNode_Path(const GNode *gn)
690 return gn->path != NULL ? gn->path : gn->name;
693 MAKE_INLINE const char *
694 GNode_VarTarget(GNode *gn) { return Var_ValueDirect(TARGET, gn); }
695 MAKE_INLINE const char *
696 GNode_VarOodate(GNode *gn) { return Var_ValueDirect(OODATE, gn); }
697 MAKE_INLINE const char *
698 GNode_VarAllsrc(GNode *gn) { return Var_ValueDirect(ALLSRC, gn); }
699 MAKE_INLINE const char *
700 GNode_VarImpsrc(GNode *gn) { return Var_ValueDirect(IMPSRC, gn); }
701 MAKE_INLINE const char *
702 GNode_VarPrefix(GNode *gn) { return Var_ValueDirect(PREFIX, gn); }
703 MAKE_INLINE const char *
704 GNode_VarArchive(GNode *gn) { return Var_ValueDirect(ARCHIVE, gn); }
705 MAKE_INLINE const char *
706 GNode_VarMember(GNode *gn) { return Var_ValueDirect(MEMBER, gn); }
709 #define UNCONST(ptr) ({ \
714 __d.__cp = ptr, __d.__p; })
716 #define UNCONST(ptr) (void *)(ptr)
719 /* At least GNU/Hurd systems lack hardcoded MAXPATHLEN/PATH_MAX */
724 #define MAXPATHLEN BMAKE_PATH_MAX
727 #define PATH_MAX MAXPATHLEN
731 #define KILLPG(pid, sig) kill(-(pid), (sig))
733 #define KILLPG(pid, sig) killpg((pid), (sig))
737 ch_isalnum(char ch) { return isalnum((unsigned char)ch) != 0; }
739 ch_isalpha(char ch) { return isalpha((unsigned char)ch) != 0; }
741 ch_isdigit(char ch) { return isdigit((unsigned char)ch) != 0; }
743 ch_isspace(char ch) { return isspace((unsigned char)ch) != 0; }
745 ch_isupper(char ch) { return isupper((unsigned char)ch) != 0; }
747 ch_tolower(char ch) { return (char)tolower((unsigned char)ch); }
749 ch_toupper(char ch) { return (char)toupper((unsigned char)ch); }
752 cpp_skip_whitespace(const char **pp)
754 while (ch_isspace(**pp))
759 cpp_skip_hspace(const char **pp)
761 while (**pp == ' ' || **pp == '\t')
766 pp_skip_whitespace(char **pp)
768 while (ch_isspace(**pp))
773 pp_skip_hspace(char **pp)
775 while (**pp == ' ' || **pp == '\t')
780 # include <sys/cdefs.h>
782 # define MAKE_RCSID(id) __RCSID(id)
785 # define MAKE_RCSID(id) static volatile char rcsid[] = id
788 #endif /* MAKE_MAKE_H */