1 /* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993
2 Free Software Foundation, Inc.
3 This file is part of GNU Make.
5 GNU Make is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 GNU Make is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNU Make; see the file COPYING. If not, write to
17 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 /* AIX requires this to be the first thing in the file. */
20 #if defined (_AIX) && !defined (__GNUC__)
29 /* This must happen before #include <signal.h> so
30 that the declaration therein is changed. */
31 #define signal bsdsignal
35 #include <sys/types.h>
48 #define isblank(c) ((c) == ' ' || (c) == '\t')
58 #if !defined (HAVE_SYS_SIGLIST) && defined (HAVE__SYS_SIGLIST)
59 #define sys_siglist _sys_siglist
60 #define HAVE_SYS_SIGLIST /* Now we have it. */
62 /* It was declared in <signal.h>, with who knows what type.
63 Don't declare it again and risk conflicting. */
64 #define SYS_SIGLIST_DECLARED
67 #ifdef HAVE_SYS_SIGLIST
68 #ifndef SYS_SIGLIST_DECLARED
69 extern char *sys_siglist
[];
75 /* Some systems do not define NSIG in <signal.h>. */
85 #define RETSIGTYPE void
89 #define sigmask(sig) (1 << ((sig) - 1))
95 #ifdef HAVE_SYS_PARAM_H
96 #include <sys/param.h>
101 #define PATH_MAX MAXPATHLEN
102 #endif /* Not POSIX. */
103 #endif /* No PATH_MAX. */
105 #define MAXPATHLEN 1024
106 #endif /* No MAXPATHLEN. */
109 #define GET_PATH_MAX PATH_MAX
110 #define PATH_VAR(var) char var[PATH_MAX]
112 #define NEED_GET_PATH_MAX
113 extern unsigned int get_path_max ();
114 #define GET_PATH_MAX (get_path_max ())
115 #define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
128 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
131 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
135 #if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
139 #else /* No standard headers. */
151 extern char *malloc (), *realloc ();
154 extern void qsort ();
155 extern void abort (), exit ();
157 #endif /* Standard headers. */
162 #define index(s, c) strchr((s), (c))
165 #define rindex(s, c) strrchr((s), (c))
169 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
172 #define bzero(s, n) memset ((s), 0, (n))
175 #define bcopy(s, d, n) memcpy ((d), (s), (n))
178 #else /* Not ANSI_STRING. */
184 extern void bzero ();
187 extern void bcopy ();
190 #endif /* ANSI_STRING. */
196 #define alloca(n) __builtin_alloca (n)
200 #else /* Not HAVE_ALLOCA_H. */
202 extern char *alloca ();
203 #endif /* Not AIX. */
204 #endif /* HAVE_ALLOCA_H. */
208 #define streq(a, b) \
210 (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
212 /* Buggy compiler can't handle this. */
213 #define streq(a, b) (strcmp ((a), (b)) == 0)
216 /* Add to VAR the hashing value of C, one character in a name. */
217 #define HASH(var, c) \
218 ((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
220 #if defined(__GNUC__) || defined(ENUM_BITFIELDS)
221 #define ENUM_BITFIELD(bits) :bits
223 #define ENUM_BITFIELD(bits)
227 extern void message (), fatal (), error ();
228 extern void makefile_error (), makefile_fatal ();
229 extern void pfatal_with_name (), perror_with_name ();
230 extern char *savestring (), *concat ();
231 extern char *xmalloc (), *xrealloc ();
232 extern char *find_next_token (), *next_token (), *end_of_token ();
233 extern void collapse_continuations (), remove_comments ();
234 extern char *sindex (), *lindex ();
235 extern int alpha_compare ();
236 extern void print_spaces ();
237 extern struct dep
*copy_dep_chain ();
238 extern char *find_percent ();
241 extern int ar_name ();
242 extern void ar_parse_name ();
243 extern int ar_touch ();
244 extern time_t ar_member_date ();
247 extern void dir_load ();
248 extern int dir_file_exists_p (), file_exists_p (), file_impossible_p ();
249 extern void file_impossible ();
250 extern char *dir_name ();
252 extern void define_default_variables ();
253 extern void set_default_suffixes (), install_default_implicit_rules ();
254 extern void convert_to_pattern (), count_implicit_rule_limits ();
255 extern void create_pattern_rule ();
257 extern void build_vpath_lists (), construct_vpath_list ();
258 extern int vpath_search ();
260 extern void construct_include_path ();
261 extern void uniquize_deps ();
263 extern int update_goal_chain ();
264 extern void notice_finished_file ();
266 extern void user_access (), make_access (), child_access ();
273 #if !defined (__GNU_LIBRARY__) && !defined (POSIX)
275 #ifdef HAVE_SIGSETMASK
276 extern int sigsetmask ();
277 extern int sigblock ();
281 extern long int atol ();
282 extern int unlink (), stat (), fstat ();
283 extern int pipe (), close (), read (), write (), open ();
284 extern long int lseek ();
286 #endif /* Not GNU C library or POSIX. */
289 extern char *getcwd ();
291 extern char *getwd ();
292 #define getcwd(buf, len) getwd (buf)
295 extern char **environ
;
297 extern char *reading_filename
;
298 extern unsigned int *reading_lineno_ptr
;
300 extern int just_print_flag
, silent_flag
, ignore_errors_flag
, keep_going_flag
;
301 extern int debug_flag
, print_data_base_flag
, question_flag
, touch_flag
;
302 extern int env_overrides
, no_builtin_rules_flag
, print_version_flag
;
303 extern int print_directory_flag
;
305 extern unsigned int job_slots
;
306 extern double max_load_average
;
308 extern char *program
;
309 extern char *starting_directory
;
310 extern unsigned int makelevel
;
312 extern unsigned int commands_started
;
315 #define DEBUGPR(msg) \
316 do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
317 fflush (stdout); } while (0)