summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Goncharov <dgoncharov@users.sf.net>2023-04-02 11:04:26 -0400
committerPaul Smith <psmith@gnu.org>2023-04-02 11:12:19 -0400
commit80727d709c3a14c5f7b4ab14d7c59b8709dc133e (patch)
treec1fc9ecb2b581d4ddba3280f8004dfd92c76c092 /src
parentcd46baab90296a75e03c73ad5c1f6f5bc3eb6cb3 (diff)
downloadmake-git-80727d709c3a14c5f7b4ab14d7c59b8709dc133e.tar.gz
[SV 63856] Fix pruning of double-colon rules
Given this setup: $ cat Makefile A::; @echo A-1 && sleep 1 && echo A-1 done A::; @echo A-2 && sleep 1 && echo A-2 done A::; @echo A-3 && sleep 1 && echo A-3 done B::; @echo B-1 && sleep 1 && echo B-1 done B::; @echo B-2 && sleep 1 && echo B-2 done B::; @echo B-3 && sleep 1 && echo B-3 done $ make -j8 A .WAIT B All recipes for A should be started sequentially and complete before any recipe for B is started, then all recipes for B should be started sequentially. This wasn't happening because the double-colon target was getting pruned too early. * src/remake.c (update_file): Don't prune a target if it's a double colon rule which is complete, but there are other recipes to run for this target: we want those other recipes to be run first. * tests/scripts/targets/WAIT: Test .WAIT with double colon rules.
Diffstat (limited to 'src')
-rw-r--r--src/remake.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/remake.c b/src/remake.c
index dec4667c..bdf78b3e 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -373,9 +373,15 @@ update_file (struct file *file, unsigned int depth)
{
/* Check for the case where a target has been tried and failed but
the diagnostics haven't been issued. If we need the diagnostics
- then we will have to continue. */
+ then we will have to continue.
+ In the case of double colon rules, this file cannot be pruned if
+ this recipe finished (file->command_state == cs_finished) and there
+ are more double colon rules for this file. Instead the recipe of the
+ next double colon rule of this file should be run. */
if (!(f->updated && f->update_status > us_none
- && !f->dontcare && f->no_diag))
+ && !f->dontcare && f->no_diag)
+ && !(file->double_colon && file->command_state == cs_finished &&
+ f->prev))
{
DBF (DB_VERBOSE, _("Pruning file '%s'.\n"));
return f->command_state == cs_finished ? f->update_status : us_success;