[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Bob Proulx
Subject: Re: .DELETE_ON_ERROR ?
Date: Tue, 10 May 2005 22:29:58 -0600
User-agent: Mutt/1.5.9i

Stepan Kasal wrote:
> contains:
> foo.h: foo.x
>       $(GENERATOR) foo.x >foo.h
> But the GENERATOR command failed and I have empty foo.h.

Yes, because the shell redirection creates the file instead of the

> It would be nice if make deleted foo.h automatically, but this is not the
> historical practice.  GNU make enables you to change its behaviour by
> mentioning a target:
> Could Automake possibly add this target to all generated's?

Is your goal to limit the amount of editing you need to
do?  Because it would seem that it would be easy for you to add that
target to the makefile yourself since you are already adding the
generator lines.

How much control of the generator do you have?  You could make it a
wrapper for the real generator.  Have it delete the target on error.

If you modify your you can use a stanza like this to
detect the error and to remove the file in this particular case.  Then
pass an error up to make on the way out.

  foo.h: foo.x
        $(GENERATOR) foo.x >foo.h || { rm -f foo.h ; exit 1 ;}

> I understand that the problem is that we want to write portable Makefiles.
> OTOH, this change doesn't prevent build from scratch with non-GNU makes.
> And most developers use GNU make, and this change can help them with their
> work.

The example above is portable to non-gnu make.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]