On Wed, Jul 05, 2017 at 01:25:59PM -0700, Philip Guenther wrote:
> On Wed, 5 Jul 2017, Marc Espie wrote:
> > This is a very slight deviation from posix rules, but not in spirit. My 
> > interpretation is that posix rules describe the intent of the make rules 
> > (produce a file in such a way), but don't really care about intermediate 
> > names.
> ...
> >  .l.c:
> > -   ${LEX.l} ${.IMPSRC}
> > -   mv lex.yy.c ${.TARGET}
> > +   ${LEX.l} -o ${.TARGET} ${.IMPSRC}
> 
> Only concern I would have is whether an up-to-date-but-broken .c file 
> would be left behind if lex fails after creating the file, resulting in 
> the next build thinking it doesn't need to run lex (and then doing the 
> Wrong Thing with the broken file).
> 
> Will lex remove the bogus output file if it fails?  (That's a benefit to 
> using "-o $@" and _not_ ">$@", as the former gives lex the name of the 
> file so it can cleanup on failure.)
> 
> (The current rule of course doesn't have this issue because the broken 
> file left behind would be the intermediate and not the actual target.)

If necessary, || rm -f ${.TARGET}
will deal with this.

Reply via email to