Re: Hot to write pattern rules for suffix deletion

Stephen Touset <[email protected]> Sun, 28 Jan 2024 17:54:50 -0500
Newsgroups gmane.comp.gnu.make.general
Message-ID <CAEpzeb-gyWOLEifWRonSLQXX+TU15m3iRJZuxiOAeeXE+F3kag@mail.gmail.com>
On Jan 4, 2024 at 23:50:44, Philip Guenther <[email protected]> wrote:

> On Thu, Jan 4, 2024 at 8:51 PM Stephen Touset <[email protected]> wrote:
>
>>
>>     %: %.envsubst
>>         envsubst < $< > $@
>>
>> Obviously this rule isn't correct.
>
>
> Can you explain why you don't believe that to be correct?  Given that a
> pattern rule only applies when the prerequisites either exist or make knows
> how to create them, why wouldn't that work?
>

You were 100% right. I thought this wouldn’t work since it would create a
rule for every possible target, but make does the right thing here as you
pointed out and *only* matches this pattern when the prerequisite exists.

Thanks!

-- 
Stephen Touset <[email protected]>