1 /* $NetBSD: make.h,v 1.256 2021/02/05 19:19:17 sjg 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).
144 #if defined(lint) || defined(USE_C99_BOOLEAN)
146 typedef bool Boolean;
149 #elif defined(USE_DOUBLE_BOOLEAN)
150 /* During development, to find type mismatches in function declarations. */
151 typedef double Boolean;
154 #elif defined(USE_UCHAR_BOOLEAN)
156 * During development, to find code that depends on the exact value of TRUE or
157 * that stores other values in Boolean variables.
159 typedef unsigned char Boolean;
160 #define TRUE ((unsigned char)0xFF)
161 #define FALSE ((unsigned char)0x00)
162 #elif defined(USE_CHAR_BOOLEAN)
164 * During development, to find code that uses a boolean as array index, via
167 typedef char Boolean;
168 #define TRUE ((char)-1)
169 #define FALSE ((char)0x00)
170 #elif defined(USE_ENUM_BOOLEAN)
171 typedef enum Boolean { FALSE, TRUE } Boolean;
185 #include "make-conf.h"
187 #include "make_malloc.h"
190 * some vendors don't have this --sjg
192 #if defined(S_IFDIR) && !defined(S_ISDIR)
193 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
196 #if defined(sun) && (defined(__svr4__) || defined(__SVR4))
197 # define POSIX_SIGNALS
201 * The typical flow of states is:
203 * The direct successful path:
204 * UNMADE -> BEINGMADE -> MADE.
206 * The direct error path:
207 * UNMADE -> BEINGMADE -> ERROR.
209 * The successful path when dependencies need to be made first:
210 * UNMADE -> DEFERRED -> REQUESTED -> BEINGMADE -> MADE.
212 * A node that has dependencies, and one of the dependencies cannot be made:
213 * UNMADE -> DEFERRED -> ABORTED.
215 * A node that turns out to be up-to-date:
216 * UNMADE -> BEINGMADE -> UPTODATE.
218 typedef enum GNodeMade {
219 /* Not examined yet. */
221 /* The node has been examined but is not yet ready since its
222 * dependencies have to be made first. */
225 /* The node is on the toBeMade list. */
228 /* The node is already being made. Trying to build a node in this
229 * state indicates a cycle in the graph. */
232 /* Was out-of-date and has been made. */
234 /* Was already up-to-date, does not need to be made. */
236 /* An error occurred while it was being made.
237 * Used only in compat mode. */
239 /* The target was aborted due to an error making a dependency.
240 * Used only in compat mode. */
245 * The OP_ constants are used when parsing a dependency line as a way of
246 * communicating to other parts of the program the way in which a target
249 * Some of the OP_ constants can be combined, others cannot.
251 typedef enum GNodeType {
254 /* The dependency operator ':' is the most common one. The commands
255 * of this node are executed if any child is out-of-date. */
257 /* The dependency operator '!' always executes its commands, even if
258 * its children are up-to-date. */
260 /* The dependency operator '::' behaves like ':', except that it
261 * allows multiple dependency groups to be defined. Each of these
262 * groups is executed on its own, independently from the others.
263 * Each individual dependency group is called a cohort. */
264 OP_DOUBLEDEP = 1 << 2,
266 /* Matches the dependency operators ':', '!' and '::'. */
267 OP_OPMASK = OP_DEPENDS | OP_FORCE | OP_DOUBLEDEP,
269 /* Don't care if the target doesn't exist and can't be created. */
270 OP_OPTIONAL = 1 << 3,
271 /* Use associated commands for parents. */
273 /* Target is never out of date, but always execute commands anyway.
274 * Its time doesn't matter, so it has none...sort of. */
276 /* Ignore non-zero exit status from shell commands when creating the
279 /* Don't remove the target when interrupted. */
280 OP_PRECIOUS = 1 << 7,
281 /* Don't echo commands when executed. */
283 /* Target is a recursive make so its commands should always be
284 * executed when it is out of date, regardless of the state of the
287 /* Target is out-of-date only if any of its children was out-of-date. */
289 /* Assume the children of the node have been already made. */
291 /* Special .BEGIN, .END or .INTERRUPT. */
292 OP_SPECIAL = 1 << 12,
293 /* Like .USE, only prepend commands. */
294 OP_USEBEFORE = 1 << 13,
295 /* The node is invisible to its parents. I.e. it doesn't show up in
296 * the parents' local variables (.IMPSRC, .ALLSRC). */
297 OP_INVISIBLE = 1 << 14,
298 /* The node does not become the main target, even if it is the first
299 * target in the first makefile. */
300 OP_NOTMAIN = 1 << 15,
301 /* Not a file target; run always. */
303 /* Don't search for the file in the path. */
305 /* In a dependency line "target: source1 .WAIT source2", source1 is
306 * made first, including its children. Once that is finished,
307 * source2 is made, including its children. The .WAIT keyword may
308 * appear more than once in a single dependency declaration. */
310 /* .NOMETA do not create a .meta file */
312 /* .META we _do_ want a .meta file */
314 /* Do not compare commands in .meta file */
315 OP_NOMETA_CMP = 1 << 21,
316 /* Possibly a submake node */
317 OP_SUBMAKE = 1 << 22,
319 /* Attributes applied by PMake */
321 /* The node is a transformation rule, such as ".c.o". */
322 OP_TRANSFORM = 1 << 30,
323 /* Target is a member of an archive */
324 /* XXX: How does this differ from OP_ARCHV? */
326 /* The node is a library,
327 * its name has the form "-l<libname>" */
329 /* The node is an archive member,
330 * its name has the form "archive(member)" */
331 /* XXX: How does this differ from OP_MEMBER? */
333 /* Target has all the commands it should. Used when parsing to catch
334 * multiple command groups for a target. Only applies to the
335 * dependency operators ':' and '!', but not to '::'. */
336 OP_HAS_COMMANDS = 1 << 26,
337 /* The special command "..." has been seen. All further commands from
338 * this node will be saved on the .END node instead, to be executed at
340 OP_SAVE_CMDS = 1 << 25,
341 /* Already processed by Suff_FindDeps, to find dependencies from
342 * suffix transformation rules. */
343 OP_DEPS_FOUND = 1 << 24,
344 /* Node found while expanding .ALLSRC */
347 OP_NOTARGET = OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM
350 typedef enum GNodeFlags {
352 /* this target needs to be (re)made */
354 /* children of this target were made */
356 /* children don't exist, and we pretend made */
358 /* Set by Make_ProcessWait() */
360 /* Build requested by .ORDER processing */
362 /* Node created from .depend */
363 FROM_DEPEND = 1 << 5,
364 /* We do it once only */
365 DONE_ALLSRC = 1 << 6,
366 /* Used by MakePrintStatus */
368 /* Used by MakePrintStatus */
372 typedef struct List StringList;
373 typedef struct ListNode StringListNode;
375 typedef struct List GNodeList;
376 typedef struct ListNode GNodeListNode;
378 typedef struct SearchPath {
379 List /* of CachedDir */ dirs;
383 * A graph node represents a target that can possibly be made, including its
384 * relation to other targets and a lot of other details.
386 typedef struct GNode {
387 /* The target's name, such as "clean" or "make.c" */
389 /* The unexpanded name of a .USE node */
391 /* The full pathname of the file belonging to the target.
392 * XXX: What about .PHONY targets? These don't have an associated
396 /* The type of operator used to define the sources (see the OP flags
398 * XXX: This looks like a wild mixture of type and flags. */
402 /* The state of processing on this node */
404 /* The number of unmade children */
407 /* The modification time; 0 means the node does not have a
408 * corresponding file; see GNode_IsOODate. */
410 struct GNode *youngestChild;
412 /* The GNodes for which this node is an implied source. May be empty.
413 * For example, when there is an inference rule for .c.o, the node for
414 * file.c has the node for file.o in this list. */
415 GNodeList implicitParents;
417 /* The nodes that depend on this one, or in other words, the nodes for
418 * which this is a source. */
420 /* The nodes on which this one depends. */
423 /* .ORDER nodes we need made. The nodes that must be made (if they're
424 * made) before this node can be made, but that do not enter into the
425 * datedness of this node. */
426 GNodeList order_pred;
427 /* .ORDER nodes who need us. The nodes that must be made (if they're
428 * made at all) after this node is made, but that do not depend on
429 * this node, in the normal sense. */
430 GNodeList order_succ;
433 * Other nodes of the same name, for targets that were defined using
434 * the '::' dependency operator (OP_DOUBLEDEP).
437 /* The "#n" suffix for this cohort, or "" for other nodes */
439 /* The number of unmade instances on the cohorts list */
441 /* Pointer to the first instance of a '::' node; only set when on a
443 struct GNode *centurion;
445 /* Last time (sequence number) we tried to make this node */
446 unsigned int checked_seqno;
449 * The "local" variables that are specific to this target and this
450 * target only, such as $@, $<, $?.
452 * Also used for the global variable scopes SCOPE_GLOBAL,
453 * SCOPE_CMDLINE, SCOPE_INTERNAL, which contain variables with
456 HashTable /* of Var pointer */ vars;
458 /* The commands to be given to a shell to create this target. */
461 /* Suffix for the node (determined by Suff_FindDeps and opaque to
462 * everyone but the Suff module) */
463 struct Suffix *suffix;
465 /* Filename where the GNode got defined */
466 /* XXX: What is the lifetime of this string? */
468 /* Line number where the GNode got defined */
472 /* Error levels for diagnostics during parsing. */
473 typedef enum ParseErrorLevel {
474 /* Exit when the current top-level makefile has been parsed
477 /* Print "warning"; may be upgraded to fatal by the -w option. */
479 /* Informational, mainly used during development of makefiles. */
484 * Values returned by Cond_EvalLine and Cond_EvalCondition.
486 typedef enum CondEvalResult {
487 COND_PARSE, /* Parse the next lines */
488 COND_SKIP, /* Skip the next lines */
489 COND_INVALID /* Not a conditional statement */
492 /* Names of the variables that are "local" to a specific target. */
493 #define TARGET "@" /* Target of dependency */
494 #define OODATE "?" /* All out-of-date sources */
495 #define ALLSRC ">" /* All sources */
496 #define IMPSRC "<" /* Source implied by transformation */
497 #define PREFIX "*" /* Common prefix */
498 #define ARCHIVE "!" /* Archive in "archive(member)" syntax */
499 #define MEMBER "%" /* Member in "archive(member)" syntax */
505 /* True if every target is precious */
506 extern Boolean allPrecious;
507 /* True if failed targets should be deleted */
508 extern Boolean deleteOnError;
509 /* TRUE while processing .depend */
510 extern Boolean doing_depend;
512 extern GNode *defaultNode;
515 * Variables defined internally by make which should not override those set
518 extern GNode *SCOPE_INTERNAL;
519 /* Variables defined in a global scope, e.g in the makefile itself. */
520 extern GNode *SCOPE_GLOBAL;
521 /* Variables defined on the command line. */
522 extern GNode *SCOPE_CMDLINE;
525 * Value returned by Var_Parse when an error is encountered. It actually
526 * points to an empty string, so naive callers needn't worry about it.
528 extern char var_Error[];
530 /* The time at the start of this whole process */
534 * The list of directories to search when looking for targets (set by the
535 * special target .PATH).
537 extern SearchPath dirSearchPath;
538 /* Used for .include "...". */
539 extern SearchPath *parseIncPath;
541 * Used for .include <...>, for the built-in sys.mk and for makefiles from
542 * the command line arguments.
544 extern SearchPath *sysIncPath;
545 /* The default for sysIncPath. */
546 extern SearchPath *defSysIncPath;
548 /* Startup directory */
549 extern char curdir[];
550 /* The basename of the program name, suffixed with [n] for sub-makes. */
551 extern const char *progname;
552 extern int makelevel;
553 /* Name of the .depend makefile */
554 extern char *makeDependfile;
555 /* If we replaced environ, this will be non-NULL. */
556 extern char **savedEnv;
560 #define MAKEFLAGS ".MAKEFLAGS"
561 #define MAKEOVERRIDES ".MAKEOVERRIDES"
562 /* prefix when printing the target of a job */
563 #define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX"
564 #define MAKE_EXPORTED ".MAKE.EXPORTED" /* exported variables */
565 #define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all loaded makefiles */
566 #define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
567 #define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
568 #define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */
569 #define MAKE_MODE ".MAKE.MODE"
570 #ifndef MAKE_LEVEL_ENV
571 # define MAKE_LEVEL_ENV "MAKELEVEL"
574 typedef enum DebugFlags {
580 DEBUG_ERROR = 1 << 4,
582 DEBUG_GRAPH1 = 1 << 6,
583 DEBUG_GRAPH2 = 1 << 7,
584 DEBUG_GRAPH3 = 1 << 8,
587 DEBUG_LOUD = 1 << 11,
588 DEBUG_MAKE = 1 << 12,
589 DEBUG_META = 1 << 13,
590 DEBUG_PARSE = 1 << 14,
591 DEBUG_SCRIPT = 1 << 15,
592 DEBUG_SHELL = 1 << 16,
593 DEBUG_SUFF = 1 << 17,
594 DEBUG_TARG = 1 << 18,
596 DEBUG_ALL = (1 << 20) - 1
599 #define CONCAT(a, b) a##b
601 #define DEBUG(module) ((opts.debug & CONCAT(DEBUG_, module)) != 0)
603 void debug_printf(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
605 #define DEBUG_IMPL(module, args) \
609 } while (/*CONSTCOND*/FALSE)
611 #define DEBUG0(module, text) \
612 DEBUG_IMPL(module, ("%s", text))
613 #define DEBUG1(module, fmt, arg1) \
614 DEBUG_IMPL(module, (fmt, arg1))
615 #define DEBUG2(module, fmt, arg1, arg2) \
616 DEBUG_IMPL(module, (fmt, arg1, arg2))
617 #define DEBUG3(module, fmt, arg1, arg2, arg3) \
618 DEBUG_IMPL(module, (fmt, arg1, arg2, arg3))
619 #define DEBUG4(module, fmt, arg1, arg2, arg3, arg4) \
620 DEBUG_IMPL(module, (fmt, arg1, arg2, arg3, arg4))
621 #define DEBUG5(module, fmt, arg1, arg2, arg3, arg4, arg5) \
622 DEBUG_IMPL(module, (fmt, arg1, arg2, arg3, arg4, arg5))
624 typedef enum PrintVarsMode {
630 /* Command line options */
631 typedef struct CmdOpts {
632 /* -B: whether we are make compatible */
635 /* -d: debug control: There is one bit per module. It is up to the
636 * module what debug information to print. */
639 /* -df: debug output is written here - default stderr */
644 * Runs make in strict mode, with additional checks and better error
648 /* -dV: for the -V option, print unexpanded variable values */
651 /* -e: check environment variables before global variables */
652 Boolean checkEnvFirst;
654 /* -f: the makefiles to read */
655 StringList makefiles;
657 /* -i: if true, ignore all errors from shell commands */
658 Boolean ignoreErrors;
660 /* -j: the maximum number of jobs that can run in parallel;
661 * this is coordinated with the submakes */
664 /* -k: if true and an error occurs while making a node, continue
665 * making nodes that do not depend on the erroneous node */
668 /* -N: execute no commands from the targets */
669 Boolean noRecursiveExecute;
671 /* -n: execute almost no commands from the targets */
675 * -q: if true, do not really make anything, just see if the targets
680 /* -r: raw mode, do not load the builtin rules. */
683 /* -s: don't echo the shell commands before executing them */
686 /* -t: touch the targets if they are out-of-date, but don't actually
690 /* -[Vv]: print expanded or unexpanded selected variables */
691 PrintVarsMode printVars;
692 /* -[Vv]: the variables to print */
693 StringList variables;
695 /* -W: if true, makefile parsing warnings are treated as errors */
696 Boolean parseWarnFatal;
698 /* -w: print 'Entering' and 'Leaving' for submakes */
701 /* -X: if true, do not export variables set on the command line to the
703 Boolean varNoExportEnv;
705 /* The target names specified on the command line.
706 * Used to resolve .if make(...) statements. */
715 void GNode_UpdateYoungestChild(GNode *, GNode *);
716 Boolean GNode_IsOODate(GNode *);
717 void Make_ExpandUse(GNodeList *);
718 time_t Make_Recheck(GNode *);
719 void Make_HandleUse(GNode *, GNode *);
720 void Make_Update(GNode *);
721 void Make_DoAllVar(GNode *);
722 Boolean Make_Run(GNodeList *);
723 Boolean shouldDieQuietly(GNode *, int);
724 void PrintOnError(GNode *, const char *);
725 void Main_ExportMAKEFLAGS(Boolean);
726 Boolean Main_SetObjdir(Boolean, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
727 int mkTempFile(const char *, char *, size_t);
728 int str2Lst_Append(StringList *, char *);
729 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
730 Boolean GNode_ShouldExecute(GNode *gn);
732 /* See if the node was seen on the left-hand side of a dependency operator. */
734 GNode_IsTarget(const GNode *gn)
736 return (gn->type & OP_OPMASK) != 0;
739 MAKE_INLINE const char *
740 GNode_Path(const GNode *gn)
742 return gn->path != NULL ? gn->path : gn->name;
746 GNode_IsWaitingFor(const GNode *gn)
748 return (gn->flags & REMAKE) && gn->made <= REQUESTED;
752 GNode_IsReady(const GNode *gn)
754 return gn->made > DEFERRED;
758 GNode_IsDone(const GNode *gn)
760 return gn->made >= MADE;
764 GNode_IsError(const GNode *gn)
766 return gn->made == ERROR || gn->made == ABORTED;
769 MAKE_INLINE const char *
770 GNode_VarTarget(GNode *gn) { return GNode_ValueDirect(gn, TARGET); }
771 MAKE_INLINE const char *
772 GNode_VarOodate(GNode *gn) { return GNode_ValueDirect(gn, OODATE); }
773 MAKE_INLINE const char *
774 GNode_VarAllsrc(GNode *gn) { return GNode_ValueDirect(gn, ALLSRC); }
775 MAKE_INLINE const char *
776 GNode_VarImpsrc(GNode *gn) { return GNode_ValueDirect(gn, IMPSRC); }
777 MAKE_INLINE const char *
778 GNode_VarPrefix(GNode *gn) { return GNode_ValueDirect(gn, PREFIX); }
779 MAKE_INLINE const char *
780 GNode_VarArchive(GNode *gn) { return GNode_ValueDirect(gn, ARCHIVE); }
781 MAKE_INLINE const char *
782 GNode_VarMember(GNode *gn) { return GNode_ValueDirect(gn, MEMBER); }
785 #define UNCONST(ptr) ({ \
790 __d.__cp = ptr, __d.__p; })
792 #define UNCONST(ptr) (void *)(ptr)
795 /* At least GNU/Hurd systems lack hardcoded MAXPATHLEN/PATH_MAX */
800 #define MAXPATHLEN BMAKE_PATH_MAX
803 #define PATH_MAX MAXPATHLEN
807 #define KILLPG(pid, sig) kill(-(pid), (sig))
809 #define KILLPG(pid, sig) killpg((pid), (sig))
813 ch_isalnum(char ch) { return isalnum((unsigned char)ch) != 0; }
815 ch_isalpha(char ch) { return isalpha((unsigned char)ch) != 0; }
817 ch_isdigit(char ch) { return isdigit((unsigned char)ch) != 0; }
819 ch_isspace(char ch) { return isspace((unsigned char)ch) != 0; }
821 ch_isupper(char ch) { return isupper((unsigned char)ch) != 0; }
823 ch_tolower(char ch) { return (char)tolower((unsigned char)ch); }
825 ch_toupper(char ch) { return (char)toupper((unsigned char)ch); }
828 cpp_skip_whitespace(const char **pp)
830 while (ch_isspace(**pp))
835 cpp_skip_hspace(const char **pp)
837 while (**pp == ' ' || **pp == '\t')
842 pp_skip_whitespace(char **pp)
844 while (ch_isspace(**pp))
849 pp_skip_hspace(char **pp)
851 while (**pp == ' ' || **pp == '\t')
856 # define MAKE_RCSID(id) extern void do_not_define_rcsid(void)
857 #elif defined(MAKE_NATIVE)
858 # include <sys/cdefs.h>
859 # define MAKE_RCSID(id) __RCSID(id)
860 #elif defined(MAKE_ALL_IN_ONE) && defined(__COUNTER__)
861 # define MAKE_RCSID_CONCAT(x, y) CONCAT(x, y)
862 # define MAKE_RCSID(id) static volatile char \
863 MAKE_RCSID_CONCAT(rcsid_, __COUNTER__)[] = id
864 #elif defined(MAKE_ALL_IN_ONE)
865 # define MAKE_RCSID(id) extern void do_not_define_rcsid(void)
867 # define MAKE_RCSID(id) static volatile char rcsid[] = id
870 #endif /* MAKE_MAKE_H */