Checkpoint changes. Bug fixes, mostly.

This commit is contained in:
Paul Smith 1998-10-03 05:39:55 +00:00
parent e90887e68a
commit 2c64fb221a
38 changed files with 2840 additions and 2266 deletions

234
ChangeLog
View File

@ -1,3 +1,225 @@
1998-09-21 Paul D. Smith <psmith@gnu.org>
* job.c (construct_command_argv_internal): Only add COMMAND.COM
"@echo off" line for non-UNIXy shells.
1998-09-09 Paul D. Smith <psmith@gnu.org>
* w32/subproc/sub_proc.c: Add in missing HAVE_MKS_SHELL tests.
1998-09-04 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): If we hit the "missing separator" error,
check for the common case of 8 spaces instead of a TAB and give an
extra comment to help people out.
1998-08-29 Paul Eggert <eggert@twinsun.com>
* configure.in (AC_STRUCT_ST_MTIM_NSEC):
Renamed from AC_STRUCT_ST_MTIM.
* acinclude.m4 (AC_STRUCT_ST_MTIM_NSEC): Likewise.
Port to UnixWare 2.1.2 and pedantic Solaris 2.6.
* acconfig.h (ST_MTIM_NSEC):
Renamed from HAVE_ST_MTIM, with a new meaning.
* filedef.h (FILE_TIMESTAMP_FROM_S_AND_NS):
Use new ST_MTIM_NSEC macro.
1998-08-26 Paul D. Smith <psmith@gnu.org>
* remake.c (check_dep): For any intermediate file, not just
secondary ones, try implicit and default rules if no explicit
rules are given. I'm not sure why this was restricted to
secondary rules in the first place.
1998-08-24 Paul D. Smith <psmith@gnu.org>
* make.texinfo (Special Targets): Update documentation for
.INTERMEDIATE: if used with no dependencies, then it does nothing;
old docs said it marked all targets as intermediate, which it
didn't... and which would be silly :).
* implicit.c (pattern_search): If we find a dependency in our
internal tables, make sure it's not marked intermediate before
accepting it as a found_file[].
1998-08-20 Paul D. Smith <psmith@gnu.org>
* ar.c (ar_glob): Use existing alpha_compare() with qsort.
(ar_glob_alphacompare): Remove it.
Modify Paul Eggert's patch so we don't abandon older systems:
* configure.in: Warn the user if neither waitpid() nor wait3() is
available.
* job.c (WAIT_NOHANG): Don't syntax error on ancient hosts.
(child_handler, dead_children): Define these if WAIT_NOHANG is not
available.
(reap_children): Only track the dead_children count if no
WAIT_NOHANG. Otherwise, it's a boolean.
* main.c (main): Add back signal handler if no WAIT_NOHANG is
available; only use default signal handler if it is.
1998-08-20 Paul Eggert <eggert@twinsun.com>
Install a more robust signal handling mechanism for systems which
support it.
* job.c (WAIT_NOHANG): Define to a syntax error if our host
is truly ancient; this should never happen.
(child_handler, dead_children): Remove.
(reap_children): Don't try to keep separate track of how many
dead children we have, as this is too bug-prone.
Just ask the OS instead.
(vmsHandleChildTerm): Fix typo in error message; don't mention
child_handler.
* main.c (main): Make sure we're not ignoring SIGCHLD/SIGCLD;
do this early, before we could possibly create a subprocess.
Just use the default behavior; don't have our own handler.
1998-08-18 Eli Zaretskii <eliz@is.elta.co.il>
* read.c (read_makefile) [__MSDOS__, WINDOWS32]: Add code to
recognize library archive members when dealing with drive spec
mess. Discovery and initial fix by George Racz <gracz@mincom.com>.
1998-08-18 Paul D. Smith <psmith@gnu.org>
* configure.in: Check for stdlib.h explicitly (some hosts have it
but don't have STDC_HEADERS).
* make.h: Use HAVE_STDLIB_H. Clean up some #defines.
* config.ami: Re-compute based on new config.h.in contents.
* config.h-vms: Ditto.
* config.h.W32: Ditto.
* configh.dos: Ditto.
1998-08-17 Paul D. Smith <psmith@gnu.org>
* make.texinfo: Added copyright year to the printed copy. Removed
the price from the manual. Change the top-level reference to
running make to be "Invoking make" instead of "make Invocation",
to comply with GNU doc standards.
* make.h (__format__, __printf__): Added support for these in
__attribute__ macro.
(message, error, fatal): Use ... prototype form under __STDC__.
Add __format__ attributes for printf-style functions.
* configure.in (AC_FUNC_VPRINTF): Check for vprintf()/_doprnt().
* misc.c(message, error, fatal): Add preprocessor stuff to enable
creation of variable-argument functions with appropriate
prototypes, that works with ANSI, pre-ANSI, varargs.h, stdarg.h,
v*printf(), _doprnt(), or none of the above. Culled from GNU
fileutils and slightly modified.
(makefile_error, makefile_error): Removed (merged into error() and
fatal(), respectively).
* amiga.c: Use them.
* ar.c: Use them.
* arscan.c: Use them.
* commands.c: Use them.
* expand.c: Use them.
* file.c: Use them.
* function.c: Use them.
* job.c: Use them.
* main.c: Use them.
* misc.c: Use them.
* read.c: Use them.
* remake.c: Use them.
* remote-cstms.c: Use them.
* rule.c: Use them.
* variable.c: Use them.
* make.h (struct floc): New structure to store file location
information.
* commands.h (struct commands): Use it.
* variable.c (try_variable_definition): Use it.
* commands.c: Use it.
* default.c: Use it.
* file.c: Use it.
* function.c: Use it.
* misc.c: Use it.
* read.c: Use it.
* rule.c: Use it.
1998-08-16 Paul Eggert <eggert@twinsun.com>
* filedef.h (FILE_TIMESTAMP_PRINT_LEN_BOUND): Add 10, for nanoseconds.
1998-08-16 Paul Eggert <eggert@twinsun.com>
* filedef.h (FLOOR_LOG2_SECONDS_PER_YEAR): New macro.
(FILE_TIMESTAMP_PRINT_LEN_BOUND): Tighten bound, and try to
make it easier to understand.
1998-08-14 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): We've already unquoted any colon chars
by the time we're done reading the targets, so arrange for
parse_file_seq() on the target list to not do so again.
1998-08-05 Paul D. Smith <psmith@gnu.org>
* configure.in: Added glob/configure.in data. We'll have the glob
code include the regular make config.h, rather than creating its
own.
* getloadavg.c (main): Change return type to int.
1998-08-01 Paul Eggert <eggert@twinsun.com>
* job.c (reap_children): Ignore unknown children.
1998-07-31 Paul D. Smith <psmith@gnu.org>
* make.h, filedef.h, dep.h, rule.h, commands.h, remake.c:
Add prototypes for functions. Some prototypes needed to be moved
in order to get #include order reasonable.
1998-07-30 Paul D. Smith <psmith@gnu.org>
* make.h: Added MIN/MAX.
* filedef.h: Use them; remove FILE_TIMESTAMP_MIN.
1998-07-30 Paul Eggert <eggert@twinsun.com>
Add support for sub-second timestamp resolution on hosts that
support it (just Solaris 2.6, so far).
* acconfig.h (HAVE_ST_MTIM, uintmax_t): New undefs.
* acinclude.m4 (jm_AC_HEADER_INTTYPES_H, AC_STRUCT_ST_MTIM,
jm_AC_TYPE_UINTMAX_T): New defuns.
* commands.c (delete_target): Convert file timestamp to
seconds before comparing to archive timestamp. Extract mod
time from struct stat using FILE_TIMESTAMP_STAT_MODTIME.
* configure.in (C_STRUCT_ST_MTIM, jm_AC_TYPE_UINTMAX_T): Add.
(AC_CHECK_LIB, AC_CHECK_FUNCS): Add clock_gettime.
* file.c (snap_deps): Use FILE_TIMESTAMP, not time_t.
(file_timestamp_now, file_timestamp_sprintf): New functions.
(print_file): Print file timestamps as FILE_TIMESTAMP, not
time_t.
* filedef.h: Include <inttypes.h> if available and if HAVE_ST_MTIM.
(FILE_TIMESTAMP, FILE_TIMESTAMP_STAT_MODTIME, FILE_TIMESTAMP_MIN,
FILE_TIMESTAMPS_PER_S, FILE_TIMESTAMP_FROM_S_AND_NS,
FILE_TIMESTAMP_DIV, FILE_TIMESTAMP_MOD, FILE_TIMESTAMP_S,
FILE_TIMESTAMP_NS, FILE_TIMESTAMP_PRINT_LEN_BOUND): New macros.
(file_timestamp_now, file_timestamp_sprintf): New decls.
(struct file.last_mtime, f_mtime, file_mtime_1, NEW_MTIME):
time_t -> FILE_TIMESTAMP.
* implicit.c (pattern_search): Likewise.
* vpath.c (vpath_search, selective_vpath_search): Likewise.
* main.c (main): Likewise.
* remake.c (check_dep, name_mtime, library_search, f_mtime): Likewise.
(f_mtime): Use file_timestamp_now instead of `time'.
Print file timestamp with file_timestamp_sprintf.
* vpath.c (selective_vpath_search): Extract file time stamp from
struct stat with FILE_TIMESTAMP_STAT_MODTIME.
1998-07-28 Paul D. Smith <psmith@gnu.org> 1998-07-28 Paul D. Smith <psmith@gnu.org>
* Version 3.77 released. * Version 3.77 released.
@ -118,7 +340,7 @@
1998-06-19 Eli Zaretskii <eliz@is.elta.co.il> 1998-06-19 Eli Zaretskii <eliz@is.elta.co.il>
* job.c (start_job_command): Reset execute_by_shell after an empty * job.c (start_job_command): Reset execute_by_shell after an empty
command was skipped. command was skipped.
1998-06-09 Paul D. Smith <psmith@gnu.org> 1998-06-09 Paul D. Smith <psmith@gnu.org>
@ -503,7 +725,7 @@ Thu Aug 28 17:04:47 1997 Paul D. Smith <psmith@baynetworks.com>
Wed Aug 27 17:09:32 1997 Paul D. Smith <psmith@baynetworks.com> Wed Aug 27 17:09:32 1997 Paul D. Smith <psmith@baynetworks.com>
* Version 3.75.92 * Version 3.75.92
Tue Aug 26 11:59:15 1997 Paul D. Smith <psmith@baynetworks.com> Tue Aug 26 11:59:15 1997 Paul D. Smith <psmith@baynetworks.com>
@ -538,16 +760,16 @@ Fri Aug 22 1997 Eli Zaretskii <eliz@is.elta.co.il>
Sat Aug 16 00:56:15 1997 John W. Eaton <jwe@bevo.che.wisc.edu> Sat Aug 16 00:56:15 1997 John W. Eaton <jwe@bevo.che.wisc.edu>
* vmsify.c (vmsify, case 11): After translating `..' elements, set * vmsify.c (vmsify, case 11): After translating `..' elements, set
nstate to N_OPEN if there are still more elements to process. nstate to N_OPEN if there are still more elements to process.
(vmsify, case 2): After translating `foo/bar' up to the slash, (vmsify, case 2): After translating `foo/bar' up to the slash,
set nstate to N_OPEN, not N_DOT. set nstate to N_OPEN, not N_DOT.
Fri Aug 8 15:18:09 1997 John W. Eaton <jwe@bevo.che.wisc.edu> Fri Aug 8 15:18:09 1997 John W. Eaton <jwe@bevo.che.wisc.edu>
* dir.c (vmsstat_dir): Leave name unmodified on exit. * dir.c (vmsstat_dir): Leave name unmodified on exit.
* make.h (PATH_SEPARATOR_CHAR): Set to comma for VMS. * make.h (PATH_SEPARATOR_CHAR): Set to comma for VMS.
* vpath.c: Fix comments to refer to path separator, not colon. * vpath.c: Fix comments to refer to path separator, not colon.
(selective_vpath_search): Avoid Unixy slash handling for VMS. (selective_vpath_search): Avoid Unixy slash handling for VMS.
Thu Aug 7 22:24:03 1997 John W. Eaton <jwe@bevo.che.wisc.edu> Thu Aug 7 22:24:03 1997 John W. Eaton <jwe@bevo.che.wisc.edu>

View File

@ -7,13 +7,18 @@
NORECURSE = true NORECURSE = true
ACLOCALARGS =
CFLAGS = -g -O -Wall -D__USE_FIXED_PROTOTYPES__
export CFLAGS
# If the user asked for a specific target, invoke the Makefile instead. # If the user asked for a specific target, invoke the Makefile instead.
# #
.DEFAULT: .DEFAULT:
@[ -f Makefile.in -a -f configure -a -f aclocal.m4 -a -f config.h.in ] \ @[ -f Makefile.in -a -f configure -a -f aclocal.m4 -a -f config.h.in ] \
|| $(MAKE) __cfg NORECURSE= || $(MAKE) __cfg NORECURSE=
@[ -f Makefile ] \ @[ -f Makefile ] \
|| ./configure || CFLAGS='-g -O -Wall -D__USE_FIXED_PROTOTYPES__' ./configure
$(MAKE) -f Makefile $@ $(MAKE) -f Makefile $@
.PHONY: __cfg __cfg_basic .PHONY: __cfg __cfg_basic
@ -23,21 +28,20 @@ NORECURSE = true
ACCONFIG = acconfig.h ACCONFIG = acconfig.h
__cfg: __cfg_basic config.h.in TAGS __cfg: __cfg_basic config.h.in TAGS
cd glob && $(MAKE) -f ../GNUmakefile __cfg_basic ACCONFIG=
ifdef NORECURSE ifdef NORECURSE
@echo ""; echo "Now you should run one of:"; echo ""; \ @echo ""; echo "Now you should run:"; echo ""; \
echo " make all"; \ echo " make all"; echo ""; \
echo "then, optionally, one of:"; echo ""; \
echo " make dist"; \ echo " make dist"; \
echo " make distdir"; \ echo " make distdir"; \
echo " make distcheck"; echo ""; \ echo " make distcheck"; \
echo "Or similar to proceed.";\
echo "" echo ""
endif endif
__cfg_basic: aclocal.m4 stamp-h.in configure Makefile.in __cfg_basic: aclocal.m4 stamp-h.in configure Makefile.in
aclocal.m4: configure.in $(wildcard acinclude.m4) aclocal.m4: configure.in $(wildcard acinclude.m4)
aclocal aclocal $(ACLOCALARGS)
config.h.in: stamp-h.in config.h.in: stamp-h.in
stamp-h.in: configure.in aclocal.m4 $(ACCONFIG) stamp-h.in: configure.in aclocal.m4 $(ACCONFIG)
@ -45,7 +49,7 @@ stamp-h.in: configure.in aclocal.m4 $(ACCONFIG)
echo timestamp > $@ echo timestamp > $@
configure: configure.in aclocal.m4 configure: configure.in aclocal.m4
autoconf autoconf $(ACARGS)
Makefile.in: configure.in config.h.in Makefile.am aclocal.m4 Makefile.in: configure.in config.h.in Makefile.am aclocal.m4
automake --add-missing automake --add-missing

View File

@ -10,6 +10,10 @@
/* Define this if the SCCS `get' command understands the `-G<file>' option. */ /* Define this if the SCCS `get' command understands the `-G<file>' option. */
#undef SCCS_GET_MINUS_G #undef SCCS_GET_MINUS_G
/* Define to be the nanoseconds member of struct stat's st_mtim,
if it exists. */
#undef ST_MTIM_NSEC
/* Define this if the C library defines the variable `sys_siglist'. */ /* Define this if the C library defines the variable `sys_siglist'. */
#undef HAVE_SYS_SIGLIST #undef HAVE_SYS_SIGLIST
@ -18,3 +22,7 @@
/* Define this if you have the `union wait' type in <sys/wait.h>. */ /* Define this if you have the `union wait' type in <sys/wait.h>. */
#undef HAVE_UNION_WAIT #undef HAVE_UNION_WAIT
/* Define to `unsigned long' or `unsigned long long'
if <inttypes.h> doesn't define. */
#undef uintmax_t

View File

@ -86,7 +86,7 @@ changequote([,])dnl
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl Got this from the GNU fileutils 3.16r distribution dnl Got this from the GNU fileutils 3.16r distribution
dnl by Paul Eggert <egger@twinsun.com> dnl by Paul Eggert <eggert@twinsun.com>
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl The problem is that the default compilation flags in Solaris 2.6 won't dnl The problem is that the default compilation flags in Solaris 2.6 won't
@ -129,3 +129,82 @@ AC_DEFUN(AC_LFS,
done ;; done ;;
esac esac
]) ])
dnl ---------------------------------------------------------------------------
dnl From Paul Eggert <eggert@twinsun.com>
dnl Define HAVE_INTTYPES_H if <inttypes.h> exists,
dnl doesn't clash with <sys/types.h>, and declares uintmax_t.
AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
[
if test x = y; then
dnl This code is deliberately never run via ./configure.
dnl FIXME: this is a gross hack to make autoheader put an entry
dnl for `HAVE_INTTYPES_H' in config.h.in.
AC_CHECK_FUNCS(INTTYPES_H)
fi
AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <inttypes.h>],
[uintmax_t i = (uintmax_t) -1;],
jm_ac_cv_header_inttypes_h=yes,
jm_ac_cv_header_inttypes_h=no)])
if test $jm_ac_cv_header_inttypes_h = yes; then
ac_kludge=HAVE_INTTYPES_H
AC_DEFINE_UNQUOTED($ac_kludge)
fi
])
dnl ---------------------------------------------------------------------------
dnl From Paul Eggert <eggert@twinsun.com>
AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
[AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
ac_cv_struct_st_mtim_nsec,
[ac_save_CPPFLAGS="$CPPFLAGS"
ac_cv_struct_st_mtim_nsec=no
# tv_nsec -- the usual case
# _tv_nsec -- Solaris 2.6, if
# (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
# && !defined __EXTENSIONS__)
# st__tim.tv_nsec -- UnixWare 2.1.2
for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
[ac_cv_struct_st_mtim_nsec=$ac_val; break])
done
CPPFLAGS="$ac_save_CPPFLAGS"])
if test $ac_cv_struct_st_mtim_nsec != no; then
AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec)
fi
]
)
dnl ---------------------------------------------------------------------------
dnl From Paul Eggert <eggert@twinsun.com>
dnl Define uintmax_t to `unsigned long' or `unsigned long long'
dnl if <inttypes.h> does not exist.
AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
[
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
if test $jm_ac_cv_header_inttypes_h = no; then
AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
[AC_TRY_COMPILE([],
[unsigned long long i = (unsigned long long) -1;],
ac_cv_type_unsigned_long_long=yes,
ac_cv_type_unsigned_long_long=no)])
if test $ac_cv_type_unsigned_long_long = yes; then
AC_DEFINE(uintmax_t, unsigned long long)
else
AC_DEFINE(uintmax_t, unsigned long)
fi
fi
])

View File

@ -45,7 +45,7 @@ char ** argv;
buffer = AllocMem (len, MEMF_ANY); buffer = AllocMem (len, MEMF_ANY);
if (!buffer) if (!buffer)
fatal ("MyExecute: Cannot allocate space for calling a command"); fatal (NILF, "MyExecute: Cannot allocate space for calling a command");
ptr = buffer; ptr = buffer;

25
ar.c
View File

@ -46,7 +46,7 @@ ar_name (name)
return 0; return 0;
if (p[1] == '(' && end[-1] == ')') if (p[1] == '(' && end[-1] == ')')
fatal ("attempt to use unsupported feature: `%s'", name); fatal (NILF, "attempt to use unsupported feature: `%s'", name);
return 1; return 1;
} }
@ -137,7 +137,7 @@ int
ar_touch (name) ar_touch (name)
char *name; char *name;
{ {
error ("touch archive member is not available on VMS"); error (NILF, "touch archive member is not available on VMS");
return -1; return -1;
} }
#else #else
@ -169,22 +169,24 @@ ar_touch (name)
switch (ar_member_touch (arname, memname)) switch (ar_member_touch (arname, memname))
{ {
case -1: case -1:
error ("touch: Archive `%s' does not exist", arname); error (NILF, "touch: Archive `%s' does not exist", arname);
break; break;
case -2: case -2:
error ("touch: `%s' is not a valid archive", arname); error (NILF, "touch: `%s' is not a valid archive", arname);
break; break;
case -3: case -3:
perror_with_name ("touch: ", arname); perror_with_name ("touch: ", arname);
break; break;
case 1: case 1:
error ("touch: Member `%s' does not exist in `%s'", memname, arname); error (NILF,
"touch: Member `%s' does not exist in `%s'", memname, arname);
break; break;
case 0: case 0:
val = 0; val = 0;
break; break;
default: default:
error ("touch: Bad return code from ar_member_touch on `%s'", name); error (NILF,
"touch: Bad return code from ar_member_touch on `%s'", name);
} }
if (!arname_used) if (!arname_used)
@ -233,15 +235,6 @@ ar_glob_match (desc, mem, truncated,
return 0L; return 0L;
} }
/* Alphabetic sorting function for `qsort'. */
static int
ar_glob_alphacompare (a, b)
char **a, **b;
{
return strcmp (*a, *b);
}
/* Return nonzero if PATTERN contains any metacharacters. /* Return nonzero if PATTERN contains any metacharacters.
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
static int static int
@ -316,7 +309,7 @@ ar_glob (arname, member_pattern, size)
names[i++] = n->name; names[i++] = n->name;
/* Sort them alphabetically. */ /* Sort them alphabetically. */
qsort ((char *) names, i, sizeof (*names), ar_glob_alphacompare); qsort ((char *) names, i, sizeof (*names), alpha_compare);
/* Put them back into the chain in the sorted order. */ /* Put them back into the chain in the sorted order. */
i = 0; i = 0;

View File

