bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dependency issue in GNU Make?


From: Henning Makholm
Subject: Re: Dependency issue in GNU Make?
Date: 21 Feb 2002 14:41:25 +0100

Scripsit Michael Opdenacker <address@hidden>

> I found the below problem using GNU Make 3.79.1.
> What do you think?

I'm not the maintainer of GNU Make, but I had a similar problem last
fall. When I investigated the source I found that support for -t in
3.79.1 is indeed broken. I came up whith the following patch, which
seemed to fix my problems, and also works as expected for your example

diff -urN make-3.79.1.original/remake.c make-3.79.1/remake.c
--- make-3.79.1.original/remake.c       Tue Jun 20 16:00:17 2000
+++ make-3.79.1/remake.c        Sat Nov  3 03:15:19 2001
@@ -696,6 +696,7 @@
 {
   struct dep *d;
   int ran = file->command_state == cs_running;
+  int touched = 0 ;
 
   file->command_state = cs_finished;
   file->updated = 1;
@@ -724,24 +725,34 @@
          if (file->phony)
            file->update_status = 0;
          else
-           /* Should set file's modification date and do nothing else.  */
-           file->update_status = touch_file (file);
+            {
+             /* Should set file's modification date and do nothing else.  */
+             file->update_status = touch_file (file);
+              /* Pretend we ran a real touch command, to suppress the
+                 "`foo' is up to date" message.  */
+              commands_started++ ;
+              /* Request for the timestamp to be updated (and distributed
+                 to the double-colon entries). Simply setting ran=1 would
+                 almost have done the trick, but messes up with the also_make
+                 updating logic below.  */
+              touched = 1 ;
+            }
        }
     }
 
   if (file->mtime_before_update == UNKNOWN_MTIME)
     file->mtime_before_update = file->last_mtime;
 
-  if (ran && !file->phony)
+  if (ran && !file->phony || touched)
     {
       struct file *f;
       int i = 0;
 
-      /* If -n or -q and all the commands are recursive, we ran them so
+      /* If -n or -t 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)
+      if (question_flag || just_print_flag || touch_flag)
         {
           for (i = file->cmds->ncommand_lines; i > 0; --i)
             if (! (file->cmds->lines_flags[i-1] & COMMANDS_RECURSE))

-- 
Henning Makholm                                             "# good fish ...
                                                    # goodfish, goodfish ...
                                                        # good-good FISH! #"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]