[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #60165] Multiple pattern rules with single rule

From: Jean-Baptiste Poittevin
Subject: Re: [bug #60165] Multiple pattern rules with single rule
Date: Tue, 19 Jul 2022 20:26:55 +0200

M. Smith,

Le 2022-07-19 14:00:59, Paul D. Smith a écrit :
> Follow-up Comment #1, bug #60165 (project make):
> The attached patch (if I understand it correctly) will break the large
> majority of makefiles that use pattern rules today, including even some
> built-in rules in GNU make.  It's clearly a non-starter from a
> backward-compatibility standpoint.
> We implemented "&:" for explicit rules, to allow them to declare grouped
> targets: multiple targets generated by a single invocation of the recipe (this
> is how pattern rules ":") work.
> We need to finish this by allowing a single definition of a pattern rule to
> create "exploded" rules: multiple pattern rules (the way explicit rules with
> ":" work).  But as above, we definitely can't do that by just changing the way
> pattern rules with ":" work.

I understand your position on historical ':' behaviour, although some of it
can be quite surprising.

Here is the situation which made me think that the behaviour was not intended :

$ cat Makefile
all: af bf

a% b%: %
        cp $< $@

        touch $@

$ make
touch f
cp f af

$ make
cp f bf

$ make
make: rien à faire pour « all ».

For the proposed patch, I think it would at worst build targets it wasn’t
building before on first run. The overriden rules could also change behaviour,
as the match should be exact for an override to occur.

> Back when "&:" was suggested I had proposed using "|:" as a separator that
> means that one rule is created for each target.  That is, if you use "&:"
> (with any type of rule) you get grouped behavior.  If you use "|:" (with any
> type of rule) you get exploded behavior.  And if you use ":" without a
> specifier you get the "historical" behavior (exploded with explicit rules and
> grouped with pattern rules).

I can give a try at "|:", now that the first dive in make source code was made.

Jean-Baptiste Poittevin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]