@ -69,7 +69,7 @@ VMS_get_member_info (module, rfa)
&bufdesc.dsc$w_length, 0); &bufdesc.dsc$w_length, 0);
if (! status) if (! status)
{ {
error ("lbr$set_module failed to extract module info, status = %d", error (NILF, "lbr$set_module failed to extract module info, status = %d",
status); status);
lbr$close (&VMS_lib_idx); lbr$close (&VMS_lib_idx);
@ -151,7 +151,7 @@ ar_scan (archive, function, arg)
if (! status) if (! status)
{ {
error ("lbr$ini_control failed with status = %d",status); error (NILF, "lbr$ini_control failed with status = %d",status);
return -2; return -2;
} }
@ -162,7 +162,7 @@ ar_scan (archive, function, arg)
if (! status) if (! status)
{ {
error ("unable to open library `%s' to lookup member `%s'", error (NILF, "unable to open library `%s' to lookup member `%s'",
archive, (char *)arg); archive, (char *)arg);
return -1; return -1;
} }

View File

@ -473,13 +473,13 @@ delete_target (file, on_behalf_of)
#ifndef NO_ARCHIVES #ifndef NO_ARCHIVES
if (ar_name (file->name)) if (ar_name (file->name))
{ {
if (ar_member_date (file->name) != file->last_mtime) if (ar_member_date (file->name) != FILE_TIMESTAMP_S (file->last_mtime))
{ {
if (on_behalf_of) if (on_behalf_of)
error ("*** [%s] Archive member `%s' may be bogus; not deleted", error (NILF, "*** [%s] Archive member `%s' may be bogus; not deleted",
on_behalf_of, file->name); on_behalf_of, file->name);
else else
error ("*** Archive member `%s' may be bogus; not deleted", error (NILF, "*** Archive member `%s' may be bogus; not deleted",
file->name); file->name);
} }
return; return;
@ -488,12 +488,12 @@ delete_target (file, on_behalf_of)
if (stat (file->name, &st) == 0 if (stat (file->name, &st) == 0
&& S_ISREG (st.st_mode) && S_ISREG (st.st_mode)
&& (time_t) st.st_mtime != file->last_mtime) && FILE_TIMESTAMP_STAT_MODTIME (st) != file->last_mtime)
{ {
if (on_behalf_of) if (on_behalf_of)
error ("*** [%s] Deleting file `%s'", on_behalf_of, file->name); error (NILF, "*** [%s] Deleting file `%s'", on_behalf_of, file->name);
else else
error ("*** Deleting file `%s'", file->name); error (NILF, "*** Deleting file `%s'", file->name);
if (unlink (file->name) < 0 if (unlink (file->name) < 0
&& errno != ENOENT) /* It disappeared; so what. */ && errno != ENOENT) /* It disappeared; so what. */
perror_with_name ("unlink: ", file->name); perror_with_name ("unlink: ", file->name);
@ -533,10 +533,11 @@ print_commands (cmds)
fputs ("# commands to execute", stdout); fputs ("# commands to execute", stdout);
if (cmds->filename == 0) if (cmds->fileinfo.filenm == 0)
puts (" (built-in):"); puts (" (built-in):");
else else
printf (" (from `%s', line %u):\n", cmds->filename, cmds->lineno); printf (" (from `%s', line %lu):\n",
cmds->fileinfo.filenm, cmds->fileinfo.lineno);
s = cmds->commands; s = cmds->commands;
while (*s != '\0') while (*s != '\0')

View File

@ -21,8 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
struct commands struct commands
{ {
char *filename; /* File that contains commands. */ struct floc fileinfo; /* Where commands were defined. */
unsigned int lineno; /* Line number in file. */
char *commands; /* Commands text. */ char *commands; /* Commands text. */
unsigned int ncommand_lines;/* Number of command lines. */ unsigned int ncommand_lines;/* Number of command lines. */
char **command_lines; /* Commands chopped up into lines. */ char **command_lines; /* Commands chopped up into lines. */

View File

@ -4,121 +4,123 @@
System headers sometimes define this. System headers sometimes define this.
We just want to avoid a redefinition error message. */ We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE #ifndef _ALL_SOURCE
#undef _ALL_SOURCE /* #undef _ALL_SOURCE */
#endif #endif
/* Define if using alloca.c. */ /* Define if using alloca.c. */
#define C_ALLOCA #define C_ALLOCA
/* Define if the closedir function returns void instead of int. */
/* #undef CLOSEDIR_VOID */
/* Define to empty if the keyword does not work. */ /* Define to empty if the keyword does not work. */
#undef const /* #undef const */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */ This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END /* #undef CRAY_STACKSEG_END */
/* Define for DGUX with <sys/dg_sys_info.h>. */ /* Define for DGUX with <sys/dg_sys_info.h>. */
#undef DGUX /* #undef DGUX */
/* Define if the `getloadavg' function needs to be run setuid or setgid. */ /* Define if the `getloadavg' function needs to be run setuid or setgid. */
#undef GETLOADAVG_PRIVILEGED /* #undef GETLOADAVG_PRIVILEGED */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#define gid_t int #define gid_t int
/* Define if you have alloca, as a function or macro. */ /* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA /* #undef HAVE_ALLOCA */
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ /* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H /* #undef HAVE_ALLOCA_H */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you don't have vprintf but do have _doprnt. */ /* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT /* #undef HAVE_DOPRNT */
/* Define if your system has a working fnmatch function. */
/* #undef HAVE_FNMATCH */
/* Define if your system has its own `getloadavg' function. */ /* Define if your system has its own `getloadavg' function. */
#undef HAVE_GETLOADAVG /* #undef HAVE_GETLOADAVG */
/* Define if you have the getmntent function. */ /* Define if you have the getmntent function. */
#undef HAVE_GETMNTENT /* #undef HAVE_GETMNTENT */
/* Define if the `long double' type works. */ /* Define if the `long double' type works. */
#undef HAVE_LONG_DOUBLE /* #undef HAVE_LONG_DOUBLE */
/* Define if you support file names longer than 14 characters. */ /* Define if you support file names longer than 14 characters. */
#define HAVE_LONG_FILE_NAMES #define HAVE_LONG_FILE_NAMES 1
/* Define if you have a working `mmap' system call. */ /* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP /* #undef HAVE_MMAP */
/* Define if system calls automatically restart after interruption /* Define if system calls automatically restart after interruption
by a signal. */ by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS /* #undef HAVE_RESTARTABLE_SYSCALLS */
/* Define if your struct stat has st_blksize. */ /* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE /* #undef HAVE_ST_BLKSIZE */
/* Define if your struct stat has st_blocks. */ /* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS /* #undef HAVE_ST_BLOCKS */
/* Define if you have the strcoll function and it is properly defined. */ /* Define if you have the strcoll function and it is properly defined. */
#define HAVE_STRCOLL #define HAVE_STRCOLL 1
/* Define if your struct stat has st_rdev. */ /* Define if your struct stat has st_rdev. */
#define HAVE_ST_RDEV #define HAVE_ST_RDEV 1
/* Define if you have the strftime function. */ /* Define if you have the strftime function. */
#define HAVE_STRFTIME #define HAVE_STRFTIME 1
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H /* #undef HAVE_SYS_WAIT_H */
/* Define if your struct tm has tm_zone. */ /* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE /* #undef HAVE_TM_ZONE */
/* Define if you don't have tm_zone but do have the external array /* Define if you don't have tm_zone but do have the external array
tzname. */ tzname. */
#define HAVE_TZNAME #define HAVE_TZNAME 1
/* #define tzname __tzname */
/* Define if you have <unistd.h>. */ /* Define if you have <unistd.h>. */
#define HAVE_UNISTD_H #define HAVE_UNISTD_H 1
/* Define if utime(file, NULL) sets file's timestamp to the present. */ /* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL /* #undef HAVE_UTIME_NULL */
/* Define if you have <vfork.h>. */ /* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H /* #undef HAVE_VFORK_H */
/* Define if you have the vprintf function. */ /* Define if you have the vprintf function. */
#define HAVE_VPRINTF #define HAVE_VPRINTF 1
/* Define if you have the wait3 system call. */ /* Define if you have the wait3 system call. */
#undef HAVE_WAIT3 /* #undef HAVE_WAIT3 */
/* Define if on MINIX. */ /* Define if on MINIX. */
#undef _MINIX /* #undef _MINIX */
/* Define if your struct nlist has an n_un member. */ /* Define if your struct nlist has an n_un member. */
#undef NLIST_NAME_UNION /* #undef NLIST_NAME_UNION */
/* Define if you have <nlist.h>. */ /* Define if you have <nlist.h>. */
#undef NLIST_STRUCT /* #undef NLIST_STRUCT */
/* Define if your C compiler doesn't accept -c and -o together. */ /* Define if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O /* #undef NO_MINUS_C_MINUS_O */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#define pid_t int #define pid_t int
/* Define if the system does not provide POSIX.1 features except /* Define if the system does not provide POSIX.1 features except
with this defined. */ with this defined. */
#undef _POSIX_1_SOURCE /* #undef _POSIX_1_SOURCE */
/* Define if you need to in order for stat and other things to work. */ /* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE /* #undef _POSIX_SOURCE */
/* Define as the return type of signal handlers (int or void). */ /* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void #define RETSIGTYPE void
@ -126,7 +128,7 @@
/* Define if the setvbuf function takes the buffering type as its second /* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V argument and the buffer pointer as the third, as on System V
before release 3. */ before release 3. */
#undef SETVBUF_REVERSED /* #undef SETVBUF_REVERSED */
/* If using the C implementation of alloca, define if you know the /* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be direction of stack growth for your system; otherwise it will be
@ -138,29 +140,29 @@
#define STACK_DIRECTION -1 #define STACK_DIRECTION -1
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */ /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN /* #undef STAT_MACROS_BROKEN */
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#define STDC_HEADERS #define STDC_HEADERS
/* Define on System V Release 4. */ /* Define on System V Release 4. */
#undef SVR4 /* #undef SVR4 */
/* Define if `sys_siglist' is declared by <signal.h>. */ /* Define if `sys_siglist' is declared by <signal.h>. */
#undef SYS_SIGLIST_DECLARED /* #undef SYS_SIGLIST_DECLARED */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#define uid_t int #define uid_t int
/* Define for Encore UMAX. */ /* Define for Encore UMAX. */
#undef UMAX /* #undef UMAX */
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h> /* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>. */ instead of <sys/cpustats.h>. */
#undef UMAX4_3 /* #undef UMAX4_3 */
/* Define vfork as fork if vfork does not work. */ /* Define vfork as fork if vfork does not work. */
#undef vfork /* #undef vfork */
/* Name of this package (needed by automake) */ /* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%" #define PACKAGE "%PACKAGE%"
@ -172,112 +174,130 @@
#define SCCS_GET "get" #define SCCS_GET "get"
/* Define this if the SCCS `get' command understands the `-G<file>' option. */ /* Define this if the SCCS `get' command understands the `-G<file>' option. */
#undef SCCS_GET_MINUS_G /* #undef SCCS_GET_MINUS_G */
/* Define this if the C library defines the variable `sys_siglist'. */ /* Define this if the C library defines the variable `sys_siglist'. */
#undef HAVE_SYS_SIGLIST /* #undef HAVE_SYS_SIGLIST */
/* Define this if the C library defines the variable `_sys_siglist'. */ /* Define this if the C library defines the variable `_sys_siglist'. */
#undef HAVE__SYS_SIGLIST /* #undef HAVE__SYS_SIGLIST */
/* Define this if you have the `union wait' type in <sys/wait.h>. */ /* Define this if you have the `union wait' type in <sys/wait.h>. */
#undef HAVE_UNION_WAIT /* #undef HAVE_UNION_WAIT */
/* Define this if the POSIX.1 call `sysconf (_SC_OPEN_MAX)' works properly. */
#undef HAVE_SYSCONF_OPEN_MAX
/* Define if you have the dup2 function. */ /* Define if you have the dup2 function. */
#undef HAVE_DUP2 /* #undef HAVE_DUP2 */
/* Define if you have the getcwd function. */ /* Define if you have the getcwd function. */
#define HAVE_GETCWD #define HAVE_GETCWD 1
/* Define if you have the getdtablesize function. */
#undef HAVE_GETDTABLESIZE
/* Define if you have the getgroups function. */ /* Define if you have the getgroups function. */
#undef HAVE_GETGROUPS /* #undef HAVE_GETGROUPS */
/* Define if you have the gethostbyname function. */
/* #undef HAVE_GETHOSTBYNAME */
/* Define if you have the gethostname function. */
/* #undef HAVE_GETHOSTNAME */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the mktemp function. */ /* Define if you have the mktemp function. */
#define HAVE_MKTEMP #define HAVE_MKTEMP 1
/* Define if you have the psignal function. */ /* Define if you have the psignal function. */
#undef HAVE_PSIGNAL /* #undef HAVE_PSIGNAL */
/* Define if you have the pstat_getdynamic function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define if you have the setegid function. */ /* Define if you have the setegid function. */
#undef HAVE_SETEGID /* #undef HAVE_SETEGID */
/* Define if you have the seteuid function. */ /* Define if you have the seteuid function. */
#undef HAVE_SETEUID /* #undef HAVE_SETEUID */
/* Define if you have the setlinebuf function. */ /* Define if you have the setlinebuf function. */
#undef HAVE_SETLINEBUF /* #undef HAVE_SETLINEBUF */
/* Define if you have the setregid function. */ /* Define if you have the setregid function. */
#undef HAVE_SETREGID /* #undef HAVE_SETREGID */
/* Define if you have the setreuid function. */ /* Define if you have the setreuid function. */
#undef HAVE_SETREUID /* #undef HAVE_SETREUID */
/* Define if you have the sigsetmask function. */ /* Define if you have the sigsetmask function. */
#undef HAVE_SIGSETMASK /* #undef HAVE_SIGSETMASK */
/* Define if you have the socket function. */
/* #undef HAVE_SOCKET */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP */
/* Define if you have the strerror function. */ /* Define if you have the strerror function. */
#define HAVE_STRERROR #define HAVE_STRERROR 1
/* Define if you have the strsignal function. */ /* Define if you have the strsignal function. */
#undef HAVE_STRSIGNAL /* #undef HAVE_STRSIGNAL */
/* Define if you have the wait3 function. */ /* Define if you have the wait3 function. */
#undef HAVE_WAIT3 /* #undef HAVE_WAIT3 */
/* Define if you have the waitpid function. */ /* Define if you have the waitpid function. */
#undef HAVE_WAITPID /* #undef HAVE_WAITPID */
/* Define if you have the <dirent.h> header file. */ /* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H #define HAVE_DIRENT_H 1
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H #define HAVE_FCNTL_H 1
/* Define if you have the <limits.h> header file. */ /* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H #define HAVE_LIMITS_H 1
/* Define if you have the <mach/mach.h> header file. */ /* Define if you have the <mach/mach.h> header file. */
#undef HAVE_MACH_MACH_H /* #undef HAVE_MACH_MACH_H */
/* Define if you have the <memory.h> header file. */ /* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H /* #undef HAVE_MEMORY_H */
/* Define if you have the <ndir.h> header file. */ /* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H /* #undef HAVE_NDIR_H */
/* Define if you have the <stdlib.h> header file. */
/* #undef HAVE_STDLIB_H */
/* Define if you have the <string.h> header file. */ /* Define if you have the <string.h> header file. */
#define HAVE_STRING_H #define HAVE_STRING_H 1
/* Define if you have the <sys/dir.h> header file. */ /* Define if you have the <sys/dir.h> header file. */
#define HAVE_SYS_DIR_H #define HAVE_SYS_DIR_H 1
/* Define if you have the <sys/ndir.h> header file. */ /* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H /* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/param.h> header file. */ /* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H /* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/timeb.h> header file. */ /* Define if you have the <sys/timeb.h> header file. */
#undef HAVE_SYS_TIMEB_H /* #undef HAVE_SYS_TIMEB_H */
/* Define if you have the <sys/wait.h> header file. */ /* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H /* #undef HAVE_SYS_WAIT_H */
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H #define HAVE_UNISTD_H 1
/* Define if you have the dgc library (-ldgc). */ /* Define if you have the dgc library (-ldgc). */
#undef HAVE_LIBDGC /* #undef HAVE_LIBDGC */
/* Define if you have the kstat library (-lkstat). */
/* #undef HAVE_LIBKSTAT */
/* Define if you have the sun library (-lsun). */ /* Define if you have the sun library (-lsun). */
#undef HAVE_LIBSUN /* #undef HAVE_LIBSUN */
/* Define for Case Insensitve behavior */ /* Define for Case Insensitve behavior */
#define HAVE_CASE_INSENSITIVE_FS #define HAVE_CASE_INSENSITIVE_FS

View File

@ -12,6 +12,9 @@
/* Define if using alloca.c. */ /* Define if using alloca.c. */
/* #undef C_ALLOCA */ /* #undef C_ALLOCA */
/* Define if the closedir function returns void instead of int. */
/* #undef CLOSEDIR_VOID */
/* Define to empty if the keyword does not work. */ /* Define to empty if the keyword does not work. */
/* #undef const */ /* #undef const */
@ -23,7 +26,7 @@
/* #undef DGUX */ /* #undef DGUX */
/* Define if the `getloadavg' function needs to be run setuid or setgid. */ /* Define if the `getloadavg' function needs to be run setuid or setgid. */
/* #undef GETLOADAVG_PRIVILEGED 1 */ /* #undef GETLOADAVG_PRIVILEGED */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */ /* #undef gid_t */
@ -32,14 +35,14 @@
#define HAVE_ALLOCA 1 #define HAVE_ALLOCA 1
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ /* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* #undef HAVE_ALLOCA_H 1 */ /* #undef HAVE_ALLOCA_H */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you don't have vprintf but do have _doprnt. */ /* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */ /* #undef HAVE_DOPRNT */
/* Define if your system has a working fnmatch function. */
/* #undef HAVE_FNMATCH */
/* Define if your system has its own `getloadavg' function. */ /* Define if your system has its own `getloadavg' function. */
/* #undef HAVE_GETLOADAVG */ /* #undef HAVE_GETLOADAVG */
@ -66,16 +69,16 @@
/* #undef HAVE_ST_BLOCKS */ /* #undef HAVE_ST_BLOCKS */
/* Define if you have the strcoll function and it is properly defined. */ /* Define if you have the strcoll function and it is properly defined. */
/* #undef HAVE_STRCOLL 1 */ /* #undef HAVE_STRCOLL */
/* Define if your struct stat has st_rdev. */ /* Define if your struct stat has st_rdev. */
/* #undef HAVE_ST_RDEV */ /* #undef HAVE_ST_RDEV */
/* Define if you have the strftime function. */ /* Define if you have the strftime function. */
/* #undef HAVE_STRFTIME */ /* #undef HAVE_STRFTIME */
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
/* #undef HAVE_SYS_WAIT_H 1 */ /* #undef HAVE_SYS_WAIT_H */
/* Define if your struct tm has tm_zone. */ /* Define if your struct tm has tm_zone. */
/* #undef HAVE_TM_ZONE */ /* #undef HAVE_TM_ZONE */
@ -93,13 +96,13 @@
/* #undef HAVE_UTIME_NULL */ /* #undef HAVE_UTIME_NULL */
/* Define if you have <vfork.h>. */ /* Define if you have <vfork.h>. */
/* #undef HAVE_VFORK_H 1 */ /* #undef HAVE_VFORK_H */
/* Define if you have the vprintf function. */ /* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1 #define HAVE_VPRINTF 1
/* Define if you have the wait3 system call. */ /* Define if you have the wait3 system call. */
/* #undef HAVE_WAIT3 1 */ /* #undef HAVE_WAIT3 */
/* Define if on MINIX. */ /* Define if on MINIX. */
/* #undef _MINIX */ /* #undef _MINIX */
@ -108,7 +111,7 @@
/* #undef NLIST_NAME_UNION */ /* #undef NLIST_NAME_UNION */
/* Define if you have <nlist.h>. */ /* Define if you have <nlist.h>. */
/* #undef NLIST_STRUCT 1 */ /* #undef NLIST_STRUCT */
/* Define if your C compiler doesn't accept -c and -o together. */ /* Define if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */ /* #undef NO_MINUS_C_MINUS_O */
@ -129,7 +132,7 @@
/* Define if the setvbuf function takes the buffering type as its second /* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V argument and the buffer pointer as the third, as on System V
before release 3. */ before release 3. */
/* #undef SETVBUF_REVERSED 1 */ /* #undef SETVBUF_REVERSED */
/* If using the C implementation of alloca, define if you know the /* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be direction of stack growth for your system; otherwise it will be
@ -162,23 +165,23 @@
instead of <sys/cpustats.h>. */ instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */ /* #undef UMAX4_3 */
/* Define vfork as fork if vfork does not work. */
/* #undef vfork */
/* Name of this package (needed by automake) */ /* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%" #define PACKAGE "%PACKAGE%"
/* Version of this package (needed by automake) */ /* Version of this package (needed by automake) */
#define VERSION "%VERSION%" #define VERSION "%VERSION%"
/* Define vfork as fork if vfork does not work. */
/* #undef vfork */
/* Define to the name of the SCCS `get' command. */ /* Define to the name of the SCCS `get' command. */
/* #undef SCCS_GET "/usr/sccs/get" */ /* #undef SCCS_GET */
/* Define this if the SCCS `get' command understands the `-G<file>' option. */ /* Define this if the SCCS `get' command understands the `-G<file>' option. */
/* #undef SCCS_GET_MINUS_G 1 */ /* #undef SCCS_GET_MINUS_G */
/* Define this if the C library defines the variable `sys_siglist'. */ /* Define this if the C library defines the variable `sys_siglist'. */
/* #undefine HAVE_SYS_SIGLIST 1 */ /* #undefine HAVE_SYS_SIGLIST */
/* Define this if the C library defines the variable `_sys_siglist'. */ /* Define this if the C library defines the variable `_sys_siglist'. */
/* #undef HAVE__SYS_SIGLIST */ /* #undef HAVE__SYS_SIGLIST */
@ -186,45 +189,60 @@
/* Define this if you have the `union wait' type in <sys/wait.h>. */ /* Define this if you have the `union wait' type in <sys/wait.h>. */
/* #undef HAVE_UNION_WAIT */ /* #undef HAVE_UNION_WAIT */
/* Define this if the POSIX.1 call `sysconf (_SC_OPEN_MAX)' works properly. */
/* #undef HAVE_SYSCONF_OPEN_MAX */
/* Define if you have the dup2 function. */ /* Define if you have the dup2 function. */
#define HAVE_DUP2 1 #define HAVE_DUP2 1
/* Define if you have the getcwd function. */ /* Define if you have the getcwd function. */
#define HAVE_GETCWD 1 #define HAVE_GETCWD 1
/* Define if you have the getdtablesize function. */
/* #undef HAVE_GETDTABLESIZE 1 */
/* Define if you have the getgroups function. */ /* Define if you have the getgroups function. */
/* #undef HAVE_GETGROUPS 1 */ /* #undef HAVE_GETGROUPS */
/* Define if you have the gethostbyname function. */
/* #undef HAVE_GETHOSTBYNAME */
/* Define if you have the gethostname function. */
/* #undef HAVE_GETHOSTNAME */
/* Define if you have the getloadavg function. */
/* #undef HAVE_GETLOADAVG */
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the mktemp function. */ /* Define if you have the mktemp function. */
#define HAVE_MKTEMP 1 #define HAVE_MKTEMP 1
/* Define if you have the psignal function. */ /* Define if you have the psignal function. */
/* #undef HAVE_PSIGNAL 1 */ /* #undef HAVE_PSIGNAL */
/* Define if you have the pstat_getdynamic function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define if you have the setegid function. */ /* Define if you have the setegid function. */
/* #undef HAVE_SETEGID 1 */ /* #undef HAVE_SETEGID */
/* Define if you have the seteuid function. */ /* Define if you have the seteuid function. */
/* #undef HAVE_SETEUID 1 */ /* #undef HAVE_SETEUID */
/* Define if you have the setlinebuf function. */ /* Define if you have the setlinebuf function. */
/* #undef HAVE_SETLINEBUF 1 */ /* #undef HAVE_SETLINEBUF */
/* Define if you have the setregid function. */ /* Define if you have the setregid function. */
/* #undefine HAVE_SETREGID 1 */ /* #undefine HAVE_SETREGID */
/* Define if you have the setreuid function. */ /* Define if you have the setreuid function. */
/* #define HAVE_SETREUID 1 */ /* #define HAVE_SETREUID */
/* Define if you have the sigsetmask function. */ /* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 1 #define HAVE_SIGSETMASK 1
/* Define if you have the socket function. */
/* #undef HAVE_SOCKET */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP */
/* Define if you have the strerror function. */ /* Define if you have the strerror function. */
#define HAVE_STRERROR 1 #define HAVE_STRERROR 1
@ -232,13 +250,13 @@
/* #undef HAVE_STRSIGNAL */ /* #undef HAVE_STRSIGNAL */
/* Define if you have the wait3 function. */ /* Define if you have the wait3 function. */
/* #define HAVE_WAIT3 1 */ /* #undef HAVE_WAIT3 */
/* Define if you have the waitpid function. */ /* Define if you have the waitpid function. */
/* #undef HAVE_WAITPID 1 */ /* #undef HAVE_WAITPID */
/* Define if you have the <dirent.h> header file. */ /* Define if you have the <dirent.h> header file. */
/* #unddef HAVE_DIRENT_H 1 */ /* #undef HAVE_DIRENT_H */
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#ifdef __DECC #ifdef __DECC
@ -252,17 +270,17 @@
/* #undef HAVE_MACH_MACH_H */ /* #undef HAVE_MACH_MACH_H */
/* Define if you have the <memory.h> header file. */ /* Define if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H 1 */ /* #undef HAVE_MEMORY_H */
/* Define if you have the <ndir.h> header file. */ /* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */ /* #undef HAVE_NDIR_H */
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <string.h> header file. */ /* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1 #define HAVE_STRING_H 1
/* Define if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Define if you have the <sys/dir.h> header file. */ /* Define if you have the <sys/dir.h> header file. */
/* #undef HAVE_SYS_DIR_H */ /* #undef HAVE_SYS_DIR_H */
@ -270,24 +288,29 @@
/* #undef HAVE_SYS_NDIR_H */ /* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/param.h> header file. */ /* Define if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H 1 */ /* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/timeb.h> header file. */ /* Define if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1 #define HAVE_SYS_TIMEB_H 1
/* Define if you have the <sys/wait.h> header file. */ /* Define if you have the <sys/wait.h> header file. */
/* #undef HAVE_SYS_WAIT_H 1 */ /* #undef HAVE_SYS_WAIT_H */
/* Define if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Define if you have the dgc library (-ldgc). */ /* Define if you have the dgc library (-ldgc). */
/* #undef HAVE_LIBDGC */ /* #undef HAVE_LIBDGC */
/* Define if you have the kstat library (-lkstat). */
/* #undef HAVE_LIBKSTAT */
/* Define if you have the sun library (-lsun). */ /* Define if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */ /* #undef HAVE_LIBSUN */
/* VMS specific */ /* VMS specific */
#define HAVE_VMSDIR_H 1 #define HAVE_VMSDIR_H 1
#define HAVE_STDLIB_H 1
#define INCLUDEDIR "sys$sysroot:[syslib]" #define INCLUDEDIR "sys$sysroot:[syslib]"
#define LIBDIR "sys$sysroot:[syslib]" #define LIBDIR "sys$sysroot:[syslib]"

View File

@ -4,24 +4,27 @@
System headers sometimes define this. System headers sometimes define this.
We just want to avoid a redefinition error message. */ We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE #ifndef _ALL_SOURCE
#undef _ALL_SOURCE /* #undef _ALL_SOURCE */
#endif #endif
/* Define if using alloca.c. */ /* Define if using alloca.c. */
#undef C_ALLOCA /* #undef C_ALLOCA */
/* Define if the closedir function returns void instead of int. */
/* #undef CLOSEDIR_VOID */
/* Define to empty if the keyword does not work. */ /* Define to empty if the keyword does not work. */
#undef const /* #undef const */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */ This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END /* #undef CRAY_STACKSEG_END */
/* Define for DGUX with <sys/dg_sys_info.h>. */ /* Define for DGUX with <sys/dg_sys_info.h>. */
#undef DGUX /* #undef DGUX */
/* Define if the `getloadavg' function needs to be run setuid or setgid. */ /* Define if the `getloadavg' function needs to be run setuid or setgid. */
#undef GETLOADAVG_PRIVILEGED /* #undef GETLOADAVG_PRIVILEGED */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t #undef gid_t
@ -32,40 +35,39 @@
#define HAVE_ALLOCA 1 #define HAVE_ALLOCA 1
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ /* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H /* #undef HAVE_ALLOCA_H */
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
#define HAVE_MEMMOVE 1
/* Define if you don't have vprintf but do have _doprnt. */ /* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT /* #undef HAVE_DOPRNT */
/* Define if your system has a working fnmatch function. */
/* #undef HAVE_FNMATCH */
/* Define if your system has its own `getloadavg' function. */ /* Define if your system has its own `getloadavg' function. */
#undef HAVE_GETLOADAVG /* #undef HAVE_GETLOADAVG */
/* Define if you have the getmntent function. */ /* Define if you have the getmntent function. */
#undef HAVE_GETMNTENT /* #undef HAVE_GETMNTENT */
/* Define if the `long double' type works. */ /* Define if the `long double' type works. */
#undef HAVE_LONG_DOUBLE /* #undef HAVE_LONG_DOUBLE */
/* Define if you support file names longer than 14 characters. */ /* Define if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES #undef HAVE_LONG_FILE_NAMES
#define HAVE_LONG_FILE_NAMES 1 #define HAVE_LONG_FILE_NAMES 1
/* Define if you have a working `mmap' system call. */ /* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP /* #undef HAVE_MMAP */
/* Define if system calls automatically restart after interruption /* Define if system calls automatically restart after interruption
by a signal. */ by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS /* #undef HAVE_RESTARTABLE_SYSCALLS */
/* Define if your struct stat has st_blksize. */ /* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE /* #undef HAVE_ST_BLKSIZE */
/* Define if your struct stat has st_blocks. */ /* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS /* #undef HAVE_ST_BLOCKS */
/* Define if you have the strcoll function and it is properly defined. */ /* Define if you have the strcoll function and it is properly defined. */
#undef HAVE_STRCOLL #undef HAVE_STRCOLL
@ -80,10 +82,10 @@
#define HAVE_STRFTIME 1 #define HAVE_STRFTIME 1
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H /* #undef HAVE_SYS_WAIT_H */
/* Define if your struct tm has tm_zone. */ /* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE /* #undef HAVE_TM_ZONE */
/* Define if you don't have tm_zone but do have the external array /* Define if you don't have tm_zone but do have the external array
tzname. */ tzname. */
@ -91,33 +93,33 @@
#define HAVE_TZNAME 1 #define HAVE_TZNAME 1
/* Define if you have <unistd.h>. */ /* Define if you have <unistd.h>. */
#undef HAVE_UNISTD_H /* #undef HAVE_UNISTD_H */
/* Define if utime(file, NULL) sets file's timestamp to the present. */ /* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL #undef HAVE_UTIME_NULL
#define HAVE_UTIME_NULL 1 #define HAVE_UTIME_NULL 1
/* Define if you have <vfork.h>. */ /* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H /* #undef HAVE_VFORK_H */
/* Define if you have the vprintf function. */ /* Define if you have the vprintf function. */
#undef HAVE_VPRINTF #undef HAVE_VPRINTF
#define HAVE_VPRINTF 1 #define HAVE_VPRINTF 1
/* Define if you have the wait3 system call. */ /* Define if you have the wait3 system call. */
#undef HAVE_WAIT3 /* #undef HAVE_WAIT3 */
/* Define if on MINIX. */ /* Define if on MINIX. */
#undef _MINIX /* #undef _MINIX */
/* Define if your struct nlist has an n_un member. */ /* Define if your struct nlist has an n_un member. */
#undef NLIST_NAME_UNION /* #undef NLIST_NAME_UNION */
/* Define if you have <nlist.h>. */ /* Define if you have <nlist.h>. */
#undef NLIST_STRUCT /* #undef NLIST_STRUCT */
/* Define if your C compiler doesn't accept -c and -o together. */ /* Define if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O /* #undef NO_MINUS_C_MINUS_O */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t #undef pid_t
@ -125,7 +127,7 @@
/* Define if the system does not provide POSIX.1 features except /* Define if the system does not provide POSIX.1 features except
with this defined. */ with this defined. */
#undef _POSIX_1_SOURCE /* #undef _POSIX_1_SOURCE */
/* Define if you need to in order for stat and other things to work. */ /* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE #undef _POSIX_SOURCE
@ -138,7 +140,7 @@
/* Define if the setvbuf function takes the buffering type as its second /* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V argument and the buffer pointer as the third, as on System V
before release 3. */ before release 3. */
#undef SETVBUF_REVERSED /* #undef SETVBUF_REVERSED */
/* If using the C implementation of alloca, define if you know the /* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be direction of stack growth for your system; otherwise it will be
@ -147,34 +149,34 @@
STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown STACK_DIRECTION = 0 => direction of growth unknown
*/ */
#undef STACK_DIRECTION /* #undef STACK_DIRECTION */
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */ /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN /* #undef STAT_MACROS_BROKEN */
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Define on System V Release 4. */ /* Define on System V Release 4. */
#undef SVR4 /* #undef SVR4 */
/* Define if `sys_siglist' is declared by <signal.h>. */ /* Define if `sys_siglist' is declared by <signal.h>. */
#undef SYS_SIGLIST_DECLARED /* #undef SYS_SIGLIST_DECLARED */
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t #undef uid_t
#define uid_t int #define uid_t int
/* Define for Encore UMAX. */ /* Define for Encore UMAX. */
#undef UMAX /* #undef UMAX */
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h> /* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>. */ instead of <sys/cpustats.h>. */
#undef UMAX4_3 /* #undef UMAX4_3 */
/* Define vfork as fork if vfork does not work. */ /* Define vfork as fork if vfork does not work. */
#undef vfork /* #undef vfork */
/* Name of this package (needed by automake) */ /* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%" #define PACKAGE "%PACKAGE%"
@ -187,16 +189,16 @@
#define SCCS_GET "echo no sccs get" #define SCCS_GET "echo no sccs get"
/* Define this if the SCCS `get' command understands the `-G<file>' option. */ /* Define this if the SCCS `get' command understands the `-G<file>' option. */
#undef SCCS_GET_MINUS_G /* #undef SCCS_GET_MINUS_G */
/* Define this if the C library defines the variable `sys_siglist'. */ /* Define this if the C library defines the variable `sys_siglist'. */
#undef HAVE_SYS_SIGLIST /* #undef HAVE_SYS_SIGLIST */
/* Define this if the C library defines the variable `_sys_siglist'. */ /* Define this if the C library defines the variable `_sys_siglist'. */
#undef HAVE__SYS_SIGLIST /* #undef HAVE__SYS_SIGLIST */
/* Define this if you have the `union wait' type in <sys/wait.h>. */ /* Define this if you have the `union wait' type in <sys/wait.h>. */
#undef HAVE_UNION_WAIT /* #undef HAVE_UNION_WAIT */
/* Define if you have the dup2 function. */ /* Define if you have the dup2 function. */
#undef HAVE_DUP2 #undef HAVE_DUP2
@ -207,45 +209,67 @@
#define HAVE_GETCWD 1 #define HAVE_GETCWD 1
/* Define if you have the getgroups function. */ /* Define if you have the getgroups function. */
#undef HAVE_GETGROUPS /* #undef HAVE_GETGROUPS */
/* Define if you have the gethostbyname function. */
/* #undef HAVE_GETHOSTBYNAME */
/* Define if you have the gethostname function. */
/* #undef HAVE_GETHOSTNAME */
/* Define if you have the getloadavg function. */
/* #undef HAVE_GETLOADAVG */
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
#define HAVE_MEMMOVE 1
/* Define if you have the mktemp function. */ /* Define if you have the mktemp function. */
#undef HAVE_MKTEMP #undef HAVE_MKTEMP
#define HAVE_MKTEMP 1 #define HAVE_MKTEMP 1
/* Define if you have the psignal function. */ /* Define if you have the psignal function. */
#undef HAVE_PSIGNAL /* #undef HAVE_PSIGNAL */
/* Define if you have the pstat_getdynamic function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define if you have the setegid function. */ /* Define if you have the setegid function. */
#undef HAVE_SETEGID /* #undef HAVE_SETEGID */
/* Define if you have the seteuid function. */ /* Define if you have the seteuid function. */
#undef HAVE_SETEUID /* #undef HAVE_SETEUID */
/* Define if you have the setlinebuf function. */ /* Define if you have the setlinebuf function. */
#undef HAVE_SETLINEBUF /* #undef HAVE_SETLINEBUF */
/* Define if you have the setregid function. */ /* Define if you have the setregid function. */
#undef HAVE_SETREGID /* #undef HAVE_SETREGID */
/* Define if you have the setreuid function. */ /* Define if you have the setreuid function. */
#undef HAVE_SETREUID /* #undef HAVE_SETREUID */
/* Define if you have the sigsetmask function. */ /* Define if you have the sigsetmask function. */
#undef HAVE_SIGSETMASK /* #undef HAVE_SIGSETMASK */
/* Define if you have the socket function. */
/* #undef HAVE_SOCKET */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP */
/* Define if you have the strerror function. */ /* Define if you have the strerror function. */
#undef HAVE_STRERROR #undef HAVE_STRERROR
#define HAVE_STRERROR 1 #define HAVE_STRERROR 1
/* Define if you have the strsignal function. */ /* Define if you have the strsignal function. */
#undef HAVE_STRSIGNAL /* #undef HAVE_STRSIGNAL */
/* Define if you have the wait3 function. */ /* Define if you have the wait3 function. */
#undef HAVE_WAIT3 /* #undef HAVE_WAIT3 */
/* Define if you have the waitpid function. */ /* Define if you have the waitpid function. */
#undef HAVE_WAITPID /* #undef HAVE_WAITPID */
/* Define if you have the <dirent.h> header file. */ /* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H #undef HAVE_DIRENT_H
@ -260,43 +284,46 @@
#define HAVE_LIMITS_H 1 #define HAVE_LIMITS_H 1
/* Define if you have the <mach/mach.h> header file. */ /* Define if you have the <mach/mach.h> header file. */
#undef HAVE_MACH_MACH_H /* #undef HAVE_MACH_MACH_H */
/* Define if you have the <memory.h> header file. */ /* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
#define HAVE_MEMORY_H 1 #define HAVE_MEMORY_H 1
/* Define if you have the <ndir.h> header file. */ /* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H /* #undef HAVE_NDIR_H */
/* Define if you have the <string.h> header file. */ /* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
#define HAVE_STRING_H 1 #define HAVE_STRING_H 1
/* Define if you have the <sys/dir.h> header file. */ /* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H /* #undef HAVE_SYS_DIR_H */
/* Define if you have the <sys/ndir.h> header file. */ /* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H /* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/param.h> header file. */ /* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H /* #undef HAVE_SYS_PARAM_H */
/* Define if you have the <sys/timeb.h> header file. */ /* Define if you have the <sys/timeb.h> header file. */
#undef HAVE_SYS_TIMEB_H #undef HAVE_SYS_TIMEB_H
#define HAVE_SYS_TIMEB_H 1 #define HAVE_SYS_TIMEB_H 1
/* Define if you have the <sys/wait.h> header file. */ /* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H /* #undef HAVE_SYS_WAIT_H */
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H /* #undef HAVE_UNISTD_H */
/* Define if you have the dgc library (-ldgc). */ /* Define if you have the dgc library (-ldgc). */
#undef HAVE_LIBDGC /* #undef HAVE_LIBDGC */
/* Define if you have the kstat library (-lkstat). */
/* #undef HAVE_LIBKSTAT */
/* Define if you have the sun library (-lsun). */ /* Define if you have the sun library (-lsun). */
#undef HAVE_LIBSUN /* #undef HAVE_LIBSUN */
/* /*
* Refer to README.W32 for info on the following settings * Refer to README.W32 for info on the following settings

View File

@ -3,9 +3,8 @@ AC_REVISION([$Id$])
AC_PREREQ(2.12)dnl dnl Minimum Autoconf version required. AC_PREREQ(2.12)dnl dnl Minimum Autoconf version required.
AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir.
AM_INIT_AUTOMAKE(make, 3.77) AM_INIT_AUTOMAKE(make, 3.77.90)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AC_CONFIG_SUBDIRS(glob)
AM_CONDITIONAL(MAINT_MAKEFILE, test -r $srcdir/maintMakefile) AM_CONDITIONAL(MAINT_MAKEFILE, test -r $srcdir/maintMakefile)
@ -14,6 +13,8 @@ dnl Regular configure stuff
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_CHECK_PROG(AR, ar, ar, ar)
AC_PROG_RANLIB
AC_PROG_CPP dnl Later checks need this. AC_PROG_CPP dnl Later checks need this.
dnl AC_ARG_PROGRAM -- implied by AM_INIT_AUTOMAKE; gives errors if run twice. dnl AC_ARG_PROGRAM -- implied by AM_INIT_AUTOMAKE; gives errors if run twice.
AC_AIX AC_AIX
@ -30,12 +31,15 @@ AC_HEADER_DIRENT
AC_TYPE_UID_T dnl Also does gid_t. AC_TYPE_UID_T dnl Also does gid_t.
AC_TYPE_PID_T AC_TYPE_PID_T
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_CHECK_HEADERS(unistd.h limits.h sys/param.h fcntl.h string.h memory.h \ AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/param.h fcntl.h string.h \
sys/timeb.h) memory.h sys/timeb.h)
AC_PROG_CC_C_O AC_PROG_CC_C_O
AC_C_CONST dnl getopt needs this. AC_C_CONST dnl getopt needs this.
AC_HEADER_STAT AC_HEADER_STAT
AC_STRUCT_ST_MTIM_NSEC
jm_AC_TYPE_UINTMAX_T
AC_SUBST(LIBOBJS) AC_SUBST(LIBOBJS)
AC_DEFUN(AC_CHECK_SYMBOL, [dnl AC_DEFUN(AC_CHECK_SYMBOL, [dnl
@ -51,19 +55,25 @@ changequote([,])dnl
fi fi
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
# clock_gettime is in -lposix4 in Solaris 2.6.
AC_CHECK_LIB(posix4, clock_gettime)
AC_CHECK_FUNCS(memmove psignal mktemp pstat_getdynamic \ AC_CHECK_FUNCS(memmove psignal mktemp pstat_getdynamic \
dup2 getcwd sigsetmask getgroups setlinebuf \ clock_gettime dup2 getcwd sigsetmask getgroups setlinebuf \
seteuid setegid setreuid setregid strerror strsignal) seteuid setegid setreuid setregid strerror strsignal)
AC_CHECK_SYMBOL(sys_siglist) AC_CHECK_SYMBOL(sys_siglist)
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
AC_FUNC_VFORK AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_FUNC_STRCOLL
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_SETVBUF_REVERSED AC_FUNC_SETVBUF_REVERSED
AC_FUNC_GETLOADAVG AC_FUNC_GETLOADAVG
AC_CHECK_LIB(kstat, kstat_open) AC_CHECK_LIB(kstat, kstat_open)
AC_FUNC_STRCOLL
# Check out the wait reality. # Check out the wait reality.
AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_FUNCS(waitpid wait3) AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_FUNCS(waitpid wait3)
AC_MSG_CHECKING(for union wait) AC_MSG_CHECKING(for union wait)
AC_CACHE_VAL(make_cv_union_wait, [dnl AC_CACHE_VAL(make_cv_union_wait, [dnl
AC_TRY_LINK([#include <sys/types.h> AC_TRY_LINK([#include <sys/types.h>
@ -137,7 +147,7 @@ if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
fi fi
rm -f s.conftest conftoast rm -f s.conftest conftoast
AC_OUTPUT(Makefile build.sh) AC_OUTPUT(Makefile glob/Makefile build.sh)
case "$make_badcust" in case "$make_badcust" in
yes) echo yes) echo
@ -159,6 +169,15 @@ case "$with_customs" in
fi ;; fi ;;
esac esac
case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
no/no) echo
echo "WARNING: Your system has neither waitpid() nor wait3()."
echo " Without one of these, signal handling is unreliable."
echo " You should be aware that run GNU make with -j could"
echo " result in erratic behavior."
echo ;;
esac
dnl Local Variables: dnl Local Variables:
dnl comment-start: "dnl " dnl comment-start: "dnl "
dnl comment-end: "" dnl comment-end: ""

View File

@ -468,7 +468,7 @@ install_default_suffix_rules ()
if (f->cmds == 0) if (f->cmds == 0)
{ {
f->cmds = (struct commands *) xmalloc (sizeof (struct commands)); f->cmds = (struct commands *) xmalloc (sizeof (struct commands));
f->cmds->filename = 0; f->cmds->fileinfo.filenm = 0;
f->cmds->commands = s[1]; f->cmds->commands = s[1];
f->cmds->command_lines = 0; f->cmds->command_lines = 0;
} }

22
dep.h
View File

@ -16,6 +16,16 @@ You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Flag bits for the second argument to `read_makefile'.
These flags are saved in the `changed' field of each
`struct dep' in the chain returned by `read_all_makefiles'. */
#define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */
#define RM_INCLUDED (1 << 1) /* Search makefile search path. */
#define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */
#define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */
#define RM_NOFLAG 0
/* Structure representing one dependency of a file. /* Structure representing one dependency of a file.
Each struct file's `deps' points to a chain of these, Each struct file's `deps' points to a chain of these,
chained through the `next'. chained through the `next'.
@ -59,13 +69,7 @@ extern struct nameseq *ar_glob PARAMS ((char *arname, char *member_pattern, unsi
extern char *dep_name (); extern char *dep_name ();
#endif #endif
extern struct dep *copy_dep_chain PARAMS ((struct dep *d));
extern struct dep *read_all_makefiles PARAMS ((char **makefiles)); extern struct dep *read_all_makefiles PARAMS ((char **makefiles));
extern int update_goal_chain PARAMS ((struct dep *goals, int makefiles));
/* Flag bits for the second argument to `read_makefile'. extern void uniquize_deps PARAMS ((struct dep *));
These flags are saved in the `changed' field of each
`struct dep' in the chain returned by `read_all_makefiles'. */
#define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */
#define RM_INCLUDED (1 << 1) /* Search makefile search path. */
#define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */
#define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */
#define RM_NOFLAG 0

View File

@ -95,17 +95,9 @@ recursively_expand (v)
char *value; char *value;
if (v->expanding) if (v->expanding)
{ /* Expanding V causes infinite recursion. Lose. */
/* Expanding V causes infinite recursion. Lose. */ fatal (reading_file,
if (reading_filename == 0) "Recursive variable `%s' references itself (eventually)", v->name);
fatal ("Recursive variable `%s' references itself (eventually)",
v->name);
else
makefile_fatal
(reading_filename, *reading_lineno_ptr,
"Recursive variable `%s' references itself (eventually)",
v->name);
}
v->expanding = 1; v->expanding = 1;
value = allocated_variable_expand (v->value); value = allocated_variable_expand (v->value);
@ -125,14 +117,8 @@ warn_undefined (name, length)
unsigned int length; unsigned int length;
{ {
if (warn_undefined_variables_flag) if (warn_undefined_variables_flag)
{ error (reading_file,
static const char warnmsg[] = "warning: undefined variable `%.*s'"; "warning: undefined variable `%.*s'", (int)length, name);
if (reading_filename != 0)
makefile_error (reading_filename, *reading_lineno_ptr,
warnmsg, length, name);
else
error (warnmsg, length, name);
}
} }
/* Expand a simple reference to variable NAME, which is LENGTH chars long. */ /* Expand a simple reference to variable NAME, which is LENGTH chars long. */
@ -243,14 +229,8 @@ variable_expand_string (line, string, length)
end = index (beg, closeparen); end = index (beg, closeparen);
if (end == 0) if (end == 0)
{ /* Unterminated variable reference. */
/* Unterminated variable reference. */ fatal (reading_file, "unterminated variable reference");
if (reading_filename != 0)
makefile_fatal (reading_filename, *reading_lineno_ptr,
"unterminated variable reference");
else
fatal ("unterminated variable reference");
}
p1 = lindex (beg, end, '$'); p1 = lindex (beg, end, '$');
if (p1 != 0) if (p1 != 0)
{ {
@ -460,8 +440,7 @@ variable_expand_for_file (line, file)
save = current_variable_set_list; save = current_variable_set_list;
current_variable_set_list = file->variables; current_variable_set_list = file->variables;
reading_filename = file->cmds->filename; reading_file = &file->cmds->fileinfo;
reading_lineno_ptr = &file->cmds->lineno;
fnext = file->variables->next; fnext = file->variables->next;
/* See if there's a pattern-specific variable struct for this target. */ /* See if there's a pattern-specific variable struct for this target. */
if (!file->pat_searched) if (!file->pat_searched)
@ -476,8 +455,7 @@ variable_expand_for_file (line, file)
} }
result = variable_expand (line); result = variable_expand (line);
current_variable_set_list = save; current_variable_set_list = save;
reading_filename = 0; reading_file = 0;
reading_lineno_ptr = 0;
file->variables->next = fnext; file->variables->next = fnext;
return result; return result;

85
file.c
View File

@ -16,13 +16,14 @@ You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <assert.h>
#include "make.h" #include "make.h"
#include "dep.h" #include "dep.h"
#include "filedef.h" #include "filedef.h"
#include "job.h" #include "job.h"
#include "commands.h" #include "commands.h"
#include "variable.h" #include "variable.h"
#include <assert.h>
/* Hash table of files the makefile knows how to make. */ /* Hash table of files the makefile knows how to make. */
@ -294,22 +295,22 @@ file_hash_enter (file, name, oldhash, oldname)
/* We have two sets of commands. We will go with the /* We have two sets of commands. We will go with the
one given in the rule explicitly mentioning this name, one given in the rule explicitly mentioning this name,
but give a message to let the user know what's going on. */ but give a message to let the user know what's going on. */
if (oldfile->cmds->filename != 0) if (oldfile->cmds->fileinfo.filenm != 0)
makefile_error (file->cmds->filename, file->cmds->lineno, error (&file->cmds->fileinfo,
"Commands were specified for \ "Commands were specified for \
file `%s' at %s:%u,", file `%s' at %s:%lu,",
oldname, oldfile->cmds->filename, oldname, oldfile->cmds->fileinfo.filenm,
oldfile->cmds->lineno); oldfile->cmds->fileinfo.lineno);
else else
makefile_error (file->cmds->filename, file->cmds->lineno, error (&file->cmds->fileinfo,
"Commands for file `%s' were found by \ "Commands for file `%s' were found by \
implicit rule search,", implicit rule search,",
oldname); oldname);
makefile_error (file->cmds->filename, file->cmds->lineno, error (&file->cmds->fileinfo,
"but `%s' is now considered the same file \ "but `%s' is now considered the same file \
as `%s'.", as `%s'.",
oldname, name); oldname, name);
makefile_error (file->cmds->filename, file->cmds->lineno, error (&file->cmds->fileinfo,
"Commands for `%s' will be ignored \ "Commands for `%s' will be ignored \
in favor of those for `%s'.", in favor of those for `%s'.",
name, oldname); name, oldname);
@ -331,12 +332,12 @@ in favor of those for `%s'.",
merge_variable_set_lists (&oldfile->variables, file->variables); merge_variable_set_lists (&oldfile->variables, file->variables);
if (oldfile->double_colon && file->is_target && !file->double_colon) if (oldfile->double_colon && file->is_target && !file->double_colon)
fatal ("can't rename single-colon `%s' to double-colon `%s'", fatal (NILF, "can't rename single-colon `%s' to double-colon `%s'",
oldname, name); oldname, name);
if (!oldfile->double_colon && file->double_colon) if (!oldfile->double_colon && file->double_colon)
{ {
if (oldfile->is_target) if (oldfile->is_target)
fatal ("can't rename double-colon `%s' to single-colon `%s'", fatal (NILF, "can't rename double-colon `%s' to single-colon `%s'",
oldname, name); oldname, name);
else else
oldfile->double_colon = file->double_colon; oldfile->double_colon = file->double_colon;
@ -401,7 +402,7 @@ remove_intermediates (sig)
if (!f->dontcare) if (!f->dontcare)
{ {
if (sig) if (sig)
error ("*** Deleting intermediate file `%s'", f->name); error (NILF, "*** Deleting intermediate file `%s'", f->name);
else if (!silent_flag) else if (!silent_flag)
{ {
if (! doneany) if (! doneany)
@ -465,7 +466,7 @@ snap_deps ()
{ {
/* Mark this file as phony and nonexistent. */ /* Mark this file as phony and nonexistent. */
f2->phony = 1; f2->phony = 1;
f2->last_mtime = (time_t) -1; f2->last_mtime = (FILE_TIMESTAMP) -1;
} }
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev) for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
@ -549,6 +550,51 @@ set_command_state (file, state)
d->file->command_state = state; d->file->command_state = state;
} }
/* Get and print file timestamps. */
FILE_TIMESTAMP
file_timestamp_now ()
{
#if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
struct timespec timespec;
if (clock_gettime (CLOCK_REALTIME, &timespec) == 0)
return FILE_TIMESTAMP_FROM_S_AND_NS (timespec.tv_sec, timespec.tv_nsec);
#endif
return FILE_TIMESTAMP_FROM_S_AND_NS (time ((time_t *) 0), 0);
}
void
file_timestamp_sprintf (p, ts)
char *p;
FILE_TIMESTAMP ts;
{
time_t t = FILE_TIMESTAMP_S (ts);
struct tm *tm = localtime (&t);
if (tm)
sprintf (p, "%04d-%02d-%02d %02d:%02d:%02d",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
else if (t < 0)
sprintf (p, "%ld", (long) t);
else
sprintf (p, "%lu", (unsigned long) t);
p += strlen (p);
/* Append nanoseconds as a fraction, but remove trailing zeros.
We don't know the actual timestamp resolution, since clock_getres
applies only to local times, whereas this timestamp might come
from a remote filesystem. So removing trailing zeros is the
best guess that we can do. */
sprintf (p, ".%09ld", (long) FILE_TIMESTAMP_NS (ts));
p += strlen (p) - 1;
while (*p == '0')
p--;
p += *p != '.';
*p = '\0';
}
/* Print the data base of files. */ /* Print the data base of files. */
static void static void
@ -587,13 +633,16 @@ print_file (f)
printf (" %s", dep_name (d)); printf (" %s", dep_name (d));
putchar ('\n'); putchar ('\n');
} }
if (f->last_mtime == (time_t) 0) if (f->last_mtime == 0)
puts ("# Modification time never checked."); puts ("# Modification time never checked.");
else if (f->last_mtime == (time_t) -1) else if (f->last_mtime == (FILE_TIMESTAMP) -1)
puts ("# File does not exist."); puts ("# File does not exist.");
else else
printf ("# Last modified %.24s (%ld)\n", {
ctime (&f->last_mtime), (long int) f->last_mtime); char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
file_timestamp_sprintf (buf, f->last_mtime);
printf ("# Last modified %s\n", buf);
}
printf ("# File has%s been updated.\n", printf ("# File has%s been updated.\n",
f->updated ? "" : " not"); f->updated ? "" : " not");
switch (f->command_state) switch (f->command_state)

View File

@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING. If not, write to along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Structure that represents the info on one file /* Structure that represents the info on one file
that the makefile says how to make. that the makefile says how to make.
All of these are chained together through `next'. */ All of these are chained together through `next'. */
@ -32,7 +33,7 @@ struct file
char *stem; /* Implicit stem, if an implicit char *stem; /* Implicit stem, if an implicit
rule has been used */ rule has been used */
struct dep *also_make; /* Targets that are made by making this. */ struct dep *also_make; /* Targets that are made by making this. */
time_t last_mtime; /* File's modtime, if already known. */ FILE_TIMESTAMP last_mtime; /* File's modtime, if already known. */
struct file *prev; /* Previous entry for same file name; struct file *prev; /* Previous entry for same file name;
used when there are multiple double-colon used when there are multiple double-colon
entries for the same file. */ entries for the same file. */
@ -96,12 +97,63 @@ extern unsigned int num_intermediates;
extern struct file *default_goal_file, *suffix_file, *default_file; extern struct file *default_goal_file, *suffix_file, *default_file;
extern struct file *lookup_file (), *enter_file (); extern struct file *lookup_file PARAMS ((char *name));
extern void remove_intermediates (), snap_deps (); extern struct file *enter_file PARAMS ((char *name));
extern void rename_file (), rehash_file (), file_hash_enter (); extern void remove_intermediates PARAMS ((int sig));
extern void set_command_state (); extern void snap_deps PARAMS ((void));
extern void rename_file PARAMS ((struct file *file, char *name));
extern void rehash_file PARAMS ((struct file *file, char *name));
extern void file_hash_enter PARAMS ((struct file *file, char *name,
unsigned int oldhash, char *oldname));
extern void set_command_state PARAMS ((struct file *file, int state));
extern void notice_finished_file PARAMS ((struct file *file));
#if ST_MTIM_NSEC
# define FILE_TIMESTAMP_STAT_MODTIME(st) \
FILE_TIMESTAMP_FROM_S_AND_NS ((st).st_mtim.tv_sec, \
(st).st_mtim.ST_MTIM_NSEC)
# define FILE_TIMESTAMPS_PER_S \
MIN ((FILE_TIMESTAMP) 1000000000, \
(INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP) \
/ INTEGER_TYPE_MAXIMUM (time_t)))
#else
# define FILE_TIMESTAMP_STAT_MODTIME(st) ((st).st_mtime)
# define FILE_TIMESTAMPS_PER_S 1
#endif
#define FILE_TIMESTAMP_FROM_S_AND_NS(s, ns) \
((s) * FILE_TIMESTAMPS_PER_S \
+ (ns) * FILE_TIMESTAMPS_PER_S / 1000000000)
#define FILE_TIMESTAMP_DIV(a, b) ((a)/(b) - ((a)%(b) < 0))
#define FILE_TIMESTAMP_MOD(a, b) ((a)%(b) + ((a)%(b) < 0) * (b))
#define FILE_TIMESTAMP_S(ts) FILE_TIMESTAMP_DIV ((ts), FILE_TIMESTAMPS_PER_S)
#define FILE_TIMESTAMP_NS(ts) \
(((FILE_TIMESTAMP_MOD ((ts), FILE_TIMESTAMPS_PER_S) * 1000000000) \
+ (FILE_TIMESTAMPS_PER_S - 1)) \
/ FILE_TIMESTAMPS_PER_S)
/* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN"
representing a file timestamp. The upper bound is not necessarily 19,
since the year might be less than -999 or greater than 9999.
Subtract one for the sign bit if in case file timestamps can be negative;
subtract FLOOR_LOG2_SECONDS_PER_YEAR to yield an upper bound on how many
file timestamp bits might affect the year;
302 / 1000 is log10 (2) rounded up;
add one for integer division truncation;
add one more for a minus sign if file timestamps can be negative;
add 4 to allow for any 4-digit epoch year (e.g. 1970);
add 25 to allow for "-MM-DD HH:MM:SS.NNNNNNNNN". */
#define FLOOR_LOG2_SECONDS_PER_YEAR 24
#define FILE_TIMESTAMP_PRINT_LEN_BOUND \
(((sizeof (FILE_TIMESTAMP) * CHAR_BIT - 1 - FLOOR_LOG2_SECONDS_PER_YEAR) \
* 302 / 1000) \
+ 1 + 1 + 4 + 25)
extern FILE_TIMESTAMP file_timestamp_now PARAMS ((void));
extern void file_timestamp_sprintf PARAMS ((char *p, FILE_TIMESTAMP ts));
/* Return the mtime of file F (a struct file *), caching it. /* Return the mtime of file F (a struct file *), caching it.
The value is -1 if the file does not exist. */ The value is -1 if the file does not exist. */
#define file_mtime(f) file_mtime_1 ((f), 1) #define file_mtime(f) file_mtime_1 ((f), 1)
@ -110,9 +162,9 @@ extern void set_command_state ();
we don't find it. we don't find it.
The value is -1 if the file does not exist. */ The value is -1 if the file does not exist. */
#define file_mtime_no_search(f) file_mtime_1 ((f), 0) #define file_mtime_no_search(f) file_mtime_1 ((f), 0)
extern time_t f_mtime (); extern FILE_TIMESTAMP f_mtime PARAMS ((struct file *file, int search));
#define file_mtime_1(f, v) \ #define file_mtime_1(f, v) \
((f)->last_mtime != (time_t) 0 ? (f)->last_mtime : f_mtime ((f), v)) ((f)->last_mtime ? (f)->last_mtime : f_mtime ((f), v))
/* Modtime value to use for `infinitely new'. We used to get the current time /* Modtime value to use for `infinitely new'. We used to get the current time
from the system and use that whenever we wanted `new'. But that causes from the system and use that whenever we wanted `new'. But that causes
@ -121,12 +173,13 @@ extern time_t f_mtime ();
targets, which need to be considered newer than anything that depends on targets, which need to be considered newer than anything that depends on
them, even if said dependents' modtimes are in the future. them, even if said dependents' modtimes are in the future.
If time_t is unsigned, its maximum value is the same as "(time_t) -1", If FILE_TIMESTAMP is unsigned, its maximum value is the same as
so use one less than that, because -1 is used for non-existing files. */ ((FILE_TIMESTAMP) -1), so use one less than that, because -1 is
used for non-existing files. */
#define NEW_MTIME \ #define NEW_MTIME \
(INTEGER_TYPE_SIGNED (time_t) \ (INTEGER_TYPE_SIGNED (FILE_TIMESTAMP) \
? INTEGER_TYPE_MAXIMUM (time_t) \ ? INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP) \
: (INTEGER_TYPE_MAXIMUM (time_t) - 1)) : (INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP) - 1))
#define check_renamed(file) \ #define check_renamed(file) \
while ((file)->renamed != 0) (file) = (file)->renamed /* No ; here. */ while ((file)->renamed != 0) (file) = (file)->renamed /* No ; here. */

View File

@ -319,12 +319,8 @@ int shell_function_pid = 0, shell_function_completed;
/* Note this absorbs a semicolon and is safe to use in conditionals. */ /* Note this absorbs a semicolon and is safe to use in conditionals. */
#define BADARGS(func) do { \ #define BADARGS(func) do { \
if (reading_filename != 0) \ fatal (reading_file, "insufficient arguments to function `%s'", func); \
makefile_fatal (reading_filename, *reading_lineno_ptr, \ } while (0)
"insufficient arguments to function `%s'", \
func); \
else \
fatal ("insufficient arguments to function `%s'", func); } while (0)
static char * static char *
expand_function (o, function, text, end) expand_function (o, function, text, end)
@ -395,11 +391,11 @@ expand_function (o, function, text, end)
#endif /* Not Amiga. */ #endif /* Not Amiga. */
/* For error messages. */ /* For error messages. */
if (reading_filename != 0) if (reading_file != 0)
{ {
error_prefix = (char *) alloca (strlen (reading_filename) + 100); error_prefix = (char *) alloca (strlen(reading_file->filenm)+100);
sprintf (error_prefix, sprintf (error_prefix,
"%s:%u: ", reading_filename, *reading_lineno_ptr); "%s:%lu: ", reading_file->filenm, reading_file->lineno);
} }
else else
error_prefix = ""; error_prefix = "";
@ -417,7 +413,7 @@ expand_function (o, function, text, end)
0, 0,
TRUE, TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) { DUPLICATE_SAME_ACCESS) == FALSE) {
fatal("create_child_process: DuplicateHandle(In) failed (e=%d)\n", fatal (NILF, "create_child_process: DuplicateHandle(In) failed (e=%d)\n",
GetLastError()); GetLastError());
} }
if (DuplicateHandle(GetCurrentProcess(), if (DuplicateHandle(GetCurrentProcess(),
@ -427,17 +423,17 @@ expand_function (o, function, text, end)
0, 0,
TRUE, TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) { DUPLICATE_SAME_ACCESS) == FALSE) {
fatal("create_child_process: DuplicateHandle(Err) failed (e=%d)\n", fatal (NILF, "create_child_process: DuplicateHandle(Err) failed (e=%d)\n",
GetLastError()); GetLastError());
} }
if (!CreatePipe(&hChildOutRd, &hChildOutWr, &saAttr, 0)) if (!CreatePipe(&hChildOutRd, &hChildOutWr, &saAttr, 0))
fatal("CreatePipe() failed (e=%d)\n", GetLastError()); fatal (NILF, "CreatePipe() failed (e=%d)\n", GetLastError());
hProcess = process_init_fd(hIn, hChildOutWr, hErr); hProcess = process_init_fd(hIn, hChildOutWr, hErr);
if (!hProcess) if (!hProcess)
fatal("expand_function: process_init_fd() failed\n"); fatal (NILF, "expand_function: process_init_fd() failed\n");
else else
process_register(hProcess); process_register(hProcess);
@ -447,7 +443,7 @@ expand_function (o, function, text, end)
if (!process_begin(hProcess, argv, envp, argv[0], NULL)) if (!process_begin(hProcess, argv, envp, argv[0], NULL))
pid = (int) hProcess; pid = (int) hProcess;
else else
fatal("expand_function: unable to launch process (e=%d)\n", fatal (NILF, "expand_function: unable to launch process (e=%d)\n",
process_last_err(hProcess)); process_last_err(hProcess));
/* set up to read data from child */ /* set up to read data from child */
@ -1178,24 +1174,13 @@ expand_function (o, function, text, end)
/* Check the first argument. */ /* Check the first argument. */
for (p2 = text; *p2 != '\0'; ++p2) for (p2 = text; *p2 != '\0'; ++p2)
if (*p2 < '0' || *p2 > '9') if (*p2 < '0' || *p2 > '9')
{ fatal (reading_file,
if (reading_filename != 0) "non-numeric first argument to `word' function");
makefile_fatal (reading_filename, *reading_lineno_ptr,
"non-numeric first argument to `word' function");
else
fatal ("non-numeric first argument to `word' function");
}
i = (unsigned int) atoi (text); i = (unsigned int) atoi (text);
if (i == 0) if (i == 0)
{ fatal (reading_file,
if (reading_filename != 0) "the `word' function takes a one-origin index argument");
makefile_fatal (reading_filename, *reading_lineno_ptr,
"the `word' function takes a one-origin \
index argument");
else
fatal ("the `word' function takes a one-origin index argument");
}
p2 = p3; p2 = p3;
while ((p = find_next_token (&p2, &len)) != 0) while ((p = find_next_token (&p2, &len)) != 0)
@ -1245,13 +1230,8 @@ index argument");
/* Check the first argument. */ /* Check the first argument. */
for (p2 = text; *p2 != '\0'; ++p2) for (p2 = text; *p2 != '\0'; ++p2)
if (*p2 < '0' || *p2 > '9') if (*p2 < '0' || *p2 > '9')
{ fatal (reading_file,
if (reading_filename != 0) "non-numeric first argument to `wordlist' function");
makefile_fatal (reading_filename, *reading_lineno_ptr,
"non-numeric first argument to `wordlist' function");
else
fatal ("non-numeric first argument to `wordlist' function");
}
i = (unsigned int)atoi(text); i = (unsigned int)atoi(text);
free (text); free (text);
@ -1274,13 +1254,8 @@ index argument");
for (p2 = text; *p2 != '\0'; ++p2) for (p2 = text; *p2 != '\0'; ++p2)
if (*p2 < '0' || *p2 > '9') if (*p2 < '0' || *p2 > '9')
{ fatal (reading_file,
if (reading_filename != 0) "non-numeric second argument to `wordlist' function");
makefile_fatal (reading_filename, *reading_lineno_ptr,
"non-numeric second argument to `wordlist' function");
else
fatal ("non-numeric second argument to `wordlist' function");
}
j = (unsigned int)atoi(text); j = (unsigned int)atoi(text);
free (text); free (text);
@ -1545,15 +1520,9 @@ handle_function (op, stringp)
} }
if (count >= 0) if (count >= 0)
{ fatal (reading_file,
static const char errmsg[] "unterminated call to function `%s': missing `%c'",
= "unterminated call to function `%s': missing `%c'"; function_table[code].name, closeparen);
if (reading_filename == 0)
fatal (errmsg, function_table[code].name, closeparen);
else
makefile_fatal (reading_filename, *reading_lineno_ptr, errmsg,
function_table[code].name, closeparen);
}
/* We found the end; expand the function call. */ /* We found the end; expand the function call. */

