bug-make
[Top][All Lists]
Advanced

[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 21:00:23 +0200

Le 2022-07-19 14:52:40, Paul Smith a écrit :
> On Tue, 2022-07-19 at 20:26 +0200, Jean-Baptiste Poittevin wrote:
> > a% b%: %
> >         cp $< $@
> 
> This rule is not well-formed.  By declaring two patterns as targets,
> you are telling make that your recipe will build both targets after
> successfully being invoked one time.
> 
> If your recipe doesn't actually do that, there's not much make can do
> about it, and you'll get unexpected behavior such as what you saw.
> 
> See
> https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html
> at the bottom, which references
> https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html

Well, allow me to cite the documentation linked :

(context is explicit rule)

« Rules that use the standard target separator, :, define independent targets.
This is equivalent to writing the same rule once for each target, with
duplicated prerequisites and recipes. Typically, the recipe would use automatic
variables such as ‘$@’ to specify which target is being built. »

This is a behaviour which seems reasonable to me, sufficiently consistent for
me to try to implement it. It is somehow sad that the same rule is not
applicable for pattern rules, although syntax is very similar.



reply via email to

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