summaryrefslogtreecommitdiff
path: root/remake.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-10-13 07:00:23 +0000
committerPaul Smith <psmith@gnu.org>1999-10-13 07:00:23 +0000
commit281951154bc90849385ae4cacc3cadfc1653b877 (patch)
treea78f4d17879b485ea2fa127c21d99ac40a839a00 /remake.c
parent829f4fd04b7fe9e18ed91c236ed46ebce5b27cae (diff)
downloadgunmake-281951154bc90849385ae4cacc3cadfc1653b877.tar.gz
* Fix PR/1379: -n/-q behaves correctly when all commands are recursive.
Diffstat (limited to 'remake.c')
-rw-r--r--remake.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/remake.c b/remake.c
index 7d7fd36..1d7ac08 100644
--- a/remake.c
+++ b/remake.c
@@ -93,15 +93,6 @@ update_goal_chain (goals, makefiles)
g->changed = 0;
}
-#if 0
- /* Only run one job at a time when building makefiles.
- No one seems to know why this was done, and no one can think of a good
- reason to do it. Hopefully an obvious one won't appear as soon as we
- release the next version :-/. */
- if (makefiles)
- job_slots = 1;
-#endif
-
/* All files start with the considered bit 0, so the global value is 1. */
considered = 1;
@@ -746,12 +737,23 @@ notice_finished_file (file)
if (ran && !file->phony)
{
struct file *f;
+ int i = 0;
- if (just_print_flag || question_flag
- || (file->is_target && file->cmds == 0))
- file->last_mtime = NEW_MTIME;
- else
- file->last_mtime = 0;
+ /* If -n or -q and all the commands are recursive, we ran them so
+ really check the target's mtime again. Otherwise, assume the target
+ would have been updated. */
+
+ if (question_flag || just_print_flag)
+ for (i = file->cmds->ncommand_lines; i > 0; --i)
+ if (! (file->cmds->lines_flags[i-1] & COMMANDS_RECURSE))
+ break;
+
+ /* If there were no commands at all, it's always new. */
+
+ else if (file->is_target && file->cmds == 0)
+ i = 1;
+
+ file->last_mtime = i == 0 ? 0 : NEW_MTIME;
/* Propagate the change of modification time to all the double-colon
entries for this file. */
@@ -970,20 +972,21 @@ remake_file (file)
Pretend it was successfully remade. */
file->update_status = 0;
else
- no_rule_error(file);
+ no_rule_error (file);
}
else
{
chop_commands (file->cmds);
+ /* The normal case: start some commands. */
if (!touch_flag || file->cmds->any_recurse)
{
execute_file_commands (file);
return;
}
- else
- /* This tells notice_finished_file it is ok to touch the file. */
- file->update_status = 0;
+
+ /* This tells notice_finished_file it is ok to touch the file. */
+ file->update_status = 0;
}
/* This does the touching under -t. */