View File

@ -1038,7 +1038,7 @@ getloadavg (loadavg, nelem)
#endif /* ! HAVE_GETLOADAVG */ #endif /* ! HAVE_GETLOADAVG */
#ifdef TEST #ifdef TEST
void int
main (argc, argv) main (argc, argv)
int argc; int argc;
char **argv; char **argv;

View File

@ -1,3 +1,8 @@
1998-08-05 Paul D. Smith <psmith@gnu.org>
* configure.in: Remove; configuration for glob is handled by the
make configure.in.
1998-07-29 Paul D. Smith <psmith@gnu.org> 1998-07-29 Paul D. Smith <psmith@gnu.org>
* glob.c, fnmatch.c: New versions from the GLIBC folks (Ulrich * glob.c, fnmatch.c: New versions from the GLIBC folks (Ulrich

View File

@ -148,7 +148,7 @@ pattern_search (file, archive, depth, recursions)
that is not just `%'. */ that is not just `%'. */
int specific_rule_matched = 0; int specific_rule_matched = 0;
register unsigned int i; register unsigned int i = 0; /* uninit checks OK */
register struct rule *rule; register struct rule *rule;
register struct dep *dep; register struct dep *dep;
@ -342,6 +342,8 @@ pattern_search (file, archive, depth, recursions)
deps_found = 0; deps_found = 0;
for (dep = rule->deps; dep != 0; dep = dep->next) for (dep = rule->deps; dep != 0; dep = dep->next)
{ {
struct file *fp;
/* If the dependency name has a %, substitute the stem. */ /* If the dependency name has a %, substitute the stem. */
p = index (dep_name (dep), '%'); p = index (dep_name (dep), '%');
if (p != 0) if (p != 0)
@ -390,9 +392,12 @@ pattern_search (file, archive, depth, recursions)
dependency file we are actually looking for is in a different dependency file we are actually looking for is in a different
directory (the one gotten by prepending FILENAME's directory), directory (the one gotten by prepending FILENAME's directory),
so it might actually exist. */ so it might actually exist. */
/* If we find a file but the intermediate flag is set, then it
was put here by a .INTERMEDIATE: rule so ignore it. */
if ((!dep->changed || check_lastslash) if ((!dep->changed || check_lastslash)
&& (lookup_file (p) != 0 || file_exists_p (p))) && (((fp = lookup_file (p)) != 0 && !fp->intermediate)
|| file_exists_p (p)))
{ {
found_files[deps_found++] = savestring (p, strlen (p)); found_files[deps_found++] = savestring (p, strlen (p));
continue; continue;
@ -400,7 +405,7 @@ pattern_search (file, archive, depth, recursions)
/* This code, given FILENAME = "lib/foo.o", dependency name /* This code, given FILENAME = "lib/foo.o", dependency name
"lib/foo.c", and VPATH=src, searches for "src/lib/foo.c". */ "lib/foo.c", and VPATH=src, searches for "src/lib/foo.c". */
vp = p; vp = p;
if (vpath_search (&vp, (time_t *) 0)) if (vpath_search (&vp, (FILE_TIMESTAMP *) 0))
{ {
DEBUGP2 ("Found dependency `%s' as VPATH `%s'\n", p, vp); DEBUGP2 ("Found dependency `%s' as VPATH `%s'\n", p, vp);
strcpy(vp, p); strcpy(vp, p);

302
job.c
View File

@ -29,25 +29,25 @@ char *default_shell = "sh.exe";
int no_default_sh_exe = 1; int no_default_sh_exe = 1;
int batch_mode_shell = 1; int batch_mode_shell = 1;
#else /* WINDOWS32 */ #else /* WINDOWS32 */
#ifdef _AMIGA # ifdef _AMIGA
char default_shell[] = ""; char default_shell[] = "";
extern int MyExecute (char **); extern int MyExecute (char **);
#else /* _AMIGA */ # else /* _AMIGA */
#ifdef __MSDOS__ # ifdef __MSDOS__
/* The default shell is a pointer so we can change it if Makefile /* The default shell is a pointer so we can change it if Makefile
says so. It is without an explicit path so we get a chance says so. It is without an explicit path so we get a chance
to search the $PATH for it (since MSDOS doesn't have standard to search the $PATH for it (since MSDOS doesn't have standard
directories we could trust). */ directories we could trust). */
char *default_shell = "command.com"; char *default_shell = "command.com";
#else /* __MSDOS__ */ # else /* __MSDOS__ */
char default_shell[] = "/bin/sh"; char default_shell[] = "/bin/sh";
#endif /* __MSDOS__ */ # endif /* __MSDOS__ */
int batch_mode_shell = 0; int batch_mode_shell = 0;
#endif /* _AMIGA */ # endif /* _AMIGA */
#endif /* WINDOWS32 */ #endif /* WINDOWS32 */
#ifdef __MSDOS__ #ifdef __MSDOS__
#include <process.h> # include <process.h>
static int execute_by_shell; static int execute_by_shell;
static int dos_pid = 123; static int dos_pid = 123;
int dos_status; int dos_status;
@ -55,7 +55,7 @@ int dos_command_running;
#endif /* __MSDOS__ */ #endif /* __MSDOS__ */
#ifdef _AMIGA #ifdef _AMIGA
#include <proto/dos.h> # include <proto/dos.h>
static int amiga_pid = 123; static int amiga_pid = 123;
static int amiga_status; static int amiga_status;
static char amiga_bname[32]; static char amiga_bname[32];
@ -63,101 +63,101 @@ static int amiga_batch_file;
#endif /* Amiga. */ #endif /* Amiga. */
#ifdef VMS #ifdef VMS
#include <time.h> # include <time.h>
#include <processes.h> # include <processes.h>
#include <starlet.h> # include <starlet.h>
#include <lib$routines.h> # include <lib$routines.h>
#endif #endif
#ifdef WINDOWS32 #ifdef WINDOWS32
#include <windows.h> # include <windows.h>
#include <io.h> # include <io.h>
#include <process.h> # include <process.h>
#include "sub_proc.h" # include "sub_proc.h"
#include "w32err.h" # include "w32err.h"
#include "pathstuff.h" # include "pathstuff.h"
#endif /* WINDOWS32 */ #endif /* WINDOWS32 */
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#else #else
#include <sys/file.h> # include <sys/file.h>
#endif #endif
#if defined (HAVE_SYS_WAIT_H) || defined (HAVE_UNION_WAIT) #if defined (HAVE_SYS_WAIT_H) || defined (HAVE_UNION_WAIT)
#include <sys/wait.h> # include <sys/wait.h>
#endif #endif
#ifdef HAVE_WAITPID #ifdef HAVE_WAITPID
#define WAIT_NOHANG(status) waitpid (-1, (status), WNOHANG) # define WAIT_NOHANG(status) waitpid (-1, (status), WNOHANG)
#else /* Don't have waitpid. */ #else /* Don't have waitpid. */
#ifdef HAVE_WAIT3 # ifdef HAVE_WAIT3
#ifndef wait3 # ifndef wait3
extern int wait3 (); extern int wait3 ();
#endif # endif
#define WAIT_NOHANG(status) wait3 ((status), WNOHANG, (struct rusage *) 0) # define WAIT_NOHANG(status) wait3 ((status), WNOHANG, (struct rusage *) 0)
#endif /* Have wait3. */ # endif /* Have wait3. */
#endif /* Have waitpid. */ #endif /* Have waitpid. */
#if !defined (wait) && !defined (POSIX) #if !defined (wait) && !defined (POSIX)
extern int wait (); extern int wait ();
#endif #endif
#ifndef HAVE_UNION_WAIT #ifndef HAVE_UNION_WAIT
#define WAIT_T int # define WAIT_T int
#ifndef WTERMSIG # ifndef WTERMSIG
#define WTERMSIG(x) ((x) & 0x7f) # define WTERMSIG(x) ((x) & 0x7f)
#endif # endif
#ifndef WCOREDUMP # ifndef WCOREDUMP
#define WCOREDUMP(x) ((x) & 0x80) # define WCOREDUMP(x) ((x) & 0x80)
#endif # endif
#ifndef WEXITSTATUS # ifndef WEXITSTATUS
#define WEXITSTATUS(x) (((x) >> 8) & 0xff) # define WEXITSTATUS(x) (((x) >> 8) & 0xff)
#endif # endif
#ifndef WIFSIGNALED # ifndef WIFSIGNALED
#define WIFSIGNALED(x) (WTERMSIG (x) != 0) # define WIFSIGNALED(x) (WTERMSIG (x) != 0)
#endif # endif
#ifndef WIFEXITED # ifndef WIFEXITED
#define WIFEXITED(x) (WTERMSIG (x) == 0) # define WIFEXITED(x) (WTERMSIG (x) == 0)
#endif # endif
#else /* Have `union wait'. */ #else /* Have `union wait'. */
#define WAIT_T union wait # define WAIT_T union wait
#ifndef WTERMSIG # ifndef WTERMSIG
#define WTERMSIG(x) ((x).w_termsig) # define WTERMSIG(x) ((x).w_termsig)
#endif # endif
#ifndef WCOREDUMP # ifndef WCOREDUMP
#define WCOREDUMP(x) ((x).w_coredump) # define WCOREDUMP(x) ((x).w_coredump)
#endif # endif
#ifndef WEXITSTATUS # ifndef WEXITSTATUS
#define WEXITSTATUS(x) ((x).w_retcode) # define WEXITSTATUS(x) ((x).w_retcode)
#endif # endif
#ifndef WIFSIGNALED # ifndef WIFSIGNALED
#define WIFSIGNALED(x) (WTERMSIG(x) != 0) # define WIFSIGNALED(x) (WTERMSIG(x) != 0)
#endif # endif
#ifndef WIFEXITED # ifndef WIFEXITED
#define WIFEXITED(x) (WTERMSIG(x) == 0) # define WIFEXITED(x) (WTERMSIG(x) == 0)
#endif # endif
#endif /* Don't have `union wait'. */ #endif /* Don't have `union wait'. */
#ifdef VMS #ifdef VMS
static int vms_jobsefnmask=0; static int vms_jobsefnmask = 0;
#endif /* !VMS */ #endif /* !VMS */
#ifndef HAVE_UNISTD_H #ifndef HAVE_UNISTD_H
extern int dup2 (); extern int dup2 ();
extern int execve (); extern int execve ();
extern void _exit (); extern void _exit ();
#ifndef VMS # ifndef VMS
extern int geteuid (); extern int geteuid ();
extern int getegid (); extern int getegid ();
extern int setgid (); extern int setgid ();
extern int getgid (); extern int getgid ();
#endif # endif
#endif #endif
extern char *allocated_variable_expand_for_file PARAMS ((char *line, struct file *file)); extern char *allocated_variable_expand_for_file PARAMS ((char *line, struct file *file));
@ -169,7 +169,6 @@ extern int start_remote_job_p PARAMS ((int));
extern int remote_status PARAMS ((int *exit_code_ptr, int *signal_ptr, extern int remote_status PARAMS ((int *exit_code_ptr, int *signal_ptr,
int *coredump_ptr, int block)); int *coredump_ptr, int block));
RETSIGTYPE child_handler PARAMS ((int));
static void free_child PARAMS ((struct child *)); static void free_child PARAMS ((struct child *));
static void start_job_command PARAMS ((struct child *child)); static void start_job_command PARAMS ((struct child *child));
static int load_too_high PARAMS ((void)); static int load_too_high PARAMS ((void));
@ -224,21 +223,19 @@ child_error (target_name, exit_code, exit_sig, coredump, ignored)
#ifdef VMS #ifdef VMS
if (!(exit_code & 1)) if (!(exit_code & 1))
error("*** [%s] Error 0x%x%s", target_name, exit_code, ((ignored)? " (ignored)" : "")); error (NILF, "*** [%s] Error 0x%x%s", target_name, exit_code, ((ignored)? " (ignored)" : ""));
#else #else
if (exit_sig == 0) if (exit_sig == 0)
error (ignored ? "[%s] Error %d (ignored)" : error (NILF, ignored ? "[%s] Error %d (ignored)" :
"*** [%s] Error %d", "*** [%s] Error %d",
target_name, exit_code); target_name, exit_code);
else else
error ("*** [%s] %s%s", error (NILF, "*** [%s] %s%s",
target_name, strsignal (exit_sig), target_name, strsignal (exit_sig),
coredump ? " (core dumped)" : ""); coredump ? " (core dumped)" : "");
#endif /* VMS */ #endif /* VMS */
} }
static unsigned int dead_children = 0;
#ifdef VMS #ifdef VMS
/* Wait for nchildren children to terminate */ /* Wait for nchildren children to terminate */
static void static void
@ -259,6 +256,13 @@ vmsWaitForChildren(int *status)
#endif #endif
/* If we can't use waitpid() or wait3(), then we use a signal handler
to track the number of SIGCHLD's we got. This is less robust. */
#ifndef WAIT_NOHANG
static unsigned int dead_children = 0;
/* Notice that a child died. /* Notice that a child died.
reap_children should be called when convenient. */ reap_children should be called when convenient. */
RETSIGTYPE RETSIGTYPE
@ -271,6 +275,8 @@ child_handler (sig)
printf ("Got a SIGCHLD; %d unreaped children.\n", dead_children); printf ("Got a SIGCHLD; %d unreaped children.\n", dead_children);
} }
#endif /* WAIT_NOHANG */
extern int shell_function_pid, shell_function_completed; extern int shell_function_pid, shell_function_completed;
/* Reap dead children, storing the returned status and the new command /* Reap dead children, storing the returned status and the new command
@ -284,9 +290,12 @@ reap_children (block, err)
int block, err; int block, err;
{ {
WAIT_T status; WAIT_T status;
#ifdef WAIT_NOHANG
int dead_children = 1; /* Initially, assume we have some. */
#endif
while ((children != 0 || shell_function_pid != 0) && while ((children != 0 || shell_function_pid != 0) &&
(block || dead_children > 0)) (block || dead_children))
{ {
int remote = 0; int remote = 0;
register int pid; register int pid;
@ -295,13 +304,14 @@ reap_children (block, err)
int child_failed; int child_failed;
int any_remote, any_local; int any_remote, any_local;
if (err && dead_children == 0) if (err && block)
{ {
/* We might block for a while, so let the user know why. */ /* We might block for a while, so let the user know why. */
fflush (stdout); fflush (stdout);
error ("*** Waiting for unfinished jobs...."); error (NILF, "*** Waiting for unfinished jobs....");
} }
#ifndef WAIT_NOHANG
/* We have one less dead child to reap. /* We have one less dead child to reap.
The test and decrement are not atomic; if it is compiled into: The test and decrement are not atomic; if it is compiled into:
register = dead_children - 1; register = dead_children - 1;
@ -316,6 +326,7 @@ reap_children (block, err)
if (dead_children > 0) if (dead_children > 0)
--dead_children; --dead_children;
#endif
any_remote = 0; any_remote = 0;
any_local = shell_function_pid != 0; any_local = shell_function_pid != 0;
@ -338,8 +349,12 @@ reap_children (block, err)
else else
pid = 0; pid = 0;
if (pid < 0) if (pid > 0)
/* We got a remote child. */
remote = 1;
else if (pid < 0)
{ {
/* A remote status command failed miserably. Punt. */
remote_status_lose: remote_status_lose:
#ifdef EINTR #ifdef EINTR
if (errno == EINTR) if (errno == EINTR)
@ -347,11 +362,11 @@ reap_children (block, err)
#endif #endif
pfatal_with_name ("remote_status"); pfatal_with_name ("remote_status");
} }
else if (pid == 0) else
{ {
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
/* No remote children. Check for local children. */ /* No remote children. Check for local children. */
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
if (any_local) if (any_local)
{ {
#ifdef VMS #ifdef VMS
@ -371,15 +386,26 @@ reap_children (block, err)
if (pid < 0) if (pid < 0)
{ {
/* The wait*() failed miserably. Punt. */
#ifdef EINTR #ifdef EINTR
if (errno == EINTR) if (errno == EINTR)
continue; continue;
#endif #endif
pfatal_with_name ("wait"); pfatal_with_name ("wait");
} }
else if (pid == 0) else if (pid > 0)
{ {
/* No local children. */ /* We got one; chop the status word up. */
exit_code = WEXITSTATUS (status);
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
coredump = WCOREDUMP (status);
}
else
{
/* No local children are dead. */
#ifdef WAIT_NOHANG
dead_children = 0;
#endif
if (block && any_remote) if (block && any_remote)
{ {
/* Now try a blocking wait for a remote child. */ /* Now try a blocking wait for a remote child. */
@ -396,14 +422,7 @@ reap_children (block, err)
else else
break; break;
} }
else #endif /* !__MSDOS__, !Amiga, !WINDOWS32. */
{
/* Chop the status word up. */
exit_code = WEXITSTATUS (status);
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
coredump = WCOREDUMP (status);
}
#else /* __MSDOS__, Amiga, WINDOWS32. */
#ifdef __MSDOS__ #ifdef __MSDOS__
/* Life is very different on MSDOS. */ /* Life is very different on MSDOS. */
pid = dos_pid - 1; pid = dos_pid - 1;
@ -423,39 +442,35 @@ reap_children (block, err)
coredump = 0; coredump = 0;
#endif /* _AMIGA */ #endif /* _AMIGA */
#ifdef WINDOWS32 #ifdef WINDOWS32
{ {
HANDLE hPID; HANDLE hPID;
int err; int err;
/* wait for anything to finish */ /* wait for anything to finish */
if (hPID = process_wait_for_any()) { if (hPID = process_wait_for_any()) {
/* was an error found on this process? */ /* was an error found on this process? */
err = process_last_err(hPID); err = process_last_err(hPID);
/* get exit data */ /* get exit data */
exit_code = process_exit_code(hPID); exit_code = process_exit_code(hPID);
if (err) if (err)
fprintf(stderr, "make (e=%d): %s", fprintf(stderr, "make (e=%d): %s",
exit_code, map_windows32_error_to_string(exit_code)); exit_code, map_windows32_error_to_string(exit_code));
/* signal */ /* signal */
exit_sig = process_signal(hPID); exit_sig = process_signal(hPID);
/* cleanup process */ /* cleanup process */
process_cleanup(hPID); process_cleanup(hPID);
coredump = 0; coredump = 0;
} }
pid = (int) hPID; pid = (int) hPID;
} }
#endif /* WINDOWS32 */ #endif /* WINDOWS32 */
#endif /* Not __MSDOS__ */
} }
else
/* We got a remote child. */
remote = 1;
/* Check if this is the child of the `shell' function. */ /* Check if this is the child of the `shell' function. */
if (!remote && pid == shell_function_pid) if (!remote && pid == shell_function_pid)
@ -478,14 +493,9 @@ reap_children (block, err)
if (c == 0) if (c == 0)
{ {
/* An unknown child died. */ /* An unknown child died.
char buf[100]; Ignore it; it was inherited from our invoker. */
sprintf (buf, "Unknown%s job %d", remote ? " remote" : "", pid); continue;
if (child_failed)
child_error (buf, exit_code, exit_sig, coredump,
ignore_errors_flag);
else
error ("%s finished.", buf);
} }
else else
{ {
@ -495,17 +505,17 @@ reap_children (block, err)
(unsigned long int) c, (unsigned long int) c,
(long) c->pid, c->remote ? " (remote)" : ""); (long) c->pid, c->remote ? " (remote)" : "");
if (c->sh_batch_file) { if (c->sh_batch_file) {
if (debug_flag) if (debug_flag)
printf("Cleaning up temporary batch file %s\n", c->sh_batch_file); printf("Cleaning up temp batch file %s\n", c->sh_batch_file);
/* just try and remove, don't care if this fails */ /* just try and remove, don't care if this fails */
remove(c->sh_batch_file); remove(c->sh_batch_file);
/* all done with memory */ /* all done with memory */
free(c->sh_batch_file); free(c->sh_batch_file);
c->sh_batch_file = NULL; c->sh_batch_file = NULL;
} }
/* If this child had the good stdin, say it is now free. */ /* If this child had the good stdin, say it is now free. */
if (c->good_stdin) if (c->good_stdin)
@ -661,12 +671,12 @@ extern sigset_t fatal_signal_set;
void void
block_sigs () block_sigs ()
{ {
#ifdef POSIX #ifdef POSIX
(void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0); (void) sigprocmask (SIG_BLOCK, &fatal_signal_set, (sigset_t *) 0);
#else #else
#ifdef HAVE_SIGSETMASK # ifdef HAVE_SIGSETMASK
(void) sigblock (fatal_signal_mask); (void) sigblock (fatal_signal_mask);
#endif # endif
#endif #endif
} }
@ -1098,9 +1108,9 @@ start_waiting_job (c)
case cs_running: case cs_running:
c->next = children; c->next = children;
if (debug_flag) if (debug_flag)
printf ("Putting child 0x%08lx PID %05d%s on the chain.\n", printf ("Putting child 0x%08lx PID %ld%s on the chain.\n",
(unsigned long int) c, (unsigned long int) c,
c->pid, c->remote ? " (remote)" : ""); (long) c->pid, c->remote ? " (remote)" : "");
children = c; children = c;
/* One more job slot is in use. */ /* One more job slot is in use. */
++job_slots_used; ++job_slots_used;
@ -1322,7 +1332,7 @@ load_too_high ()
{ {
if (errno == 0) if (errno == 0)
/* An errno value of zero means getloadavg is just unsupported. */ /* An errno value of zero means getloadavg is just unsupported. */
error ("cannot enforce load limits on this operating system"); error (NILF, "cannot enforce load limits on this operating system");
else else
perror_with_name ("cannot enforce load limit: ", "getloadavg"); perror_with_name ("cannot enforce load limit: ", "getloadavg");
} }
@ -1427,8 +1437,7 @@ int vmsHandleChildTerm(struct child *child)
break; break;
default: default:
error ("internal error: `%s' command_state \ error (NILF, "internal error: `%s' command_state", c->file->name);
%d in child_handler", c->file->name);
abort (); abort ();
break; break;
} }
@ -1682,7 +1691,7 @@ exec_command (argv, envp)
switch (errno) switch (errno)
{ {
case ENOENT: case ENOENT:
error ("%s: Command not found", argv[0]); error (NILF, "%s: Command not found", argv[0]);
break; break;
case ENOEXEC: case ENOEXEC:
{ {
@ -1711,7 +1720,7 @@ exec_command (argv, envp)
execvp (shell, new_argv); execvp (shell, new_argv);
if (errno == ENOENT) if (errno == ENOENT)
error ("%s: Shell program not found", shell); error (NILF, "%s: Shell program not found", shell);
else else
perror_with_name ("execvp: ", shell); perror_with_name ("execvp: ", shell);
break; break;
@ -2205,8 +2214,8 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
p = next_token (p); p = next_token (p);
--p; --p;
if (unixy_shell && !batch_mode_shell) if (unixy_shell && !batch_mode_shell)
*ap++ = '\\'; *ap++ = '\\';
*ap++ = ' '; *ap++ = ' ';
continue; continue;
} }
@ -2234,11 +2243,9 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
*ap = '\0'; *ap = '\0';
#ifdef WINDOWS32 #ifdef WINDOWS32
/* /* Some shells do not work well when invoked as 'sh -c xxx' to run a
* Some shells do not work well when invoked as 'sh -c xxx' to run command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these
* a command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). cases, run commands via a script file. */
* In these cases, run commands via a script file.
*/
if ((no_default_sh_exe || batch_mode_shell) && batch_filename_ptr) { if ((no_default_sh_exe || batch_mode_shell) && batch_filename_ptr) {
FILE* batch = NULL; FILE* batch = NULL;
int id = GetCurrentProcessId(); int id = GetCurrentProcessId();
@ -2269,7 +2276,8 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
/* create batch file to execute command */ /* create batch file to execute command */
batch = fopen (*batch_filename_ptr, "w"); batch = fopen (*batch_filename_ptr, "w");
fputs ("@echo off\n", batch); if (!unixy_shell)
fputs ("@echo off\n", batch);
fputs (command_ptr, batch); fputs (command_ptr, batch);
fputc ('\n', batch); fputc ('\n', batch);
fclose (batch); fclose (batch);
@ -2305,7 +2313,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
} }
#else #else
else else
fatal("%s (line %d) Invalid shell context (!unixy && !batch_mode_shell)\n", fatal (NILF, "%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n",
__FILE__, __LINE__); __FILE__, __LINE__);
#endif #endif
} }

2
job.h
View File

@ -44,7 +44,7 @@ struct child
unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */ unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */
unsigned int deleted:1; /* Nonzero if targets have been deleted. */ unsigned int deleted:1; /* Nonzero if targets have been deleted. */
char* sh_batch_file; /* used to execute shell commands via scripts */ char *sh_batch_file; /* Script file for shell commands */
}; };
extern struct child *children; extern struct child *children;

92
main.c
View File

@ -22,6 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "variable.h" #include "variable.h"
#include "job.h" #include "job.h"
#include "commands.h" #include "commands.h"
#include "rule.h"
#include "getopt.h" #include "getopt.h"
#include <assert.h> #include <assert.h>
#ifdef _AMIGA #ifdef _AMIGA
@ -41,7 +42,6 @@ extern void init_dir PARAMS ((void));
extern void remote_setup PARAMS ((void)); extern void remote_setup PARAMS ((void));
extern void remote_cleanup PARAMS ((void)); extern void remote_cleanup PARAMS ((void));
extern RETSIGTYPE fatal_error_signal PARAMS ((int sig)); extern RETSIGTYPE fatal_error_signal PARAMS ((int sig));
extern RETSIGTYPE child_handler PARAMS ((int sig));
extern void print_variable_data_base PARAMS ((void)); extern void print_variable_data_base PARAMS ((void));
extern void print_dir_data_base PARAMS ((void)); extern void print_dir_data_base PARAMS ((void));
@ -49,18 +49,22 @@ extern void print_rule_data_base PARAMS ((void));
extern void print_file_data_base PARAMS ((void)); extern void print_file_data_base PARAMS ((void));
extern void print_vpath_data_base PARAMS ((void)); extern void print_vpath_data_base PARAMS ((void));
#if defined HAVE_WAITPID || defined HAVE_WAIT3
# define HAVE_WAIT_NOHANG
#endif
#ifndef HAVE_UNISTD_H #ifndef HAVE_UNISTD_H
extern int chdir (); extern int chdir ();
#endif #endif
#ifndef STDC_HEADERS #ifndef STDC_HEADERS
#ifndef sun /* Sun has an incorrect decl in a header. */ #ifndef sun /* Sun has an incorrect decl in a header. */
extern void exit (); extern void exit PARAMS ((int)) __attribute__ ((noreturn));
#endif #endif
extern double atof (); extern double atof ();
#endif #endif
extern char *mktemp (); extern char *mktemp ();
static void print_data_base PARAMS((void)); static void print_data_base PARAMS ((void));
static void print_version PARAMS ((void)); static void print_version PARAMS ((void));
static void decode_switches PARAMS ((int argc, char **argv, int env)); static void decode_switches PARAMS ((int argc, char **argv, int env));
static void decode_env_switches PARAMS ((char *envar, unsigned int len)); static void decode_env_switches PARAMS ((char *envar, unsigned int len));
@ -413,7 +417,7 @@ enter_command_line_file (name)
char *name; char *name;
{ {
if (name[0] == '\0') if (name[0] == '\0')
fatal ("empty string invalid as file name"); fatal (NILF, "empty string invalid as file name");
if (name[0] == '~') if (name[0] == '~')
{ {
@ -664,8 +668,7 @@ int main (int argc, char ** argv)
#endif #endif
default_goal_file = 0; default_goal_file = 0;
reading_filename = 0; reading_file = 0;
reading_lineno_ptr = 0;
#if defined (__MSDOS__) && !defined (_POSIX_SOURCE) #if defined (__MSDOS__) && !defined (_POSIX_SOURCE)
/* Request the most powerful version of `system', to /* Request the most powerful version of `system', to
@ -722,6 +725,20 @@ int main (int argc, char ** argv)
#undef FATAL_SIG #undef FATAL_SIG
/* Do not ignore the child-death signal. This must be done before
any children could possibly be created; otherwise, the wait
functions won't work on systems with the SVR4 ECHILD brain
damage, if our invoker is ignoring this signal. */
#ifdef HAVE_WAIT_NOHANG
# if defined SIGCHLD
(void) signal (SIGCHLD, SIG_DFL);
# endif
# if defined SIGCLD && SIGCLD != SIGCHLD
(void) signal (SIGCLD, SIG_DFL);
# endif
#endif
/* Make sure stdout is line-buffered. */ /* Make sure stdout is line-buffered. */
#ifdef HAVE_SETLINEBUF #ifdef HAVE_SETLINEBUF
@ -782,7 +799,7 @@ int main (int argc, char ** argv)
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
perror_with_name ("getcwd: ", ""); perror_with_name ("getcwd: ", "");
#else #else
error ("getwd: %s", current_directory); error (NILF, "getwd: %s", current_directory);
#endif #endif
current_directory[0] = '\0'; current_directory[0] = '\0';
directory_before_chdir = 0; directory_before_chdir = 0;
@ -1051,7 +1068,7 @@ int main (int argc, char ** argv)
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
perror_with_name ("getcwd: ", ""); perror_with_name ("getcwd: ", "");
#else #else
error ("getwd: %s", current_directory); error (NILF, "getwd: %s", current_directory);
#endif #endif
starting_directory = 0; starting_directory = 0;
} }
@ -1089,7 +1106,7 @@ int main (int argc, char ** argv)
#endif #endif
if (stdin_nm) if (stdin_nm)
fatal("Makefile from standard input specified twice."); fatal (NILF, "Makefile from standard input specified twice.");
outfile = fopen (name, "w"); outfile = fopen (name, "w");
if (outfile == 0) if (outfile == 0)
@ -1126,14 +1143,20 @@ int main (int argc, char ** argv)
} }
} }
/* Set up to handle children dying. This must be done before #ifndef HAVE_WAIT_NOHANG
reading in the makefiles so that `shell' function calls will work. */ {
extern RETSIGTYPE child_handler PARAMS ((int sig));
#ifdef SIGCHLD /* Set up to handle children dying. This must be done before
(void) signal (SIGCHLD, child_handler); reading in the makefiles so that `shell' function calls will work.
#endif Note we only do this if we have to. */
#ifdef SIGCLD # if defined SIGCHLD
(void) signal (SIGCLD, child_handler); (void) signal (SIGCHLD, child_handler);
# endif
# if defined SIGCLD && SIGCLD != SIGCHLD
(void) signal (SIGCLD, child_handler);
# endif
}
#endif #endif
/* Let the user send us SIGUSR1 to toggle the -d flag during the run. */ /* Let the user send us SIGUSR1 to toggle the -d flag during the run. */
@ -1178,8 +1201,8 @@ int main (int argc, char ** argv)
no_default_sh_exe = !find_and_set_default_shell(NULL); no_default_sh_exe = !find_and_set_default_shell(NULL);
if (no_default_sh_exe && job_slots != 1) { if (no_default_sh_exe && job_slots != 1) {
error("Do not specify -j or --jobs if sh.exe is not available."); error (NILF, "Do not specify -j or --jobs if sh.exe is not available.");
error("Resetting make for single job mode."); error (NILF, "Resetting make for single job mode.");
job_slots = 1; job_slots = 1;
} }
#endif /* WINDOWS32 */ #endif /* WINDOWS32 */
@ -1251,7 +1274,7 @@ int main (int argc, char ** argv)
for (p = old_files->list; *p != 0; ++p) for (p = old_files->list; *p != 0; ++p)
{ {
f = enter_command_line_file (*p); f = enter_command_line_file (*p);
f->last_mtime = (time_t) 1; f->last_mtime = (FILE_TIMESTAMP) 1;
f->updated = 1; f->updated = 1;
f->update_status = 0; f->update_status = 0;
f->command_state = cs_finished; f->command_state = cs_finished;
@ -1273,7 +1296,7 @@ int main (int argc, char ** argv)
{ {
/* Update any makefiles if necessary. */ /* Update any makefiles if necessary. */
time_t *makefile_mtimes = 0; FILE_TIMESTAMP *makefile_mtimes = 0;
unsigned int mm_idx = 0; unsigned int mm_idx = 0;
char **nargv = argv; char **nargv = argv;
int nargc = argc; int nargc = argc;
@ -1323,11 +1346,12 @@ int main (int argc, char ** argv)
if (f == NULL || !f->double_colon) if (f == NULL || !f->double_colon)
{ {
if (makefile_mtimes == 0) if (makefile_mtimes == 0)
makefile_mtimes = (time_t *) xmalloc (sizeof (time_t)); makefile_mtimes = (FILE_TIMESTAMP *)
xmalloc (sizeof (FILE_TIMESTAMP));
else else
makefile_mtimes = (time_t *) makefile_mtimes = (FILE_TIMESTAMP *)
xrealloc ((char *) makefile_mtimes, xrealloc ((char *) makefile_mtimes,
(mm_idx + 1) * sizeof (time_t)); (mm_idx + 1) * sizeof (FILE_TIMESTAMP));
makefile_mtimes[mm_idx++] = file_mtime_no_search (d->file); makefile_mtimes[mm_idx++] = file_mtime_no_search (d->file);
last = d; last = d;
d = d->next; d = d->next;
@ -1373,13 +1397,13 @@ int main (int argc, char ** argv)
} }
else if (! (d->changed & RM_DONTCARE)) else if (! (d->changed & RM_DONTCARE))
{ {
time_t mtime; FILE_TIMESTAMP mtime;
/* The update failed and this makefile was not /* The update failed and this makefile was not
from the MAKEFILES variable, so we care. */ from the MAKEFILES variable, so we care. */
error ("Failed to remake makefile `%s'.", error (NILF, "Failed to remake makefile `%s'.",
d->file->name); d->file->name);
mtime = file_mtime_no_search (d->file); mtime = file_mtime_no_search (d->file);
any_remade |= (mtime != (time_t) -1 any_remade |= (mtime != (FILE_TIMESTAMP) -1
&& mtime != makefile_mtimes[i]); && mtime != makefile_mtimes[i]);
} }
} }
@ -1391,12 +1415,12 @@ int main (int argc, char ** argv)
if (d->changed & RM_INCLUDED) if (d->changed & RM_INCLUDED)
/* An included makefile. We don't need /* An included makefile. We don't need
to die, but we do want to complain. */ to die, but we do want to complain. */
error ("Included makefile `%s' was not found.", error (NILF, "Included makefile `%s' was not found.",
dep_name (d)); dep_name (d));
else else
{ {
/* A normal makefile. We must die later. */ /* A normal makefile. We must die later. */
error ("Makefile `%s' was not found", dep_name (d)); error (NILF, "Makefile `%s' was not found", dep_name (d));
any_failed = 1; any_failed = 1;
} }
} }
@ -1461,7 +1485,7 @@ int main (int argc, char ** argv)
else else
bad = 1; bad = 1;
if (bad) if (bad)
fatal ("Couldn't change back to original directory."); fatal (NILF, "Couldn't change back to original directory.");
} }
#ifndef _AMIGA #ifndef _AMIGA
@ -1570,14 +1594,14 @@ int main (int argc, char ** argv)
else else
{ {
if (read_makefiles == 0) if (read_makefiles == 0)
fatal ("No targets specified and no makefile found"); fatal (NILF, "No targets specified and no makefile found");
else else
fatal ("No targets"); fatal (NILF, "No targets");
} }
/* If we detected some clock skew, generate one last warning */ /* If we detected some clock skew, generate one last warning */
if (clock_skew_detected) if (clock_skew_detected)
error("*** Warning: Clock skew detected. Your build may be incomplete."); error (NILF, "*** Warning: Clock skew detected. Your build may be incomplete.");
/* Exit. */ /* Exit. */
die (status); die (status);
@ -1661,7 +1685,7 @@ handle_non_switch_argument (arg, env)
if (arg[0] == '-' && arg[1] == '\0') if (arg[0] == '-' && arg[1] == '\0')
/* Ignore plain `-' for compatibility. */ /* Ignore plain `-' for compatibility. */
return; return;
v = try_variable_definition ((char *) 0, 0, arg, o_command); v = try_variable_definition (0, arg, o_command);
if (v != 0) if (v != 0)
{ {
/* It is indeed a variable definition. Record a pointer to /* It is indeed a variable definition. Record a pointer to
@ -1825,7 +1849,7 @@ decode_switches (argc, argv, env)
if (i < 1) if (i < 1)
{ {
if (doit) if (doit)
error ("the `-%c' option requires a \ error (NILF, "the `-%c' option requires a \
positive integral argument", positive integral argument",
cs->c); cs->c);
bad = 1; bad = 1;

494
make.h
View File

@ -25,27 +25,27 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
(which it would do because make.h was found in $srcdir). */ (which it would do because make.h was found in $srcdir). */
#include <config.h> #include <config.h>
#undef HAVE_CONFIG_H #undef HAVE_CONFIG_H
#define HAVE_CONFIG_H #define HAVE_CONFIG_H 1
/* Use prototypes if available. */ /* Use prototypes if available. */
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) #if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#undef PARAMS # undef PARAMS
#define PARAMS(protos) protos # define PARAMS(protos) protos
#else /* Not C++ or ANSI C. */ #else /* Not C++ or ANSI C. */
#undef PARAMS # undef PARAMS
#define PARAMS(protos) () # define PARAMS(protos) ()
#endif /* C++ or ANSI C. */ #endif /* C++ or ANSI C. */
#ifdef CRAY #ifdef CRAY
/* This must happen before #include <signal.h> so /* This must happen before #include <signal.h> so
that the declaration therein is changed. */ that the declaration therein is changed. */
#define signal bsdsignal # define signal bsdsignal
#endif #endif
#define _GNU_SOURCE #define _GNU_SOURCE 1
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
@ -55,35 +55,35 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* SCO 3.2 "devsys 4.2" has a prototype for `ftime' in <time.h> that bombs /* 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 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. */ <sys/timeb.h>? If any does not, configure should check for it. */
#include <sys/timeb.h> # include <sys/timeb.h>
#endif #endif
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#ifndef errno #ifndef errno
extern int errno; extern int errno;
#endif #endif
#ifndef isblank #ifndef isblank
#define isblank(c) ((c) == ' ' || (c) == '\t') # define isblank(c) ((c) == ' ' || (c) == '\t')
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get /* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
POSIX.1 behavior with `cc -YPOSIX', which predefines POSIX itself! */ POSIX.1 behavior with `cc -YPOSIX', which predefines POSIX itself! */
#if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS) # if defined (_POSIX_VERSION) && !defined (ultrix) && !defined (VMS)
#define POSIX # define POSIX 1
#endif # endif
#endif #endif
/* Some systems define _POSIX_VERSION but are not really POSIX.1. */ /* 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))) #if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386)))
#undef POSIX # undef POSIX
#endif #endif
#if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE) #if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
#define POSIX # define POSIX 1
#endif #endif
#if defined (HAVE_SYS_SIGLIST) && !defined (SYS_SIGLIST_DECLARED) #if defined (HAVE_SYS_SIGLIST) && !defined (SYS_SIGLIST_DECLARED)
@ -91,54 +91,54 @@ extern char *sys_siglist[];
#endif #endif
#if !defined (HAVE_SYS_SIGLIST) || !defined (HAVE_STRSIGNAL) #if !defined (HAVE_SYS_SIGLIST) || !defined (HAVE_STRSIGNAL)
#include "signame.h" # include "signame.h"
#endif #endif
/* Some systems do not define NSIG in <signal.h>. */ /* Some systems do not define NSIG in <signal.h>. */
#ifndef NSIG #ifndef NSIG
#ifdef _NSIG # ifdef _NSIG
#define NSIG _NSIG # define NSIG _NSIG
#else # else
#define NSIG 32 # define NSIG 32
#endif # endif
#endif #endif
#ifndef RETSIGTYPE #ifndef RETSIGTYPE
#define RETSIGTYPE void # define RETSIGTYPE void
#endif #endif
#ifndef sigmask #ifndef sigmask
#define sigmask(sig) (1 << ((sig) - 1)) # define sigmask(sig) (1 << ((sig) - 1))
#endif #endif
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> # include <limits.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> # include <sys/param.h>
#endif #endif
#ifndef PATH_MAX #ifndef PATH_MAX
#ifndef POSIX # ifndef POSIX
#define PATH_MAX MAXPATHLEN # define PATH_MAX MAXPATHLEN
#endif /* Not POSIX. */ # endif
#endif /* No PATH_MAX. */ #endif
#ifndef MAXPATHLEN #ifndef MAXPATHLEN
#define MAXPATHLEN 1024 # define MAXPATHLEN 1024
#endif /* No MAXPATHLEN. */ #endif
#ifdef PATH_MAX #ifdef PATH_MAX
#define GET_PATH_MAX PATH_MAX # define GET_PATH_MAX PATH_MAX
#define PATH_VAR(var) char var[PATH_MAX] # define PATH_VAR(var) char var[PATH_MAX]
#else #else
#define NEED_GET_PATH_MAX # define NEED_GET_PATH_MAX 1
# define GET_PATH_MAX (get_path_max ())
# define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
extern unsigned int get_path_max PARAMS ((void)); extern unsigned int get_path_max PARAMS ((void));
#define GET_PATH_MAX (get_path_max ())
#define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX)
#endif #endif
#ifndef CHAR_BIT #ifndef CHAR_BIT
#define CHAR_BIT 8 # define CHAR_BIT 8
#endif #endif
/* Nonzero if the integer type T is signed. */ /* Nonzero if the integer type T is signed. */
@ -150,171 +150,189 @@ extern unsigned int get_path_max PARAMS ((void));
(! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)) (! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))
#define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t)) #define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t))
#ifdef STAT_MACROS_BROKEN #ifdef STAT_MACROS_BROKEN
#ifdef S_ISREG # ifdef S_ISREG
#undef S_ISREG # undef S_ISREG
#endif # endif
#ifdef S_ISDIR # ifdef S_ISDIR
#undef S_ISDIR # undef S_ISDIR
#endif # endif
#endif /* STAT_MACROS_BROKEN. */ #endif /* STAT_MACROS_BROKEN. */
#ifndef S_ISREG #ifndef S_ISREG
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif #endif
#ifndef S_ISDIR #ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif #endif
#ifdef VMS #ifdef VMS
#include <stdio.h> # include <stdio.h>
#include <types.h> # include <types.h>
#include <unixlib.h> # include <unixlib.h>
#include <unixio.h> # include <unixio.h>
#include <errno.h> # include <errno.h>
#include <perror.h> # include <perror.h>
#endif #endif
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) || defined(VMS)) #ifndef __attribute__
#include <stdlib.h> /* This feature is available in gcc versions 2.5 and later. */
#include <string.h> # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
#define ANSI_STRING # define __attribute__(x)
#else /* No standard headers. */ # endif
/* The __-protected variants of `format' and `printf' attributes
#ifdef HAVE_STRING_H are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
#include <string.h> # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#define ANSI_STRING # define __format__ format
#else # define __printf__ printf
#include <strings.h> # endif
#endif
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif #endif
#if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)
# include <stdlib.h>
# include <string.h>
# define ANSI_STRING 1
#else /* No standard headers. */
# ifdef HAVE_STRING_H
# include <string.h>
# define ANSI_STRING 1
# else
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# else
extern char *malloc PARAMS ((int)); extern char *malloc PARAMS ((int));
extern char *realloc PARAMS ((char *, int)); extern char *realloc PARAMS ((char *, int));
extern void free PARAMS ((char *)); extern void free PARAMS ((char *));
extern void abort PARAMS ((void)); extern void abort PARAMS ((void)) __attribute__ ((noreturn));
extern void exit PARAMS ((int)); extern void exit PARAMS ((int)) __attribute__ ((noreturn));
# endif /* HAVE_STDLIB_H. */
#endif /* Standard headers. */ #endif /* Standard headers. */
#ifdef ANSI_STRING #if ST_MTIM_NSEC
# if HAVE_INTTYPES_H
#ifndef index # include <inttypes.h>
#define index(s, c) strchr((s), (c)) # endif
#endif # define FILE_TIMESTAMP uintmax_t
#ifndef rindex #else
#define rindex(s, c) strrchr((s), (c)) # define FILE_TIMESTAMP time_t
#endif #endif
#ifndef bcmp #ifdef ANSI_STRING
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
#endif
#ifndef bzero
#define bzero(s, n) memset ((s), 0, (n))
#endif
#if defined(HAVE_MEMMOVE) && !defined(bcopy)
#define bcopy(s, d, n) memmove ((d), (s), (n))
#endif
#else /* Not ANSI_STRING. */ # ifndef index
# define index(s, c) strchr((s), (c))
# endif
# ifndef rindex
# define rindex(s, c) strrchr((s), (c))
# endif
#ifndef bcmp # ifndef bcmp
extern int bcmp (); # define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
#endif # endif
#ifndef bzero # ifndef bzero
extern void bzero (); # define bzero(s, n) memset ((s), 0, (n))
#endif # endif
#ifndef bcopy # if defined(HAVE_MEMMOVE) && !defined(bcopy)
extern void bcopy (); # define bcopy(s, d, n) memmove ((d), (s), (n))
#endif # endif
#endif /* ANSI_STRING. */ #else /* Not ANSI_STRING. */
#undef ANSI_STRING
# ifndef bcmp
extern int bcmp PARAMS ((const char *, const char *, int));
# endif
# ifndef bzero
extern void bzero PARAMS ((char *, int));
#endif
# ifndef bcopy
extern void bcopy PARAMS ((const char *b1, char *b2, int));
# endif
#endif /* ANSI_STRING. */
#undef ANSI_STRING
/* SCO Xenix has a buggy macro definition in <string.h>. */ /* SCO Xenix has a buggy macro definition in <string.h>. */
#undef strerror #undef strerror
#if !defined(ANSI_STRING) && !defined(__DECC) #if !defined(ANSI_STRING) && !defined(__DECC)
extern char *strerror PARAMS ((int errnum)); extern char *strerror PARAMS ((int errnum));
#endif #endif
#ifndef __attribute__ #ifdef __GNUC__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # undef alloca
# define __attribute__(x) # define alloca(n) __builtin_alloca (n)
# endif #else /* Not GCC. */
#endif # ifdef HAVE_ALLOCA_H
# include <alloca.h>
#ifdef __GNUC__ # else /* Not HAVE_ALLOCA_H. */
#undef alloca # ifndef _AIX
#define alloca(n) __builtin_alloca (n)
#else /* Not GCC. */
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#else /* Not HAVE_ALLOCA_H. */
#ifndef _AIX
extern char *alloca (); extern char *alloca ();
#endif /* Not AIX. */ # endif /* Not AIX. */
#endif /* HAVE_ALLOCA_H. */ # endif /* HAVE_ALLOCA_H. */
#endif /* GCC. */ #endif /* GCC. */
#ifndef iAPX286 #ifndef iAPX286
#define streq(a, b) \ # define streq(a, b) \
((a) == (b) || \ ((a) == (b) || \
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1)))) (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
#ifdef HAVE_CASE_INSENSITIVE_FS # ifdef HAVE_CASE_INSENSITIVE_FS
#define strieq(a, b) \ # define strieq(a, b) \
((a) == (b) || \ ((a) == (b) || \
(tolower(*(a)) == tolower(*(b)) && (*(a) == '\0' || !strcmpi ((a) + 1, (b) + 1)))) (tolower(*(a)) == tolower(*(b)) && (*(a) == '\0' || !strcmpi ((a) + 1, (b) + 1))))
#else # else
#define strieq(a, b) \ # define strieq(a, b) \
((a) == (b) || \ ((a) == (b) || \
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1)))) (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
#endif # endif
#else #else
/* Buggy compiler can't handle this. */ /* Buggy compiler can't handle this. */
#define streq(a, b) (strcmp ((a), (b)) == 0) # define streq(a, b) (strcmp ((a), (b)) == 0)
#define strieq(a, b) (strcmp ((a), (b)) == 0) # define strieq(a, b) (strcmp ((a), (b)) == 0)
#endif #endif
/* Add to VAR the hashing value of C, one character in a name. */ /* Add to VAR the hashing value of C, one character in a name. */
#define HASH(var, c) \ #define HASH(var, c) \
((var += (c)), (var = ((var) << 7) + ((var) >> 20))) ((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
#ifdef HAVE_CASE_INSENSITIVE_FS /* Fold filenames */ #ifdef HAVE_CASE_INSENSITIVE_FS /* Fold filenames */
#define HASHI(var, c) \ # define HASHI(var, c) \
((var += tolower((c))), (var = ((var) << 7) + ((var) >> 20))) ((var += tolower((c))), (var = ((var) << 7) + ((var) >> 20)))
#else #else
#define HASHI(var, c) HASH(var,c) # define HASHI(var, c) HASH(var,c)
#endif #endif
#if defined(__GNUC__) || defined(ENUM_BITFIELDS) #if defined(__GNUC__) || defined(ENUM_BITFIELDS)
#define ENUM_BITFIELD(bits) :bits # define ENUM_BITFIELD(bits) :bits
#else #else
#define ENUM_BITFIELD(bits) # define ENUM_BITFIELD(bits)
#endif #endif
#if defined(__MSDOS__) || defined(WINDOWS32) #if defined(__MSDOS__) || defined(WINDOWS32)
#define PATH_SEPARATOR_CHAR ';' # define PATH_SEPARATOR_CHAR ';'
#else #else
#if defined(VMS) # if defined(VMS)
#define PATH_SEPARATOR_CHAR ',' # define PATH_SEPARATOR_CHAR ','
#else # else
#define PATH_SEPARATOR_CHAR ':' # define PATH_SEPARATOR_CHAR ':'
#endif # endif
#endif #endif
#ifdef WINDOWS32 #ifdef WINDOWS32
#include <fcntl.h> # include <fcntl.h>
#include <malloc.h> # include <malloc.h>
#define pipe(p) _pipe(p, 512, O_BINARY) # define pipe(p) _pipe(p, 512, O_BINARY)
#define kill(pid,sig) w32_kill(pid,sig) # define kill(pid,sig) w32_kill(pid,sig)
extern void sync_Path_environment(void); extern void sync_Path_environment(void);
extern int kill(int pid, int sig); extern int kill(int pid, int sig);
extern int safe_stat(char *file, struct stat *sb); extern int safe_stat(char *file, struct stat *sb);
extern char *end_of_token_w32(); extern char *end_of_token_w32(char *s, char stopchar);
extern int find_and_set_default_shell(char *token); extern int find_and_set_default_shell(char *token);
/* indicates whether or not we have Bourne shell */ /* indicates whether or not we have Bourne shell */
@ -323,72 +341,81 @@ extern int no_default_sh_exe;
/* is default_shell unixy? */ /* is default_shell unixy? */
extern int unixy_shell; extern int unixy_shell;
#endif /* WINDOWS32 */ #endif /* WINDOWS32 */
extern void die () __attribute__ ((noreturn));
extern void message ();
extern void fatal () __attribute__ ((noreturn));
extern void error ();
extern void log_working_directory ();
extern void makefile_error ();
extern void makefile_fatal () __attribute__ ((noreturn));
extern void pfatal_with_name () __attribute__ ((noreturn));
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 ();
extern int alpha_compare ();
extern void print_spaces ();
extern struct dep *copy_dep_chain ();
extern char *find_char_unquote ();
extern char *find_percent ();
#ifndef NO_ARCHIVES struct floc
extern int ar_name (); {
extern void ar_parse_name (); char *filenm;
extern int ar_touch (); unsigned long lineno;
extern time_t ar_member_date (); };
#define NILF ((struct floc *)0)
/* Fancy processing for variadic functions in both ANSI and pre-ANSI
compilers. */
#if defined __STDC__ && __STDC__
extern void message (int prefix, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void error (const struct floc *flocp, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void fatal (const struct floc *flocp, const char *fmt, ...)
__attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
#else
extern void message ();
extern void error ();
extern void fatal ();
#endif #endif
extern void dir_load (); extern void die PARAMS ((int)) __attribute__ ((noreturn));
extern int dir_file_exists_p (); extern void log_working_directory PARAMS ((int));
extern int file_exists_p (); extern void pfatal_with_name PARAMS ((char *)) __attribute__ ((noreturn));
extern int file_impossible_p (); extern void perror_with_name PARAMS ((char *, char *));
extern void file_impossible (); extern char *savestring PARAMS ((char *, unsigned int));
extern char *dir_name (); extern char *concat PARAMS ((char *, char *, char *));
extern char *xmalloc PARAMS ((unsigned int));
extern char *xrealloc PARAMS ((char *, unsigned int));
extern char *find_next_token PARAMS ((char **, unsigned int *));
extern char *next_token PARAMS ((char *));
extern char *end_of_token PARAMS ((char *));
extern void collapse_continuations PARAMS ((char *));
extern void remove_comments PARAMS((char *));
extern char *sindex PARAMS ((char *, unsigned int, char *, unsigned int));
extern char *lindex PARAMS ((char *, char *, int));
extern int alpha_compare PARAMS ((const void *, const void *));
extern void print_spaces PARAMS ((unsigned int));
extern char *find_char_unquote PARAMS ((char *, char *, int));
extern char *find_percent PARAMS ((char *));
extern void define_default_variables (); #ifndef NO_ARCHIVES
extern void set_default_suffixes (); extern int ar_name PARAMS ((char *));
extern void install_default_suffix_rules (); extern void ar_parse_name PARAMS ((char *, char **, char **));
extern void install_default_implicit_rules (); extern int ar_touch PARAMS ((char *));
extern void count_implicit_rule_limits (); extern time_t ar_member_date PARAMS ((char *));
extern void convert_to_pattern (); #endif
extern void create_pattern_rule ();
extern void build_vpath_lists (); extern int dir_file_exists_p PARAMS ((char *, char *));
extern void construct_vpath_list (); extern int file_exists_p PARAMS ((char *));
extern int vpath_search (); extern int file_impossible_p PARAMS ((char *));
extern int gpath_search (); extern void file_impossible PARAMS ((char *));
extern char *dir_name PARAMS ((char *));
extern void construct_include_path (); extern void define_default_variables PARAMS ((void));
extern void uniquize_deps (); extern void set_default_suffixes PARAMS ((void));
extern void install_default_suffix_rules PARAMS ((void));
extern void install_default_implicit_rules PARAMS ((void));
extern int update_goal_chain (); extern void build_vpath_lists PARAMS ((void));
extern void notice_finished_file (); extern void construct_vpath_list PARAMS ((char *pattern, char *dirpath));
extern int vpath_search PARAMS ((char **file, FILE_TIMESTAMP *mtime_ptr));
extern int gpath_search PARAMS ((char *file, int len));
extern void user_access (); extern void construct_include_path PARAMS ((char **arg_dirs));
extern void make_access ();
extern void child_access ();
#ifdef HAVE_VFORK_H extern void user_access PARAMS ((void));
#include <vfork.h> extern void make_access PARAMS ((void));
extern void child_access PARAMS ((void));
#ifdef HAVE_VFORK_H
# include <vfork.h>
#endif #endif
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION, /* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
@ -397,26 +424,25 @@ extern void child_access ();
#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32) #if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32)
extern long int atol (); extern long int atol ();
#ifndef VMS # ifndef VMS
extern long int lseek (); extern long int lseek ();
#endif # endif
#endif /* Not GNU C library or POSIX. */ #endif /* Not GNU C library or POSIX. */
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
extern char *getcwd (); extern char *getcwd ();
#ifdef VMS # ifdef VMS
extern char *getwd PARAMS ((char *)); extern char *getwd PARAMS ((char *));
#endif # endif
#else #else
extern char *getwd (); extern char *getwd ();
#define getcwd(buf, len) getwd (buf) # define getcwd(buf, len) getwd (buf)
#endif #endif
extern char **environ; extern const struct floc *reading_file;
extern char *reading_filename; extern char **environ;
extern unsigned int *reading_lineno_ptr;
extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag; 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 debug_flag, print_data_base_flag, question_flag, touch_flag;
@ -445,9 +471,16 @@ extern unsigned int commands_started;
extern int handling_fatal_signal; extern int handling_fatal_signal;
#ifndef MIN
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
#endif
#ifndef MAX
#define MAX(_a,_b) ((_a)>(_b)?(_a):(_b))
#endif
#define DEBUGPR(msg) \ #define DEBUGPR(msg) \
do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \ do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
fflush (stdout); } while (0) fflush (stdout); } while (0)
#ifdef VMS #ifdef VMS
# ifndef EXIT_FAILURE # ifndef EXIT_FAILURE
@ -470,4 +503,3 @@ extern int handling_fatal_signal;
# define EXIT_TROUBLE 1 # define EXIT_TROUBLE 1
# endif # endif
#endif #endif

View File

@ -68,17 +68,17 @@ by the Free Software Foundation.
@titlepage @titlepage
@title GNU Make @title GNU Make
@subtitle A Program for Directing Recompilation @subtitle A Program for Directing Recompilation
@subtitle GNU @code{make} Version @value{VERSION}. @subtitle GNU @code{make} Version @value{VERSION}
@subtitle @value{UPDATE-MONTH} @subtitle @value{UPDATE-MONTH}
@author Richard M. Stallman and Roland McGrath @author Richard M. Stallman and Roland McGrath
@page @page
@vskip 0pt plus 1filll @vskip 0pt plus 1filll
Copyright @copyright{} 1988, '89, '90, '91, '92, '93, '94, '95, '96, '97 Free Software Foundation, Inc. Copyright @copyright{} 1988, '89, '90, '91, '92, '93, '94, '95, '96, '97, '98
Free Software Foundation, Inc.
@sp 2 @sp 2
Published by the Free Software Foundation @* Published by the Free Software Foundation @*
59 Temple Place -- Suite 330, @* 59 Temple Place -- Suite 330, @*
Boston, MA 02111-1307 USA @* Boston, MA 02111-1307 USA @*
Printed copies are available for $20 each. @*
ISBN @value{ISBN} @* ISBN @value{ISBN} @*
Permission is granted to make and distribute verbatim copies of Permission is granted to make and distribute verbatim copies of
@ -124,7 +124,7 @@ This manual describes @code{make} and contains the following chapters:@refill
* Conditionals:: Use or ignore parts of the makefile based * Conditionals:: Use or ignore parts of the makefile based
on the values of variables. on the values of variables.
* Functions:: Many powerful ways to manipulate text. * Functions:: Many powerful ways to manipulate text.
* make Invocation: Running. How to invoke @code{make} on the command line. * Invoking make: Running. How to invoke @code{make} on the command line.
* Implicit Rules:: Use implicit rules to treat many files alike, * Implicit Rules:: Use implicit rules to treat many files alike,
based on their file names. based on their file names.
* Archives:: How @code{make} can update library archives. * Archives:: How @code{make} can update library archives.
@ -2241,8 +2241,7 @@ match that file's name.
The targets which @code{.INTERMEDIATE} depends on are treated as The targets which @code{.INTERMEDIATE} depends on are treated as
intermediate files. @xref{Chained Rules, ,Chains of Implicit Rules}. intermediate files. @xref{Chained Rules, ,Chains of Implicit Rules}.
@code{.INTERMEDIATE} with no dependencies marks all file targets @code{.INTERMEDIATE} with no dependencies has no effect.
mentioned in the makefile as intermediate.
@findex .SECONDARY @findex .SECONDARY
@item .SECONDARY @item .SECONDARY

163
misc.c
View File

@ -20,17 +20,52 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "dep.h" #include "dep.h"
/* Variadic functions. We go through contortions to allow proper function
prototypes for both ANSI and pre-ANSI C compilers, and also for those
which support stdarg.h vs. varargs.h, and finally those which have
vfprintf(), etc. and those who have _doprnt... or nothing.
This fancy stuff all came from GNU fileutils, except for the VA_PRINTF and
VA_END macros used here since we have multiple print functions. */
#if HAVE_VPRINTF || HAVE_DOPRNT
# define HAVE_STDVARARGS 1
# if __STDC__
# include <stdarg.h>
# define VA_START(args, lastarg) va_start(args, lastarg)
# else
# include <varargs.h>
# define VA_START(args, lastarg) va_start(args)
# endif
# if HAVE_VPRINTF
# define VA_PRINTF(fp, lastarg, args) vfprintf((fp), (lastarg), (args))
# else
# define VA_PRINTF(fp, lastarg, args) _doprnt((lastarg), (args), (fp))
# endif
# define VA_END(args) va_end(args)
#else
/* # undef HAVE_STDVARARGS */
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
# define VA_START(args, lastarg)
# define VA_END(args)
#endif
/* Compare strings *S1 and *S2. /* Compare strings *S1 and *S2.
Return negative if the first is less, positive if it is greater, Return negative if the first is less, positive if it is greater,
zero if they are equal. */ zero if they are equal. */
int int
alpha_compare (s1, s2) alpha_compare (v1, v2)
char **s1, **s2; const void *v1, *v2;
{ {
if (**s1 != **s2) const char *s1 = *((char **)v1);
return **s1 - **s2; const char *s2 = *((char **)v2);
return strcmp (*s1, *s2);
if (*s1 != *s2)
return *s1 - *s2;
return strcmp (s1, s2);
} }
/* Discard each backslash-newline combination from LINE. /* Discard each backslash-newline combination from LINE.
@ -173,13 +208,22 @@ concat (s1, s2, s3)
/* Print a message on stdout. */ /* Print a message on stdout. */
void void
message (prefix, s1, s2, s3, s4, s5, s6) #if __STDC__ && HAVE_STDVARARGS
message (int prefix, const char *fmt, ...)
#else
message (prefix, fmt, va_alist)
int prefix; int prefix;
char *s1, *s2, *s3, *s4, *s5, *s6; const char *fmt;
va_dcl
#endif
{ {
#if HAVE_STDVARARGS
va_list args;
#endif
log_working_directory (1); log_working_directory (1);
if (s1 != 0) if (fmt != 0)
{ {
if (prefix) if (prefix)
{ {
@ -188,78 +232,77 @@ message (prefix, s1, s2, s3, s4, s5, s6)
else else
printf ("%s[%u]: ", program, makelevel); printf ("%s[%u]: ", program, makelevel);
} }
printf (s1, s2, s3, s4, s5, s6); VA_START (args, fmt);
VA_PRINTF (stdout, fmt, args);
VA_END (args);
putchar ('\n'); putchar ('\n');
} }
fflush (stdout); fflush (stdout);
} }
/* Print an error message and exit. */ /* Print an error message. */
/* VARARGS1 */
void
fatal (s1, s2, s3, s4, s5, s6)
char *s1, *s2, *s3, *s4, *s5, *s6;
{
log_working_directory (1);
if (makelevel == 0)
fprintf (stderr, "%s: *** ", program);
else
fprintf (stderr, "%s[%u]: *** ", program, makelevel);
fprintf (stderr, s1, s2, s3, s4, s5, s6);
fputs (". Stop.\n", stderr);
die (2);
}
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
/* VARARGS1 */
void void
error (s1, s2, s3, s4, s5, s6) #if __STDC__ && HAVE_STDVARARGS
char *s1, *s2, *s3, *s4, *s5, *s6; error (const struct floc *flocp, const char *fmt, ...)
#else
error (flocp, fmt, va_alist)
const struct floc *flocp;
const char *fmt;
va_dcl
#endif
{ {
#if HAVE_STDVARARGS
va_list args;
#endif
log_working_directory (1); log_working_directory (1);
if (makelevel == 0) if (flocp && flocp->filenm)
fprintf (stderr, "%s:%lu: ", flocp->filenm, flocp->lineno);
else if (makelevel == 0)
fprintf (stderr, "%s: ", program); fprintf (stderr, "%s: ", program);
else else
fprintf (stderr, "%s[%u]: ", program, makelevel); fprintf (stderr, "%s[%u]: ", program, makelevel);
fprintf (stderr, s1, s2, s3, s4, s5, s6);
VA_START(args, fmt);
VA_PRINTF (stderr, fmt, args);
VA_END (args);
putc ('\n', stderr); putc ('\n', stderr);
fflush (stderr); fflush (stderr);
} }
void /* Print an error message and exit. */
makefile_error (file, lineno, s1, s2, s3, s4, s5, s6)
char *file;
unsigned int lineno;
char *s1, *s2, *s3, *s4, *s5, *s6;
{
log_working_directory (1);
fprintf (stderr, "%s:%u: ", file, lineno);
fprintf (stderr, s1, s2, s3, s4, s5, s6);
putc ('\n', stderr);
fflush (stderr);
}
void void
makefile_fatal (file, lineno, s1, s2, s3, s4, s5, s6) #if __STDC__ && HAVE_STDVARARGS
char *file; fatal (const struct floc *flocp, const char *fmt, ...)
unsigned int lineno; #else
char *s1, *s2, *s3, *s4, *s5, *s6; fatal (flocp, fmt, va_alist)
const struct floc *flocp;
const char *fmt;
va_dcl
#endif
{ {
if (!file) #if HAVE_STDVARARGS
fatal(s1, s2, s3, s4, s5, s6); va_list args;
#endif
log_working_directory (1); log_working_directory (1);
fprintf (stderr, "%s:%u: *** ", file, lineno); if (flocp && flocp->filenm)
fprintf (stderr, s1, s2, s3, s4, s5, s6); fprintf (stderr, "%s:%lu: *** ", flocp->filenm, flocp->lineno);
else if (makelevel == 0)
fprintf (stderr, "%s: *** ", program);
else
fprintf (stderr, "%s[%u]: *** ", program, makelevel);
VA_START(args, fmt);
VA_PRINTF (stderr, fmt, args);
VA_END (args);
fputs (". Stop.\n", stderr); fputs (". Stop.\n", stderr);
die (2); die (2);
@ -293,7 +336,7 @@ void
perror_with_name (str, name) perror_with_name (str, name)
char *str, *name; char *str, *name;
{ {
error ("%s%s: %s", str, name, strerror (errno)); error (NILF, "%s%s: %s", str, name, strerror (errno));
} }
/* Print an error message from errno and exit. */ /* Print an error message from errno and exit. */
@ -302,7 +345,7 @@ void
pfatal_with_name (name) pfatal_with_name (name)
char *name; char *name;
{ {
fatal ("%s: %s", name, strerror (errno)); fatal (NILF, "%s: %s", name, strerror (errno));
/* NOTREACHED */ /* NOTREACHED */
} }
@ -318,7 +361,7 @@ xmalloc (size)
{ {
char *result = (char *) malloc (size); char *result = (char *) malloc (size);
if (result == 0) if (result == 0)
fatal ("virtual memory exhausted"); fatal (NILF, "virtual memory exhausted");
return result; return result;
} }
@ -330,7 +373,7 @@ xrealloc (ptr, size)
{ {
char *result = (char *) realloc (ptr, size); char *result = (char *) realloc (ptr, size);
if (result == 0) if (result == 0)
fatal ("virtual memory exhausted"); fatal (NILF, "virtual memory exhausted");
return result; return result;
} }

219
read.c
View File

@ -119,26 +119,27 @@ static unsigned int max_incl_len;
/* The filename and pointer to line number of the /* The filename and pointer to line number of the
makefile currently being read in. */ makefile currently being read in. */
char *reading_filename; const struct floc *reading_file;
unsigned int *reading_lineno_ptr;
/* The chain of makefiles read by read_makefile. */ /* The chain of makefiles read by read_makefile. */
static struct dep *read_makefiles = 0; static struct dep *read_makefiles = 0;
static int read_makefile PARAMS ((char *filename, int flags)); static int read_makefile PARAMS ((char *filename, int flags));
static unsigned int readline PARAMS ((struct linebuffer *linebuffer, FILE *stream, static unsigned long readline PARAMS ((struct linebuffer *linebuffer,
char *filename, unsigned int lineno)); FILE *stream, const struct floc *flocp));
static unsigned int do_define PARAMS ((char *name, unsigned int namelen, enum variable_origin origin, static void do_define PARAMS ((char *name, unsigned int namelen,
unsigned int lineno, FILE *infile, char *filename)); enum variable_origin origin, FILE *infile,
static int conditional_line PARAMS ((char *line, char *filename, unsigned int lineno)); struct floc *flocp));
static int conditional_line PARAMS ((char *line, const struct floc *flocp));
static void record_files PARAMS ((struct nameseq *filenames, char *pattern, char *pattern_percent, static void record_files PARAMS ((struct nameseq *filenames, char *pattern, char *pattern_percent,
struct dep *deps, unsigned int cmds_started, char *commands, struct dep *deps, unsigned int cmds_started, char *commands,
unsigned int commands_idx, int two_colon, char *filename, unsigned int commands_idx, int two_colon,
unsigned int lineno, int set_default)); const struct floc *flocp, int set_default));
static void record_target_var PARAMS ((struct nameseq *filenames, char *defn, static void record_target_var PARAMS ((struct nameseq *filenames, char *defn,
int two_colon, enum variable_origin origin, int two_colon,
char *filename, unsigned int lineno)); enum variable_origin origin,
const struct floc *flocp));
static enum make_word_type get_next_mword PARAMS ((char *buffer, char *delim, static enum make_word_type get_next_mword PARAMS ((char *buffer, char *delim,
char **startp, unsigned int *length)); char **startp, unsigned int *length));
@ -290,11 +291,11 @@ read_makefile (filename, flags)
int len, reading_target; int len, reading_target;
int ignoring = 0, in_ignored_define = 0; int ignoring = 0, in_ignored_define = 0;
int no_targets = 0; /* Set when reading a rule without targets. */ int no_targets = 0; /* Set when reading a rule without targets. */
struct floc fileinfo;
char *passed_filename = filename; char *passed_filename = filename;
struct nameseq *filenames = 0; struct nameseq *filenames = 0;
struct dep *deps; struct dep *deps;
unsigned int lineno = 1;
unsigned int nlines = 0; unsigned int nlines = 0;
int two_colon = 0; int two_colon = 0;
char *pattern = 0, *pattern_percent; char *pattern = 0, *pattern_percent;
@ -310,19 +311,22 @@ read_makefile (filename, flags)
if (filenames != 0) \ if (filenames != 0) \
record_files (filenames, pattern, pattern_percent, deps, \ record_files (filenames, pattern, pattern_percent, deps, \
cmds_started, commands, commands_idx, \ cmds_started, commands, commands_idx, \
two_colon, filename, lineno, \ two_colon, &fileinfo, \
!(flags & RM_NO_DEFAULT_GOAL)); \ !(flags & RM_NO_DEFAULT_GOAL)); \
filenames = 0; \ filenames = 0; \
commands_idx = 0; \ commands_idx = 0; \
if (pattern) { free(pattern); pattern = 0; } \ if (pattern) { free(pattern); pattern = 0; } \
} while (0) } while (0)
fileinfo.filenm = filename;
fileinfo.lineno = 1;
pattern_percent = 0; pattern_percent = 0;
cmds_started = lineno; cmds_started = fileinfo.lineno;
if (debug_flag) if (debug_flag)
{ {
printf ("Reading makefile `%s'", filename); printf ("Reading makefile `%s'", fileinfo.filenm);
if (flags & RM_NO_DEFAULT_GOAL) if (flags & RM_NO_DEFAULT_GOAL)
printf (" (no default goal)"); printf (" (no default goal)");
if (flags & RM_INCLUDED) if (flags & RM_INCLUDED)
@ -398,8 +402,7 @@ read_makefile (filename, flags)
return 0; return 0;
} }
reading_filename = filename; reading_file = &fileinfo;
reading_lineno_ptr = &lineno;
/* Loop over lines in the file. /* Loop over lines in the file.
The strategy is to accumulate target names in FILENAMES, dependencies The strategy is to accumulate target names in FILENAMES, dependencies
@ -410,8 +413,8 @@ read_makefile (filename, flags)
while (!feof (infile)) while (!feof (infile))
{ {
lineno += nlines; fileinfo.lineno += nlines;
nlines = readline (&lb, infile, filename, lineno); nlines = readline (&lb, infile, &fileinfo);
/* Check for a shell command line first. /* Check for a shell command line first.
If it is not one, we can stop treating tab specially. */ If it is not one, we can stop treating tab specially. */
@ -437,7 +440,7 @@ read_makefile (filename, flags)
/* Append this command line to the line being accumulated. */ /* Append this command line to the line being accumulated. */
p = lb.buffer; p = lb.buffer;
if (commands_idx == 0) if (commands_idx == 0)
cmds_started = lineno; cmds_started = fileinfo.lineno;
len = strlen (p); len = strlen (p);
if (len + 1 + commands_idx > commands_len) if (len + 1 + commands_idx > commands_len)
{ {
@ -506,12 +509,11 @@ read_makefile (filename, flags)
|| word1eq ("ifeq", 4) || word1eq ("ifneq", 5) || word1eq ("ifeq", 4) || word1eq ("ifneq", 5)
|| word1eq ("else", 4) || word1eq ("endif", 5))) || word1eq ("else", 4) || word1eq ("endif", 5)))
{ {
int i = conditional_line (p, filename, lineno); int i = conditional_line (p, &fileinfo);
if (i >= 0) if (i >= 0)
ignoring = i; ignoring = i;
else else
makefile_fatal (filename, lineno, fatal (&fileinfo, "invalid syntax in conditional");
"invalid syntax in conditional");
continue; continue;
} }
@ -520,7 +522,7 @@ read_makefile (filename, flags)
if (in_ignored_define) if (in_ignored_define)
in_ignored_define = 0; in_ignored_define = 0;
else else
makefile_fatal (filename, lineno, "extraneous `endef'"); fatal (&fileinfo, "extraneous `endef'");
continue; continue;
} }
@ -538,8 +540,7 @@ read_makefile (filename, flags)
p = index (p2, '\0'); p = index (p2, '\0');
while (isblank (p[-1])) while (isblank (p[-1]))
--p; --p;
lineno = do_define (p2, p - p2, o_file, do_define (p2, p - p2, o_file, infile, &fileinfo);
lineno, infile, filename);
} }
continue; continue;
} }
@ -548,7 +549,7 @@ read_makefile (filename, flags)
{ {
p2 = next_token (p + 8); p2 = next_token (p + 8);
if (p2 == 0) if (p2 == 0)
makefile_error (filename, lineno, "empty `override' directive"); error (&fileinfo, "empty `override' directive");
if (!strncmp (p2, "define", 6) && (isblank (p2[6]) || p2[6] == '\0')) if (!strncmp (p2, "define", 6) && (isblank (p2[6]) || p2[6] == '\0'))
{ {
if (ignoring) if (ignoring)
@ -563,14 +564,12 @@ read_makefile (filename, flags)
p = index (p2, '\0'); p = index (p2, '\0');
while (isblank (p[-1])) while (isblank (p[-1]))
--p; --p;
lineno = do_define (p2, p - p2, o_override, do_define (p2, p - p2, o_override, infile, &fileinfo);
lineno, infile, filename);
} }
} }
else if (!ignoring else if (!ignoring
&& !try_variable_definition (filename, lineno, && !try_variable_definition (&fileinfo, p2, o_override))
p2, o_override)) error (&fileinfo, "empty `override' directive");
makefile_error (filename, lineno, "empty `override' directive");
continue; continue;
} }
@ -587,7 +586,7 @@ read_makefile (filename, flags)
p2 = next_token (p + 6); p2 = next_token (p + 6);
if (*p2 == '\0') if (*p2 == '\0')
export_all_variables = 1; export_all_variables = 1;
v = try_variable_definition (filename, lineno, p2, o_file); v = try_variable_definition (&fileinfo, p2, o_file);
if (v != 0) if (v != 0)
v->export = v_export; v->export = v_export;
else else
@ -653,7 +652,7 @@ read_makefile (filename, flags)
p = allocated_variable_expand (next_token (p + (noerror ? 8 : 7))); p = allocated_variable_expand (next_token (p + (noerror ? 8 : 7)));
if (*p == '\0') if (*p == '\0')
{ {
makefile_error (filename, lineno, error (&fileinfo,
"no file name for `%sinclude'", "no file name for `%sinclude'",
noerror ? "-" : ""); noerror ? "-" : "");
continue; continue;
@ -688,7 +687,7 @@ read_makefile (filename, flags)
if (! read_makefile (name, (RM_INCLUDED | RM_NO_TILDE if (! read_makefile (name, (RM_INCLUDED | RM_NO_TILDE
| (noerror ? RM_DONTCARE : 0))) | (noerror ? RM_DONTCARE : 0)))
&& ! noerror) && ! noerror)
makefile_error (filename, lineno, error (&fileinfo,
"%s: %s", name, strerror (errno)); "%s: %s", name, strerror (errno));
free(name); free(name);
} }
@ -701,11 +700,10 @@ read_makefile (filename, flags)
/* Restore state. */ /* Restore state. */
conditionals = save; conditionals = save;
reading_filename = filename; reading_file = &fileinfo;
reading_lineno_ptr = &lineno;
} }
#undef word1eq #undef word1eq
else if (try_variable_definition (filename, lineno, p, o_file)) else if (try_variable_definition (&fileinfo, p, o_file))
/* This line has been dealt with. */ /* This line has been dealt with. */
; ;
else if (lb.buffer[0] == '\t') else if (lb.buffer[0] == '\t')
@ -720,7 +718,7 @@ read_makefile (filename, flags)
because there was no preceding target, and the line because there was no preceding target, and the line
might have been usable as a variable definition. might have been usable as a variable definition.
But now it is definitely lossage. */ But now it is definitely lossage. */
makefile_fatal (filename, lineno, fatal (&fileinfo,
"commands commence before first target"); "commands commence before first target");
} }
else else
@ -739,6 +737,7 @@ read_makefile (filename, flags)
enum variable_origin v_origin; enum variable_origin v_origin;
char *cmdleft, *lb_next; char *cmdleft, *lb_next;
unsigned int len, plen = 0; unsigned int len, plen = 0;
char *colonp;
/* Record the previous rule. */ /* Record the previous rule. */
@ -768,7 +767,7 @@ read_makefile (filename, flags)
{ {
case w_eol: case w_eol:
if (cmdleft != 0) if (cmdleft != 0)
makefile_fatal (filename, lineno, fatal (&fileinfo,
"missing rule before commands"); "missing rule before commands");
else else
/* This line contained a variable reference that /* This line contained a variable reference that
@ -789,8 +788,6 @@ read_makefile (filename, flags)
p2 = variable_expand_string(NULL, lb_next, len); p2 = variable_expand_string(NULL, lb_next, len);
while (1) while (1)
{ {
char *colonp;
lb_next += len; lb_next += len;
if (cmdleft == 0) if (cmdleft == 0)
{ {
@ -825,12 +822,12 @@ read_makefile (filename, flags)
colonp = find_char_unquote(p2, ":", 0); colonp = find_char_unquote(p2, ":", 0);
#if defined(__MSDOS__) || defined(WINDOWS32) #if defined(__MSDOS__) || defined(WINDOWS32)
/* The drive spec brain-damage strikes again... */ /* The drive spec brain-damage strikes again... */
/* FIXME: is whitespace the only possible separator of words /* Note that the only separators of targets in this context
in this context? If not, the `isspace' test below will are whitespace and a left paren. If others are possible,
need to be changed into a call to `index'. */ they should be added to the string in the call to index. */
while (colonp && (colonp[1] == '/' || colonp[1] == '\\') && while (colonp && (colonp[1] == '/' || colonp[1] == '\\') &&
colonp > p2 && isalpha(colonp[-1]) && colonp > p2 && isalpha(colonp[-1]) &&
(colonp == p2 + 1 || isspace(colonp[-2]))) (colonp == p2 + 1 || index(" \t(", colonp[-2]) != 0))
colonp = find_char_unquote(colonp + 1, ":", 0); colonp = find_char_unquote(colonp + 1, ":", 0);
#endif #endif
if (colonp != 0) if (colonp != 0)
@ -838,7 +835,11 @@ read_makefile (filename, flags)
wtype = get_next_mword(lb_next, NULL, &lb_next, &len); wtype = get_next_mword(lb_next, NULL, &lb_next, &len);
if (wtype == w_eol) if (wtype == w_eol)
makefile_fatal (filename, lineno, "missing separator"); /* There's no need to be ivory-tower about this: check for
one of the most common bugs found in makefiles... */
fatal (&fileinfo, "missing separator%s",
strncmp(lb.buffer, " ", 8) ? ""
: " (did you mean TAB instead of 8 spaces?)");
p2 += strlen(p2); p2 += strlen(p2);
*(p2++) = ' '; *(p2++) = ' ';
@ -850,10 +851,14 @@ read_makefile (filename, flags)
p2 = next_token (variable_buffer); p2 = next_token (variable_buffer);
filenames = multi_glob (parse_file_seq (&p2, ':', /* Make the colon the end-of-string so we know where to stop
looking for targets. */
*colonp = '\0';
filenames = multi_glob (parse_file_seq (&p2, '\0',
sizeof (struct nameseq), sizeof (struct nameseq),
1), 1),
sizeof (struct nameseq)); sizeof (struct nameseq));
*colonp = ':';
if (!filenames) if (!filenames)
{ {
@ -896,8 +901,7 @@ read_makefile (filename, flags)
if (wtype == w_varassign || v_origin == o_override) if (wtype == w_varassign || v_origin == o_override)
{ {
record_target_var(filenames, p, two_colon, v_origin, record_target_var(filenames, p, two_colon, v_origin, &fileinfo);
filename, lineno);
filenames = 0; filenames = 0;
continue; continue;
} }
@ -959,7 +963,8 @@ read_makefile (filename, flags)
check_again = 0; check_again = 0;
/* For MSDOS and WINDOWS32, skip a "C:\..." or a "C:/..." */ /* For MSDOS and WINDOWS32, skip a "C:\..." or a "C:/..." */
if (p != 0 && (p[1] == '\\' || p[1] == '/') && if (p != 0 && (p[1] == '\\' || p[1] == '/') &&
isalpha(p[-1]) && (p == p2 + 1 || index(" \t:", p[-2]) != 0)) { isalpha(p[-1]) &&
(p == p2 + 1 || index(" \t:(", p[-2]) != 0)) {
p = index(p + 1, ':'); p = index(p + 1, ':');
check_again = 1; check_again = 1;
} }
@ -971,13 +976,13 @@ read_makefile (filename, flags)
target = parse_file_seq (&p2, ':', sizeof (struct nameseq), 1); target = parse_file_seq (&p2, ':', sizeof (struct nameseq), 1);
++p2; ++p2;
if (target == 0) if (target == 0)
makefile_fatal (filename, lineno, "missing target pattern"); fatal (&fileinfo, "missing target pattern");
else if (target->next != 0) else if (target->next != 0)
makefile_fatal (filename, lineno, "multiple target patterns"); fatal (&fileinfo, "multiple target patterns");
pattern = target->name; pattern = target->name;
pattern_percent = find_percent (pattern); pattern_percent = find_percent (pattern);
if (pattern_percent == 0) if (pattern_percent == 0)
makefile_fatal (filename, lineno, fatal (&fileinfo,
"target pattern contains no `%%'"); "target pattern contains no `%%'");
free((char *)target); free((char *)target);
} }
@ -995,7 +1000,7 @@ read_makefile (filename, flags)
/* Semicolon means rest of line is a command. */ /* Semicolon means rest of line is a command. */
unsigned int len = strlen (cmdleft); unsigned int len = strlen (cmdleft);
cmds_started = lineno; cmds_started = fileinfo.lineno;
/* Add this command line to the buffer. */ /* Add this command line to the buffer. */
if (len + 2 > commands_len) if (len + 2 > commands_len)
@ -1019,7 +1024,7 @@ read_makefile (filename, flags)
} }
if (conditionals->if_cmds) if (conditionals->if_cmds)
makefile_fatal (filename, lineno, "missing `endif'"); fatal (&fileinfo, "missing `endif'");
/* At eof, record the last rule. */ /* At eof, record the last rule. */
record_waiting_files (); record_waiting_files ();
@ -1028,8 +1033,7 @@ read_makefile (filename, flags)
free ((char *) commands); free ((char *) commands);
fclose (infile); fclose (infile);
reading_filename = 0; reading_file = 0;
reading_lineno_ptr = 0;
return 1; return 1;
} }
@ -1040,14 +1044,13 @@ read_makefile (filename, flags)
LINENO, INFILE and FILENAME refer to the makefile being read. LINENO, INFILE and FILENAME refer to the makefile being read.
The value returned is LINENO, updated for lines read here. */ The value returned is LINENO, updated for lines read here. */
static unsigned int static void
do_define (name, namelen, origin, lineno, infile, filename) do_define (name, namelen, origin, infile, flocp)
char *name; char *name;
unsigned int namelen; unsigned int namelen;
enum variable_origin origin; enum variable_origin origin;
unsigned int lineno;
FILE *infile; FILE *infile;
char *filename; struct floc *flocp;
{ {
struct linebuffer lb; struct linebuffer lb;
unsigned int nlines = 0; unsigned int nlines = 0;
@ -1067,8 +1070,8 @@ do_define (name, namelen, origin, lineno, infile, filename)
{ {
unsigned int len; unsigned int len;
lineno += nlines; flocp->lineno += nlines;
nlines = readline (&lb, infile, filename, lineno); nlines = readline (&lb, infile, flocp);
collapse_continuations (lb.buffer); collapse_continuations (lb.buffer);
@ -1080,8 +1083,7 @@ do_define (name, namelen, origin, lineno, infile, filename)
p += 5; p += 5;
remove_comments (p); remove_comments (p);
if (*next_token (p) != '\0') if (*next_token (p) != '\0')
makefile_error (filename, lineno, error (flocp, "Extraneous text after `endef' directive");
"Extraneous text after `endef' directive");
/* Define the variable. */ /* Define the variable. */
if (idx == 0) if (idx == 0)
definition[0] = '\0'; definition[0] = '\0';
@ -1090,7 +1092,7 @@ do_define (name, namelen, origin, lineno, infile, filename)
(void) define_variable (var, strlen (var), definition, origin, 1); (void) define_variable (var, strlen (var), definition, origin, 1);
free (definition); free (definition);
freebuffer (&lb); freebuffer (&lb);
return (lineno + nlines); return;
} }
else else
{ {
@ -1110,10 +1112,10 @@ do_define (name, namelen, origin, lineno, infile, filename)
} }
/* No `endef'!! */ /* No `endef'!! */
makefile_fatal (filename, lineno, "missing `endef', unterminated `define'"); fatal (flocp, "missing `endef', unterminated `define'");
/* NOTREACHED */ /* NOTREACHED */
return 0; return;
} }
/* Interpret conditional commands "ifdef", "ifndef", "ifeq", /* Interpret conditional commands "ifdef", "ifndef", "ifeq",
@ -1128,10 +1130,9 @@ do_define (name, namelen, origin, lineno, infile, filename)
1 if following text should be ignored. */ 1 if following text should be ignored. */
static int static int
conditional_line (line, filename, lineno) conditional_line (line, flocp)
char *line; char *line;
char *filename; const struct floc *flocp;
unsigned int lineno;
{ {
int notdef; int notdef;
char *cmdname; char *cmdname;
@ -1165,17 +1166,16 @@ conditional_line (line, filename, lineno)
if (*cmdname == 'e') if (*cmdname == 'e')
{ {
if (*line != '\0') if (*line != '\0')
makefile_error (filename, lineno, error (flocp,
"Extraneous text after `%s' directive", "Extraneous text after `%s' directive", cmdname);
cmdname);
/* "Else" or "endif". */ /* "Else" or "endif". */
if (conditionals->if_cmds == 0) if (conditionals->if_cmds == 0)
makefile_fatal (filename, lineno, "extraneous `%s'", cmdname); fatal (flocp, "extraneous `%s'", cmdname);
/* NOTDEF indicates an `endif' command. */ /* NOTDEF indicates an `endif' command. */
if (notdef) if (notdef)
--conditionals->if_cmds; --conditionals->if_cmds;
else if (conditionals->seen_else[conditionals->if_cmds - 1]) else if (conditionals->seen_else[conditionals->if_cmds - 1])
makefile_fatal (filename, lineno, "only one `else' per conditional"); fatal (flocp, "only one `else' per conditional");
else else
{ {
/* Toggle the state of ignorance. */ /* Toggle the state of ignorance. */
@ -1321,9 +1321,8 @@ conditional_line (line, filename, lineno)
*line = '\0'; *line = '\0';
line = next_token (++line); line = next_token (++line);
if (*line != '\0') if (*line != '\0')
makefile_error (filename, lineno, error (flocp,
"Extraneous text after `%s' directive", "Extraneous text after `%s' directive", cmdname);
cmdname);
s2 = variable_expand (s2); s2 = variable_expand (s2);
conditionals->ignoring[conditionals->if_cmds - 1] conditionals->ignoring[conditionals->if_cmds - 1]
@ -1384,13 +1383,12 @@ uniquize_deps (chain)
variable value list. */ variable value list. */
static void static void
record_target_var (filenames, defn, two_colon, origin, filename, lineno) record_target_var (filenames, defn, two_colon, origin, flocp)
struct nameseq *filenames; struct nameseq *filenames;
char *defn; char *defn;
int two_colon; int two_colon;
enum variable_origin origin; enum variable_origin origin;
char *filename; const struct floc *flocp;
unsigned int lineno;
{ {
struct nameseq *nextf; struct nameseq *nextf;
struct variable_set_list *global; struct variable_set_list *global;
@ -1433,10 +1431,9 @@ record_target_var (filenames, defn, two_colon, origin, filename, lineno)
/* Make the new variable context current and define the variable. */ /* Make the new variable context current and define the variable. */
current_variable_set_list = vlist; current_variable_set_list = vlist;
v = try_variable_definition(filename, lineno, defn, origin); v = try_variable_definition(flocp, defn, origin);
if (!v) if (!v)
makefile_error(filename, lineno, error (flocp, "Malformed per-target variable definition");
"Malformed per-target variable definition");
v->per_target = 1; v->per_target = 1;
/* If it's not an override, check to see if there was a command-line /* If it's not an override, check to see if there was a command-line
@ -1474,7 +1471,7 @@ record_target_var (filenames, defn, two_colon, origin, filename, lineno)
static void static void
record_files (filenames, pattern, pattern_percent, deps, cmds_started, record_files (filenames, pattern, pattern_percent, deps, cmds_started,
commands, commands_idx, two_colon, filename, lineno, set_default) commands, commands_idx, two_colon, flocp, set_default)
struct nameseq *filenames; struct nameseq *filenames;
char *pattern, *pattern_percent; char *pattern, *pattern_percent;
struct dep *deps; struct dep *deps;
@ -1482,8 +1479,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
char *commands; char *commands;
unsigned int commands_idx; unsigned int commands_idx;
int two_colon; int two_colon;
char *filename; const struct floc *flocp;
unsigned int lineno;
int set_default; int set_default;
{ {
struct nameseq *nextf; struct nameseq *nextf;
@ -1495,8 +1491,8 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
if (commands_idx > 0) if (commands_idx > 0)
{ {
cmds = (struct commands *) xmalloc (sizeof (struct commands)); cmds = (struct commands *) xmalloc (sizeof (struct commands));
cmds->filename = filename; cmds->fileinfo.filenm = flocp->filenm;
cmds->lineno = cmds_started; cmds->fileinfo.lineno = cmds_started;
cmds->commands = savestring (commands, commands_idx); cmds->commands = savestring (commands, commands_idx);
cmds->command_lines = 0; cmds->command_lines = 0;
} }
@ -1519,11 +1515,10 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
implicit |= implicit_percent != 0; implicit |= implicit_percent != 0;
if (implicit && pattern != 0) if (implicit && pattern != 0)
makefile_fatal (filename, lineno, fatal (flocp, "mixed implicit and static pattern rules");
"mixed implicit and static pattern rules");
if (implicit && implicit_percent == 0) if (implicit && implicit_percent == 0)
makefile_fatal (filename, lineno, "mixed implicit and normal rules"); fatal (flocp, "mixed implicit and normal rules");
if (implicit) if (implicit)
{ {
@ -1562,7 +1557,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
if (!pattern_matches (pattern, pattern_percent, name)) if (!pattern_matches (pattern, pattern_percent, name))
{ {
/* Give a warning if the rule is meaningless. */ /* Give a warning if the rule is meaningless. */
makefile_error (filename, lineno, error (flocp,
"target `%s' doesn't match the target pattern", "target `%s' doesn't match the target pattern",
name); name);
this = 0; this = 0;
@ -1594,15 +1589,15 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
f = enter_file (name); f = enter_file (name);
if (f->double_colon) if (f->double_colon)
makefile_fatal (filename, lineno, fatal (flocp,
"target file `%s' has both : and :: entries", "target file `%s' has both : and :: entries",
f->name); f->name);
/* If CMDS == F->CMDS, this target was listed in this rule /* If CMDS == F->CMDS, this target was listed in this rule
more than once. Just give a warning since this is harmless. */ more than once. Just give a warning since this is harmless. */
if (cmds != 0 && cmds == f->cmds) if (cmds != 0 && cmds == f->cmds)
makefile_error error
(filename, lineno, (flocp,
"target `%s' given more than once in the same rule.", "target `%s' given more than once in the same rule.",
f->name); f->name);
@ -1611,10 +1606,10 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
whose commands were preinitialized. */ whose commands were preinitialized. */
else if (cmds != 0 && f->cmds != 0 && f->is_target) else if (cmds != 0 && f->cmds != 0 && f->is_target)
{ {
makefile_error (cmds->filename, cmds->lineno, error (&cmds->fileinfo,
"warning: overriding commands for target `%s'", "warning: overriding commands for target `%s'",
f->name); f->name);
makefile_error (f->cmds->filename, f->cmds->lineno, error (&f->cmds->fileinfo,
"warning: ignoring old commands for target `%s'", "warning: ignoring old commands for target `%s'",
f->name); f->name);
} }
@ -1696,7 +1691,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
/* Check for both : and :: rules. Check is_target so /* Check for both : and :: rules. Check is_target so
we don't lose on default suffix rules or makefiles. */ we don't lose on default suffix rules or makefiles. */
if (f != 0 && f->is_target && !f->double_colon) if (f != 0 && f->is_target && !f->double_colon)
makefile_fatal (filename, lineno, fatal (flocp,
"target file `%s' has both : and :: entries", "target file `%s' has both : and :: entries",
f->name); f->name);
f = enter_file (name); f = enter_file (name);
@ -2089,12 +2084,11 @@ parse_file_seq (stringp, stopchar, size, strip)
Return the number of actual lines read (> 1 if hacked continuation lines). Return the number of actual lines read (> 1 if hacked continuation lines).
*/ */
static unsigned int static unsigned long
readline (linebuffer, stream, filename, lineno) readline (linebuffer, stream, flocp)
struct linebuffer *linebuffer; struct linebuffer *linebuffer;
FILE *stream; FILE *stream;
char *filename; const struct floc *flocp;
unsigned int lineno;
{ {
char *buffer = linebuffer->buffer; char *buffer = linebuffer->buffer;
register char *p = linebuffer->buffer; register char *p = linebuffer->buffer;
@ -2116,8 +2110,7 @@ readline (linebuffer, stream, filename, lineno)
lossage strikes again! (xmkmf puts NULs in its makefiles.) lossage strikes again! (xmkmf puts NULs in its makefiles.)
There is nothing really to be done; we synthesize a newline so There is nothing really to be done; we synthesize a newline so
the following line doesn't appear to be part of this line. */ the following line doesn't appear to be part of this line. */
makefile_error (filename, lineno, error (flocp, "warning: NUL character seen; rest of line ignored");
"warning: NUL character seen; rest of line ignored");
p[0] = '\n'; p[0] = '\n';
len = 1; len = 1;
} }
@ -2177,7 +2170,7 @@ readline (linebuffer, stream, filename, lineno)
} }
if (ferror (stream)) if (ferror (stream))
pfatal_with_name (filename); pfatal_with_name (flocp->filenm);
return nlines; return nlines;
} }
@ -2296,8 +2289,12 @@ get_next_mword (buffer, delim, startp, length)
case ':': case ':':
#if defined(__MSDOS__) || defined(WINDOWS32) #if defined(__MSDOS__) || defined(WINDOWS32)
/* A word CAN include a colon in its drive spec. */ /* A word CAN include a colon in its drive spec. The drive
if (!(p - beg == 2 && (*p == '/' || *p == '\\') && isalpha (*beg))) spec is allowed either at the beginning of a word, or as part
of the archive member name, like in "libfoo.a(d:/foo/bar.o)". */
if (!(p - beg >= 2 &&
(*p == '/' || *p == '\\') && isalpha (p[-2]) &&
(p - beg == 2 || p[-3] == '(')))
#endif #endif
goto done_word; goto done_word;
@ -2657,7 +2654,7 @@ multi_glob (chain, size)
} }
case GLOB_NOSPACE: case GLOB_NOSPACE:
fatal ("virtual memory exhausted"); fatal (NILF, "virtual memory exhausted");
break; break;
default: default:

View File

@ -48,13 +48,11 @@ unsigned int commands_started = 0;
static int update_file PARAMS ((struct file *file, unsigned int depth)); static int update_file PARAMS ((struct file *file, unsigned int depth));
static int update_file_1 PARAMS ((struct file *file, unsigned int depth)); static int update_file_1 PARAMS ((struct file *file, unsigned int depth));
static int check_dep PARAMS ((struct file *file, unsigned int depth, time_t this_mtime, int *must_make_ptr)); static int check_dep PARAMS ((struct file *file, unsigned int depth, FILE_TIMESTAMP this_mtime, int *must_make_ptr));
static int touch_file PARAMS ((struct file *file)); static int touch_file PARAMS ((struct file *file));
static void remake_file PARAMS ((struct file *file)); static void remake_file PARAMS ((struct file *file));
static time_t name_mtime PARAMS ((char *name)); static FILE_TIMESTAMP name_mtime PARAMS ((char *name));
static int library_search PARAMS ((char **lib, time_t *mtime_ptr)); static int library_search PARAMS ((char **lib, FILE_TIMESTAMP *mtime_ptr));
extern time_t f_mtime PARAMS ((struct file *file, int search));
/* Remake all the goals in the `struct dep' chain GOALS. Return -1 if nothing /* Remake all the goals in the `struct dep' chain GOALS. Return -1 if nothing
@ -128,7 +126,7 @@ update_goal_chain (goals, makefiles)
{ {
unsigned int ocommands_started; unsigned int ocommands_started;
int x; int x;
time_t mtime = MTIME (file); FILE_TIMESTAMP mtime = MTIME (file);
check_renamed (file); check_renamed (file);
if (makefiles) if (makefiles)
{ {
@ -268,9 +266,9 @@ no_rule_error(file)
if (!file->dontcare) if (!file->dontcare)
{ {
if (file->parent == 0) if (file->parent == 0)
error (msg_noparent, "*** ", file->name, "."); error (NILF, msg_noparent, "*** ", file->name, ".");
else else
error (msg_parent, "*** ", error (NILF, msg_parent, "*** ",
file->name, file->parent->name, "."); file->name, file->parent->name, ".");
file->shownerror = 1; file->shownerror = 1;
} }
@ -279,9 +277,9 @@ no_rule_error(file)
else else
{ {
if (file->parent == 0) if (file->parent == 0)
fatal (msg_noparent, "", file->name, ""); fatal (NILF, msg_noparent, "", file->name, "");
else else
fatal (msg_parent, "", file->name, file->parent->name, ""); fatal (NILF, msg_parent, "", file->name, file->parent->name, "");
} }
} }
@ -341,7 +339,7 @@ update_file_1 (file, depth)
struct file *file; struct file *file;
unsigned int depth; unsigned int depth;
{ {
register time_t this_mtime; register FILE_TIMESTAMP this_mtime;
int noexist, must_make, deps_changed; int noexist, must_make, deps_changed;
int dep_status = 0; int dep_status = 0;
register struct dep *d, *lastd; register struct dep *d, *lastd;
@ -396,7 +394,7 @@ update_file_1 (file, depth)
this_mtime = file_mtime (file); this_mtime = file_mtime (file);
check_renamed (file); check_renamed (file);
noexist = this_mtime == (time_t) -1; noexist = this_mtime == (FILE_TIMESTAMP) -1;
if (noexist) if (noexist)
DEBUGPR ("File `%s' does not exist.\n"); DEBUGPR ("File `%s' does not exist.\n");
@ -427,7 +425,7 @@ update_file_1 (file, depth)
d = file->deps; d = file->deps;
while (d != 0) while (d != 0)
{ {
time_t mtime; FILE_TIMESTAMP mtime;
check_renamed (d->file); check_renamed (d->file);
@ -436,7 +434,7 @@ update_file_1 (file, depth)
if (d->file->updating) if (d->file->updating)
{ {
error ("Circular %s <- %s dependency dropped.", error (NILF, "Circular %s <- %s dependency dropped.",
file->name, d->file->name); file->name, d->file->name);
/* We cannot free D here because our the caller will still have /* We cannot free D here because our the caller will still have
a reference to it when we were called recursively via a reference to it when we were called recursively via
@ -484,7 +482,7 @@ update_file_1 (file, depth)
for (d = file->deps; d != 0; d = d->next) for (d = file->deps; d != 0; d = d->next)
if (d->file->intermediate) if (d->file->intermediate)
{ {
time_t mtime = file_mtime (d->file); FILE_TIMESTAMP mtime = file_mtime (d->file);
check_renamed (d->file); check_renamed (d->file);
d->file->parent = file; d->file->parent = file;
dep_status |= update_file (d->file, depth); dep_status |= update_file (d->file, depth);
@ -537,7 +535,7 @@ update_file_1 (file, depth)
if (depth == 0 && keep_going_flag if (depth == 0 && keep_going_flag
&& !just_print_flag && !question_flag) && !just_print_flag && !question_flag)
error ("Target `%s' not remade because of errors.", file->name); error (NILF, "Target `%s' not remade because of errors.", file->name);
return dep_status; return dep_status;
} }
@ -559,13 +557,13 @@ update_file_1 (file, depth)
deps_changed = 0; deps_changed = 0;
for (d = file->deps; d != 0; d = d->next) for (d = file->deps; d != 0; d = d->next)
{ {
time_t d_mtime = file_mtime (d->file); FILE_TIMESTAMP d_mtime = file_mtime (d->file);
check_renamed (d->file); check_renamed (d->file);
#if 1 /* %%% In version 4, remove this code completely to #if 1 /* %%% In version 4, remove this code completely to
implement not remaking deps if their deps are newer implement not remaking deps if their deps are newer
than their parents. */ than their parents. */
if (d_mtime == (time_t) -1 && !d->file->intermediate) if (d_mtime == (FILE_TIMESTAMP) -1 && !d->file->intermediate)
/* We must remake if this dep does not /* We must remake if this dep does not
exist and is not intermediate. */ exist and is not intermediate. */
must_make = 1; must_make = 1;
@ -581,7 +579,7 @@ update_file_1 (file, depth)
if (debug_flag && !noexist) if (debug_flag && !noexist)
{ {
print_spaces (depth); print_spaces (depth);
if (d_mtime == (time_t) -1) if (d_mtime == (FILE_TIMESTAMP) -1)
printf ("Dependency `%s' does not exist.\n", dep_name (d)); printf ("Dependency `%s' does not exist.\n", dep_name (d));
else else
printf ("Dependency `%s' is %s than dependent `%s'.\n", printf ("Dependency `%s' is %s than dependent `%s'.\n",
@ -771,7 +769,7 @@ static int
check_dep (file, depth, this_mtime, must_make_ptr) check_dep (file, depth, this_mtime, must_make_ptr)
struct file *file; struct file *file;
unsigned int depth; unsigned int depth;
time_t this_mtime; FILE_TIMESTAMP this_mtime;
int *must_make_ptr; int *must_make_ptr;
{ {
register struct dep *d; register struct dep *d;
@ -784,21 +782,20 @@ check_dep (file, depth, this_mtime, must_make_ptr)
/* If this is a non-intermediate file, update it and record /* If this is a non-intermediate file, update it and record
whether it is newer than THIS_MTIME. */ whether it is newer than THIS_MTIME. */
{ {
time_t mtime; FILE_TIMESTAMP mtime;
dep_status = update_file (file, depth); dep_status = update_file (file, depth);
check_renamed (file); check_renamed (file);
mtime = file_mtime (file); mtime = file_mtime (file);
check_renamed (file); check_renamed (file);
if (mtime == (time_t) -1 || mtime > this_mtime) if (mtime == (FILE_TIMESTAMP) -1 || mtime > this_mtime)
*must_make_ptr = 1; *must_make_ptr = 1;
} }
else else
{ {
/* FILE is an intermediate file. */ /* FILE is an intermediate file. */
time_t mtime; FILE_TIMESTAMP mtime;
if (!file->phony && file->cmds == 0 && !file->tried_implicit if (!file->phony && file->cmds == 0 && !file->tried_implicit)
&& file->secondary)
{ {
if (try_implicit_rule (file, depth)) if (try_implicit_rule (file, depth))
DEBUGPR ("Found an implicit rule for `%s'.\n"); DEBUGPR ("Found an implicit rule for `%s'.\n");
@ -806,7 +803,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
DEBUGPR ("No implicit rule found for `%s'.\n"); DEBUGPR ("No implicit rule found for `%s'.\n");
file->tried_implicit = 1; file->tried_implicit = 1;
} }
if (file->cmds == 0 && !file->is_target && file->secondary if (file->cmds == 0 && !file->is_target
&& default_file != 0 && default_file->cmds != 0) && default_file != 0 && default_file->cmds != 0)
{ {
DEBUGPR ("Using default commands for `%s'.\n"); DEBUGPR ("Using default commands for `%s'.\n");
@ -818,7 +815,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
check_renamed (file); check_renamed (file);
mtime = file_mtime (file); mtime = file_mtime (file);
check_renamed (file); check_renamed (file);
if (mtime != (time_t) -1 && mtime > this_mtime) if (mtime != (FILE_TIMESTAMP) -1 && mtime > this_mtime)
*must_make_ptr = 1; *must_make_ptr = 1;
/* Otherwise, update all non-intermediate files we depend on, /* Otherwise, update all non-intermediate files we depend on,
if necessary, and see whether any of them is more if necessary, and see whether any of them is more
@ -833,7 +830,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
{ {
if (d->file->updating) if (d->file->updating)
{ {
error ("Circular %s <- %s dependency dropped.", error (NILF, "Circular %s <- %s dependency dropped.",
file->name, d->file->name); file->name, d->file->name);
if (lastd == 0) if (lastd == 0)
{ {
@ -858,7 +855,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
if (d->file->command_state == cs_running if (d->file->command_state == cs_running
|| d->file->command_state == cs_deps_running) || d->file->command_state == cs_deps_running)
/* Record that some of FILE's dependencies are still being made. /* Record that some of FILE's deps are still being made.
This tells the upper levels to wait on processing it until This tells the upper levels to wait on processing it until
the commands are finished. */ the commands are finished. */
set_command_state (file, cs_deps_running); set_command_state (file, cs_deps_running);
@ -978,12 +975,12 @@ remake_file (file)
the library's actual name (/lib/libLIBNAME.a, etc.) is substituted into the library's actual name (/lib/libLIBNAME.a, etc.) is substituted into
FILE. */ FILE. */
time_t FILE_TIMESTAMP
f_mtime (file, search) f_mtime (file, search)
register struct file *file; register struct file *file;
int search; int search;
{ {
time_t mtime; FILE_TIMESTAMP mtime;
/* File's mtime is not known; must get it from the system. */ /* File's mtime is not known; must get it from the system. */
@ -1049,9 +1046,9 @@ f_mtime (file, search)
free (arname); free (arname);
free (memname); free (memname);
if (mtime == (time_t) -1) if (mtime == (FILE_TIMESTAMP) -1)
/* The archive doesn't exist, so it's members don't exist either. */ /* The archive doesn't exist, so it's members don't exist either. */
return (time_t) -1; return (FILE_TIMESTAMP) -1;
mtime = ar_member_date (file->hname); mtime = ar_member_date (file->hname);
} }
@ -1060,7 +1057,7 @@ f_mtime (file, search)
{ {
mtime = name_mtime (file->name); mtime = name_mtime (file->name);
if (mtime == (time_t) -1 && search && !file->ignore_vpath) if (mtime == (FILE_TIMESTAMP) -1 && search && !file->ignore_vpath)
{ {
/* If name_mtime failed, search VPATH. */ /* If name_mtime failed, search VPATH. */
char *name = file->name; char *name = file->name;
@ -1098,16 +1095,15 @@ f_mtime (file, search)
We only need to do this once, for now. */ We only need to do this once, for now. */
static time_t now = 0; static FILE_TIMESTAMP now = 0;
if (!clock_skew_detected if (!clock_skew_detected
&& mtime != (time_t)-1 && mtime > now && mtime != (FILE_TIMESTAMP)-1 && mtime > now
&& !file->updated) && !file->updated)
{ {
/* This file's time appears to be in the future. /* This file's time appears to be in the future.
Update our concept of the present, and compare again. */ Update our concept of the present, and compare again. */
extern time_t time (); now = file_timestamp_now ();
time (&now);
#ifdef WINDOWS32 #ifdef WINDOWS32
/* /*
@ -1126,8 +1122,13 @@ f_mtime (file, search)
#endif #endif
#endif #endif
{ {
error("*** Warning: File `%s' has modification time in the future (%ld > %ld)", char mtimebuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
file->name, mtime, now); char nowbuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
file_timestamp_sprintf (mtimebuf, mtime);
file_timestamp_sprintf (nowbuf, now);
error (NILF, "*** Warning: File `%s' has modification time in the future (%s > %s)",
file->name, mtimebuf, nowbuf);
clock_skew_detected = 1; clock_skew_detected = 1;
} }
} }
@ -1148,16 +1149,16 @@ f_mtime (file, search)
/* Return the mtime of the file or archive-member reference NAME. */ /* Return the mtime of the file or archive-member reference NAME. */
static time_t static FILE_TIMESTAMP
name_mtime (name) name_mtime (name)
register char *name; register char *name;
{ {
struct stat st; struct stat st;
if (stat (name, &st) < 0) if (stat (name, &st) < 0)
return (time_t) -1; return (FILE_TIMESTAMP) -1;
return (time_t) st.st_mtime; return FILE_TIMESTAMP_STAT_MODTIME (st);
} }
@ -1168,7 +1169,7 @@ name_mtime (name)
static int static int
library_search (lib, mtime_ptr) library_search (lib, mtime_ptr)
char **lib; char **lib;
time_t *mtime_ptr; FILE_TIMESTAMP *mtime_ptr;
{ {
static char *dirs[] = static char *dirs[] =
{ {
@ -1188,7 +1189,7 @@ library_search (lib, mtime_ptr)
}; };
char *libname = &(*lib)[2]; /* Name without the `-l'. */ char *libname = &(*lib)[2]; /* Name without the `-l'. */
time_t mtime; FILE_TIMESTAMP mtime;
/* Buffer to construct possible names in. */ /* Buffer to construct possible names in. */
char *buf = xmalloc (sizeof (LIBDIR) + 8 + strlen (libname) + 4 + 2 + 1); char *buf = xmalloc (sizeof (LIBDIR) + 8 + strlen (libname) + 4 + 2 + 1);
@ -1202,7 +1203,7 @@ library_search (lib, mtime_ptr)
sprintf (buf, "%s.lib", libname); sprintf (buf, "%s.lib", libname);
#endif #endif
mtime = name_mtime (buf); mtime = name_mtime (buf);
if (mtime != (time_t) -1) if (mtime != (FILE_TIMESTAMP) -1)
{ {
*lib = buf; *lib = buf;
if (mtime_ptr != 0) if (mtime_ptr != 0)
@ -1235,7 +1236,7 @@ library_search (lib, mtime_ptr)
buf = (char *) xrealloc (djdir_len + 1); buf = (char *) xrealloc (djdir_len + 1);
sprintf (buf, "%s/lib/lib%s.a", djdir->value, libname); sprintf (buf, "%s/lib/lib%s.a", djdir->value, libname);
mtime = name_mtime (buf); mtime = name_mtime (buf);
if (mtime != (time_t) -1) if (mtime != (FILE_TIMESTAMP) -1)
{ {
*lib = buf; *lib = buf;
if (mtime_ptr != 0) if (mtime_ptr != 0)
@ -1254,7 +1255,7 @@ library_search (lib, mtime_ptr)
sprintf (buf, "%s/%s.lib", *dp, libname); sprintf (buf, "%s/%s.lib", *dp, libname);
#endif #endif
mtime = name_mtime (buf); mtime = name_mtime (buf);
if (mtime != (time_t) -1) if (mtime != (FILE_TIMESTAMP) -1)
{ {
*lib = buf; *lib = buf;
if (mtime_ptr != 0) if (mtime_ptr != 0)

View File

@ -157,7 +157,7 @@ start_remote_job (argv, envp, stdin_fd, is_remote, id_ptr, used_stdin)
retsock = Rpc_UdpCreate (True, 0); retsock = Rpc_UdpCreate (True, 0);
if (retsock < 0) if (retsock < 0)
{ {
error ("exporting: Couldn't create return socket."); error (NILF, "exporting: Couldn't create return socket.");
return 1; return 1;
} }
@ -202,7 +202,7 @@ start_remote_job (argv, envp, stdin_fd, is_remote, id_ptr, used_stdin)
{ {
(void) close (retsock); (void) close (retsock);
(void) close (sock); (void) close (sock);
error ("exporting to %s: %s", error (NILF, "exporting to %s: %s",
host ? host->h_name : inet_ntoa (permit.addr), host ? host->h_name : inet_ntoa (permit.addr),
Rpc_ErrorMessage (status)); Rpc_ErrorMessage (status));
return 1; return 1;
@ -211,14 +211,14 @@ start_remote_job (argv, envp, stdin_fd, is_remote, id_ptr, used_stdin)
{ {
(void) close (retsock); (void) close (retsock);
(void) close (sock); (void) close (sock);
error ("exporting to %s: %s", error (NILF, "exporting to %s: %s",
host ? host->h_name : inet_ntoa (permit.addr), host ? host->h_name : inet_ntoa (permit.addr),
msg); msg);
return 1; return 1;
} }
else else
{ {
error ("*** exported to %s (id %u)", error (NILF, "*** exported to %s (id %u)",
host ? host->h_name : inet_ntoa (permit.addr), host ? host->h_name : inet_ntoa (permit.addr),
permit.id); permit.id);
} }

6
rule.c
View File

@ -416,8 +416,8 @@ install_pattern_rule (p, terminal)
{ {
r->terminal = terminal; r->terminal = terminal;
r->cmds = (struct commands *) xmalloc (sizeof (struct commands)); r->cmds = (struct commands *) xmalloc (sizeof (struct commands));
r->cmds->filename = 0; r->cmds->fileinfo.filenm = 0;
r->cmds->lineno = 0; r->cmds->fileinfo.lineno = 0;
/* These will all be string literals, but we malloc space for them /* These will all be string literals, but we malloc space for them
anyway because somebody might want to free them later. */ anyway because somebody might want to free them later. */
r->cmds->commands = savestring (p->commands, strlen (p->commands)); r->cmds->commands = savestring (p->commands, strlen (p->commands));
@ -664,7 +664,7 @@ print_rule_data_base ()
} }
if (num_pattern_rules != rules) if (num_pattern_rules != rules)
fatal ("BUG: num_pattern_rules wrong! %u != %u", fatal (NILF, "BUG: num_pattern_rules wrong! %u != %u",
num_pattern_rules, rules); num_pattern_rules, rules);
puts ("\n# Pattern-specific variable values"); puts ("\n# Pattern-specific variable values");

7
rule.h
View File

@ -62,3 +62,10 @@ extern void install_pattern_rule PARAMS ((struct pspec *p, int terminal));
extern int new_pattern_rule PARAMS ((struct rule *rule, int override)); extern int new_pattern_rule PARAMS ((struct rule *rule, int override));
extern struct pattern_var *create_pattern_var PARAMS ((char *target, char *suffix)); extern struct pattern_var *create_pattern_var PARAMS ((char *target, char *suffix));
extern struct pattern_var *lookup_pattern_var PARAMS ((char *target)); extern struct pattern_var *lookup_pattern_var PARAMS ((char *target));
extern void count_implicit_rule_limits PARAMS ((void));
extern void convert_to_pattern PARAMS ((void));
extern void create_pattern_rule PARAMS ((char **targets,
char **target_percents, int terminal,
struct dep *deps,
struct commands *commands,
int override));

View File

@ -676,9 +676,8 @@ target_environment (file)
returned. */ returned. */
struct variable * struct variable *
try_variable_definition (filename, lineno, line, origin) try_variable_definition (flocp, line, origin)
char *filename; const struct floc *flocp;
unsigned int lineno;
char *line; char *line;
enum variable_origin origin; enum variable_origin origin;
{ {
@ -766,7 +765,7 @@ try_variable_definition (filename, lineno, line, origin)
expanded_name = allocated_variable_expand (name); expanded_name = allocated_variable_expand (name);
if (expanded_name[0] == '\0') if (expanded_name[0] == '\0')
makefile_fatal (filename, lineno, "empty variable name"); fatal (flocp, "empty variable name");
/* Calculate the variable's new value in VALUE. */ /* Calculate the variable's new value in VALUE. */

View File

@ -102,7 +102,7 @@ extern void initialize_file_variables PARAMS ((struct file *file));
extern void print_file_variables PARAMS ((struct file *file)); extern void print_file_variables PARAMS ((struct file *file));
extern void print_variable_set PARAMS ((struct variable_set *set, char *prefix)); extern void print_variable_set PARAMS ((struct variable_set *set, char *prefix));
extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1)); extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
extern struct variable *try_variable_definition PARAMS ((char *filename, unsigned int lineno, char *line, enum variable_origin origin)); extern struct variable *try_variable_definition PARAMS ((const struct floc *flocp, char *line, enum variable_origin origin));
extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length)); extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length));
extern struct variable *define_variable PARAMS ((char *name, unsigned int length, char *value, extern struct variable *define_variable PARAMS ((char *name, unsigned int length, char *value,

10
vpath.c
View File

@ -48,7 +48,7 @@ static struct vpath *general_vpath;
static struct vpath *gpaths; static struct vpath *gpaths;
static int selective_vpath_search PARAMS ((struct vpath *path, char **file, time_t *mtime_ptr)); static int selective_vpath_search PARAMS ((struct vpath *path, char **file, FILE_TIMESTAMP *mtime_ptr));
/* Reverse the chain of selective VPATH lists so they /* Reverse the chain of selective VPATH lists so they
will be searched in the order given in the makefiles will be searched in the order given in the makefiles
@ -338,7 +338,7 @@ gpath_search (file, len)
int int
vpath_search (file, mtime_ptr) vpath_search (file, mtime_ptr)
char **file; char **file;
time_t *mtime_ptr; FILE_TIMESTAMP *mtime_ptr;
{ {
register struct vpath *v; register struct vpath *v;
@ -376,7 +376,7 @@ static int
selective_vpath_search (path, file, mtime_ptr) selective_vpath_search (path, file, mtime_ptr)
struct vpath *path; struct vpath *path;
char **file; char **file;
time_t *mtime_ptr; FILE_TIMESTAMP *mtime_ptr;
{ {
int not_target; int not_target;
char *name, *n; char *name, *n;
@ -524,7 +524,9 @@ selective_vpath_search (path, file, mtime_ptr)
/* Store the modtime into *MTIME_PTR for the caller. /* Store the modtime into *MTIME_PTR for the caller.
If we have had no need to stat the file here, If we have had no need to stat the file here,
we record a zero modtime to indicate this. */ we record a zero modtime to indicate this. */
*mtime_ptr = exists_in_cache ? st.st_mtime : (time_t) 0; *mtime_ptr = (exists_in_cache
? FILE_TIMESTAMP_STAT_MODTIME (st)
: (FILE_TIMESTAMP) 0);
free (name); free (name);
return 1; return 1;

View File

@ -1,60 +1,60 @@
# NOTE: If you have no `make' program at all to process this makefile, run # NOTE: If you have no `make' program at all to process this makefile, run
# `build.bat' instead. # `build.bat' instead.
# #
# Copyright (C) 1988,89,91,92,93,94,95,96,97 Free Software Foundation, Inc # Copyright (C) 1988,89,91,92,93,94,95,96,97 Free Software Foundation, Inc
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option) # the Free Software Foundation; either version 2, or (at your option)
# any later version. # any later version.
# #
# GNU Make is distributed in the hope that it will be useful, # GNU Make is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNU Make; see the file COPYING. If not, write to # along with GNU Make; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# NMakefile for GNU Make (subproc library) # NMakefile for GNU Make (subproc library)
# #
LIB = lib LIB = lib
CC = cl CC = cl
OUTDIR=. OUTDIR=.
MAKEFILE=NMakefile MAKEFILE=NMakefile
CFLAGS_any = /nologo /MT /W3 /GX /Z7 /YX /D WIN32 /D WINDOWS32 /D _WINDOWS -I. -I../include -I../.. CFLAGS_any = /nologo /MT /W3 /GX /Z7 /YX /D WIN32 /D WINDOWS32 /D _WINDOWS -I. -I../include -I../../
CFLAGS_debug = $(CFLAGS_any) /Od /D _DEBUG /FR.\WinDebug\ /Fp.\WinDebug\subproc.pch /Fo.\WinDebug/ CFLAGS_debug = $(CFLAGS_any) /Od /D _DEBUG /FR.\WinDebug\ /Fp.\WinDebug\subproc.pch /Fo.\WinDebug/
CFLAGS_release = $(CFLAGS_any) /O2 /FR.\WinRel\ /Fp.\WinRel\subproc.pch /Fo.\WinRel/ CFLAGS_release = $(CFLAGS_any) /O2 /FR.\WinRel\ /Fp.\WinRel\subproc.pch /Fo.\WinRel/
all: Release Debug all: Release Debug
Release: Release:
$(MAKE) /f $(MAKEFILE) OUTDIR=WinRel CFLAGS="$(CFLAGS_release)" WinRel/subproc.lib $(MAKE) /f $(MAKEFILE) OUTDIR=WinRel CFLAGS="$(CFLAGS_release)" WinRel/subproc.lib
Debug: Debug:
$(MAKE) /f $(MAKEFILE) OUTDIR=WinDebug CFLAGS="$(CFLAGS_debug)" WinDebug/subproc.lib $(MAKE) /f $(MAKEFILE) OUTDIR=WinDebug CFLAGS="$(CFLAGS_debug)" WinDebug/subproc.lib
clean: clean:
rmdir /s /q WinRel WinDebug rmdir /s /q WinRel WinDebug
erase *.pdb erase *.pdb
$(OUTDIR): $(OUTDIR):
if not exist .\$@\nul mkdir .\$@ if not exist .\$@\nul mkdir .\$@
OBJS = $(OUTDIR)/misc.obj $(OUTDIR)/w32err.obj $(OUTDIR)/sub_proc.obj OBJS = $(OUTDIR)/misc.obj $(OUTDIR)/w32err.obj $(OUTDIR)/sub_proc.obj
$(OUTDIR)/subproc.lib: $(OUTDIR) $(OBJS) $(OUTDIR)/subproc.lib: $(OUTDIR) $(OBJS)
$(LIB) -out:$@ @<< $(LIB) -out:$@ @<<
$(OBJS) $(OBJS)
<< <<
.c{$(OUTDIR)}.obj: .c{$(OUTDIR)}.obj:
$(CC) $(CFLAGS) /c $< $(CC) $(CFLAGS) /c $<
$(OUTDIR)/misc.obj: misc.c proc.h $(OUTDIR)/misc.obj: misc.c proc.h
$(OUTDIR)/sub_proc.obj: sub_proc.c ../include/sub_proc.h ../include/w32err.h proc.h $(OUTDIR)/sub_proc.obj: sub_proc.c ../include/sub_proc.h ../include/w32err.h proc.h
$(OUTDIR)/w32err.obj: w32err.c ../include/w32err.h $(OUTDIR)/w32err.obj: w32err.c ../include/w32err.h

File diff suppressed because it is too large Load Diff