[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Performance loss when trying to use grouped targets
From: |
Stephen Touset |
Subject: |
Re: Performance loss when trying to use grouped targets |
Date: |
Tue, 5 Mar 2024 21:40:48 +0100 |
On Mar 5, 2024 at 10:06:44, Paul Smith <psmith@gnu.org> wrote:
On Mon, 2024-03-04 at 21:01 -0500, Dmitry Goncharov wrote:
>
> A grouped targets rule like
>>
> a.x b.x &: a.q b.q; cp a.q b.q build/
>>
> tells make that a.x depends on a.q and b.q and b.x depends on a.q and
>>
> b.q. Which is not "each file depends on its corresponding file".
>
>
> The above grouped rule is the same as
>
> a.x: a.q b.q; cp a.q b.q build/
>
> b.x: a.q b.q; cp a.q b.q build/
>
>
> (There must be more to this recipe than that since these recipes don't
> actually build the targets a.x or b.x. I'm assuming you meant each
> recipe to create both a.x and b.x.)
>
> These two formulations are not really the same: grouped targets work
> differently and can't be replaced with an expanded version. A grouped
> target:
>
> a.x b.x &: a.q b.q ; <cmd>
>
> can only be emulated by something like this:
>
> a.x b.x : .sentinel ;
>
> .sentinel : a.q b.q ; <cmd> ; touch $@
>
>
>
>
>