make.h revision 1.146 1 /* $NetBSD: make.h,v 1.146 2020/09/24 07:37:42 rillig Exp $ */
2
3 /*
4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. 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. 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 /*
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 *
72 * from: @(#)make.h 8.3 (Berkeley) 6/13/95
73 */
74
75 /*-
76 * make.h --
77 * The global definitions for pmake
78 */
79
80 #ifndef MAKE_MAKE_H
81 #define MAKE_MAKE_H
82
83 #include <sys/types.h>
84 #include <sys/param.h>
85 #include <sys/stat.h>
86
87 #include <assert.h>
88 #include <ctype.h>
89 #include <fcntl.h>
90 #include <stdio.h>
91 #include <stdlib.h>
92 #include <string.h>
93 #include <unistd.h>
94
95 #ifdef BSD4_4
96 # include <sys/cdefs.h>
97 #endif
98
99 #ifndef FD_CLOEXEC
100 #define FD_CLOEXEC 1
101 #endif
102
103 #if defined(__GNUC__)
104 #define MAKE_GNUC_PREREQ(x, y) \
105 ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
106 (__GNUC__ > (x)))
107 #else /* defined(__GNUC__) */
108 #define MAKE_GNUC_PREREQ(x, y) 0
109 #endif /* defined(__GNUC__) */
110
111 #if MAKE_GNUC_PREREQ(2, 7)
112 #define MAKE_ATTR_UNUSED __attribute__((__unused__))
113 #else
114 #define MAKE_ATTR_UNUSED /* delete */
115 #endif
116
117 #if MAKE_GNUC_PREREQ(2, 5)
118 #define MAKE_ATTR_DEAD __attribute__((__noreturn__))
119 #elif defined(__GNUC__)
120 #define MAKE_ATTR_DEAD __volatile
121 #else
122 #define MAKE_ATTR_DEAD /* delete */
123 #endif
124
125 #if MAKE_GNUC_PREREQ(2, 7)
126 #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) \
127 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
128 #else
129 #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
130 #endif
131
132 /*
133 * A boolean type is defined as an integer, not an enum, for historic reasons.
134 * The only allowed values are the constants TRUE and FALSE (1 and 0).
135 */
136
137 #ifdef USE_DOUBLE_BOOLEAN
138 /* During development, to find type mismatches in function declarations. */
139 typedef double Boolean;
140 #elif defined(USE_UCHAR_BOOLEAN)
141 /* During development, to find code that depends on the exact value of TRUE or
142 * that stores other values in Boolean variables. */
143 typedef unsigned char Boolean;
144 #define TRUE ((unsigned char)0xFF)
145 #define FALSE ((unsigned char)0x00)
146 #elif defined(USE_ENUM_BOOLEAN)
147 typedef enum { FALSE, TRUE } Boolean;
148 #else
149 typedef int Boolean;
150 #endif
151 #ifndef TRUE
152 #define TRUE 1
153 #endif
154 #ifndef FALSE
155 #define FALSE 0
156 #endif
157
158 #include "lst.h"
159 #include "enum.h"
160 #include "hash.h"
161 #include "config.h"
162 #include "buf.h"
163 #include "make_malloc.h"
164
165 typedef enum {
166 UNMADE, /* Not examined yet */
167 DEFERRED, /* Examined once (building child) */
168 REQUESTED, /* on toBeMade list */
169 BEINGMADE, /* Target is already being made.
170 * Indicates a cycle in the graph. */
171 MADE, /* Was out-of-date and has been made */
172 UPTODATE, /* Was already up-to-date */
173 ERROR, /* An error occurred while it was being
174 * made (used only in compat mode) */
175 ABORTED /* The target was aborted due to an error
176 * making an inferior (compat). */
177 } GNodeMade;
178
179 /* The OP_ constants are used when parsing a dependency line as a way of
180 * communicating to other parts of the program the way in which a target
181 * should be made.
182 *
183 * These constants are bitwise-OR'ed together and placed in the 'type' field
184 * of each node. Any node that has a 'type' field which satisfies the OP_NOP
185 * function was never never on the left-hand side of an operator, though it
186 * may have been on the right-hand side... */
187 typedef enum {
188 /* Execution of commands depends on children (:) */
189 OP_DEPENDS = 1 << 0,
190 /* Always execute commands (!) */
191 OP_FORCE = 1 << 1,
192 /* Execution of commands depends on children per line (::) */
193 OP_DOUBLEDEP = 1 << 2,
194
195 OP_OPMASK = OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP,
196
197 /* Don't care if the target doesn't exist and can't be created */
198 OP_OPTIONAL = 1 << 3,
199 /* Use associated commands for parents */
200 OP_USE = 1 << 4,
201 /* Target is never out of date, but always execute commands anyway.
202 * Its time doesn't matter, so it has none...sort of */
203 OP_EXEC = 1 << 5,
204 /* Ignore errors when creating the node */
205 OP_IGNORE = 1 << 6,
206 /* Don't remove the target when interrupted */
207 OP_PRECIOUS = 1 << 7,
208 /* Don't echo commands when executed */
209 OP_SILENT = 1 << 8,
210 /* Target is a recursive make so its commands should always be executed
211 * when it is out of date, regardless of the state of the -n or -t flags */
212 OP_MAKE = 1 << 9,
213 /* Target is out-of-date only if any of its children was out-of-date */
214 OP_JOIN = 1 << 10,
215 /* Assume the children of the node have been already made */
216 OP_MADE = 1 << 11,
217 /* Special .BEGIN, .END, .INTERRUPT */
218 OP_SPECIAL = 1 << 12,
219 /* Like .USE, only prepend commands */
220 OP_USEBEFORE = 1 << 13,
221 /* The node is invisible to its parents. I.e. it doesn't show up in the
222 * parents' local variables. */
223 OP_INVISIBLE = 1 << 14,
224 /* The node is exempt from normal 'main target' processing in parse.c */
225 OP_NOTMAIN = 1 << 15,
226 /* Not a file target; run always */
227 OP_PHONY = 1 << 16,
228 /* Don't search for file in the path */
229 OP_NOPATH = 1 << 17,
230 /* .WAIT phony node */
231 OP_WAIT = 1 << 18,
232 /* .NOMETA do not create a .meta file */
233 OP_NOMETA = 1 << 19,
234 /* .META we _do_ want a .meta file */
235 OP_META = 1 << 20,
236 /* Do not compare commands in .meta file */
237 OP_NOMETA_CMP = 1 << 21,
238 /* Possibly a submake node */
239 OP_SUBMAKE = 1 << 22,
240
241 /* Attributes applied by PMake */
242
243 /* The node is a transformation rule */
244 OP_TRANSFORM = 1 << 31,
245 /* Target is a member of an archive */
246 OP_MEMBER = 1 << 30,
247 /* Target is a library */
248 OP_LIB = 1 << 29,
249 /* Target is an archive construct */
250 OP_ARCHV = 1 << 28,
251 /* Target has all the commands it should. Used when parsing to catch
252 * multiple commands for a target. */
253 OP_HAS_COMMANDS = 1 << 27,
254 /* The special command "..." has been seen. All further commands from
255 * this node will be saved on the .END node instead, to be executed at
256 * the very end. */
257 OP_SAVE_CMDS = 1 << 26,
258 /* Already processed by Suff_FindDeps */
259 OP_DEPS_FOUND = 1 << 25,
260 /* Node found while expanding .ALLSRC */
261 OP_MARK = 1 << 24
262 } GNodeType;
263
264 typedef enum {
265 REMAKE = 0x0001, /* this target needs to be (re)made */
266 CHILDMADE = 0x0002, /* children of this target were made */
267 FORCE = 0x0004, /* children don't exist, and we pretend made */
268 DONE_WAIT = 0x0008, /* Set by Make_ProcessWait() */
269 DONE_ORDER = 0x0010, /* Build requested by .ORDER processing */
270 FROM_DEPEND = 0x0020, /* Node created from .depend */
271 DONE_ALLSRC = 0x0040, /* We do it once only */
272 CYCLE = 0x1000, /* Used by MakePrintStatus */
273 DONECYCLE = 0x2000, /* Used by MakePrintStatus */
274 INTERNAL = 0x4000 /* Internal use only */
275 } GNodeFlags;
276
277 typedef struct List StringList;
278 typedef struct ListNode StringListNode;
279
280 typedef struct List GNodeList;
281 typedef struct ListNode GNodeListNode;
282
283 typedef struct List /* of CachedDir */ SearchPath;
284
285 /* A graph node represents a target that can possibly be made, including its
286 * relation to other targets and a lot of other details. */
287 typedef struct GNode {
288 /* The target's name, such as "clean" or "make.c" */
289 char *name;
290 /* The unexpanded name of a .USE node */
291 char *uname;
292 /* The full pathname of the file belonging to the target.
293 * XXX: What about .PHONY targets? These don't have an associated path. */
294 char *path;
295
296 /* The type of operator used to define the sources (see the OP flags below).
297 * XXX: This looks like a wild mixture of type and flags. */
298 GNodeType type;
299 /* whether it is involved in this invocation of make */
300 GNodeFlags flags;
301
302 /* The state of processing on this node */
303 GNodeMade made;
304 int unmade; /* The number of unmade children */
305
306 time_t mtime; /* Its modification time */
307 struct GNode *cmgn; /* The youngest child */
308
309 /* The GNodes for which this node is an implied source. May be empty.
310 * For example, when there is an inference rule for .c.o, the node for
311 * file.c has the node for file.o in this list. */
312 GNodeList *implicitParents;
313
314 /* Other nodes of the same name for the :: operator. */
315 GNodeList *cohorts;
316
317 /* The nodes that depend on this one, or in other words, the nodes for
318 * which this is a source. */
319 GNodeList *parents;
320 /* The nodes on which this one depends. */
321 GNodeList *children;
322
323 /* .ORDER nodes we need made. The nodes that must be made (if they're
324 * made) before this node can be made, but that do not enter into the
325 * datedness of this node. */
326 GNodeList *order_pred;
327 /* .ORDER nodes who need us. The nodes that must be made (if they're made
328 * at all) after this node is made, but that do not depend on this node,
329 * in the normal sense. */
330 GNodeList *order_succ;
331
332 /* #n for this cohort */
333 char cohort_num[8];
334 /* The number of unmade instances on the cohorts list */
335 int unmade_cohorts;
336 /* Pointer to the first instance of a '::' node; only set when on a
337 * cohorts list */
338 struct GNode *centurion;
339
340 /* Last time (sequence number) we tried to make this node */
341 unsigned int checked;
342
343 /* The "local" variables that are specific to this target and this target
344 * only, such as $@, $<, $?. */
345 Hash_Table context;
346
347 /* The commands to be given to a shell to create this target. */
348 StringList *commands;
349
350 /* Suffix for the node (determined by Suff_FindDeps and opaque to everyone
351 * but the Suff module) */
352 struct Suff *suffix;
353
354 /* filename where the GNode got defined */
355 const char *fname;
356 /* line number where the GNode got defined */
357 int lineno;
358 } GNode;
359
360 #define NoExecute(gn) ((gn->type & OP_MAKE) ? noRecursiveExecute : noExecute)
361 /*
362 * OP_NOP will return TRUE if the node with the given type was not the
363 * object of a dependency operator
364 */
365 #define OP_NOP(t) (((t) & OP_OPMASK) == 0x00000000)
366
367 #define OP_NOTARGET (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)
368
369 /*
370 * The TARG_ constants are used when calling the Targ_FindNode and
371 * Targ_FindList functions in targ.c. They simply tell the functions what to
372 * do if the desired node(s) is (are) not found. If the TARG_CREATE constant
373 * is given, a new, empty node will be created for the target, placed in the
374 * table of all targets and its address returned. If TARG_NOCREATE is given,
375 * a NULL pointer will be returned.
376 */
377 #define TARG_NOCREATE 0x00 /* don't create it */
378 #define TARG_CREATE 0x01 /* create node if not found */
379 #define TARG_NOHASH 0x02 /* don't look in/add to hash table */
380
381 /*
382 * Error levels for parsing. PARSE_FATAL means the process cannot continue
383 * once the makefile has been parsed. PARSE_WARNING means it can. Passed
384 * as the first argument to Parse_Error.
385 */
386 #define PARSE_INFO 3
387 #define PARSE_WARNING 2
388 #define PARSE_FATAL 1
389
390 /*
391 * Values returned by Cond_EvalLine and Cond_EvalCondition.
392 */
393 typedef enum {
394 COND_PARSE, /* Parse the next lines */
395 COND_SKIP, /* Skip the next lines */
396 COND_INVALID /* Not a conditional statement */
397 } CondEvalResult;
398
399 /*
400 * Definitions for the "local" variables. Used only for clarity.
401 */
402 #define TARGET "@" /* Target of dependency */
403 #define OODATE "?" /* All out-of-date sources */
404 #define ALLSRC ">" /* All sources */
405 #define IMPSRC "<" /* Source implied by transformation */
406 #define PREFIX "*" /* Common prefix */
407 #define ARCHIVE "!" /* Archive in "archive(member)" syntax */
408 #define MEMBER "%" /* Member in "archive(member)" syntax */
409
410 #define FTARGET "@F" /* file part of TARGET */
411 #define DTARGET "@D" /* directory part of TARGET */
412 #define FIMPSRC "<F" /* file part of IMPSRC */
413 #define DIMPSRC "<D" /* directory part of IMPSRC */
414 #define FPREFIX "*F" /* file part of PREFIX */
415 #define DPREFIX "*D" /* directory part of PREFIX */
416
417 /*
418 * Global Variables
419 */
420 extern StringList *create; /* The list of target names specified on the
421 * command line. used to resolve #if
422 * make(...) statements */
423 extern SearchPath *dirSearchPath; /* The list of directories to search when
424 * looking for targets */
425
426 extern Boolean compatMake; /* True if we are make compatible */
427 extern Boolean ignoreErrors; /* True if should ignore all errors */
428 extern Boolean beSilent; /* True if should print no commands */
429 extern Boolean noExecute; /* True if should execute nothing */
430 extern Boolean noRecursiveExecute; /* True if should execute nothing */
431 extern Boolean allPrecious; /* True if every target is precious */
432 extern Boolean deleteOnError; /* True if failed targets should be deleted */
433 extern Boolean keepgoing; /* True if should continue on unaffected
434 * portions of the graph when have an error
435 * in one portion */
436 extern Boolean touchFlag; /* TRUE if targets should just be 'touched'
437 * if out of date. Set by the -t flag */
438 extern Boolean queryFlag; /* TRUE if we aren't supposed to really make
439 * anything, just see if the targets are out-
440 * of-date */
441 extern Boolean doing_depend; /* TRUE if processing .depend */
442
443 extern Boolean checkEnvFirst; /* TRUE if environment should be searched for
444 * variables before the global context */
445
446 extern Boolean parseWarnFatal; /* TRUE if makefile parsing warnings are
447 * treated as errors */
448
449 extern Boolean varNoExportEnv; /* TRUE if we should not export variables
450 * set on the command line to the env. */
451
452 extern GNode *DEFAULT; /* .DEFAULT rule */
453
454 extern GNode *VAR_INTERNAL; /* Variables defined internally by make
455 * which should not override those set by
456 * makefiles.
457 */
458 extern GNode *VAR_GLOBAL; /* Variables defined in a global context, e.g
459 * in the Makefile itself */
460 extern GNode *VAR_CMD; /* Variables defined on the command line */
461 extern char var_Error[]; /* Value returned by Var_Parse when an error
462 * is encountered. It actually points to
463 * an empty string, so naive callers needn't
464 * worry about it. */
465
466 extern time_t now; /* The time at the start of this whole
467 * process */
468
469 extern Boolean oldVars; /* Do old-style variable substitution */
470
471 extern SearchPath *sysIncPath; /* The system include path. */
472 extern SearchPath *defIncPath; /* The default include path. */
473
474 extern char curdir[]; /* Startup directory */
475 extern char *progname; /* The program name */
476 extern char *makeDependfile; /* .depend */
477 extern char **savedEnv; /* if we replaced environ this will be non-NULL */
478
479 extern int makelevel;
480
481 /*
482 * We cannot vfork() in a child of vfork().
483 * Most systems do not enforce this but some do.
484 */
485 #define vFork() ((getpid() == myPid) ? vfork() : fork())
486 extern pid_t myPid;
487
488 #define MAKEFLAGS ".MAKEFLAGS"
489 #define MAKEOVERRIDES ".MAKEOVERRIDES"
490 #define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */
491 #define MAKE_EXPORTED ".MAKE.EXPORTED" /* variables we export */
492 #define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all the makefiles we read */
493 #define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
494 #define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
495 #define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */
496 #define MAKE_MODE ".MAKE.MODE"
497 #ifndef MAKE_LEVEL_ENV
498 # define MAKE_LEVEL_ENV "MAKELEVEL"
499 #endif
500
501 /*
502 * debug control:
503 * There is one bit per module. It is up to the module what debug
504 * information to print.
505 */
506 extern FILE *debug_file; /* Output is written here - default stderr */
507 extern int debug;
508 #define DEBUG_ARCH 0x00001
509 #define DEBUG_COND 0x00002
510 #define DEBUG_DIR 0x00004
511 #define DEBUG_GRAPH1 0x00008
512 #define DEBUG_GRAPH2 0x00010
513 #define DEBUG_JOB 0x00020
514 #define DEBUG_MAKE 0x00040
515 #define DEBUG_SUFF 0x00080
516 #define DEBUG_TARG 0x00100
517 #define DEBUG_VAR 0x00200
518 #define DEBUG_FOR 0x00400
519 #define DEBUG_SHELL 0x00800
520 #define DEBUG_ERROR 0x01000
521 #define DEBUG_LOUD 0x02000
522 #define DEBUG_META 0x04000
523 #define DEBUG_HASH 0x08000
524
525 #define DEBUG_GRAPH3 0x10000
526 #define DEBUG_SCRIPT 0x20000
527 #define DEBUG_PARSE 0x40000
528 #define DEBUG_CWD 0x80000
529
530 #define DEBUG_LINT 0x100000
531
532 #define CONCAT(a,b) a##b
533
534 #define DEBUG(module) (debug & CONCAT(DEBUG_,module))
535
536 #include "nonints.h"
537
538 void Make_TimeStamp(GNode *, GNode *);
539 Boolean Make_OODate(GNode *);
540 void Make_ExpandUse(GNodeList *);
541 time_t Make_Recheck(GNode *);
542 void Make_HandleUse(GNode *, GNode *);
543 void Make_Update(GNode *);
544 void Make_DoAllVar(GNode *);
545 Boolean Make_Run(GNodeList *);
546 int dieQuietly(GNode *, int);
547 void PrintOnError(GNode *, const char *);
548 void Main_ExportMAKEFLAGS(Boolean);
549 Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
550 int mkTempFile(const char *, char **);
551 int str2Lst_Append(StringList *, char *, const char *);
552 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
553
554 #ifdef __GNUC__
555 #define UNCONST(ptr) ({ \
556 union __unconst { \
557 const void *__cp; \
558 void *__p; \
559 } __d; \
560 __d.__cp = ptr, __d.__p; })
561 #else
562 #define UNCONST(ptr) (void *)(ptr)
563 #endif
564
565 #ifndef MIN
566 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
567 #endif
568 #ifndef MAX
569 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
570 #endif
571
572 /* At least GNU/Hurd systems lack hardcoded MAXPATHLEN/PATH_MAX */
573 #include <limits.h>
574 #ifndef MAXPATHLEN
575 #define MAXPATHLEN 4096
576 #endif
577 #ifndef PATH_MAX
578 #define PATH_MAX MAXPATHLEN
579 #endif
580
581 #if defined(SYSV)
582 #define KILLPG(pid, sig) kill(-(pid), (sig))
583 #else
584 #define KILLPG(pid, sig) killpg((pid), (sig))
585 #endif
586
587 static inline MAKE_ATTR_UNUSED Boolean ch_isalnum(char ch)
588 { return isalnum((unsigned char)ch) != 0; }
589 static inline MAKE_ATTR_UNUSED Boolean ch_isalpha(char ch)
590 { return isalpha((unsigned char)ch) != 0; }
591 static inline MAKE_ATTR_UNUSED Boolean ch_isdigit(char ch)
592 { return isdigit((unsigned char)ch) != 0; }
593 static inline MAKE_ATTR_UNUSED Boolean ch_isspace(char ch)
594 { return isspace((unsigned char)ch) != 0; }
595 static inline MAKE_ATTR_UNUSED Boolean ch_isupper(char ch)
596 { return isupper((unsigned char)ch) != 0; }
597 static inline MAKE_ATTR_UNUSED char ch_tolower(char ch)
598 { return (char)tolower((unsigned char)ch); }
599 static inline MAKE_ATTR_UNUSED char ch_toupper(char ch)
600 { return (char)toupper((unsigned char)ch); }
601
602 #ifndef MAKE_NATIVE
603 #define MAKE_RCSID(id) static volatile char rcsid[] = id
604 #else
605 #include <sys/cdefs.h>
606 #ifndef lint
607 #define MAKE_RCSID(id) __RCSID(id)
608 #endif
609 #endif
610
611 #endif /* MAKE_MAKE_H */
612