diff options
author | Paul Smith <psmith@gnu.org> | 2021-05-31 14:37:09 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2021-09-03 12:08:11 -0400 |
commit | 7c4e6b0299774280e3a93060c70c661f459aaf40 (patch) | |
tree | e180f55dc5a19c8ae643837388b575120e2eb6cf /src/remake.c | |
parent | b9c4fc441b2d66312a592bf4eab67ef7fbe4c645 (diff) | |
download | make-git-7c4e6b0299774280e3a93060c70c661f459aaf40.tar.gz |
[SV 60595] Restart whenever any makefile is rebuilt
Previously if an included makefile was rebuilt as a prerequisite of
another included makefile which didn't need to be rebuilt, make would
not realize that it needed to re-exec itself.
Ensure that if any included makefile target is rebuilt we re-exec.
Also ensure that if an included makefile is not readable, and our rule
for rebuilding it doesn't actually change it, we will still fail.
* src/remake.c (update_goal_chain): If a goal's update was successful
then check its status, even if no actual commands were run because it
was already up to date.
(show_goal_error): Remove superfluous cast.
* src/main.c (main): If the makefile remake did nothing, check that we
were able to successfully include all the makefiles we care about; if
not fail. When generating error messages about included makefiles be
sure to show the filename/linenumber information.
* test/scripts/features/reinvoke: Add tests for this behavior.
* test/scripts/options/dash-k: Update error messages.
Diffstat (limited to 'src/remake.c')
-rw-r--r-- | src/remake.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/remake.c b/src/remake.c index f7605fc0..b20d37c7 100644 --- a/src/remake.c +++ b/src/remake.c @@ -78,8 +78,8 @@ static FILE_TIMESTAMP name_mtime (const char *name); static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr); -/* Remake all the goals in the 'struct dep' chain GOALS. Return -1 if nothing - was done, 0 if all goals were updated successfully, or 1 if a goal failed. +/* Remake all the goals in the 'struct dep' chain GOALS. Return update_status + representing the totality of the status of the goals. If rebuilding_makefiles is nonzero, these goals are makefiles, so -t, -q, and -n should be disabled for them unless they were also command-line @@ -185,8 +185,7 @@ update_goal_chain (struct goaldep *goaldeps) FILE_TIMESTAMP mtime = MTIME (file); check_renamed (file); - if (file->updated && g->changed && - mtime != file->mtime_before_update) + if (file->updated && mtime != file->mtime_before_update) { /* Updating was done. If this is a makefile and just_print_flag or question_flag is set (meaning @@ -288,7 +287,7 @@ show_goal_error (void) if (goal->error) { OSS (error, &goal->floc, "%s: %s", - goal->file->name, strerror ((int)goal->error)); + goal->file->name, strerror (goal->error)); goal->error = 0; } return; @@ -1421,7 +1420,7 @@ f_mtime (struct file *file, int search) / 1e9)); char from_now_string[100]; - if (from_now >= 99 && from_now <= ULONG_MAX) + if (from_now >= 100.0 && from_now < (double) ULONG_MAX) sprintf (from_now_string, "%lu", (unsigned long) from_now); else sprintf (from_now_string, "%.2g", from_now); |