Sample Header Ad - 728x90

How to get multiple pattern rule %/$* variables in a Makefile?

2 votes
1 answer
200 views
All we get in Makefiles is just one %/$* [pattern rule](https://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html#Pattern-Rules) pair.
$ cat Makefile
%.bla:; echo $*
$ make -s m.bla
m
How shortsighted of our Unix™ fathers.
How can I achieve something like %{0}.%{1}.bla that will give me
$ make -s a.b.bla
a b
Sure, one could use $(basename), $(suffix), $(subst), but I'm talking about two actual independent $*-like variables.
Asked by Dan Jacobson (560 rep)
Jun 30, 2025, 08:13 AM
Last activity: Jul 1, 2025, 08:19 PM