mån 2010-04-19 klockan 23:25 +0000 skrev Amos Jeffries:
> >> - $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
> >> $(RM) -f $@ && exit 1
> >> + $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ ||
> >> $(RM) -f $@
> >
> > Why?
> >
>
> I had bound the exit(1) to success of the rm command, not failure of the
> awk. When we get time to sort out the shell nesting of automake it needs to
> be added back in to ensure the make runs exit on awk failure.
Sure you had.
awk ok -> SUCCESS
awk fail -> rm
rm fail -> FAILURE
rm ok -> exit 1 == FAILURE
exit in this context is just to make the shell command return an error
so make stops. rm failing is in itself an error and no explicit exit
with an error is needed in that case. If you absolutely want exit to be
called in both cases then group rm & exit
$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || ($(RM) -f $@ ;exit 1)
but I prefer your original
$(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || $(RM) -f $@ && exit 1
the effect of both is the same, and your original is both clearer and more efficient.
Regards
Henrik
Received on Wed Apr 21 2010 - 21:09:53 MDT
This archive was generated by hypermail 2.2.0 : Thu Apr 22 2010 - 12:00:08 MDT