21 #ifndef REMAKE_MAKEINT_H 22 #define REMAKE_MAKEINT_H 26 #define HAVE_CONFIG_H 1 40 # if !defined(__GNUC__) && !defined(WINDOWS32) 50 #ifndef MAKE_MAINTAINER_MODE 59 # define GMK_BUILDING_MAKE 66 # define signal bsdsignal 70 #if defined(HAVE_DMALLOC_H) && defined(__GNUC__) 71 # define __NO_STRING_INLINES 75 #include <sys/types.h> 81 #ifdef HAVE_SYS_TIMEB_H 84 # include <sys/timeb.h> 86 #if TIME_WITH_SYS_TIME 87 # include <sys/time.h> 91 # include <sys/time.h> 104 # define isblank(c) ((c) == ' ' || (c) == '\t') 111 # if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS) 117 #if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386))) 121 #if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE) 126 # define RETSIGTYPE void 130 # define sigmask(sig) (1 << ((sig) - 1)) 133 #ifndef HAVE_SA_RESTART 134 # define SA_RESTART 0 144 #ifdef HAVE_SYS_PARAM_H 145 # include <sys/param.h> 150 # define PATH_MAX MAXPATHLEN 154 # define MAXPATHLEN 1024 158 # define GET_PATH_MAX PATH_MAX 159 # define PATH_VAR(var) char var[PATH_MAX+1] 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);
172 # define USHRT_MAX 65535 177 #define INTEGER_TYPE_SIGNED(t) ((t) -1 <= 0) 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)) 186 # define CHAR_MAX INTEGER_TYPE_MAXIMUM (char) 189 #ifdef STAT_MACROS_BROKEN 199 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) 202 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) 208 # include <unixlib.h> 212 # include <builtins.h> 215 #if !defined(__attribute__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) 217 # define ATTRIBUTE(x) 219 # define ATTRIBUTE(x) __attribute__ (x) 224 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) 225 # define __format__ format 226 # define __printf__ printf 229 #define UNUSED ATTRIBUTE ((unused)) 230 #define NORETURN ATTRIBUTE ((noreturn)) 232 #if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) 235 # define ANSI_STRING 1 237 # ifdef HAVE_STRING_H 239 # define ANSI_STRING 1 241 # include <strings.h> 243 # ifdef HAVE_MEMORY_H 246 # ifdef HAVE_STDLIB_H 250 void *realloc (
void *,
int);
261 # define EXIT_SUCCESS 0 264 # define EXIT_FAILURE 1 272 char *strerror (
int errnum);
279 # include <inttypes.h> 284 #define FILE_TIMESTAMP uintmax_t 286 #if !defined(HAVE_STRSIGNAL) 287 char *strsignal (
int signum);
290 #if !defined(HAVE_UMASK) 292 extern mode_t umask (mode_t);
304 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) 307 #define streq(a, b) \ 309 (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1)))) 314 #ifdef HAVE_CASE_INSENSITIVE_FS 315 # define patheq(a, b) \ 317 || (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \ 318 && (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1)))) 320 # define patheq(a, b) streq(a, b) 323 #define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0) 325 #if defined(ENUM_BITFIELDS) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) 326 # define ENUM_BITFIELD(bits) :bits 328 # define ENUM_BITFIELD(bits) 336 # define setlocale(category, locale) 341 #define _(msgid) gettext (msgid) 342 #define N_(msgid) gettext_noop (msgid) 343 #define S_(msg1,msg2,num) ngettext (msg1,msg2,num) 349 #if defined(HAVE_DOS_PATHS) && !defined(__CYGWIN__) 350 # undef PATH_SEPARATOR_CHAR 351 # define PATH_SEPARATOR_CHAR ';' 352 #elif !defined(PATH_SEPARATOR_CHAR) 354 # define PATH_SEPARATOR_CHAR ',' 356 # define PATH_SEPARATOR_CHAR ':' 361 #if defined(HAVE_DIRECT_H) 368 # define pipe(_p) _pipe((_p), 512, O_BINARY) 369 # define kill(_pid,_sig) w32_kill((_pid),(_sig)) 371 # if defined(_MSC_VER) || defined(__WATCOMC__) 372 # define ftruncate(_fd,_len) _chsize(_fd,_len) 376 # define _S_ISDIR(m) S_ISDIR(m) 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);
384 extern int no_default_sh_exe;
391 # define LOCALEDIR NULL 395 # define WIN32_LEAN_AND_MEAN 398 #define ANY_SET(_v,_m) (((_v)&(_m)) != 0) 399 #define NONE_SET(_v,_m) (! ANY_SET ((_v),(_m))) 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 414 #define MAP_USERFUNC 0x2000 416 #define MAP_VARIABLE 0x4000 418 #define MAP_DIRSEP 0x8000 420 #define MAP_SPACE (MAP_BLANK|MAP_NEWLINE) 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 440 # error "Unknown PATH_SEPARATOR_CHAR" 443 #define STOP_SET(_v,_m) ANY_SET(stopchar_map[(unsigned char)(_v)],(_m)) 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) 451 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && !defined(USE_POSIX_SPAWN) 452 # define SET_STACK_SIZE 454 #ifdef SET_STACK_SIZE 455 # include <sys/resource.h> 461 #define NILF ((gmk_floc *)0) 463 #define CSTRLEN(_s) (sizeof (_s)-1) 464 #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s) 467 #define INTSTR_LENGTH CSTRLEN ("18446744073709551616") 469 #define DEFAULT_TTYNAME "true" 471 # define TTYNAME(_f) ttyname (_f) 473 # define TTYNAME(_f) DEFAULT_TTYNAME 477 const char *
concat (
unsigned int, ...);
478 void message (
int prefix,
size_t length,
const char *fmt, ...)
480 void error (const
gmk_floc *flocp,
size_t length, const
char *fmt, ...)
482 void fatal (const
gmk_floc *flocp,
size_t length, const
char *fmt, ...)
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), \ 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)) 497 #define OSN(_t,_a,_f,_s,_n) _t((_a), strlen (_s) + INTSTR_LENGTH, \ 499 #define ONS(_t,_a,_f,_n,_s) _t((_a), INTSTR_LENGTH + strlen (_s), \ 502 #define OUT_OF_MEM() O (fatal, NILF, _("virtual memory exhausted")) 507 #define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s)) 512 char *
xstrndup (
const char *,
size_t);
517 char *
lindex (
const char *,
const char *,
int);
523 ssize_t
writebuf (
int,
const void *,
size_t);
524 ssize_t
readbuf (
int,
void *,
size_t);
527 void *memrchr(
const void *,
int,
size_t);
537 long int hdrpos,
long int datapos,
538 long int size,
long int date,
int uid,
539 int gid,
unsigned int mode,
543 int ar_name_equal (
const char *name,
const char *mem,
int truncated);
551 const char *
dir_name (
const char *);
565 unsigned int* vpath_index,
unsigned int* path_index);
595 #ifdef MAKE_MAINTAINER_MODE 596 # define SPIN(_s) spin (_s) 597 void spin (
const char* suffix);
605 #if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32) 615 # if !defined(VMS) && !defined(__DECC) 620 # define getcwd(buf, len) getwd (buf) 625 # define strcasecmp stricmp 627 # define strcasecmp strcmpi 630 int strcasecmp (
const char *s1,
const char *s2);
634 #if !HAVE_STRNCASECMP 636 # define strncasecmp strnicmp 638 # define strncasecmp strncmpi 641 int strncasecmp (
const char *s1,
const char *s2,
int n);
664 #define RECIPEPREFIX_NAME ".RECIPEPREFIX" 665 #define RECIPEPREFIX_DEFAULT '\t' 695 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) 698 #define MAX(_a,_b) ((_a)>(_b)?(_a):(_b)) 701 #define MAKE_SUCCESS 0 702 #define MAKE_TROUBLE 1 703 #define MAKE_FAILURE 2 707 #ifdef HAVE_DMALLOC_H 711 #ifndef initialize_main 713 # define initialize_main(pargc, pargv) \ 714 { _wildcard(pargc, pargv); _response(pargc, pargv); } 716 # define initialize_main(pargc, pargv) 722 # define chdir _chdir2 725 # define getcwd _getcwd2 732 # warning NO_CHDIR2: usage of drive letters restricted 738 #ifndef initialize_main 739 # define initialize_main(pargc, pargv) 750 #define EINTRLOOP(_v,_c) while (((_v)=_c)==-1 && errno==EINTR) 759 #define ENULLLOOP(_v,_c) do { errno = 0; (_v) = _c; } \ 760 while((_v)==0 && errno==EINTR)
void block_remote_children(void)
void install_default_implicit_rules(void)
char * starting_directory
int load_file(const gmk_floc *flocp, const char **filename, int noerror)
const gmk_floc ** expanding_var
void unblock_remote_children(void)
void strcache_print_stats(const char *prefix)
int ar_name_equal(const char *name, const char *mem, int truncated)
void collapse_continuations(char *)
void set_default_suffixes(void)
void remote_cleanup(void)
char * end_of_token(const char *)
void ar_parse_name(const char *, char **, char **)
#define __printf__
Definition: makeint.h:226
void hash_init_directories(void)
const char * concat(unsigned int,...)
int start_remote_job_p(int)
char * lindex(const char *, const char *, int)
void print_variable_data_base(void)
int warn_undefined_variables_flag
void out_of_memory() NORETURN
long int(* ar_member_func_t)(int desc, const char *mem, int truncated, long int hdrpos, long int datapos, long int size, long int date, int uid, int gid, unsigned int mode, const void *arg)
Definition: makeint.h:536
int start_remote_job(char **, char **, int, int *, pid_t *, int *)
char * remote_description
char * find_next_token(const char **, size_t *)
int alpha_compare(const void *, const void *)
struct rlimit stack_limit
Definition: make.h:336
void build_vpath_lists(void)
int no_builtin_variables_flag
int strcache_setbufsize(unsigned int size)
void perror_with_name(const char *, const char *)
char * xstrdup(const char *)
void construct_include_path(const char **arg_dirs)
void show_goal_error(void)
void message(int prefix, size_t length, const char *fmt,...) ATTRIBUTE((__format__(__printf__
void unload_file(const char *name)
char * xstrndup(const char *, size_t)
void undefine_default_variables(void)
const char * dir_name(const char *)
#define FILE_TIMESTAMP
Definition: makeint.h:284
void void error(const gmk_floc *flocp, size_t length, const char *fmt,...) ATTRIBUTE((__format__(__printf__
void define_default_variables(void)
int file_impossible_p(const char *)
#define __format__
Definition: makeint.h:225
int ar_member_touch(const char *arname, const char *memname)
const char * vpath_search(const char *file, FILE_TIMESTAMP *mtime_ptr, unsigned int *vpath_index, unsigned int *path_index)
void print_vpath_data_base(void)
int file_exists_p(const char *)
int strcache_iscached(const char *str)
unsigned short stopchar_map[]
void dir_setup_glob(glob_t *)
int ar_touch(const char *)
void * xrealloc(void *, size_t)
void void void fatal(const gmk_floc *flocp, size_t length, const char *fmt,...) ATTRIBUTE((noreturn
const char * strcache_add_len(const char *str, size_t len)
char * strip_whitespace(const char **begpp, const char **endpp)
int handling_fatal_signal
int dir_file_exists_p(const char *, const char *)
Definition: gnuremake.h:23
char * find_percent(char *)
#define ATTRIBUTE(x)
Definition: makeint.h:217
int ar_member_date(const char *, time_t *)
int no_builtin_rules_flag
const gmk_floc * reading_file
ssize_t writebuf(int, const void *, size_t)
void install_default_suffix_rules(void)
const char * find_percent_cached(const char **)
void print_spaces(unsigned int)
void file_impossible(const char *)
int(* load_func_t)(const gmk_floc *flocp)
Definition: makeint.h:590
void print_dir_data_base(void)
char * next_token(const char *)
long int ar_scan(const char *archive, ar_member_func_t function, const void *arg)
int guile_gmake_setup(const gmk_floc *flocp)
FILE * get_tmpfile(char **, const char *)
int remote_status(int *, int *, int *, int)
const char * strcache_add(const char *str)
int remote_kill(pid_t id, int sig)
int ar_name(const char *)
unsigned int commands_started
#define NORETURN
Definition: makeint.h:230
void pfatal_with_name(const char *) NORETURN
ssize_t readbuf(int, void *, size_t)
void construct_vpath_list(char *pattern, char *dirpath)