help-make
[Top][All Lists]
Advanced

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

Match anything pattern rules and pattern rules- help with understanding


From: Bartłomiej Wójcik
Subject: Match anything pattern rules and pattern rules- help with understanding
Date: Mon, 29 May 2023 00:52:14 +0200

Hello,
As a developer, I am trying to get the idea of GNU make as deep as
possible. I am stuck for a while with the topic of pattern rules and match
anything pattern rules, the part of documentation that is related with that
is not to clear for me.

About match anything pattern rules:
- what is the application of that rules?
- what to avoid while using it? I would also appreciate any kind of
informations that I have to know about that topic, and maybe any kind of up
to date examples.

About pattern rules:
Documentation says "When the target pattern does not contain a slash (and
it usually does not), directory names in the file names are removed from
the file name before it is compared with the target prefix and suffix.
After the comparison of the file name to the target pattern, the directory
names, along with the slash that ends them, are added on to the
prerequisite file names generated from the pattern rule’s prerequisite
patterns and the file name. The directories are ignored only for the
purpose of finding an implicit rule to use, not in the application of that
rule. Thus, ‘e%t’ matches the file name src/eat, with ‘src/a’ as the stem.
When prerequisites are turned into file names, the directories from the
stem are added at the front, while the rest of the stem is substituted for
the ‘%’. The stem ‘src/a’ with a prerequisite pattern ‘c%r’ gives the file
name src/car."

What does mean, that "directory names in the file names are removed"? Maybe
it is about the definition of file name that the file name is in fact built
also with the path? I am not able also to catch that part:
"After the comparison of the file name to the target pattern, the directory
names, along with the slash that ends them, are added on to the
prerequisite file names generated from the pattern rule’s prerequisite
patterns and the file name."

I would appreciate any kind of explanation.

BR,
Bartek


reply via email to

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