Re: [PATCH] Don't write directly to a make target ($@).
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 25, 2006, 16:28 UTC
- Message-ID
- <7vejyixe5g.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <87hd3e5ixw.fsf@rho.meyering.net>
Jim Meyering <jim@meyering.net> 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.
Show 8 quoted lines
> @@ -496,37 +496,43 @@ builtin-help.o: common-cmds.h > rm -f $@ && ln git$X $@ > > common-cmds.h: Documentation/git-*.txt > - ./generate-cmdlist.sh > $@ > + ./generate-cmdlist.sh > t$@ > + mv t$@ $@ >
IOW, like this:
common-cmds.h: Documentation/git-*.txt
rm -f $@+ $@
./generate-cmdlist.sh > $@+
mv $@+ $@clean:: rm -f *+