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 $@