mirror of
https://github.com/mirror/make.git
synced 2025-01-29 05:40:52 +08:00
* Some timestamp fixes from Paul Eggert.
* Fix compilation on Linux; use libintl.h and not gettext.h when using the system gettext.
This commit is contained in:
parent
4a5550c822
commit
4972b017b6
56
ChangeLog
56
ChangeLog
@ -1,3 +1,59 @@
|
|||||||
|
2000-06-13 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* gettext.h: If we have libintl.h, use that instead of any of the
|
||||||
|
contents of gettext.h. We won't check for libintl.h unless we're
|
||||||
|
using the system gettext.
|
||||||
|
|
||||||
|
* function.c (func_word): Clarify error message.
|
||||||
|
|
||||||
|
2000-06-10 Paul Eggert <eggert@twinsun.com>
|
||||||
|
|
||||||
|
Support nanosecond resolution on hosts with 64-bit time_t and
|
||||||
|
uintmax_t (e.g. 64-bit Sparc Solaris), by splitting
|
||||||
|
FILE_TIMESTAMP into a 30-bit part for nanoseconds, with the
|
||||||
|
rest for seconds, if FILE_TIMESTAMP is at least 64 bits wide.
|
||||||
|
|
||||||
|
* make.h: Always define FILE_TIMESTAMP to be uintmax_t, for
|
||||||
|
simplicity.
|
||||||
|
|
||||||
|
* filedef.h (FILE_TIMESTAMP_HI_RES, FILE_TIMESTAMP_LO_BITS)
|
||||||
|
(UNKNOWN_MTIME, NONEXISTENT_MTIME, OLD_MTIME)
|
||||||
|
(ORDINARY_MTIME_MIN, ORDINARY_MTIME_MAX): New macros.
|
||||||
|
(FILE_TIMESTAMP_STAT_MODTIME): Now takes fname arg. All uses changed.
|
||||||
|
(FILE_TIMESTAMP_DIV, FILE_TIMESTAMP_MOD)
|
||||||
|
(FILE_TIMESTAMP_FROM_S_AND_NS): Remove.
|
||||||
|
(FILE_TIMESTAMP_S, FILE_TIMESTAMP_NS): Use shifts instead of
|
||||||
|
multiplication and division. Offset the timestamps by
|
||||||
|
ORDINARY_MTIME_MIN.
|
||||||
|
(file_timestamp_cons): New decl.
|
||||||
|
(NEW_MTIME): Now just the maximal timestamp value, as we no longer use
|
||||||
|
-1 to refer to nonexistent files.
|
||||||
|
|
||||||
|
* file.c (snap_deps, print_file): Use NONEXISTENT_MTIME,
|
||||||
|
UNKNOWN_MTIME, and OLD_MTIME instead of magic constants.
|
||||||
|
* filedef.h (file_mtime_1): Likewise.
|
||||||
|
* main.c (main): Likewise.
|
||||||
|
* remake.c (update_file_1, notice_finished_file, check_dep)
|
||||||
|
(f_mtime, name_mtime, library_search): Likewise.
|
||||||
|
* vpath.c (selective_vpath_search): Likewise.
|
||||||
|
|
||||||
|
* remake.c (f_mtime): Do not assume that (time_t) -1 equals
|
||||||
|
NONEXISTENT_MTIME. When futzing with time stamps, adjust by
|
||||||
|
multiples of 2**30, not 10**9. Do not calculate timestamp
|
||||||
|
adjustments on DOS unless they are needed.
|
||||||
|
|
||||||
|
* commands.c (delete_target): Do not assume that
|
||||||
|
FILE_TIMESTAMP_S yields -1 for a nonexistent file, as that is
|
||||||
|
no longer true with the new representation.
|
||||||
|
|
||||||
|
* file.c (file_timestamp_cons): New function, replacing
|
||||||
|
FILE_TIMESTAMP_FROM_S_AND_NS. All uses changed.
|
||||||
|
(file_timestamp_now): Use FILE_TIMESTAMP_HI_RES instead of 1 <
|
||||||
|
FILE_TIMESTAMPS_PER_S to determine whether we're using hi-res
|
||||||
|
timestamps.
|
||||||
|
(print_file): Print OLD_MTIME values as "very old" instead of
|
||||||
|
as a timestamp.
|
||||||
|
|
||||||
2000-05-31 Paul Eggert <eggert@twinsun.com>
|
2000-05-31 Paul Eggert <eggert@twinsun.com>
|
||||||
|
|
||||||
* remake.c (name_mtime): Check for stat failures. Retry if EINTR.
|
* remake.c (name_mtime): Check for stat failures. Retry if EINTR.
|
||||||
|
2
NEWS
2
NEWS
@ -46,7 +46,7 @@ Version 3.79
|
|||||||
all debugging information is generated.
|
all debugging information is generated.
|
||||||
|
|
||||||
* The `-p' (print database) output now includes filename and linenumber
|
* The `-p' (print database) output now includes filename and linenumber
|
||||||
information for variable definitions, to help debugging.
|
information for variable definitions, to aid debugging.
|
||||||
|
|
||||||
* The wordlist function no longer reverses its arguments if the "start"
|
* The wordlist function no longer reverses its arguments if the "start"
|
||||||
value is greater than the "end" value. If that's true, nothing is
|
value is greater than the "end" value. If that's true, nothing is
|
||||||
|
@ -7,21 +7,12 @@
|
|||||||
/* Define to 1 if NLS is requested. */
|
/* Define to 1 if NLS is requested. */
|
||||||
#undef ENABLE_NLS
|
#undef ENABLE_NLS
|
||||||
|
|
||||||
/* Define as 1 if you have dcgettext. */
|
|
||||||
#undef HAVE_DCGETTEXT
|
|
||||||
|
|
||||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
|
||||||
#undef HAVE_GETTEXT
|
|
||||||
|
|
||||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||||
#undef HAVE_LC_MESSAGES
|
#undef HAVE_LC_MESSAGES
|
||||||
|
|
||||||
/* Define to the installation directory for locales. */
|
/* Define to the installation directory for locales. */
|
||||||
#undef LOCALEDIR
|
#undef LOCALEDIR
|
||||||
|
|
||||||
/* Define as 1 if you have the stpcpy function. */
|
|
||||||
#undef HAVE_STPCPY
|
|
||||||
|
|
||||||
/* Define to the name of the SCCS `get' command. */
|
/* Define to the name of the SCCS `get' command. */
|
||||||
#undef SCCS_GET
|
#undef SCCS_GET
|
||||||
|
|
||||||
|
10
acinclude.m4
10
acinclude.m4
@ -486,6 +486,8 @@ esac
|
|||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl Enable internationalization support for GNU make.
|
dnl Enable internationalization support for GNU make.
|
||||||
dnl Obtained from the libit 0.7 distribution
|
dnl Obtained from the libit 0.7 distribution
|
||||||
|
dnl Modified to check for a system version of GNU gettext by
|
||||||
|
dnl Paul D. Smith <psmith@gnu.org>
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(fp_WITH_GETTEXT, [
|
AC_DEFUN(fp_WITH_GETTEXT, [
|
||||||
|
|
||||||
@ -509,7 +511,7 @@ AC_DEFUN(fp_WITH_GETTEXT, [
|
|||||||
|
|
||||||
# Look around for gettext() on the system
|
# Look around for gettext() on the system
|
||||||
AC_SEARCH_LIBS(gettext, intl)
|
AC_SEARCH_LIBS(gettext, intl)
|
||||||
if test $ac_cv_search_gettext = no; then
|
if test "$ac_cv_search_gettext" = no; then
|
||||||
with_included_gettext=yes
|
with_included_gettext=yes
|
||||||
else
|
else
|
||||||
# We only want to deal with GNU's gettext; if we don't have that
|
# We only want to deal with GNU's gettext; if we don't have that
|
||||||
@ -523,10 +525,10 @@ AC_DEFUN(fp_WITH_GETTEXT, [
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $with_included_gettext = yes; then
|
if test "$with_included_gettext" = yes; then
|
||||||
LIBOBJS="$LIBOBJS gettext.o"
|
LIBOBJS="$LIBOBJS gettext.o"
|
||||||
AC_DEFINE(HAVE_GETTEXT)
|
AC_DEFINE(HAVE_GETTEXT, 1, [Define if you have the gettext function.])
|
||||||
AC_DEFINE(HAVE_DCGETTEXT)
|
AC_DEFINE(HAVE_DCGETTEXT, 1, [Define if you have the dcgettext function.])
|
||||||
else
|
else
|
||||||
AC_CHECK_HEADERS(libintl.h)
|
AC_CHECK_HEADERS(libintl.h)
|
||||||
AC_CHECK_FUNCS(dcgettext gettext)
|
AC_CHECK_FUNCS(dcgettext gettext)
|
||||||
|
@ -477,7 +477,10 @@ 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_TIMESTAMP_S (file->last_mtime))
|
time_t file_date = (file->last_mtime == NONEXISTENT_MTIME
|
||||||
|
? (time_t) -1
|
||||||
|
: (time_t) FILE_TIMESTAMP_S (file->last_mtime));
|
||||||
|
if (ar_member_date (file->name) != file_date)
|
||||||
{
|
{
|
||||||
if (on_behalf_of)
|
if (on_behalf_of)
|
||||||
error (NILF, _("*** [%s] Archive member `%s' may be bogus; not deleted"),
|
error (NILF, _("*** [%s] Archive member `%s' may be bogus; not deleted"),
|
||||||
@ -492,7 +495,7 @@ 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)
|
||||||
&& FILE_TIMESTAMP_STAT_MODTIME (st) != file->last_mtime)
|
&& FILE_TIMESTAMP_STAT_MODTIME (file->name, st) != file->last_mtime)
|
||||||
{
|
{
|
||||||
if (on_behalf_of)
|
if (on_behalf_of)
|
||||||
error (NILF, _("*** [%s] Deleting file `%s'"), on_behalf_of, file->name);
|
error (NILF, _("*** [%s] Deleting file `%s'"), on_behalf_of, file->name);
|
||||||
|
60
file.c
60
file.c
@ -475,8 +475,8 @@ 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 = (FILE_TIMESTAMP) -1;
|
f2->last_mtime = NONEXISTENT_MTIME;
|
||||||
f2->mtime_before_update = (FILE_TIMESTAMP) -1;
|
f2->mtime_before_update = NONEXISTENT_MTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
|
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
|
||||||
@ -564,35 +564,73 @@ set_command_state (file, state)
|
|||||||
d->file->command_state = state;
|
d->file->command_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert an external file timestamp to internal form. */
|
||||||
|
|
||||||
|
FILE_TIMESTAMP
|
||||||
|
file_timestamp_cons (fname, s, ns)
|
||||||
|
char const *fname;
|
||||||
|
time_t s;
|
||||||
|
int ns;
|
||||||
|
{
|
||||||
|
int offset = ORDINARY_MTIME_MIN + (FILE_TIMESTAMP_HI_RES ? ns : 0);
|
||||||
|
FILE_TIMESTAMP product = (FILE_TIMESTAMP) s << FILE_TIMESTAMP_LO_BITS;
|
||||||
|
FILE_TIMESTAMP ts = product + offset;
|
||||||
|
|
||||||
|
if (! (s <= FILE_TIMESTAMP_S (ORDINARY_MTIME_MAX)
|
||||||
|
&& product <= ts && ts <= ORDINARY_MTIME_MAX))
|
||||||
|
{
|
||||||
|
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
||||||
|
ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX;
|
||||||
|
file_timestamp_sprintf (buf, ts);
|
||||||
|
error (NILF, _("%s: Timestamp out of range; substituting %s"),
|
||||||
|
fname ? fname : _("Current time"), buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get and print file timestamps. */
|
/* Get and print file timestamps. */
|
||||||
|
|
||||||
FILE_TIMESTAMP
|
FILE_TIMESTAMP
|
||||||
file_timestamp_now ()
|
file_timestamp_now ()
|
||||||
{
|
{
|
||||||
|
time_t s;
|
||||||
|
int ns;
|
||||||
|
|
||||||
/* Don't bother with high-resolution clocks if file timestamps have
|
/* Don't bother with high-resolution clocks if file timestamps have
|
||||||
only one-second resolution. The code below should work, but it's
|
only one-second resolution. The code below should work, but it's
|
||||||
not worth the hassle of debugging it on hosts where it fails. */
|
not worth the hassle of debugging it on hosts where it fails. */
|
||||||
if (1 < FILE_TIMESTAMPS_PER_S)
|
if (FILE_TIMESTAMP_HI_RES)
|
||||||
{
|
{
|
||||||
#if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
|
#if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
|
||||||
{
|
{
|
||||||
struct timespec timespec;
|
struct timespec timespec;
|
||||||
if (clock_gettime (CLOCK_REALTIME, ×pec) == 0)
|
if (clock_gettime (CLOCK_REALTIME, ×pec) == 0)
|
||||||
return FILE_TIMESTAMP_FROM_S_AND_NS (timespec.tv_sec,
|
{
|
||||||
timespec.tv_nsec);
|
s = timespec.tv_sec;
|
||||||
|
ns = timespec.tv_nsec;
|
||||||
|
goto got_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_GETTIMEOFDAY
|
#if HAVE_GETTIMEOFDAY
|
||||||
{
|
{
|
||||||
struct timeval timeval;
|
struct timeval timeval;
|
||||||
if (gettimeofday (&timeval, 0) == 0)
|
if (gettimeofday (&timeval, 0) == 0)
|
||||||
return FILE_TIMESTAMP_FROM_S_AND_NS (timeval.tv_sec,
|
{
|
||||||
timeval.tv_usec * 1000);
|
s = timeval.tv_sec;
|
||||||
|
ns = timeval.tv_usec * 1000;
|
||||||
|
goto got_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return FILE_TIMESTAMP_FROM_S_AND_NS (time ((time_t *) 0), 0);
|
s = time ((time_t *) 0);
|
||||||
|
ns = 0;
|
||||||
|
|
||||||
|
got_time:
|
||||||
|
return file_timestamp_cons (0, s, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -666,10 +704,12 @@ print_file (f)
|
|||||||
printf (" %s", dep_name (d));
|
printf (" %s", dep_name (d));
|
||||||
putchar ('\n');
|
putchar ('\n');
|
||||||
}
|
}
|
||||||
if (f->last_mtime == 0)
|
if (f->last_mtime == UNKNOWN_MTIME)
|
||||||
puts (_("# Modification time never checked."));
|
puts (_("# Modification time never checked."));
|
||||||
else if (f->last_mtime == (FILE_TIMESTAMP) -1)
|
else if (f->last_mtime == NONEXISTENT_MTIME)
|
||||||
puts (_("# File does not exist."));
|
puts (_("# File does not exist."));
|
||||||
|
else if (f->last_mtime == OLD_MTIME)
|
||||||
|
puts (_("# File is very old."));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
||||||
|
75
filedef.h
75
filedef.h
@ -118,28 +118,28 @@ extern void notice_finished_file PARAMS ((struct file *file));
|
|||||||
|
|
||||||
|
|
||||||
#ifdef ST_MTIM_NSEC
|
#ifdef ST_MTIM_NSEC
|
||||||
# define FILE_TIMESTAMP_STAT_MODTIME(st) \
|
# define FILE_TIMESTAMP_HI_RES \
|
||||||
FILE_TIMESTAMP_FROM_S_AND_NS ((st).st_mtime, \
|
(2147483647 < INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP) >> 31)
|
||||||
(st).st_mtim.ST_MTIM_NSEC)
|
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
|
||||||
# define FILE_TIMESTAMPS_PER_S \
|
file_timestamp_cons (fname, (st).st_mtime, (st).st_mtim.ST_MTIM_NSEC)
|
||||||
MIN ((FILE_TIMESTAMP) 1000000000, \
|
|
||||||
(INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP) \
|
|
||||||
/ INTEGER_TYPE_MAXIMUM (time_t)))
|
|
||||||
#else
|
#else
|
||||||
# define FILE_TIMESTAMP_STAT_MODTIME(st) ((st).st_mtime)
|
# define FILE_TIMESTAMP_HI_RES 0
|
||||||
# define FILE_TIMESTAMPS_PER_S 1
|
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
|
||||||
|
file_timestamp_cons (fname, (st).st_mtime, 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FILE_TIMESTAMP_FROM_S_AND_NS(s, ns) \
|
/* If FILE_TIMESTAMP is 64 bits (or more), use nanosecond resolution.
|
||||||
((s) * FILE_TIMESTAMPS_PER_S \
|
(Multiply by 2**30 instead of by 10**9 to save time at the cost of
|
||||||
+ (ns) * FILE_TIMESTAMPS_PER_S / 1000000000)
|
slightly decreasing the number of available timestamps.) With
|
||||||
#define FILE_TIMESTAMP_DIV(a, b) ((a)/(b) - ((a)%(b) < 0))
|
64-bit FILE_TIMESTAMP, this stops working on 2514-05-30 01:53:04
|
||||||
#define FILE_TIMESTAMP_MOD(a, b) ((a)%(b) + ((a)%(b) < 0) * (b))
|
UTC, but by then uintmax_t should be larger than 64 bits. */
|
||||||
#define FILE_TIMESTAMP_S(ts) FILE_TIMESTAMP_DIV ((ts), FILE_TIMESTAMPS_PER_S)
|
#define FILE_TIMESTAMPS_PER_S (FILE_TIMESTAMP_HI_RES ? 1000000000 : 1)
|
||||||
#define FILE_TIMESTAMP_NS(ts) \
|
#define FILE_TIMESTAMP_LO_BITS (FILE_TIMESTAMP_HI_RES ? 30 : 0)
|
||||||
(((FILE_TIMESTAMP_MOD ((ts), FILE_TIMESTAMPS_PER_S) * 1000000000) \
|
|
||||||
+ (FILE_TIMESTAMPS_PER_S - 1)) \
|
#define FILE_TIMESTAMP_S(ts) (((ts) - ORDINARY_MTIME_MIN) \
|
||||||
/ FILE_TIMESTAMPS_PER_S)
|
>> FILE_TIMESTAMP_LO_BITS)
|
||||||
|
#define FILE_TIMESTAMP_NS(ts) (((ts) - ORDINARY_MTIME_MIN) \
|
||||||
|
& ((1 << FILE_TIMESTAMP_LO_BITS) - 1))
|
||||||
|
|
||||||
/* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN"
|
/* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN"
|
||||||
representing a file timestamp. The upper bound is not necessarily 19,
|
representing a file timestamp. The upper bound is not necessarily 19,
|
||||||
@ -159,35 +159,48 @@ extern void notice_finished_file PARAMS ((struct file *file));
|
|||||||
* 302 / 1000) \
|
* 302 / 1000) \
|
||||||
+ 1 + 1 + 4 + 25)
|
+ 1 + 1 + 4 + 25)
|
||||||
|
|
||||||
|
extern FILE_TIMESTAMP file_timestamp_cons PARAMS ((char const *,
|
||||||
|
time_t, int));
|
||||||
extern FILE_TIMESTAMP file_timestamp_now PARAMS ((void));
|
extern FILE_TIMESTAMP file_timestamp_now PARAMS ((void));
|
||||||
extern void file_timestamp_sprintf PARAMS ((char *p, FILE_TIMESTAMP ts));
|
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 NONEXISTENT_MTIME if the file does not exist. */
|
||||||
#define file_mtime(f) file_mtime_1 ((f), 1)
|
#define file_mtime(f) file_mtime_1 ((f), 1)
|
||||||
/* Return the mtime of file F (a struct file *), caching it.
|
/* Return the mtime of file F (a struct file *), caching it.
|
||||||
Don't search using vpath for the file--if it doesn't actually exist,
|
Don't search using vpath for the file--if it doesn't actually exist,
|
||||||
we don't find it.
|
we don't find it.
|
||||||
The value is -1 if the file does not exist. */
|
The value is NONEXISTENT_MTIME 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 FILE_TIMESTAMP f_mtime PARAMS ((struct file *file, int search));
|
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 ? (f)->last_mtime : f_mtime ((f), v))
|
((f)->last_mtime == UNKNOWN_MTIME ? f_mtime ((f), v) : (f)->last_mtime)
|
||||||
|
|
||||||
|
/* Special timestamp values. */
|
||||||
|
|
||||||
|
/* The file's timestamp is not yet known. */
|
||||||
|
#define UNKNOWN_MTIME 0
|
||||||
|
|
||||||
|
/* The file does not exist. */
|
||||||
|
#define NONEXISTENT_MTIME 1
|
||||||
|
|
||||||
|
/* The file does not exist, and we assume that it is older than any
|
||||||
|
actual file. */
|
||||||
|
#define OLD_MTIME 2
|
||||||
|
|
||||||
|
/* The smallest and largest ordinary timestamps. */
|
||||||
|
#define ORDINARY_MTIME_MIN (OLD_MTIME + 1)
|
||||||
|
#define ORDINARY_MTIME_MAX ((FILE_TIMESTAMP_S (NEW_MTIME) \
|
||||||
|
<< FILE_TIMESTAMP_LO_BITS) \
|
||||||
|
+ ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S - 1)
|
||||||
|
|
||||||
/* 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
|
||||||
trouble when the machine running make and the machine holding a file have
|
trouble when the machine running make and the machine holding a file have
|
||||||
different ideas about what time it is; and can also lose for `force'
|
different ideas about what time it is; and can also lose for `force'
|
||||||
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. */
|
||||||
|
#define NEW_MTIME INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP)
|
||||||
If FILE_TIMESTAMP is unsigned, its maximum value is the same as
|
|
||||||
((FILE_TIMESTAMP) -1), so use one less than that, because -1 is
|
|
||||||
used for non-existing files. */
|
|
||||||
#define NEW_MTIME \
|
|
||||||
(INTEGER_TYPE_SIGNED (FILE_TIMESTAMP) \
|
|
||||||
? INTEGER_TYPE_MAXIMUM (FILE_TIMESTAMP) \
|
|
||||||
: (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. */
|
||||||
|
@ -738,7 +738,7 @@ func_word (o, argv, funcname)
|
|||||||
i = atoi (argv[0]);
|
i = atoi (argv[0]);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
fatal (reading_file, _("the `word' function takes a positive index argument"));
|
fatal (reading_file, _("first argument to `word' function must be greater than 0"));
|
||||||
|
|
||||||
|
|
||||||
end_p = argv[1];
|
end_p = argv[1];
|
||||||
|
26
gettext.h
26
gettext.h
@ -17,16 +17,14 @@
|
|||||||
along with this program; if not, write to the Free Software Foundation,
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* Because on some systems (e.g. Solaris) we sometimes have to include
|
/* Include libintl.h, if it was found: we don't even look for it unless we
|
||||||
the systems libintl.h as well as this file we have more complex
|
want to use the system's gettext(). If not, the rest of the file contains
|
||||||
include protection above. But the systems header might perhaps also
|
the headers necessary for our own gettext.c. */
|
||||||
define _LIBINTL_H and therefore we have to protect the definition here. */
|
|
||||||
|
|
||||||
#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
|
#ifdef HAVE_LIBINTL_H
|
||||||
#ifndef _LIBINTL_H
|
# include <libintl.h>
|
||||||
# define _LIBINTL_H 1
|
|
||||||
#endif
|
#else
|
||||||
#define _LIBGETTEXT_H 1
|
|
||||||
|
|
||||||
/* We define an additional symbol to signal that we use the GNU
|
/* We define an additional symbol to signal that we use the GNU
|
||||||
implementation of gettext. */
|
implementation of gettext. */
|
||||||
@ -80,10 +78,6 @@ extern const struct _msg_ent _msg_tbl[];
|
|||||||
extern int _msg_tbl_length;
|
extern int _msg_tbl_length;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For automatical extraction of messages sometimes no real
|
|
||||||
translation is needed. Instead the string itself is the result. */
|
|
||||||
#define gettext_noop(Str) (Str)
|
|
||||||
|
|
||||||
/* Look up MSGID in the current default message catalog for the current
|
/* Look up MSGID in the current default message catalog for the current
|
||||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||||
text). */
|
text). */
|
||||||
@ -172,6 +166,12 @@ extern int _nl_msg_cat_cntr;
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* !HAVE_LIBINTL_H */
|
||||||
|
|
||||||
|
#ifndef gettext_noop
|
||||||
|
/* For automatical extraction of messages sometimes no real
|
||||||
|
translation is needed. Instead the string itself is the result. */
|
||||||
|
# define gettext_noop(Str) (Str)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* End of libgettext.h */
|
/* End of libgettext.h */
|
||||||
|
6
main.c
6
main.c
@ -1575,7 +1575,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
build_vpath_lists ();
|
build_vpath_lists ();
|
||||||
|
|
||||||
/* Mark files given with -o flags as very old (00:00:01.00 Jan 1, 1970)
|
/* Mark files given with -o flags as very old
|
||||||
and as having been updated already, and files given with -W flags as
|
and as having been updated already, and files given with -W flags as
|
||||||
brand new (time-stamp as far as possible into the future). */
|
brand new (time-stamp as far as possible into the future). */
|
||||||
|
|
||||||
@ -1583,7 +1583,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 = f->mtime_before_update = (FILE_TIMESTAMP) 1;
|
f->last_mtime = f->mtime_before_update = OLD_MTIME;
|
||||||
f->updated = 1;
|
f->updated = 1;
|
||||||
f->update_status = 0;
|
f->update_status = 0;
|
||||||
f->command_state = cs_finished;
|
f->command_state = cs_finished;
|
||||||
@ -1716,7 +1716,7 @@ int main (int argc, char ** argv)
|
|||||||
error (NILF, _("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 != (FILE_TIMESTAMP) -1
|
any_remade |= (mtime != NONEXISTENT_MTIME
|
||||||
&& mtime != makefile_mtimes[i]);
|
&& mtime != makefile_mtimes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
make.h
8
make.h
@ -286,14 +286,10 @@ extern char *alloca ();
|
|||||||
# endif /* HAVE_ALLOCA_H. */
|
# endif /* HAVE_ALLOCA_H. */
|
||||||
#endif /* GCC. */
|
#endif /* GCC. */
|
||||||
|
|
||||||
#ifdef ST_MTIM_NSEC
|
#if HAVE_INTTYPES_H
|
||||||
# if HAVE_INTTYPES_H
|
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
# endif
|
|
||||||
# define FILE_TIMESTAMP uintmax_t
|
|
||||||
#else
|
|
||||||
# define FILE_TIMESTAMP time_t
|
|
||||||
#endif
|
#endif
|
||||||
|
#define FILE_TIMESTAMP uintmax_t
|
||||||
|
|
||||||
/* ISDIGIT offers the following features:
|
/* ISDIGIT offers the following features:
|
||||||
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
||||||
|
77
remake.c
77
remake.c
@ -390,7 +390,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 == (FILE_TIMESTAMP) -1;
|
noexist = this_mtime == NONEXISTENT_MTIME;
|
||||||
if (noexist)
|
if (noexist)
|
||||||
DBF (DB_BASIC, _("File `%s' does not exist.\n"));
|
DBF (DB_BASIC, _("File `%s' does not exist.\n"));
|
||||||
|
|
||||||
@ -560,7 +560,7 @@ update_file_1 (file, depth)
|
|||||||
#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 == (FILE_TIMESTAMP) -1 && !d->file->intermediate)
|
if (d_mtime == NONEXISTENT_MTIME && !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;
|
||||||
@ -577,7 +577,7 @@ update_file_1 (file, depth)
|
|||||||
{
|
{
|
||||||
const char *fmt = 0;
|
const char *fmt = 0;
|
||||||
|
|
||||||
if (d_mtime == (FILE_TIMESTAMP) -1)
|
if (d_mtime == NONEXISTENT_MTIME)
|
||||||
{
|
{
|
||||||
if (ISDB (DB_BASIC))
|
if (ISDB (DB_BASIC))
|
||||||
fmt = _("Prerequisite `%s' of target `%s' does not exist.\n");
|
fmt = _("Prerequisite `%s' of target `%s' does not exist.\n");
|
||||||
@ -726,7 +726,7 @@ notice_finished_file (file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->mtime_before_update == 0)
|
if (file->mtime_before_update == UNKNOWN_MTIME)
|
||||||
file->mtime_before_update = file->last_mtime;
|
file->mtime_before_update = file->last_mtime;
|
||||||
|
|
||||||
if (ran && !file->phony)
|
if (ran && !file->phony)
|
||||||
@ -750,7 +750,7 @@ notice_finished_file (file)
|
|||||||
else if (file->is_target && file->cmds == 0)
|
else if (file->is_target && file->cmds == 0)
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
file->last_mtime = i == 0 ? 0 : NEW_MTIME;
|
file->last_mtime = i == 0 ? UNKNOWN_MTIME : NEW_MTIME;
|
||||||
|
|
||||||
/* Propagate the change of modification time to all the double-colon
|
/* Propagate the change of modification time to all the double-colon
|
||||||
entries for this file. */
|
entries for this file. */
|
||||||
@ -811,7 +811,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 == (FILE_TIMESTAMP) -1 || mtime > this_mtime)
|
if (mtime == NONEXISTENT_MTIME || mtime > this_mtime)
|
||||||
*must_make_ptr = 1;
|
*must_make_ptr = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -839,7 +839,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 != (FILE_TIMESTAMP) -1 && mtime > this_mtime)
|
if (mtime != NONEXISTENT_MTIME && 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
|
||||||
@ -1040,6 +1040,7 @@ f_mtime (file, search)
|
|||||||
struct file *arfile;
|
struct file *arfile;
|
||||||
time_t memtime;
|
time_t memtime;
|
||||||
int arname_used = 0;
|
int arname_used = 0;
|
||||||
|
time_t member_date;
|
||||||
|
|
||||||
/* Find the archive's name. */
|
/* Find the archive's name. */
|
||||||
ar_parse_name (file->name, &arname, &memname);
|
ar_parse_name (file->name, &arname, &memname);
|
||||||
@ -1094,23 +1095,21 @@ f_mtime (file, search)
|
|||||||
free (arname);
|
free (arname);
|
||||||
free (memname);
|
free (memname);
|
||||||
|
|
||||||
if (mtime == (FILE_TIMESTAMP) -1)
|
if (mtime == NONEXISTENT_MTIME)
|
||||||
/* The archive doesn't exist, so its members don't exist either. */
|
/* The archive doesn't exist, so its members don't exist either. */
|
||||||
return (FILE_TIMESTAMP) -1;
|
return NONEXISTENT_MTIME;
|
||||||
|
|
||||||
memtime = ar_member_date (file->hname);
|
member_date = ar_member_date (file->hname);
|
||||||
if (memtime == (time_t) -1)
|
mtime = (member_date == (time_t) -1
|
||||||
/* The archive member doesn't exist. */
|
? NONEXISTENT_MTIME
|
||||||
return (FILE_TIMESTAMP) -1;
|
: file_timestamp_cons (file->hname, member_date, 0));
|
||||||
|
|
||||||
mtime = FILE_TIMESTAMP_FROM_S_AND_NS (memtime, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mtime = name_mtime (file->name);
|
mtime = name_mtime (file->name);
|
||||||
|
|
||||||
if (mtime == (FILE_TIMESTAMP) -1 && search && !file->ignore_vpath)
|
if (mtime == NONEXISTENT_MTIME && search && !file->ignore_vpath)
|
||||||
{
|
{
|
||||||
/* If name_mtime failed, search VPATH. */
|
/* If name_mtime failed, search VPATH. */
|
||||||
char *name = file->name;
|
char *name = file->name;
|
||||||
@ -1119,8 +1118,8 @@ f_mtime (file, search)
|
|||||||
|| (name[0] == '-' && name[1] == 'l'
|
|| (name[0] == '-' && name[1] == 'l'
|
||||||
&& library_search (&name, &mtime)))
|
&& library_search (&name, &mtime)))
|
||||||
{
|
{
|
||||||
if (mtime != 0)
|
if (mtime != UNKNOWN_MTIME)
|
||||||
/* vpath_search and library_search store zero in MTIME
|
/* vpath_search and library_search store UNKNOWN_MTIME
|
||||||
if they didn't need to do a stat call for their work. */
|
if they didn't need to do a stat call for their work. */
|
||||||
file->last_mtime = mtime;
|
file->last_mtime = mtime;
|
||||||
|
|
||||||
@ -1148,35 +1147,38 @@ f_mtime (file, search)
|
|||||||
|
|
||||||
We only need to do this once, for now. */
|
We only need to do this once, for now. */
|
||||||
|
|
||||||
|
if (!clock_skew_detected
|
||||||
|
&& mtime != NONEXISTENT_MTIME
|
||||||
|
&& !file->updated)
|
||||||
|
{
|
||||||
static FILE_TIMESTAMP now;
|
static FILE_TIMESTAMP now;
|
||||||
|
|
||||||
FILE_TIMESTAMP adjusted_mtime = mtime;
|
FILE_TIMESTAMP adjusted_mtime = mtime;
|
||||||
|
|
||||||
|
#if defined WINDOWS32 || defined _MSDOS__
|
||||||
|
FILE_TIMESTAMP adjustment;
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
/* FAT filesystems round time to the nearest even second!
|
/* FAT filesystems round time to the nearest even second!
|
||||||
Allow for any file (NTFS or FAT) to perhaps suffer from this
|
Allow for any file (NTFS or FAT) to perhaps suffer from this
|
||||||
brain damage. */
|
brain damage. */
|
||||||
if ((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0
|
adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0
|
||||||
&& FILE_TIMESTAMP_NS (adjusted_mtime) == 0)
|
&& FILE_TIMESTAMP_NS (adjusted_mtime) == 0)
|
||||||
adjusted_mtime -= FILE_TIMESTAMPS_PER_S;
|
? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS
|
||||||
|
: 0);
|
||||||
#else
|
#else
|
||||||
#ifdef __MSDOS__
|
|
||||||
/* On DJGPP under Windows 98 and Windows NT, FAT filesystems can
|
/* On DJGPP under Windows 98 and Windows NT, FAT filesystems can
|
||||||
set file times up to 3 seconds into the future! The bug doesn't
|
set file times up to 3 seconds into the future! The bug doesn't
|
||||||
occur in plain DOS or in Windows 95, but we play it safe. */
|
occur in plain DOS or in Windows 95, but we play it safe. */
|
||||||
adjusted_mtime -= 3 * FILE_TIMESTAMPS_PER_S;
|
adjustment = (FILE_TIMESTAMP) 3 << FILE_TIMESTAMP_LO_BITS;
|
||||||
#endif
|
#endif
|
||||||
|
if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime)
|
||||||
|
adjusted_mtime -= adjustment;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!clock_skew_detected
|
/* If the file's time appears to be in the future, udpate our
|
||||||
&& mtime != (FILE_TIMESTAMP)-1 && now < adjusted_mtime
|
concept of the present and try once more. */
|
||||||
&& !file->updated)
|
if (now < adjusted_mtime
|
||||||
{
|
&& (now = file_timestamp_now ()) < adjusted_mtime)
|
||||||
/* This file's time appears to be in the future.
|
|
||||||
Update our concept of the present, and compare again. */
|
|
||||||
|
|
||||||
now = file_timestamp_now ();
|
|
||||||
|
|
||||||
if (now < adjusted_mtime)
|
|
||||||
{
|
{
|
||||||
char mtimebuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
char mtimebuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
||||||
char nowbuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
char nowbuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
|
||||||
@ -1201,7 +1203,8 @@ f_mtime (file, search)
|
|||||||
been built by us but was found now, it existed before make
|
been built by us but was found now, it existed before make
|
||||||
started. So, turn off the intermediate bit so make doesn't
|
started. So, turn off the intermediate bit so make doesn't
|
||||||
delete it, since it didn't create it. */
|
delete it, since it didn't create it. */
|
||||||
if (mtime != (FILE_TIMESTAMP)-1 && file->command_state == cs_not_started
|
if (mtime != NONEXISTENT_MTIME && file->command_state == cs_not_started
|
||||||
|
&& file->command_state == cs_not_started
|
||||||
&& !file->tried_implicit && file->intermediate)
|
&& !file->tried_implicit && file->intermediate)
|
||||||
file->intermediate = 0;
|
file->intermediate = 0;
|
||||||
|
|
||||||
@ -1227,10 +1230,10 @@ name_mtime (name)
|
|||||||
{
|
{
|
||||||
if (errno != ENOENT && errno != ENOTDIR)
|
if (errno != ENOENT && errno != ENOTDIR)
|
||||||
perror_with_name ("stat:", name);
|
perror_with_name ("stat:", name);
|
||||||
return (FILE_TIMESTAMP) -1;
|
return NONEXISTENT_MTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FILE_TIMESTAMP_STAT_MODTIME (st);
|
return FILE_TIMESTAMP_STAT_MODTIME (name, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1316,7 +1319,7 @@ library_search (lib, mtime_ptr)
|
|||||||
|
|
||||||
/* Look first for `libNAME.a' in the current directory. */
|
/* Look first for `libNAME.a' in the current directory. */
|
||||||
mtime = name_mtime (libbuf);
|
mtime = name_mtime (libbuf);
|
||||||
if (mtime != (FILE_TIMESTAMP) -1)
|
if (mtime != NONEXISTENT_MTIME)
|
||||||
{
|
{
|
||||||
*lib = xstrdup (libbuf);
|
*lib = xstrdup (libbuf);
|
||||||
if (mtime_ptr != 0)
|
if (mtime_ptr != 0)
|
||||||
@ -1356,7 +1359,7 @@ library_search (lib, mtime_ptr)
|
|||||||
{
|
{
|
||||||
sprintf (buf, "%s/%s", *dp, libbuf);
|
sprintf (buf, "%s/%s", *dp, libbuf);
|
||||||
mtime = name_mtime (buf);
|
mtime = name_mtime (buf);
|
||||||
if (mtime != (FILE_TIMESTAMP) -1)
|
if (mtime != NONEXISTENT_MTIME)
|
||||||
{
|
{
|
||||||
*lib = xstrdup (buf);
|
*lib = xstrdup (buf);
|
||||||
if (mtime_ptr != 0)
|
if (mtime_ptr != 0)
|
||||||
|
6
vpath.c
6
vpath.c
@ -525,10 +525,10 @@ selective_vpath_search (path, file, mtime_ptr)
|
|||||||
if (mtime_ptr != 0)
|
if (mtime_ptr != 0)
|
||||||
/* 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 UNKNOWN_MTIME to indicate this. */
|
||||||
*mtime_ptr = (exists_in_cache
|
*mtime_ptr = (exists_in_cache
|
||||||
? FILE_TIMESTAMP_STAT_MODTIME (st)
|
? FILE_TIMESTAMP_STAT_MODTIME (name, st)
|
||||||
: (FILE_TIMESTAMP) 0);
|
: UNKNOWN_MTIME);
|
||||||
|
|
||||||
free (name);
|
free (name);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user