git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Don't write directly to a make target ($@).

From
THTimo Hirvonen <tihirvon@gmail.com>
Date
May 25, 2006, 16:41 UTC
Message-ID
<20060525194125.9380842a.tihirvon@gmail.com>
In-Reply-To
<7vejyixe5g.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 28 quoted lines
> 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.
> 
> > @@ -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 *+
Or just use one tmp file, i.e. ".tmp" instead of t$@.
-- 
http://onion.dynserv.net/~timo/
Previous: Junio C HamanoNext: Jim Meyering
Message 3 of 6 in “Don't write directly to a make target ($@).”
  1. Don't write directly to a make target ($@).Jim Meyering, May 25, 2006
  2. Junio C HamanoMay 25, 2006
  3. Timo HirvonenMay 25, 2006
  4. Jim MeyeringMay 25, 2006
  5. Jim MeyeringMay 25, 2006
  6. Jim MeyeringMay 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.