Re: clarifications about “10.8 Implicit Rule Searc h Algorithm.”

Dmitry Goncharov <[email protected]> Tue, 21 Oct 2025 00:35:11 -0400
Newsgroups gmane.comp.gnu.make.general
Message-ID <CAG+Z0CvCtjeLJPBQdVDK1Zq0e9ZC8PgkidiH5NYFCgNS5tt29w@mail.gmail.com>
On Mon, Oct 20, 2025 at 3:57=E2=80=AFPM Dmitry <[email protected]> wrote=
:
> > At that point make calls pattern_search recursively to find a rule to b=
uild 'aaa'.
> So now our new target is=E2=80=AF=E2=80=98aaa=E2=80=99, and we must start=
 searching implicit
> rules from the beginning.

Make is still working on figuring out whether rule '%.o: aaa' is
suitable to build foo.o.
This recursive call is needed to find if there is a rule to build
prerequisite 'aaa'.
Rule '%.o: aaa' itself cannot be used for the reasons explained in the
chained rules chapter.

> We take the pattern rule=E2=80=AF=E2=80=98%.o=E2=80=AF:=E2=80=AFaaa=E2=80=
=99=E2=80=AFand discard it not because of
> recursion, but because its target=E2=80=AF=E2=80=98%.o=E2=80=99=E2=80=AFd=
oesn=E2=80=99t match=E2=80=AF=E2=80=98aaa=E2=80=99.

Who deceived you like that?
Make discards rule '%.o: aaa', because this rule is already in use in
this chain.

> And the message =E2=80=9CAvoiding implicit rule recursion for rule '%.o:=
=E2=80=AFaaa'=E2=80=9D
> doesn=E2=80=99t appear at all.

Make indeed prints "Avoiding implicit rule recursion for rule '%.o: aaa'."
The output, that you yourself posted a couple of emails ago, has this line.
Which makes me puzzled why you say this message does not appear.

> Where am I missing the point?

This rule-is-already-in-use check (that accompanies " Avoiding
implicit rule recursion for rule...")
takes place before checking whether a rule matches the target.
It is cheaper to check rule-is-already-in-use than to figure out if a
rule matches.

regards, Dmitry