| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef REMAKE_MAKEINT_H |
| 22 |
#define REMAKE_MAKEINT_H |
| 23 |
|
| 24 |
#include <config.h> |
| 25 |
#undef HAVE_CONFIG_H |
| 26 |
#define HAVE_CONFIG_H 1 |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#define _GNU_SOURCE 1 |
| 32 |
|
| 33 |
|
| 34 |
#if HAVE_ALLOCA_H |
| 35 |
# include <alloca.h> |
| 36 |
#else |
| 37 |
# ifdef _AIX |
| 38 |
#pragma alloca |
| 39 |
# else |
| 40 |
# if !defined(__GNUC__) && !defined(WINDOWS32) |
| 41 |
# ifndef alloca |
| 42 |
char *alloca (); |
| 43 |
# endif |
| 44 |
# endif |
| 45 |
# endif |
| 46 |
#endif |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
#ifndef MAKE_MAINTAINER_MODE |
| 51 |
# define NDEBUG 1 |
| 52 |
#endif |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
#ifdef WINDOWS32 |
| 59 |
# define GMK_BUILDING_MAKE |
| 60 |
#endif |
| 61 |
#include "gnuremake.h" |
| 62 |
|
| 63 |
#ifdef CRAY |
| 64 |
|
| 65 |
|
| 66 |
# define signal bsdsignal |
| 67 |
#endif |
| 68 |
|
| 69 |
|
| 70 |
#if defined(HAVE_DMALLOC_H) && defined(__GNUC__) |
| 71 |
# define __NO_STRING_INLINES |
| 72 |
#endif |
| 73 |
|
| 74 |
#include <stddef.h> |
| 75 |
#include <sys/types.h> |
| 76 |
#include <sys/stat.h> |
| 77 |
#include <signal.h> |
| 78 |
#include <stdio.h> |
| 79 |
#include <ctype.h> |
| 80 |
|
| 81 |
#ifdef HAVE_SYS_TIMEB_H |
| 82 |
|
| 83 |
|
| 84 |
# include <sys/timeb.h> |
| 85 |
#endif |
| 86 |
#if TIME_WITH_SYS_TIME |
| 87 |
# include <sys/time.h> |
| 88 |
# include <time.h> |
| 89 |
#else |
| 90 |
# if HAVE_SYS_TIME_H |
| 91 |
# include <sys/time.h> |
| 92 |
# else |
| 93 |
# include <time.h> |
| 94 |
# endif |
| 95 |
#endif |
| 96 |
|
| 97 |
#include <errno.h> |
| 98 |
|
| 99 |
#ifndef errno |
| 100 |
extern int errno; |
| 101 |
#endif |
| 102 |
|
| 103 |
#ifndef isblank |
| 104 |
# define isblank(c) ((c) == ' ' || (c) == '\t') |
| 105 |
#endif |
| 106 |
|
| 107 |
#ifdef HAVE_UNISTD_H |
| 108 |
# include <unistd.h> |
| 109 |
|
| 110 |
|
| 111 |
# if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS) |
| 112 |
# define POSIX 1 |
| 113 |
# endif |
| 114 |
#endif |
| 115 |
|
| 116 |
|
| 117 |
#if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386))) |
| 118 |
# undef POSIX |
| 119 |
#endif |
| 120 |
|
| 121 |
#if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE) |
| 122 |
# define POSIX 1 |
| 123 |
#endif |
| 124 |
|
| 125 |
#ifndef RETSIGTYPE |
| 126 |
# define RETSIGTYPE void |
| 127 |
#endif |
| 128 |
|
| 129 |
#ifndef sigmask |
| 130 |
# define sigmask(sig) (1 << ((sig) - 1)) |
| 131 |
#endif |
| 132 |
|
| 133 |
#ifndef HAVE_SA_RESTART |
| 134 |
# define SA_RESTART 0 |
| 135 |
#endif |
| 136 |
|
| 137 |
#ifdef HAVE_VFORK_H |
| 138 |
# include <vfork.h> |
| 139 |
#endif |
| 140 |
|
| 141 |
#ifdef HAVE_LIMITS_H |
| 142 |
# include <limits.h> |
| 143 |
#endif |
| 144 |
#ifdef HAVE_SYS_PARAM_H |
| 145 |
# include <sys/param.h> |
| 146 |
#endif |
| 147 |
|
| 148 |
#ifndef PATH_MAX |
| 149 |
# ifndef POSIX |
| 150 |
# define PATH_MAX MAXPATHLEN |
| 151 |
# endif |
| 152 |
#endif |
| 153 |
#ifndef MAXPATHLEN |
| 154 |
# define MAXPATHLEN 1024 |
| 155 |
#endif |
| 156 |
|
| 157 |
#ifdef PATH_MAX |
| 158 |
# define GET_PATH_MAX PATH_MAX |
| 159 |
# define PATH_VAR(var) char var[PATH_MAX+1] |
| 160 |
#else |
| 161 |
# define NEED_GET_PATH_MAX 1 |
| 162 |
# define GET_PATH_MAX (get_path_max ()) |
| 163 |
# define PATH_VAR(var) char *var = alloca (GET_PATH_MAX+1) |
| 164 |
unsigned int get_path_max (void); |
| 165 |
#endif |
| 166 |
|
| 167 |
#ifndef CHAR_BIT |
| 168 |
# define CHAR_BIT 8 |
| 169 |
#endif |
| 170 |
|
| 171 |
#ifndef USHRT_MAX |
| 172 |
# define USHRT_MAX 65535 |
| 173 |
#endif |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
#define INTEGER_TYPE_SIGNED(t) ((t) -1 <= 0) |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
#define INTEGER_TYPE_MINIMUM(t) \ |
| 182 |
(! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)) |
| 183 |
#define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t)) |
| 184 |
|
| 185 |
#ifndef CHAR_MAX |
| 186 |
# define CHAR_MAX INTEGER_TYPE_MAXIMUM (char) |
| 187 |
#endif |
| 188 |
|
| 189 |
#ifdef STAT_MACROS_BROKEN |
| 190 |
# ifdef S_ISREG |
| 191 |
# undef S_ISREG |
| 192 |
# endif |
| 193 |
# ifdef S_ISDIR |
| 194 |
# undef S_ISDIR |
| 195 |
# endif |
| 196 |
#endif |
| 197 |
|
| 198 |
#ifndef S_ISREG |
| 199 |
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) |
| 200 |
#endif |
| 201 |
#ifndef S_ISDIR |
| 202 |
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) |
| 203 |
#endif |
| 204 |
|
| 205 |
#ifdef VMS |
| 206 |
# include <fcntl.h> |
| 207 |
# include <types.h> |
| 208 |
# include <unixlib.h> |
| 209 |
# include <unixio.h> |
| 210 |
# include <perror.h> |
| 211 |
|
| 212 |
# include <builtins.h> |
| 213 |
#endif |
| 214 |
|
| 215 |
#if !defined(__attribute__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) |
| 216 |
|
| 217 |
# define ATTRIBUTE(x) |
| 218 |
#else |
| 219 |
# define ATTRIBUTE(x) __attribute__ (x) |
| 220 |
#endif |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) |
| 225 |
# define __format__ format |
| 226 |
# define __printf__ printf |
| 227 |
#endif |
| 228 |
|
| 229 |
#define UNUSED ATTRIBUTE ((unused)) |
| 230 |
#define NORETURN ATTRIBUTE ((noreturn)) |
| 231 |
|
| 232 |
#if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) |
| 233 |
# include <stdlib.h> |
| 234 |
# include <string.h> |
| 235 |
# define ANSI_STRING 1 |
| 236 |
#else |
| 237 |
# ifdef HAVE_STRING_H |
| 238 |
# include <string.h> |
| 239 |
# define ANSI_STRING 1 |
| 240 |
# else |
| 241 |
# include <strings.h> |
| 242 |
# endif |
| 243 |
# ifdef HAVE_MEMORY_H |
| 244 |
# include <memory.h> |
| 245 |
# endif |
| 246 |
# ifdef HAVE_STDLIB_H |
| 247 |
# include <stdlib.h> |
| 248 |
# else |
| 249 |
void *malloc (int); |
| 250 |
void *realloc (void *, int); |
| 251 |
void free (void *); |
| 252 |
|
| 253 |
void abort (void) NORETURN; |
| 254 |
void exit (int) NORETURN; |
| 255 |
# endif |
| 256 |
|
| 257 |
#endif |
| 258 |
|
| 259 |
|
| 260 |
#ifndef EXIT_SUCCESS |
| 261 |
# define EXIT_SUCCESS 0 |
| 262 |
#endif |
| 263 |
#ifndef EXIT_FAILURE |
| 264 |
# define EXIT_FAILURE 1 |
| 265 |
#endif |
| 266 |
|
| 267 |
#ifndef ANSI_STRING |
| 268 |
|
| 269 |
|
| 270 |
#undef strerror |
| 271 |
#if !defined(__DECC) |
| 272 |
char *strerror (int errnum); |
| 273 |
#endif |
| 274 |
|
| 275 |
#endif |
| 276 |
#undef ANSI_STRING |
| 277 |
|
| 278 |
#if HAVE_INTTYPES_H |
| 279 |
# include <inttypes.h> |
| 280 |
#endif |
| 281 |
#if HAVE_STDINT_H |
| 282 |
# include <stdint.h> |
| 283 |
#endif |
| 284 |
#define FILE_TIMESTAMP uintmax_t |
| 285 |
|
| 286 |
#if !defined(HAVE_STRSIGNAL) |
| 287 |
char *strsignal (int signum); |
| 288 |
#endif |
| 289 |
|
| 290 |
#if !defined(HAVE_UMASK) |
| 291 |
typedef int mode_t; |
| 292 |
extern mode_t umask (mode_t); |
| 293 |
#endif |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) |
| 305 |
|
| 306 |
|
| 307 |
#define streq(a, b) \ |
| 308 |
((a) == (b) || \ |
| 309 |
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1)))) |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
#ifdef HAVE_CASE_INSENSITIVE_FS |
| 315 |
# define patheq(a, b) \ |
| 316 |
((a) == (b) \ |
| 317 |
|| (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \ |
| 318 |
&& (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1)))) |
| 319 |
#else |
| 320 |
# define patheq(a, b) streq(a, b) |
| 321 |
#endif |
| 322 |
|
| 323 |
#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0) |
| 324 |
|
| 325 |
#if defined(ENUM_BITFIELDS) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) |
| 326 |
# define ENUM_BITFIELD(bits) :bits |
| 327 |
#else |
| 328 |
# define ENUM_BITFIELD(bits) |
| 329 |
#endif |
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
#if HAVE_LOCALE_H |
| 334 |
# include <locale.h> |
| 335 |
#else |
| 336 |
# define setlocale(category, locale) |
| 337 |
#endif |
| 338 |
|
| 339 |
#include <gettext.h> |
| 340 |
|
| 341 |
#define _(msgid) gettext (msgid) |
| 342 |
#define N_(msgid) gettext_noop (msgid) |
| 343 |
#define S_(msg1,msg2,num) ngettext (msg1,msg2,num) |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
#if defined(HAVE_DOS_PATHS) && !defined(__CYGWIN__) |
| 350 |
# undef PATH_SEPARATOR_CHAR |
| 351 |
# define PATH_SEPARATOR_CHAR ';' |
| 352 |
#elif !defined(PATH_SEPARATOR_CHAR) |
| 353 |
# if defined (VMS) |
| 354 |
# define PATH_SEPARATOR_CHAR ',' |
| 355 |
# else |
| 356 |
# define PATH_SEPARATOR_CHAR ':' |
| 357 |
# endif |
| 358 |
#endif |
| 359 |
|
| 360 |
|
| 361 |
#if defined(HAVE_DIRECT_H) |
| 362 |
# include <direct.h> |
| 363 |
#endif |
| 364 |
|
| 365 |
#ifdef WINDOWS32 |
| 366 |
# include <fcntl.h> |
| 367 |
# include <malloc.h> |
| 368 |
# define pipe(_p) _pipe((_p), 512, O_BINARY) |
| 369 |
# define kill(_pid,_sig) w32_kill((_pid),(_sig)) |
| 370 |
|
| 371 |
# if defined(_MSC_VER) || defined(__WATCOMC__) |
| 372 |
# define ftruncate(_fd,_len) _chsize(_fd,_len) |
| 373 |
# endif |
| 374 |
|
| 375 |
# ifndef _S_ISDIR |
| 376 |
# define _S_ISDIR(m) S_ISDIR(m) |
| 377 |
# endif |
| 378 |
|
| 379 |
void sync_Path_environment (void); |
| 380 |
int w32_kill (pid_t pid, int sig); |
| 381 |
int find_and_set_default_shell (const char *token); |
| 382 |
|
| 383 |
|
| 384 |
extern int no_default_sh_exe; |
| 385 |
|
| 386 |
|
| 387 |
extern int unixy_shell; |
| 388 |
|
| 389 |
|
| 390 |
# ifndef LOCALEDIR |
| 391 |
# define LOCALEDIR NULL |
| 392 |
# endif |
| 393 |
|
| 394 |
|
| 395 |
# define WIN32_LEAN_AND_MEAN |
| 396 |
#endif |
| 397 |
|
| 398 |
#define ANY_SET(_v,_m) (((_v)&(_m)) != 0) |
| 399 |
#define NONE_SET(_v,_m) (! ANY_SET ((_v),(_m))) |
| 400 |
|
| 401 |
#define MAP_NUL 0x0001 |
| 402 |
#define MAP_BLANK 0x0002 |
| 403 |
#define MAP_NEWLINE 0x0004 |
| 404 |
#define MAP_COMMENT 0x0008 |
| 405 |
#define MAP_SEMI 0x0010 |
| 406 |
#define MAP_EQUALS 0x0020 |
| 407 |
#define MAP_COLON 0x0040 |
| 408 |
#define MAP_VARSEP 0x0080 |
| 409 |
#define MAP_PIPE 0x0100 |
| 410 |
#define MAP_DOT 0x0200 |
| 411 |
#define MAP_COMMA 0x0400 |
| 412 |
|
| 413 |
|
| 414 |
#define MAP_USERFUNC 0x2000 |
| 415 |
|
| 416 |
#define MAP_VARIABLE 0x4000 |
| 417 |
|
| 418 |
#define MAP_DIRSEP 0x8000 |
| 419 |
|
| 420 |
#define MAP_SPACE (MAP_BLANK|MAP_NEWLINE) |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
#if defined(HAVE_DOS_PATHS) && !defined(__CYGWIN__) |
| 427 |
# undef PATH_SEPARATOR_CHAR |
| 428 |
# define PATH_SEPARATOR_CHAR ';' |
| 429 |
# define MAP_PATHSEP MAP_SEMI |
| 430 |
#elif !defined(PATH_SEPARATOR_CHAR) |
| 431 |
#define PATH_SEPARATOR_CHAR ':' |
| 432 |
#define MAP_PATHSEP MAP_COLON |
| 433 |
#elif PATH_SEPARATOR_CHAR == ':' |
| 434 |
# define MAP_PATHSEP MAP_COLON |
| 435 |
#elif PATH_SEPARATOR_CHAR == ';' |
| 436 |
# define MAP_PATHSEP MAP_SEMI |
| 437 |
#elif PATH_SEPARATOR_CHAR == ',' |
| 438 |
# define MAP_PATHSEP MAP_COMMA |
| 439 |
#else |
| 440 |
# error "Unknown PATH_SEPARATOR_CHAR" |
| 441 |
#endif |
| 442 |
|
| 443 |
#define STOP_SET(_v,_m) ANY_SET(stopchar_map[(unsigned char)(_v)],(_m)) |
| 444 |
|
| 445 |
#define ISBLANK(c) STOP_SET((c),MAP_BLANK) |
| 446 |
#define ISSPACE(c) STOP_SET((c),MAP_SPACE) |
| 447 |
#define NEXT_TOKEN(s) while (ISSPACE (*(s))) ++(s) |
| 448 |
#define END_OF_TOKEN(s) while (! STOP_SET (*(s), MAP_SPACE|MAP_NUL)) ++(s) |
| 449 |
|
| 450 |
|
| 451 |
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && !defined(USE_POSIX_SPAWN) |
| 452 |
# define SET_STACK_SIZE |
| 453 |
#endif |
| 454 |
#ifdef SET_STACK_SIZE |
| 455 |
# include <sys/resource.h> |
| 456 |
extern struct rlimit stack_limit; |
| 457 |
#endif |
| 458 |
|
| 459 |
#include <glob.h> |
| 460 |
|
| 461 |
#define NILF ((gmk_floc *)0) |
| 462 |
|
| 463 |
#define CSTRLEN(_s) (sizeof (_s)-1) |
| 464 |
#define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s) |
| 465 |
|
| 466 |
|
| 467 |
#define INTSTR_LENGTH CSTRLEN ("18446744073709551616") |
| 468 |
|
| 469 |
#define DEFAULT_TTYNAME "true" |
| 470 |
#ifdef HAVE_TTYNAME |
| 471 |
# define TTYNAME(_f) ttyname (_f) |
| 472 |
#else |
| 473 |
# define TTYNAME(_f) DEFAULT_TTYNAME |
| 474 |
#endif |
| 475 |
|
| 476 |
|
| 477 |
const char *concat (unsigned int, ...); |
| 478 |
void message (int prefix, size_t length, const char *fmt, ...) |
| 479 |
ATTRIBUTE ((__format__ (__printf__, 3, 4))); |
| 480 |
void error (const gmk_floc *flocp, size_t length, const char *fmt, ...) |
| 481 |
ATTRIBUTE ((__format__ (__printf__, 3, 4))); |
| 482 |
void fatal (const gmk_floc *flocp, size_t length, const char *fmt, ...) |
| 483 |
ATTRIBUTE ((noreturn, __format__ (__printf__, 3, 4))); |
| 484 |
void out_of_memory () NORETURN; |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
#define O(_t,_a,_f) _t((_a), 0, (_f)) |
| 489 |
#define OS(_t,_a,_f,_s) _t((_a), strlen (_s), (_f), (_s)) |
| 490 |
#define OSS(_t,_a,_f,_s1,_s2) _t((_a), strlen (_s1) + strlen (_s2), \ |
| 491 |
(_f), (_s1), (_s2)) |
| 492 |
#define OSSS(_t,_a,_f,_s1,_s2,_s3) _t((_a), strlen (_s1) + strlen (_s2) + strlen (_s3), \ |
| 493 |
(_f), (_s1), (_s2), (_s3)) |
| 494 |
#define ON(_t,_a,_f,_n) _t((_a), INTSTR_LENGTH, (_f), (_n)) |
| 495 |
#define ONN(_t,_a,_f,_n1,_n2) _t((_a), INTSTR_LENGTH*2, (_f), (_n1), (_n2)) |
| 496 |
|
| 497 |
#define OSN(_t,_a,_f,_s,_n) _t((_a), strlen (_s) + INTSTR_LENGTH, \ |
| 498 |
(_f), (_s), (_n)) |
| 499 |
#define ONS(_t,_a,_f,_n,_s) _t((_a), INTSTR_LENGTH + strlen (_s), \ |
| 500 |
(_f), (_n), (_s)) |
| 501 |
|
| 502 |
#define OUT_OF_MEM() O (fatal, NILF, _("virtual memory exhausted")) |
| 503 |
|
| 504 |
void die (int) NORETURN; |
| 505 |
void pfatal_with_name (const char *) NORETURN; |
| 506 |
void perror_with_name (const char *, const char *); |
| 507 |
#define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s)) |
| 508 |
void *xmalloc (size_t); |
| 509 |
void *xcalloc (size_t); |
| 510 |
void *xrealloc (void *, size_t); |
| 511 |
char *xstrdup (const char *); |
| 512 |
char *xstrndup (const char *, size_t); |
| 513 |
char *find_next_token (const char **, size_t *); |
| 514 |
char *next_token (const char *); |
| 515 |
char *end_of_token (const char *); |
| 516 |
void collapse_continuations (char *); |
| 517 |
char *lindex (const char *, const char *, int); |
| 518 |
int alpha_compare (const void *, const void *); |
| 519 |
void print_spaces (unsigned int); |
| 520 |
char *find_percent (char *); |
| 521 |
const char *find_percent_cached (const char **); |
| 522 |
FILE *get_tmpfile (char **, const char *); |
| 523 |
ssize_t writebuf (int, const void *, size_t); |
| 524 |
ssize_t readbuf (int, void *, size_t); |
| 525 |
|
| 526 |
#ifndef HAVE_MEMRCHR |
| 527 |
void *memrchr(const void *, int, size_t); |
| 528 |
#endif |
| 529 |
|
| 530 |
#ifndef NO_ARCHIVES |
| 531 |
int ar_name (const char *); |
| 532 |
void ar_parse_name (const char *, char **, char **); |
| 533 |
int ar_touch (const char *); |
| 534 |
int ar_member_date (const char *, time_t *); |
| 535 |
|
| 536 |
typedef long int (*ar_member_func_t) (int desc, const char *mem, int truncated, |
| 537 |
long int hdrpos, long int datapos, |
| 538 |
long int size, long int date, int uid, |
| 539 |
int gid, unsigned int mode, |
| 540 |
const void *arg); |
| 541 |
|
| 542 |
long int ar_scan (const char *archive, ar_member_func_t function, const void *arg); |
| 543 |
int ar_name_equal (const char *name, const char *mem, int truncated); |
| 544 |
int ar_member_touch (const char *arname, const char *memname); |
| 545 |
#endif |
| 546 |
|
| 547 |
int dir_file_exists_p (const char *, const char *); |
| 548 |
int file_exists_p (const char *); |
| 549 |
int file_impossible_p (const char *); |
| 550 |
void file_impossible (const char *); |
| 551 |
const char *dir_name (const char *); |
| 552 |
void print_dir_data_base (void); |
| 553 |
void dir_setup_glob (glob_t *); |
| 554 |
void hash_init_directories (void); |
| 555 |
|
| 556 |
void define_default_variables (void); |
| 557 |
void undefine_default_variables (void); |
| 558 |
void set_default_suffixes (void); |
| 559 |
void install_default_suffix_rules (void); |
| 560 |
void install_default_implicit_rules (void); |
| 561 |
|
| 562 |
void build_vpath_lists (void); |
| 563 |
void construct_vpath_list (char *pattern, char *dirpath); |
| 564 |
const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr, |
| 565 |
unsigned int* vpath_index, unsigned int* path_index); |
| 566 |
|
| 567 |
|
| 568 |
void construct_include_path (const char **arg_dirs); |
| 569 |
|
| 570 |
void user_access (void); |
| 571 |
void make_access (void); |
| 572 |
void child_access (void); |
| 573 |
|
| 574 |
char *strip_whitespace (const char **begpp, const char **endpp); |
| 575 |
|
| 576 |
void show_goal_error (void); |
| 577 |
|
| 578 |
|
| 579 |
void strcache_init (void); |
| 580 |
void strcache_print_stats (const char *prefix); |
| 581 |
int strcache_iscached (const char *str); |
| 582 |
const char *strcache_add (const char *str); |
| 583 |
const char *strcache_add_len (const char *str, size_t len); |
| 584 |
int strcache_setbufsize (unsigned int size); |
| 585 |
|
| 586 |
|
| 587 |
int guile_gmake_setup (const gmk_floc *flocp); |
| 588 |
|
| 589 |
|
| 590 |
typedef int (*load_func_t)(const gmk_floc *flocp); |
| 591 |
int load_file (const gmk_floc *flocp, const char **filename, int noerror); |
| 592 |
void unload_file (const char *name); |
| 593 |
|
| 594 |
|
| 595 |
#ifdef MAKE_MAINTAINER_MODE |
| 596 |
# define SPIN(_s) spin (_s) |
| 597 |
void spin (const char* suffix); |
| 598 |
#else |
| 599 |
# define SPIN(_s) |
| 600 |
#endif |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32) |
| 606 |
|
| 607 |
long int atol (); |
| 608 |
# ifndef VMS |
| 609 |
long int lseek (); |
| 610 |
# endif |
| 611 |
|
| 612 |
#endif |
| 613 |
|
| 614 |
#ifdef HAVE_GETCWD |
| 615 |
#else |
| 616 |
char *getwd (); |
| 617 |
# define getcwd(buf, len) getwd (buf) |
| 618 |
#endif |
| 619 |
|
| 620 |
#if !HAVE_STRCASECMP |
| 621 |
# if HAVE_STRICMP |
| 622 |
# define strcasecmp stricmp |
| 623 |
# elif HAVE_STRCMPI |
| 624 |
# define strcasecmp strcmpi |
| 625 |
# else |
| 626 |
|
| 627 |
int strcasecmp (const char *s1, const char *s2); |
| 628 |
# endif |
| 629 |
#endif |
| 630 |
|
| 631 |
#if !HAVE_STRNCASECMP |
| 632 |
# if HAVE_STRNICMP |
| 633 |
# define strncasecmp strnicmp |
| 634 |
# elif HAVE_STRNCMPI |
| 635 |
# define strncasecmp strncmpi |
| 636 |
# else |
| 637 |
|
| 638 |
int strncasecmp (const char *s1, const char *s2, int n); |
| 639 |
# endif |
| 640 |
#endif |
| 641 |
|
| 642 |
extern const gmk_floc *reading_file; |
| 643 |
extern const gmk_floc **expanding_var; |
| 644 |
|
| 645 |
extern char **environ; |
| 646 |
|
| 647 |
extern unsigned short stopchar_map[]; |
| 648 |
|
| 649 |
extern int just_print_flag, run_silent, ignore_errors_flag, keep_going_flag; |
| 650 |
extern int print_data_base_flag, question_flag, touch_flag, always_make_flag; |
| 651 |
extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag; |
| 652 |
extern int print_version_flag, print_directory, check_symlink_flag; |
| 653 |
extern int warn_undefined_variables_flag, trace_flag, posix_pedantic; |
| 654 |
extern int not_parallel, second_expansion, clock_skew_detected; |
| 655 |
extern int rebuilding_makefiles, one_shell, output_sync, verify_flag; |
| 656 |
|
| 657 |
|
| 658 |
extern int batch_mode_shell; |
| 659 |
|
| 660 |
|
| 661 |
#define RECIPEPREFIX_NAME ".RECIPEPREFIX" |
| 662 |
#define RECIPEPREFIX_DEFAULT '\t' |
| 663 |
extern char cmd_prefix; |
| 664 |
|
| 665 |
extern unsigned int job_slots; |
| 666 |
extern int job_fds[2]; |
| 667 |
extern int job_rfd; |
| 668 |
extern double max_load_average; |
| 669 |
|
| 670 |
extern const char *program; |
| 671 |
|
| 672 |
void remote_setup (void); |
| 673 |
void remote_cleanup (void); |
| 674 |
int start_remote_job_p (int); |
| 675 |
int start_remote_job (char **, char **, int, int *, pid_t *, int *); |
| 676 |
int remote_status (int *, int *, int *, int); |
| 677 |
void block_remote_children (void); |
| 678 |
void unblock_remote_children (void); |
| 679 |
int remote_kill (pid_t id, int sig); |
| 680 |
void print_variable_data_base (void); |
| 681 |
void print_vpath_data_base (void); |
| 682 |
|
| 683 |
extern char *starting_directory; |
| 684 |
extern unsigned int makelevel; |
| 685 |
extern pid_t makeparent_pid; |
| 686 |
extern char *makeparent_target; |
| 687 |
extern char *version_string, *remote_description, *make_host; |
| 688 |
|
| 689 |
extern unsigned int commands_started; |
| 690 |
|
| 691 |
extern int handling_fatal_signal; |
| 692 |
|
| 693 |
#ifndef MIN |
| 694 |
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) |
| 695 |
#endif |
| 696 |
#ifndef MAX |
| 697 |
#define MAX(_a,_b) ((_a)>(_b)?(_a):(_b)) |
| 698 |
#endif |
| 699 |
|
| 700 |
#define MAKE_SUCCESS 0 |
| 701 |
#define MAKE_TROUBLE 1 |
| 702 |
#define MAKE_FAILURE 2 |
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
#ifdef HAVE_DMALLOC_H |
| 707 |
#include <dmalloc.h> |
| 708 |
#endif |
| 709 |
|
| 710 |
#ifndef initialize_main |
| 711 |
# ifdef __EMX__ |
| 712 |
# define initialize_main(pargc, pargv) \ |
| 713 |
{ _wildcard(pargc, pargv); _response(pargc, pargv); } |
| 714 |
# else |
| 715 |
# define initialize_main(pargc, pargv) |
| 716 |
# endif |
| 717 |
#endif |
| 718 |
|
| 719 |
#ifdef __EMX__ |
| 720 |
# if !defined chdir |
| 721 |
# define chdir _chdir2 |
| 722 |
# endif |
| 723 |
# if !defined getcwd |
| 724 |
# define getcwd _getcwd2 |
| 725 |
# endif |
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
# ifdef NO_CHDIR2 |
| 731 |
# warning NO_CHDIR2: usage of drive letters restricted |
| 732 |
# undef chdir |
| 733 |
# undef getcwd |
| 734 |
# endif |
| 735 |
#endif |
| 736 |
|
| 737 |
#ifndef initialize_main |
| 738 |
# define initialize_main(pargc, pargv) |
| 739 |
#endif |
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
#define EINTRLOOP(_v,_c) while (((_v)=_c)==-1 && errno==EINTR) |
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
#define ENULLLOOP(_v,_c) do { errno = 0; (_v) = _c; } \ |
| 759 |
while((_v)==0 && errno==EINTR) |
| 760 |
|
| 761 |
#endif |