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>
54 #if !defined (HAVE_SYS_SIGLIST) && defined (HAVE__SYS_SIGLIST)
55 #define sys_siglist _sys_siglist
56 #define HAVE_SYS_SIGLIST /* Now we have it. */
58 /* It was declared in <signal.h>, with who knows what type.
59 Don't declare it again and risk conflicting. */
60 #define SYS_SIGLIST_DECLARED
63 #ifdef HAVE_SYS_SIGLIST
64 #ifndef SYS_SIGLIST_DECLARED
65 extern char *sys_siglist
[];
72 #define isblank(c) ((c) == ' ' || (c) == '\t')
75 #if !defined(NSIG) && defined(_NSIG)
80 #define RETSIGTYPE void
84 #define sigmask(sig) (1 << ((sig) - 1))
90 #ifdef HAVE_SYS_PARAM_H
91 #include <sys/param.h>
96 #define PATH_MAX MAXPATHLEN
97 #endif /* Not POSIX. */
98 #endif /* No PATH_MAX. */
100 #define MAXPATHLEN 1024
101 #endif /* No MAXPATHLEN. */
104 #define GET_PATH_MAX PATH_MAX
105 #define PATH_VAR(var) char var[PATH_MAX]
107 #define NEED_GET_PATH_MAX
108 extern unsigned int get_path_max ();
109 #define GET_PATH_MAX (get_path_max ())
110 #define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
123 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
126 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
130 #if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
134 #else /* No standard headers. */
146 extern char *malloc (), *realloc ();
149 extern void qsort ();
150 extern void abort (), exit ();
152 #endif /* Standard headers. */
157 #define index(s, c) strchr((s), (c))
160 #define rindex(s, c) strrchr((s), (c))
164 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
167 #define bzero(s, n) memset ((s), 0, (n))
170 #define bcopy(s, d, n) memcpy ((d), (s), (n))
173 #else /* Not ANSI_STRING. */
179 extern void bzero ();
182 extern void bcopy ();
185 #endif /* ANSI_STRING. */
191 #define alloca(n) __builtin_alloca (n)
195 #else /* Not HAVE_ALLOCA_H. */
197 extern char *alloca ();
198 #endif /* Not AIX. */
199 #endif /* HAVE_ALLOCA_H. */
203 #define streq(a, b) \
205 (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
207 /* Buggy compiler can't handle this. */
208 #define streq(a, b) (strcmp ((a), (b)) == 0)
211 /* Add to VAR the hashing value of C, one character in a name. */
212 #define HASH(var, c) \
213 ((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
215 #if defined(__GNUC__) || defined(ENUM_BITFIELDS)
216 #define ENUM_BITFIELD(bits) :bits
218 #define ENUM_BITFIELD(bits)
222 extern void message (), fatal (), error ();
223 extern void makefile_error (), makefile_fatal ();
224 extern void pfatal_with_name (), perror_with_name ();
225 extern char *savestring (), *concat ();
226 extern char *xmalloc (), *xrealloc ();
227 extern char *find_next_token (), *next_token (), *end_of_token ();
228 extern void collapse_continuations (), remove_comments ();
229 extern char *sindex (), *lindex ();
230 extern int alpha_compare ();
231 extern void print_spaces ();
232 extern struct dep
*copy_dep_chain ();
233 extern char *find_percent ();
236 extern int ar_name ();
237 extern void ar_parse_name ();
238 extern int ar_touch ();
239 extern time_t ar_member_date ();
242 extern void dir_load ();
243 extern int dir_file_exists_p (), file_exists_p (), file_impossible_p ();
244 extern void file_impossible ();
245 extern char *dir_name ();
247 extern void define_default_variables ();
248 extern void set_default_suffixes (), install_default_implicit_rules ();
249 extern void convert_to_pattern (), count_implicit_rule_limits ();
250 extern void create_pattern_rule ();
252 extern void build_vpath_lists (), construct_vpath_list ();
253 extern int vpath_search ();
255 extern void construct_include_path ();
256 extern void uniquize_deps ();
258 extern int update_goal_chain ();
259 extern void notice_finished_file ();
261 extern void user_access (), make_access (), child_access ();
268 #if !defined (__GNU_LIBRARY__) && !defined (POSIX)
270 #ifdef HAVE_SIGSETMASK
271 extern int sigsetmask ();
272 extern int sigblock ();
276 extern long int atol ();
277 extern int unlink (), stat (), fstat ();
278 extern int pipe (), close (), read (), write (), open ();
279 extern long int lseek ();
281 #endif /* Not GNU C library or POSIX. */
284 extern char *getcwd ();
286 extern char *getwd ();
287 #define getcwd(buf, len) getwd (buf)
290 #if !defined(__GNU_LIBRARY__) && (!defined(vfork) || !defined(POSIX))
292 extern pid_t
vfork ();
298 extern char **environ
;
300 extern char *reading_filename
;
301 extern unsigned int *reading_lineno_ptr
;
303 extern int just_print_flag
, silent_flag
, ignore_errors_flag
, keep_going_flag
;
304 extern int debug_flag
, print_data_base_flag
, question_flag
, touch_flag
;
305 extern int env_overrides
, no_builtin_rules_flag
, print_version_flag
;
306 extern int print_directory_flag
;
308 extern unsigned int job_slots
;
309 extern double max_load_average
;
311 extern char *program
;
312 extern char *starting_directory
;
313 extern unsigned int makelevel
;
315 extern unsigned int commands_started
;
318 #define DEBUGPR(msg) \
319 do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
320 fflush (stdout); } while (0)