summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-08-20 18:10:20 +0000
committerRoland McGrath <roland@redhat.com>1992-08-20 18:10:20 +0000
commitdb7633eac4fc8bd6b797cc21220f8d2696f48514 (patch)
treee5d898f3eb48d5c69c69fae0aa2f040f3dfb86cd
parent8fbb7720414e9067af8468c920cc6658d668a26b (diff)
downloadgunmake-db7633eac4fc8bd6b797cc21220f8d2696f48514.tar.gz
Formerly remake.c.~32~
-rw-r--r--remake.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/remake.c b/remake.c
index ee92d14..5714c81 100644
--- a/remake.c
+++ b/remake.c
@@ -35,7 +35,7 @@ extern int try_implicit_rule ();
/* Incremented when a file has been remade. */
static unsigned int files_remade = 0;
-static int update_file (), update_file_1 (), check_dep ();
+static int update_file (), update_file_1 (), check_dep (), touch_file ();
static void remake_file ();
static time_t name_mtime (), library_file_mtime ();
extern time_t f_mtime ();
@@ -559,6 +559,22 @@ notice_finished_file (file)
++files_remade;
+ if (touch_flag
+ /* The update status will be:
+ -1 if no commands were run;
+ 0 if some commands (+ or ${MAKE}) were run and won;
+ 1 if some commands were run and lost.
+ The only time we don't want to touch the target is if
+ it had some recursive commands, and they lost. */
+ && file->update_status != 1)
+ {
+ if (file->phony)
+ file->update_status = 0;
+ else
+ /* Should set file's modification date and do nothing else. */
+ file->update_status = touch_file (file);
+ }
+
if (!file->phony)
{
if (just_print_flag || question_flag
@@ -660,7 +676,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
return dep_status;
}
-/* Touch FILE. Return zero if successful, nonzero if not. */
+/* Touch FILE. Return zero if successful, one if not. */
#define TOUCH_ERROR(call) return (perror_with_name (call, file->name), 1)
@@ -749,15 +765,7 @@ remake_file (file)
{
chop_commands (file->cmds);
- if (touch_flag && !file->cmds->any_recurse)
- {
- if (file->phony)
- file->update_status = 0;
- else
- /* Should set file's modification date and do nothing else. */
- file->update_status = touch_file (file);
- }
- else
+ if (!touch_flag || file->cmds->any_recurse)
{
execute_file_commands (file);
return;