]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Fix bug #2515: the .SECONDARY target with no prerequisites wasn't
authorPaul Smith <psmith@gnu.org>
Fri, 28 Mar 2003 06:31:44 +0000 (06:31 +0000)
committerPaul Smith <psmith@gnu.org>
Fri, 28 Mar 2003 06:31:44 +0000 (06:31 +0000)
behaving properly (if you listed prerequisites it worked properly).

ChangeLog
file.c
tests/ChangeLog
tests/scripts/targets/SECONDARY

index 37b22fcda33f7496474da1466460d05bf06724f8..cce4014b2f65bb83dd49f6f9a63c77988e274abd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-28  Paul D. Smith  <psmith@gnu.org>
+
+       * file.c (snap_deps): If .SECONDARY with no targets is given, set
+       the intermediate flag on all targets.  Fixes bug #2515.
+
 2003-03-24  Paul D. Smith  <psmith@gnu.org>
 
        * configure.in, Makefile.am, glob/Makefile.am, doc/Makefile.am:
diff --git a/file.c b/file.c
index 77e3e6a6da5568f12cb5d47ffe6407230c9b46d8..f043e9cc004a7de4a353362e7c0dbade5bf2e378 100644 (file)
--- a/file.c
+++ b/file.c
@@ -392,6 +392,15 @@ remove_intermediates (int sig)
     }
 }
 \f
+/* Set the intermediate flag.  */
+
+static void
+set_intermediate (const void *item)
+{
+  struct file *f = (struct file *) item;
+  f->intermediate = 1;
+}
+
 /* For each dependency of each file, make the `struct dep' point
    at the appropriate `struct file' (which may have to be created).
 
@@ -473,7 +482,10 @@ snap_deps (void)
             f2->intermediate = f2->secondary = 1;
       /* .SECONDARY with no deps listed marks *all* files that way.  */
       else
-        all_secondary = 1;
+        {
+          all_secondary = 1;
+          hash_map (&files, set_intermediate);
+        }
     }
 
   f = lookup_file (".EXPORT_ALL_VARIABLES");
index 88fffb6709de4e66fc5198dd699e8394984e4ba7..b4ba23ecb37bfa9ed5895986597584544903cbbd 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-28  Paul D. Smith  <psmith@gnu.org>
+
+       * scripts/targets/SECONDARY: Test the "global" .SECONDARY (with
+       not prerequisites)--Bug #2515.
+
 2003-01-30  Paul D. Smith  <psmith@gnu.org>
 
        * scripts/features/targetvars: Test very long target-specific
index 5a60ed2af9e90ae4953a274395ba6153c88c7cea..a6c5dab60e6b70dfeb621b4487f5c12ce9d386bf 100644 (file)
@@ -81,5 +81,32 @@ $answer = "cp foo.f foo.e\ncp foo.e foo.c\n";
 
 unlink('foo.f', 'foo.e', 'foo.d', 'foo.c');
 
+# TEST #7 -- test the "global" .SECONDARY, with no targets.
+
+$makefile2 = &get_tmpfile;
+
+open(MAKEFILE, "> $makefile2");
+
+print MAKEFILE <<'EOF';
+.SECONDARY:
+
+final: intermediate
+intermediate: source
+
+final intermediate source:
+       echo $< > $@
+EOF
+
+close(MAKEFILE);
+
+&utouch(-10, 'source');
+touch('final');
+
+&run_make_with_options($makefile2, '', &get_logfile);
+$answer = "$make_name: `final' is up to date.\n";
+&compare_output($answer, &get_logfile(1));
+
+unlink('source', 'final', 'intermediate');
+
 # This tells the test driver that the perl test script executed properly.
 1;