Feature/Enhancement Request: More flexible pattern prereqs for .PRECIOUS

[email protected] Sun, 28 Dec 2025 23:40:26 +0000
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <Rwr59OJibI8cCzm6TrB9UPgDX0AwUsW_O4LCeYS7Qv300J585kky7NIs_VWWPqNggoQmgSYT_mrMcvZ8-9WArWjYUBGm0eREoHrvgmi29BE=@protonmail.com>
Greetings,

I was confused by the behavior of the following Makefile:
somedata-%.txt:
xxd /dev/urandom | head -30 > $@

final-%.txt: somedata-%.txt
wc $< > $@
.PRECIOUS: somedata-%

Despite my expectations, make deletes somedata-foo.txt:
$ make -f mwe.mk final-foo.txt
xxd /dev/urandom | head -30 > somedata-foo.txt
wc somedata-foo.txt > final-foo.txtrm somedata-foo.txt

I found that changing the last line to ".PRECIOUS: somedata-%.txt" gives me what I want, and that this matches the behavior described in the documentation. However, I think this behavior is a bit inconvenient, and was curious if this could be changed. I think it would be useful to list more generic .PRECIOUS prerequisite patterns. No idea what the downsides or back-compatibility of this feature would be though, so I'm interested to hear maintainers' thoughts.

Thank you for your time.