Re: multiple percent signs in single prerequisite - revisited

Paul Smith <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Organization GNU's Not UNIX!
Message-ID <[email protected]>
On Tue, 2022-07-19 at 08:44 +0200, Peter Apian-Bennewitz wrote:
> A rule like
> 
>       %.mp4: %/%.mov
> or
>      %.mp4: foo_%_%.bar
> 
> substitutes only the first % while looking for matching
> prerequisites. - why ?

Because that's the way it was implemented, and documented, and that's
the way it's always worked...

I know of no reason other than that's how Roland (or RMS?  Not sure who
created pattern rules back in the day) did it.  At this point there
would be a backward-compatibility problem with trying to change it.

You can get around this if you use secondary expansion[1] capabilities:

  .SECONDEXPANSION:

  %.mp4: $$*/$$*/mov

or

  %.mp4: foo_$$*_$$*.bar



[1] https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html
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.