On Fri, 2024-06-28 at 17:53 +0900, Masahiro Yamada wrote: > So, I started to think that > this is not so useful because I do not see consistency > between "pattern rules" and "static pattern rule".
"Static pattern rules" are confusingly named because they have nothing to do with pattern rules. They just use "%" for matching. A pattern rule creates one implicit rule for make, and an implicit rule is a template that says, "IF you want to build a target that matches this pattern, and there's no explicit rule to create it, and all its prerequisites either exist or can be built, THEN you can use this recipe to do it". Implicit rules have lots of extra capabilities and behaviors. A static pattern rule creates a set of explicit rules, for each target. Explicit rules are simple and well-defined without much in the way of extra behaviors. The pattern match/replace is very simple: just the way that the $(patsubst ...) function works. That is, this: foo.x bar.x baz.x : %.x : ; @echo $@ is identical to, and stored internally by make as, writing this: foo.x : ; @echo $@ bar.x : ; @echo $@ baz.x : ; @echo $@ You're correct that the fancy behavior regarding directories is not part of the behavior of static pattern rules. Pattern rules and static pattern rules are two very different features, that do different things, but have an unfortunate overlap in their names. I do not agree with your conclusion that, because they don't have the same behavior in this way, they are "not so useful". They are each useful for their own intended purpose. -- Paul D. Smith <psm...@gnu.org> Find some GNU Make tips at: https://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist