summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2000-07-07 17:34:56 +0000
committerPaul Smith <psmith@gnu.org>2000-07-07 17:34:56 +0000
commit3c132f10f39f1675607d50f5c75669ec64e13bb5 (patch)
tree6a749a7c51472ff1f41aaa1cb6eb3a2dcaac9f70
parent88187d9f4b963227e72a46848826eab93545da6e (diff)
downloadgunmake-3c132f10f39f1675607d50f5c75669ec64e13bb5.tar.gz
* Minor code cleanups
* Fix for PR/1811, from Paul Eggert.
-rw-r--r--ChangeLog40
-rw-r--r--Makefile.am2
-rw-r--r--NEWS2
-rw-r--r--TODO.private67
-rw-r--r--file.c15
-rw-r--r--filedef.h6
-rw-r--r--remake.c59
-rw-r--r--variable.c3
8 files changed, 139 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index d30cfa4..f057bd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2000-07-07 Paul D. Smith <psmith@gnu.org>
+
+ * remake.c (f_mtime): If NO_FLOAT is defined, don't bother with
+ the offset calculation.
+ (name_mtime): Replace EINTR test with EINTR_SET macro.
+
+2000-07-07 Paul Eggert <eggert@twinsun.com>
+
+ Fix for PR/1811:
+
+ * remake.c (update_file_1):
+ Avoid spurious rebuilds of archive members due to their
+ timestamp resolution being only one second.
+ (f_mtime): Avoid spurious warnings of timestamps in the future due to
+ the clock's resolution being lower than file timestamps'.
+ When warning about future timestamps, report only the discrepancy,
+ not the absolute value of the timestamp and the current time.
+
+ * file.c (file_timestamp_now): New arg RESOLUTION.
+ * filedef.h (file_timestamp_now): Likewise.
+ (FILE_TIMESTAMP_NS): Now returns int. All uses changed.
+
+2000-07-05 Paul D. Smith <psmith@gnu.org>
+
+ * variable.c (lookup_variable) [VMS]: Remove vestigial references
+ to listp. Fixes PR/1793.
+
+2000-06-26 Paul Eggert <eggert@twinsun.com>
+
+ * Makefile.am (MAINTAINERCLEANFILES): New macro, with stamp-pot in it.
+
+ * dir.c (vms_hash): Ensure ctype macro args are nonnegative.
+
+ * remake.c (f_mtime): Remove unused var memtime.
+
+2000-06-25 Martin Buchholz <martin@xemacs.org>
+
+ * make.texinfo, NEWS, TODO.private: Minor spelling corrections.
+ Ran spell-check on make.texinfo.
+
2000-06-23 Paul D. Smith <psmith@gnu.org>
* main.c (main): Replace EXIT_SUCCESS, EXIT_FAILURE, and
diff --git a/Makefile.am b/Makefile.am
index 08db1a6..1f4c6f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,6 +57,8 @@ all-local: $(srcdir)/stamp-pot
$(srcdir)/stamp-pot: $(POTFILES)
@echo "$(POTFILES)" > $@
+MAINTAINERCLEANFILES = $(srcdir)/stamp-pot
+
# --------------- Local INSTALL Section
diff --git a/NEWS b/NEWS
index a89b75c..40ddb1d 100644
--- a/NEWS
+++ b/NEWS
@@ -44,7 +44,7 @@ Version 3.79
explicitly within a make rule you may need to re-examine your use for
correctness given this change.
-* A new psuedo-target .NOTPARALLEL is available. If defined, the
+* A new pseudo-target .NOTPARALLEL is available. If defined, the
current makefile is run serially regardless of the value of -j.
However, submakes are still eligible for parallel execution.
diff --git a/TODO.private b/TODO.private
index 5af0544..693b7bb 100644
--- a/TODO.private
+++ b/TODO.private
@@ -28,13 +28,14 @@ priority on my list of things I don't have time to do right now is
fixing up the GNU make test suite. Most importantly it needs to be made
"parallelizable", so more than one regression can run at the same time
(essentially, make the "work" directory local). Also, the CWD during
-the test should be in the work directory; right now sometimes tests leak
-files into the main directory which causes subsequent tests to fail
-(some tests may need to be tweaked). Beyond that, any cleanup done to
-make writing, reading, or handling tests simpler would be great! Please
-feel free to make whatever changes you like to the current tests, given
-some high-level goals, and that you'll port the current tests to
-whatever you do :).
+the test should be in the work directory or, better, a test-specific
+temporary directory so each test gets a new directory; right now
+sometimes tests leak files into the main directory which causes
+subsequent tests to fail (some tests may need to be tweaked). Beyond
+that, any cleanup done to make writing, reading, or handling tests
+simpler would be great! Please feel free to make whatever changes you
+like to the current tests, given some high-level goals, and that you'll
+port the current tests to whatever you do :).
The Rest of the List
@@ -46,9 +47,9 @@ The Rest of the List
2) Option to check more than timestamps to determine if targets have
changed. This is also a very big one. It's _close_ to my plate :),
- and I have very definite ideas about how I want it done. Please
- pick something else unless you must have this feature. If you try
- it, please work _extremely_ closely with me on it.
+ and I have very definite ideas about how I would like it done.
+ Please pick something else unless you must have this feature. If
+ you try it, please work _extremely_ closely with me on it.
2a) Possibly a special case of this is the .KEEP_STATE feature of Sun's
make. Some great folks at W U. in Canada did an implementation of
@@ -95,7 +96,7 @@ The Rest of the List
doing until #1 is done.
9) Right now the .PRECIOUS, .INTERMEDIATE, and .SECONDARY
- psuedo-targets have different capabilities. For example, .PRECIOUS
+ pseudo-targets have different capabilities. For example, .PRECIOUS
can take a "%", the others can't. Etc. These should all work the
same, insofar as that makes sense.
@@ -105,15 +106,35 @@ The Rest of the List
very important for parallel builds: sometimes you need some stuff
done first but you don't want to rebuild everything because of it.
-11) Improved debugging/logging/etc. capabilities. This area is in
- desparate need of work; the current -d, -s, etc. options are simply
- insufficient. We need different levels of output: some that are
- much less verbose. E.g., maybe just print one line about why make
- decides to rebuild each target. Also, we could use something like
- the -E option for preprocessors; this would print out makefiles
- after resolving all includes, immediate variable reverences, etc.
- Also, a way to turn on and off obeying the "@" token for scripts
- that's independent of -n (so we could have them in effect for -n,
- and have them not in effect without -n).
-
- Maybe other things. Contact me about the user interface.
+11) Improved debugging/logging/etc. capabilities. Part of this is done:
+ I introduced a number of debugging enhancements. Tim Magill is (I
+ think) looking into options to control output more selectively.
+ One thing I want to do in debugging is add a flag to allow debugging
+ of variables as they're expanded (!). This would be incredibly
+ verbose, but could be invaluable when nothing else seems to work and
+ you just can't figure it out. The way variables are expanded now
+ means this isn't 100% trivial, but it probably won't be hard.
+
+12) Integration of Guile as an embedded scripting language. This means:
+ allowing Guile functions to be declared in makefiles somehow, then
+ providing a syntax for invoking them. At least one formulation of
+ that would have the function resolve to a string which would be
+ substituted in the makefile, kind of like $(shell ...) does now, but
+ using the embedded interpreter so there's no process forked of
+ course. Obviously this is an optional add-on feature.
+
+ It could be more advanced than that, even, who knows? Maybe make
+ could provide Guile functions that allow Guile scripts more direct
+ access to internal make structures, somehow. This kind of thing
+ needs a lot of thought.
+
+ Also there's always the flip side: in some very fundamental ways
+ make isn't the best choice right now for a complex build tool. It's
+ great for simple-to-medium tasks, but there are already other tools
+ available for the really tough situations. Ask yourself,
+ realistically, how much work is worthwhile to add to make, given the
+ fundamentals you can't really overcome without significantly
+ affecting backward compatibility--and then why not use another tool
+ in the first place?
+
+ Something to think about.
diff --git a/file.c b/file.c
index 90cb873..f5f9a77 100644
--- a/file.c
+++ b/file.c
@@ -580,11 +580,12 @@ file_timestamp_cons (fname, s, ns)
return ts;
}
-/* Get and print file timestamps. */
-
+/* Return the current time as a file timestamp, setting *RESOLUTION to
+ its resolution. */
FILE_TIMESTAMP
-file_timestamp_now ()
+file_timestamp_now (int *resolution)
{
+ int r;
time_t s;
int ns;
@@ -598,6 +599,7 @@ file_timestamp_now ()
struct timespec timespec;
if (clock_gettime (CLOCK_REALTIME, &timespec) == 0)
{
+ r = 1;
s = timespec.tv_sec;
ns = timespec.tv_nsec;
goto got_time;
@@ -609,6 +611,7 @@ file_timestamp_now ()
struct timeval timeval;
if (gettimeofday (&timeval, 0) == 0)
{
+ r = 1000;
s = timeval.tv_sec;
ns = timeval.tv_usec * 1000;
goto got_time;
@@ -617,13 +620,17 @@ file_timestamp_now ()
#endif
}
+ r = 1000000000;
s = time ((time_t *) 0);
ns = 0;
got_time:
+ *resolution = r;
return file_timestamp_cons (0, s, ns);
}
+/* Place into the buffer P a printable representation of the file
+ timestamp TS. */
void
file_timestamp_sprintf (p, ts)
char *p;
@@ -647,7 +654,7 @@ file_timestamp_sprintf (p, ts)
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));
+ sprintf (p, ".%09d", FILE_TIMESTAMP_NS (ts));
p += strlen (p) - 1;
while (*p == '0')
p--;
diff --git a/filedef.h b/filedef.h
index 68c72de..19f24f8 100644
--- a/filedef.h
+++ b/filedef.h
@@ -131,8 +131,8 @@ extern void notice_finished_file PARAMS ((struct file *file));
#define FILE_TIMESTAMP_S(ts) (((ts) - ORDINARY_MTIME_MIN) \
>> FILE_TIMESTAMP_LO_BITS)
-#define FILE_TIMESTAMP_NS(ts) (((ts) - ORDINARY_MTIME_MIN) \
- & ((1 << FILE_TIMESTAMP_LO_BITS) - 1))
+#define FILE_TIMESTAMP_NS(ts) ((int) (((ts) - ORDINARY_MTIME_MIN) \
+ & ((1 << FILE_TIMESTAMP_LO_BITS) - 1)))
/* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN"
representing a file timestamp. The upper bound is not necessarily 19,
@@ -154,7 +154,7 @@ extern void notice_finished_file PARAMS ((struct file *file));
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 ((int *));
extern void file_timestamp_sprintf PARAMS ((char *p, FILE_TIMESTAMP ts));
/* Return the mtime of file F (a struct file *), caching it.
diff --git a/remake.c b/remake.c
index 1ea0df2..0f9f2aa 100644
--- a/remake.c
+++ b/remake.c
@@ -396,6 +396,15 @@ update_file_1 (file, depth)
noexist = this_mtime == NONEXISTENT_MTIME;
if (noexist)
DBF (DB_BASIC, _("File `%s' does not exist.\n"));
+ else
+ {
+#ifndef NO_ARCHIVES
+ /* Avoid spurious rebuilds of archive members due to their
+ timestamp resolution being only one second. */
+ if (1 < FILE_TIMESTAMPS_PER_S && ar_name (file->name))
+ this_mtime += FILE_TIMESTAMPS_PER_S - 1;
+#endif
+ }
must_make = noexist;
@@ -1041,7 +1050,6 @@ f_mtime (file, search)
char *arname, *memname;
struct file *arfile;
- time_t memtime;
int arname_used = 0;
time_t member_date;
@@ -1154,7 +1162,7 @@ f_mtime (file, search)
&& mtime != NONEXISTENT_MTIME
&& !file->updated)
{
- static FILE_TIMESTAMP now;
+ static FILE_TIMESTAMP adjusted_now;
FILE_TIMESTAMP adjusted_mtime = mtime;
@@ -1178,19 +1186,28 @@ f_mtime (file, search)
adjusted_mtime -= adjustment;
#endif
- /* If the file's time appears to be in the future, udpate our
+ /* If the file's time appears to be in the future, update our
concept of the present and try once more. */
- if (now < adjusted_mtime
- && (now = file_timestamp_now ()) < adjusted_mtime)
- {
- char mtimebuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
- 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;
+ if (adjusted_now < adjusted_mtime)
+ {
+ int resolution;
+ FILE_TIMESTAMP now = file_timestamp_now (&resolution);
+ adjusted_now = now + (resolution - 1);
+ if (adjusted_now < adjusted_mtime)
+ {
+#ifdef NO_FLOAT
+ error (NILF, _("*** Warning: File `%s' has modification time in the future"),
+ file->name);
+#else
+ double from_now =
+ (FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now)
+ + ((FILE_TIMESTAMP_NS (mtime) - FILE_TIMESTAMP_NS (now))
+ / 1e9));
+ error (NILF, _("*** Warning: File `%s' has modification time %.2g s in the future"),
+ file->name, from_now);
+#endif
+ clock_skew_detected = 1;
+ }
}
}
}
@@ -1228,13 +1245,13 @@ name_mtime (name)
{
struct stat st;
- while (stat (name, &st) != 0)
- if (errno != EINTR)
- {
- if (errno != ENOENT && errno != ENOTDIR)
- perror_with_name ("stat:", name);
- return NONEXISTENT_MTIME;
- }
+ while (stat (name, &st) != 0)
+ if (!EINTR_SET)
+ {
+ if (errno != ENOENT && errno != ENOTDIR)
+ perror_with_name ("stat:", name);
+ return NONEXISTENT_MTIME;
+ }
return FILE_TIMESTAMP_STAT_MODTIME (name, st);
}
diff --git a/variable.c b/variable.c
index 6475e78..300368d 100644
--- a/variable.c
+++ b/variable.c
@@ -201,9 +201,6 @@ lookup_variable (name, length)
sptr = value;
scnt = 0;
- if (listp)
- *listp = current_variable_set_list;
-
while ((sptr = strchr (sptr, '$')))
{
scnt++;