From: Jim Meyering Date: Thu, 25 May 2006 16:42:28 GMT Subject: Re: [PATCH] Don't write directly to a make target ($@). Message-ID: <871wui5a4r.fsf@rho.meyering.net> In-Reply-To: <7vejyixe5g.fsf@assigned-by-dhcp.cox.net> Junio C Hamano wrote: > Jim Meyering writes: > >> 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.