Re: Multiple rules for same target: what is the order of prerequisites in $^ and what does $< expand to?

Philip Guenther <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <CAKKmsNi=jdf_yeCviPv0_Q9YjfjSLO1GJECYei57k37pVhhqoQ@mail.gmail.com>
On Wed, Sep 27, 2023 at 7:52 AM Renaud Pacalet <
[email protected]> wrote:

> On 9/27/23 16:32, Bahman Movaqar wrote:
> > On Wed, 2023-09-27 at 12:16 +0200, Renaud Pacalet wrote:
> >
> >> 3. Ignore all other implicit rules (which seems to contradict 4.11).
> >
> > Make only ignores the implicit rules for which there are
> > explicit/static equivalents.
>

Per 10.1 "Using Implicit Rules", make will only use an implicit rule for a
target if there isn't an explicit rule with a recipe.  If a target has an
explicit rule with a recipe, then make won't bother looking for
implicit rules and so won't use them to add more prerequisites.

Note that there are additional requirements on what implicit rules will be
used even when they are considered: if they have a prerequisite that
doesn't exist and make doesn't see how to build, then it'll ignore the rule.


Thanks for your answer, Bahman. Not sure what "equivalent" means but with
> the following Makefile:
>
> %.a: %.b
>
> a.a: a.c
>      echo $^
>

a.a has an explicit rule with a recipe so the %.a:%.b rule has no effect on
the a.a target.


Philip Guenther
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.