[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #54854] multi-target rules invoked too often with -j2
From: |
Paul D. Smith |
Subject: |
[bug #54854] multi-target rules invoked too often with -j2 |
Date: |
Wed, 17 Oct 2018 09:19:36 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0 |
Update of bug #54854 (project make):
Status: None => Not A Bug
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
This is not a bug, this is how every version of make has always worked, since
make was invented.
Your reproducer is not really minimal :). Here's a minimal reproducer:
all: foo.1 bar.1 biz.1
foo.1 bar.1 biz.1: ; touch foo.1 bar.1 biz.1
When you write a rule with three targets that's exactly the same thing as
writing three separate rules; see
https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html :
all: foo.1 bar.1 biz.1
foo.1: ; touch foo.1 bar.1 biz.1
bar.1: ; touch foo.1 bar.1 biz.1
baz.1: ; touch foo.1 bar.1 biz.1
If you run in parallel make will run all of these rules at the same time. It
has no way of knowing that one of these recipes will build all three targets.
If you run serially than make still would consider running all recipes, except
that it sees that the other targets have been updated after the first one is
complete by looking at the modification times.
You can solve this problem by using pattern rules:
all: foo.1 bar.1 biz.1
foo.% bar.% baz.%: ; touch foo.1 bar.1 biz.1
because the way make treats pattern rules with multiple targets is different:
see https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html
Or you can rewrite your rules to build one target per invocation rather than
building lots of targets at once: this is how make was designed to work.
If you'd like to discuss further please open a thread at the address@hidden
or address@hidden mailing lists.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54854>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/