make/make.h

449 lines
11 KiB
C
Raw Normal View History

1994-03-23 14:53:21 +00:00
/* Miscellaneous global declarations and portability cruft for GNU Make.
Copyright (C) 1988,89,90,91,92,93,94,95,96 Free Software Foundation, Inc.
1992-01-20 19:14:46 +00:00
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Make is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
1992-07-26 22:30:45 +00:00
/* AIX requires this to be the first thing in the file. */
#if defined (_AIX) && !defined (__GNUC__)
#pragma alloca
#endif
1993-08-12 21:19:12 +00:00
/* We use <config.h> instead of "config.h" so that a compilation
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
(which it would do because make.h was found in $srcdir). */
#include <config.h>
1993-01-12 19:36:16 +00:00
#undef HAVE_CONFIG_H
1992-12-20 22:57:06 +00:00
#define HAVE_CONFIG_H
/* Use prototypes if available. */
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#undef PARAMS
#define PARAMS(protos) protos
#else /* Not C++ or ANSI C. */
#undef PARAMS
#define PARAMS(protos) ()
#endif /* C++ or ANSI C. */
1992-09-02 21:53:59 +00:00
#ifdef CRAY
/* This must happen before #include <signal.h> so
that the declaration therein is changed. */
#define signal bsdsignal
#endif
1992-01-20 19:14:46 +00:00
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <stdio.h>
#include <ctype.h>
1993-10-28 00:09:14 +00:00
#ifdef HAVE_SYS_TIMEB_H
1993-10-14 19:08:38 +00:00
/* SCO 3.2 "devsys 4.2" has a prototype for `ftime' in <time.h> that bombs
unless <sys/timeb.h> has been included first. Does every system have a
<sys/timeb.h>? If any does not, configure should check for it. */
#include <sys/timeb.h>
1993-10-28 00:09:14 +00:00
#endif
1992-06-11 05:30:34 +00:00
#include <time.h>
1992-07-01 00:52:39 +00:00
#include <errno.h>
#ifndef errno
extern int errno;
#endif
1992-06-11 05:30:34 +00:00
1993-04-14 17:34:15 +00:00
#ifndef isblank
#define isblank(c) ((c) == ' ' || (c) == '\t')
#endif
1992-06-11 05:30:34 +00:00
#ifdef HAVE_UNISTD_H
#include <unistd.h>
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
POSIX.1 behavior with `cc -YPOSIX', which predefines POSIX itself! */
#if defined (_POSIX_VERSION) && !defined (ultrix)
1992-06-11 05:30:34 +00:00
#define POSIX
#endif
#endif
1992-01-20 19:14:46 +00:00
1993-07-08 23:51:22 +00:00
/* Some systems define _POSIX_VERSION but are not really POSIX.1. */
#if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386)))
1993-05-14 20:40:38 +00:00
#undef POSIX
#endif
1993-09-17 04:49:17 +00:00
#if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
#define POSIX
#endif
1992-07-30 19:41:18 +00:00
#if !defined (HAVE_SYS_SIGLIST) && defined (HAVE__SYS_SIGLIST)
#define sys_siglist _sys_siglist
1992-10-02 23:42:13 +00:00
#define HAVE_SYS_SIGLIST /* Now we have it. */
1992-10-12 21:58:52 +00:00
/* It was declared in <signal.h>, with who knows what type.
Don't declare it again and risk conflicting. */
#define SYS_SIGLIST_DECLARED
1992-07-30 19:41:18 +00:00
#endif
1992-11-23 20:41:02 +00:00
#ifdef HAVE_SYS_SIGLIST
#ifndef SYS_SIGLIST_DECLARED
extern char *sys_siglist[];
#endif
#else
#include "signame.h"
#endif
1993-04-14 17:34:15 +00:00
/* Some systems do not define NSIG in <signal.h>. */
#ifndef NSIG
#ifdef _NSIG
1992-01-20 19:14:46 +00:00
#define NSIG _NSIG
1993-04-14 17:34:15 +00:00
#else
#define NSIG 32
#endif
1992-01-20 19:14:46 +00:00
#endif
1992-06-11 05:30:34 +00:00
#ifndef RETSIGTYPE
#define RETSIGTYPE void
1992-01-20 19:14:46 +00:00
#endif
#ifndef sigmask
#define sigmask(sig) (1 << ((sig) - 1))
#endif
1992-06-11 05:30:34 +00:00
#ifdef HAVE_LIMITS_H
1992-01-20 19:14:46 +00:00
#include <limits.h>
#endif
1992-06-11 05:30:34 +00:00
#ifdef HAVE_SYS_PARAM_H
1992-01-20 19:14:46 +00:00
#include <sys/param.h>
1992-06-11 05:30:34 +00:00
#endif
1992-01-20 19:14:46 +00:00
#ifndef PATH_MAX
1992-10-15 23:01:36 +00:00
#ifndef POSIX
#define PATH_MAX MAXPATHLEN
#endif /* Not POSIX. */
#endif /* No PATH_MAX. */
1992-01-20 19:14:46 +00:00
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif /* No MAXPATHLEN. */
1992-06-11 05:30:34 +00:00
1992-01-20 19:14:46 +00:00
#ifdef PATH_MAX
1992-06-11 05:30:34 +00:00
#define GET_PATH_MAX PATH_MAX
1992-10-15 23:01:36 +00:00
#define PATH_VAR(var) char var[PATH_MAX]
1992-01-20 19:14:46 +00:00
#else
1992-10-15 23:01:36 +00:00
#define NEED_GET_PATH_MAX
extern unsigned int get_path_max PARAMS ((void));
1992-10-15 23:01:36 +00:00
#define GET_PATH_MAX (get_path_max ())
1992-01-20 19:14:46 +00:00
#define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
#endif
1993-07-23 20:04:37 +00:00
#ifdef STAT_MACROS_BROKEN
1992-01-20 19:14:46 +00:00
#ifdef S_ISREG
#undef S_ISREG
#endif
#ifdef S_ISDIR
#undef S_ISDIR
#endif
1993-07-23 20:04:37 +00:00
#endif /* STAT_MACROS_BROKEN. */
1992-01-20 19:14:46 +00:00
#ifndef S_ISREG
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#ifdef VMS
#include <stdio.h>
#include <types.h>
#include <unixlib.h>
#include <unixio.h>
#include <errno.h>
#include <perror.h>
#endif
1992-01-20 19:14:46 +00:00
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) || defined(VMS))
1992-01-20 19:14:46 +00:00
#include <stdlib.h>
#include <string.h>
#define ANSI_STRING
#else /* No standard headers. */
1993-04-12 20:51:32 +00:00
#ifdef HAVE_STRING_H
1992-01-20 19:14:46 +00:00
#include <string.h>
#define ANSI_STRING
1993-04-12 20:51:32 +00:00
#else
1992-01-20 19:14:46 +00:00
#include <strings.h>
#endif
1993-04-12 20:51:32 +00:00
#ifdef HAVE_MEMORY_H
#include <memory.h>
1992-01-20 19:14:46 +00:00
#endif
extern char *malloc PARAMS ((int));
extern char *realloc PARAMS ((char *, int));
extern void free PARAMS ((char *));
1992-01-20 19:14:46 +00:00
extern void abort PARAMS ((void));
extern void exit PARAMS ((int));
1992-07-26 22:30:45 +00:00
1992-01-20 19:14:46 +00:00
#endif /* Standard headers. */
#ifdef ANSI_STRING
1993-04-12 20:51:32 +00:00
1992-07-26 22:30:45 +00:00
#ifndef index
1992-01-20 19:14:46 +00:00
#define index(s, c) strchr((s), (c))
1992-07-26 22:30:45 +00:00
#endif
#ifndef rindex
1992-01-20 19:14:46 +00:00
#define rindex(s, c) strrchr((s), (c))
1992-07-26 22:30:45 +00:00
#endif
1992-01-20 19:14:46 +00:00
1992-07-26 22:30:45 +00:00
#ifndef bcmp
1992-01-20 19:14:46 +00:00
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
1992-07-26 22:30:45 +00:00
#endif
#ifndef bzero
1992-01-20 19:14:46 +00:00
#define bzero(s, n) memset ((s), 0, (n))
1992-07-26 22:30:45 +00:00
#endif
#ifndef bcopy
1992-01-20 19:14:46 +00:00
#define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
1993-04-12 20:51:32 +00:00
#else /* Not ANSI_STRING. */
#ifndef bcmp
extern int bcmp ();
#endif
#ifndef bzero
extern void bzero ();
#endif
#ifndef bcopy
extern void bcopy ();
#endif
1992-07-26 22:30:45 +00:00
#endif /* ANSI_STRING. */
1992-01-20 19:14:46 +00:00
#undef ANSI_STRING
1994-02-04 21:28:53 +00:00
/* SCO Xenix has a buggy macro definition in <string.h>. */
#undef strerror
#if !defined(ANSI_STRING) && !defined(__DECC)
extern char *strerror PARAMS ((int errnum));
1994-02-04 21:28:53 +00:00
#endif
1992-01-20 19:14:46 +00:00
#ifdef __GNUC__
#undef alloca
#define alloca(n) __builtin_alloca (n)
#else /* Not GCC. */
1993-04-12 20:51:32 +00:00
#ifdef HAVE_ALLOCA_H
1992-01-20 19:14:46 +00:00
#include <alloca.h>
1993-04-12 20:51:32 +00:00
#else /* Not HAVE_ALLOCA_H. */
1992-12-31 17:26:10 +00:00
#ifndef _AIX
1992-01-20 19:14:46 +00:00
extern char *alloca ();
1992-12-31 17:26:10 +00:00
#endif /* Not AIX. */
1993-04-12 20:51:32 +00:00
#endif /* HAVE_ALLOCA_H. */
1992-01-20 19:14:46 +00:00
#endif /* GCC. */
#ifndef iAPX286
#define streq(a, b) \
((a) == (b) || \
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
#ifdef _AMIGA
#define strieq(a, b) \
((a) == (b) || \
(tolower(*(a)) == tolower(*(b)) && (*(a) == '\0' || !strcmpi ((a) + 1, (b) + 1))))
#else
#define strieq(a, b) \
((a) == (b) || \
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
#endif
1992-01-20 19:14:46 +00:00
#else
/* Buggy compiler can't handle this. */
#define streq(a, b) (strcmp ((a), (b)) == 0)
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
#define strieq(a, b) (strcmp ((a), (b)) == 0)
1992-01-20 19:14:46 +00:00
#endif
/* Add to VAR the hashing value of C, one character in a name. */
#define HASH(var, c) \
((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
#ifdef _AMIGA /* Fold filenames on #amiga */
#define HASHI(var, c) \
((var += tolower((c))), (var = ((var) << 7) + ((var) >> 20)))
#else
#define HASHI(var, c) HASH(var,c)
#endif
1992-01-20 19:14:46 +00:00
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
#define ENUM_BITFIELD(bits) :bits
#else
#define ENUM_BITFIELD(bits)
#endif
Wed May 15 10:14:14 CDT 1996 Rob Tulloh <tulloh@tivoli.com> * dir.c: WIN32 does not support inode. For now, fully qualified pathname along with st_mtime will be keys for files. Fixed problem where vpath can be confused when files are added to a directory after the directory has already been read in. The code now attempts to reread the directory if it discovers that the datestamp on the directory has changed since it was cached by make. This problem only seems to occur on WIN32 right now so it is lumped under port #ifdef WIN32. * function.c: WIN32: call subproc library (CreateProcess()) instead of fork/exec. * job.c: WIN32: Added the code to do fork/exec/waitpid style processing on WIN32 systems via calls to subproc library. * main.c: WIN32: Several things added here. First, there is code for dealing with PATH and SHELL defaults. Make tries to figure out if the user has %PATH% set in the environment and sets it to %Path% if it is not set already. Make also looks to see if sh.exe is anywhere to be found. Code path through job.c will change based on existence of a working Bourne shell. The checking for default shell is done twice: once before makefiles are read in and again after. Fall back to MSDOS style execution mode if no sh.exe is found. Also added some debug support that allows user to pause make with -D switch and attach a debugger. This is especially useful for debugging recursive calls to make where problems appear only in the sub-make. * make.h: WIN32: A few macros and header files for WIN32 support. * misc.c: WIN32: Added a function end_of_token_w32() to assist in parsing code in read.c. * read.c: WIN32: Fixes similar to MSDOS which allow colon to appear in filenames. Use of colon in filenames would otherwise confuse make. * remake.c: WIN32: Added include of io.h to eliminate compiler warnings. Added some code to default LIBDIR if it is not set on WIN32. * variable.c: WIN32: Added support for detecting Path/PATH and converting them to semicolon separated lists for make's internal use. New function sync_Path_environment() which is called in job.c and function.c before creating a new process. Caller must set Path in environment since we don't have fork() to do this for us. * vpath.c: WIN32: Added detection for filenames containing forward or backward slashes. * NMakefile: WIN32: Visual C compatible makefile for use with nmake. Use this to build GNU make the first time on Windows NT or Windows 95. * README.WIN32: WIN32: Contains some helpful notes. * build_w32.bat: WIN32: If you don't like nmake, use this the first time you build GNU make on Windows NT or Windows 95. * config.h.WIN32: WIN32 version of config.h * subproc.bat: WIN32: A bat file used to build the subproc library from the top-level NMakefile. Needed because WIndows 95 (nmake) doesn't allow you to cd in a make rule. * w32/include/dirent.h * w32/compat/dirent.c: WIN32: opendir, readdir, closedir, etc. * w32/include/pathstuff.h: WIN32: used by files needed functions defined in pathstuff.c (prototypes). * w32/include/sub_proc.h: WIN32: prototypes for subproc.lib functions. * w32/include/w32err.h: WIN32: prototypes for w32err.c. * w32/pathstuff.c: WIN32: File and Path/Path conversion functions. * w32/subproc/build.bat: WIN32: build script for subproc library if you don't wish to use nmake. * w32/subproc/NMakefile: WIN32: Visual C compatible makefile for use with nmake. Used to build subproc library. * w32/subproc/misc.c: WIN32: subproc library support code * w32/subproc/proc.h: WIN32: subproc library support code * w32/subproc/sub_proc.c: WIN32: subproc library source code * w32/subproc/w32err.c: WIN32: subproc library support code
1996-05-22 21:51:45 +00:00
#if defined(__MSDOS__) || defined(WIN32)
#define PATH_SEPARATOR_CHAR ';'
#else
#define PATH_SEPARATOR_CHAR ':'
#endif
Wed May 15 10:14:14 CDT 1996 Rob Tulloh <tulloh@tivoli.com> * dir.c: WIN32 does not support inode. For now, fully qualified pathname along with st_mtime will be keys for files. Fixed problem where vpath can be confused when files are added to a directory after the directory has already been read in. The code now attempts to reread the directory if it discovers that the datestamp on the directory has changed since it was cached by make. This problem only seems to occur on WIN32 right now so it is lumped under port #ifdef WIN32. * function.c: WIN32: call subproc library (CreateProcess()) instead of fork/exec. * job.c: WIN32: Added the code to do fork/exec/waitpid style processing on WIN32 systems via calls to subproc library. * main.c: WIN32: Several things added here. First, there is code for dealing with PATH and SHELL defaults. Make tries to figure out if the user has %PATH% set in the environment and sets it to %Path% if it is not set already. Make also looks to see if sh.exe is anywhere to be found. Code path through job.c will change based on existence of a working Bourne shell. The checking for default shell is done twice: once before makefiles are read in and again after. Fall back to MSDOS style execution mode if no sh.exe is found. Also added some debug support that allows user to pause make with -D switch and attach a debugger. This is especially useful for debugging recursive calls to make where problems appear only in the sub-make. * make.h: WIN32: A few macros and header files for WIN32 support. * misc.c: WIN32: Added a function end_of_token_w32() to assist in parsing code in read.c. * read.c: WIN32: Fixes similar to MSDOS which allow colon to appear in filenames. Use of colon in filenames would otherwise confuse make. * remake.c: WIN32: Added include of io.h to eliminate compiler warnings. Added some code to default LIBDIR if it is not set on WIN32. * variable.c: WIN32: Added support for detecting Path/PATH and converting them to semicolon separated lists for make's internal use. New function sync_Path_environment() which is called in job.c and function.c before creating a new process. Caller must set Path in environment since we don't have fork() to do this for us. * vpath.c: WIN32: Added detection for filenames containing forward or backward slashes. * NMakefile: WIN32: Visual C compatible makefile for use with nmake. Use this to build GNU make the first time on Windows NT or Windows 95. * README.WIN32: WIN32: Contains some helpful notes. * build_w32.bat: WIN32: If you don't like nmake, use this the first time you build GNU make on Windows NT or Windows 95. * config.h.WIN32: WIN32 version of config.h * subproc.bat: WIN32: A bat file used to build the subproc library from the top-level NMakefile. Needed because WIndows 95 (nmake) doesn't allow you to cd in a make rule. * w32/include/dirent.h * w32/compat/dirent.c: WIN32: opendir, readdir, closedir, etc. * w32/include/pathstuff.h: WIN32: used by files needed functions defined in pathstuff.c (prototypes). * w32/include/sub_proc.h: WIN32: prototypes for subproc.lib functions. * w32/include/w32err.h: WIN32: prototypes for w32err.c. * w32/pathstuff.c: WIN32: File and Path/Path conversion functions. * w32/subproc/build.bat: WIN32: build script for subproc library if you don't wish to use nmake. * w32/subproc/NMakefile: WIN32: Visual C compatible makefile for use with nmake. Used to build subproc library. * w32/subproc/misc.c: WIN32: subproc library support code * w32/subproc/proc.h: WIN32: subproc library support code * w32/subproc/sub_proc.c: WIN32: subproc library source code * w32/subproc/w32err.c: WIN32: subproc library support code
1996-05-22 21:51:45 +00:00
#ifdef WIN32
#include <fcntl.h>
#include <malloc.h>
#define pipe(p) _pipe(p, 512, O_BINARY)
#define kill(pid,sig) w32_kill(pid,sig)
extern void sync_Path_environment(void);
extern int kill(int pid, int sig);
extern int safe_stat(char *file, struct stat *sb);
extern char *end_of_token_w32();
#endif
1992-01-20 19:14:46 +00:00
extern void die ();
extern void message ();
extern void fatal ();
extern void error ();
1995-11-26 01:39:38 +00:00
extern void log_working_directory ();
extern void makefile_error ();
extern void makefile_fatal ();
extern void pfatal_with_name ();
extern void perror_with_name ();
extern char *savestring ();
extern char *concat ();
extern char *xmalloc ();
extern char *xrealloc ();
extern char *find_next_token ();
extern char *next_token ();
extern char *end_of_token ();
extern void collapse_continuations ();
extern void remove_comments ();
extern char *sindex ();
extern char *lindex ();
1992-01-20 19:14:46 +00:00
extern int alpha_compare ();
extern void print_spaces ();
extern struct dep *copy_dep_chain ();
extern char *find_char_unquote ();
extern char *find_percent ();
1992-01-20 19:14:46 +00:00
#ifndef NO_ARCHIVES
extern int ar_name ();
extern void ar_parse_name ();
extern int ar_touch ();
extern time_t ar_member_date ();
#endif
extern void dir_load ();
extern int dir_file_exists_p ();
extern int file_exists_p ();
extern int file_impossible_p ();
1992-01-20 19:14:46 +00:00
extern void file_impossible ();
extern char *dir_name ();
extern void define_default_variables ();
extern void set_default_suffixes ();
extern void install_default_suffix_rules ();
extern void install_default_implicit_rules ();
extern void count_implicit_rule_limits ();
extern void convert_to_pattern ();
extern void create_pattern_rule ();
extern void build_vpath_lists ();
extern void construct_vpath_list ();
1992-01-20 19:14:46 +00:00
extern int vpath_search ();
extern void construct_include_path ();
extern void uniquize_deps ();
extern int update_goal_chain ();
extern void notice_finished_file ();
extern void user_access ();
extern void make_access ();
extern void child_access ();
1992-01-20 19:14:46 +00:00
1992-06-11 05:30:34 +00:00
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
1992-01-20 19:14:46 +00:00
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
because such systems often declare the in header files anyway. */
Wed May 15 10:14:14 CDT 1996 Rob Tulloh <tulloh@tivoli.com> * dir.c: WIN32 does not support inode. For now, fully qualified pathname along with st_mtime will be keys for files. Fixed problem where vpath can be confused when files are added to a directory after the directory has already been read in. The code now attempts to reread the directory if it discovers that the datestamp on the directory has changed since it was cached by make. This problem only seems to occur on WIN32 right now so it is lumped under port #ifdef WIN32. * function.c: WIN32: call subproc library (CreateProcess()) instead of fork/exec. * job.c: WIN32: Added the code to do fork/exec/waitpid style processing on WIN32 systems via calls to subproc library. * main.c: WIN32: Several things added here. First, there is code for dealing with PATH and SHELL defaults. Make tries to figure out if the user has %PATH% set in the environment and sets it to %Path% if it is not set already. Make also looks to see if sh.exe is anywhere to be found. Code path through job.c will change based on existence of a working Bourne shell. The checking for default shell is done twice: once before makefiles are read in and again after. Fall back to MSDOS style execution mode if no sh.exe is found. Also added some debug support that allows user to pause make with -D switch and attach a debugger. This is especially useful for debugging recursive calls to make where problems appear only in the sub-make. * make.h: WIN32: A few macros and header files for WIN32 support. * misc.c: WIN32: Added a function end_of_token_w32() to assist in parsing code in read.c. * read.c: WIN32: Fixes similar to MSDOS which allow colon to appear in filenames. Use of colon in filenames would otherwise confuse make. * remake.c: WIN32: Added include of io.h to eliminate compiler warnings. Added some code to default LIBDIR if it is not set on WIN32. * variable.c: WIN32: Added support for detecting Path/PATH and converting them to semicolon separated lists for make's internal use. New function sync_Path_environment() which is called in job.c and function.c before creating a new process. Caller must set Path in environment since we don't have fork() to do this for us. * vpath.c: WIN32: Added detection for filenames containing forward or backward slashes. * NMakefile: WIN32: Visual C compatible makefile for use with nmake. Use this to build GNU make the first time on Windows NT or Windows 95. * README.WIN32: WIN32: Contains some helpful notes. * build_w32.bat: WIN32: If you don't like nmake, use this the first time you build GNU make on Windows NT or Windows 95. * config.h.WIN32: WIN32 version of config.h * subproc.bat: WIN32: A bat file used to build the subproc library from the top-level NMakefile. Needed because WIndows 95 (nmake) doesn't allow you to cd in a make rule. * w32/include/dirent.h * w32/compat/dirent.c: WIN32: opendir, readdir, closedir, etc. * w32/include/pathstuff.h: WIN32: used by files needed functions defined in pathstuff.c (prototypes). * w32/include/sub_proc.h: WIN32: prototypes for subproc.lib functions. * w32/include/w32err.h: WIN32: prototypes for w32err.c. * w32/pathstuff.c: WIN32: File and Path/Path conversion functions. * w32/subproc/build.bat: WIN32: build script for subproc library if you don't wish to use nmake. * w32/subproc/NMakefile: WIN32: Visual C compatible makefile for use with nmake. Used to build subproc library. * w32/subproc/misc.c: WIN32: subproc library support code * w32/subproc/proc.h: WIN32: subproc library support code * w32/subproc/sub_proc.c: WIN32: subproc library source code * w32/subproc/w32err.c: WIN32: subproc library support code
1996-05-22 21:51:45 +00:00
#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WIN32)
1992-01-20 19:14:46 +00:00
1992-06-11 05:30:34 +00:00
extern long int atol ();
#ifndef VMS
1992-01-20 19:14:46 +00:00
extern long int lseek ();
#endif
1993-04-12 20:51:32 +00:00
#endif /* Not GNU C library or POSIX. */
1992-01-20 19:14:46 +00:00
1992-07-05 00:52:46 +00:00
#ifdef HAVE_GETCWD
1992-01-20 19:14:46 +00:00
extern char *getcwd ();
#ifdef VMS
extern char *getwd PARAMS ((char *));
#endif
1992-01-20 19:14:46 +00:00
#else
extern char *getwd ();
1992-06-25 00:28:36 +00:00
#define getcwd(buf, len) getwd (buf)
1992-06-11 05:30:34 +00:00
#endif
1992-01-20 19:14:46 +00:00
extern char **environ;
extern char *reading_filename;
extern unsigned int *reading_lineno_ptr;
extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
extern int env_overrides, no_builtin_rules_flag, print_version_flag;
1993-06-25 19:20:49 +00:00
extern int print_directory_flag, warn_undefined_variables_flag;
1994-10-24 23:11:57 +00:00
extern int posix_pedantic;
1992-01-20 19:14:46 +00:00
extern unsigned int job_slots;
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
#ifndef NO_FLOAT
1992-01-20 19:14:46 +00:00
extern double max_load_average;
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
#else
extern int max_load_average;
#endif
1992-01-20 19:14:46 +00:00
extern char *program;
1993-02-04 18:23:27 +00:00
extern char *starting_directory;
1992-01-20 19:14:46 +00:00
extern unsigned int makelevel;
1993-08-19 20:36:09 +00:00
extern char *version_string, *remote_description;
1993-02-04 18:23:27 +00:00
1993-01-25 23:30:16 +00:00
extern unsigned int commands_started;
1992-01-20 19:14:46 +00:00
1993-05-06 21:30:40 +00:00
extern int handling_fatal_signal;
1992-01-20 19:14:46 +00:00
1992-04-14 22:37:04 +00:00
#define DEBUGPR(msg) \
do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
fflush (stdout); } while (0)
#ifdef VMS
# ifndef EXIT_FAILURE
# define EXIT_FAILURE 3
# endif
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 1
# endif
# ifndef EXIT_TROUBLE
# define EXIT_TROUBLE 2
# endif
#else
# ifndef EXIT_FAILURE
# define EXIT_FAILURE 2
# endif
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# ifndef EXIT_TROUBLE
# define EXIT_TROUBLE 1
# endif
#endif