Ah, but make is smarter than that. Take for example this makefile:

myprog.sh :
        echo "#!/bin/sh" > $@
        sleep 3
        echo "echo Hello World!" >> $@
        echo >> $@
        chmod a+x $@

If you press ctrl-c during the sleep, then make will remove the half baked 
myprog.sh
and print: ^Cmake: *** Deleting file `myprog.sh'
make: *** [myprog.sh] Interrupt

However if you have an error in you recipe, for example add "cat not_there >> 
$@" at the end
of the recipe, then make will let the half baked  myprog.sh remain. But 
makefile execution
will of course terminate.

Thus if you have a recipe that will most likely not fail, then you should rely 
on make to do the
cleanup. If you have potential failures during a sequence of commands that 
construct the goal, 
then the tmp trick can be used.

//Fredrik

28 nov 2012 kl. 12:05 skrev Erik Joelsson:

> In this case it's rather to protect against unfortunately timed ctrl-c or 
> other external interruptions.
> 
> /Erik
> 
> On 2012-11-28 09:26, Fredrik Öhrström wrote:
>> Looks ok. However the practice of using $@.tmp is unnecessary if there
>> is no reasonable risk of failure in the recipe.
>> 
>> //Fredrik
>> 
>> 2012/11/26 Erik Joelsson<erik.joels...@oracle.com>:
>>> This patch converts 7197071 to the new build-system.
>>> 
>>> http://cr.openjdk.java.net/~erikj/8003482/webrev.jdk.01/
>>> 
>>> /Erik

Reply via email to