]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* implicit.c (pattern_search): [SV 43677] Mark files secondary.
authorPaul Smith <psmith@gnu.org>
Mon, 13 Jul 2015 04:51:35 +0000 (00:51 -0400)
committerPaul Smith <psmith@gnu.org>
Mon, 13 Jul 2015 04:51:35 +0000 (00:51 -0400)
In order to fix SV 12267 we were marking the prerequisites of
implicit (pattern) targets that existed elsewhere in the makefile
as precious to keep them from being deleted as intermediate files.
However this also keeps them from being deleted on error.  Instead
mark them as secondary.
* tests/scripts/targets/DELETE_ON_ERROR: Test DELETE_ON_ERROR.

implicit.c
tests/scripts/targets/DELETE_ON_ERROR [new file with mode: 0644]

index 8e17ff2128830a04ac308ec8d476efefe126952f..d7d391caa1563c31886bd00ec2c9bb35945977fb 100644 (file)
@@ -864,9 +864,10 @@ pattern_search (struct file *file, int archive,
 
           /* We don't want to delete an intermediate file that happened
              to be a prerequisite of some (other) target. Mark it as
-             precious.  */
+             secondary.  We don't want it to be precious as that disables
+             DELETE_ON_ERROR etc.  */
           if (f != 0)
-            f->precious = 1;
+            f->secondary = 1;
           else
             f = enter_file (imf->name);
 
diff --git a/tests/scripts/targets/DELETE_ON_ERROR b/tests/scripts/targets/DELETE_ON_ERROR
new file mode 100644 (file)
index 0000000..08f009f
--- /dev/null
@@ -0,0 +1,22 @@
+#! -*-perl-*-
+
+$description = "Test the behaviour of the .DELETE_ON_ERROR target.";
+
+$details = "";
+
+run_make_test('
+.DELETE_ON_ERROR:
+all: ; false > $@
+',
+              '', "false > all\n#MAKEFILE#:3: recipe for target 'all' failed\n#MAKE#: *** [all] Error 1\n#MAKE#: *** Deleting file 'all'", 512);
+
+run_make_test('
+.DELETE_ON_ERROR:
+all: foo.x ;
+%.x : %.q ; echo > $@
+%.q : ; false > $@
+',
+              '', "false > foo.q\n#MAKEFILE#:5: recipe for target 'foo.q' failed\n#MAKE#: *** [foo.q] Error 1\n#MAKE#: *** Deleting file 'foo.q'", 512);
+
+# This tells the test driver that the perl test script executed properly.
+1;