Re: [PATCH] Don't write directly to a make target ($@).
From: Jim Meyering <hidden>
Date: 2016-06-15 22:42:27
Junio C Hamano [off-list ref] wrote:
Jim Meyering [off-list ref] writes:quoted
Otherwise, if make is suspended, or killed with prejudice, or if the system crashes, you could be left with an up-to-date, yet corrupt, generated file.Thanks. Maybe you would want a "make clean" target for them too if you do this. I often use $@+ instead of t$@ so that I can say "rm -f *+" there.
I chose a prefix rather than a suffix, so that if git is built on a file system with unreasonable file name length limitations, the prefix will distinguish the temporary from the target; in that situation, a suffixed temporary name could map to the target name. However, assuming reasonable file name length limits, using a suffix is generally better, since it works even when the target is an absolute name. Adding a prefix obviously won't work with an absolute name. I'm happy to ignore 14-byte(and 8.3)-limited file systems and go with a suffix, if you still prefer that. New patch coming up.