Unix Programming - make: cleanup on exit/interrupt?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2007 > make: cleanup on exit/interrupt?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author make: cleanup on exit/interrupt?
Markus Dehmann

2007-06-26, 7:17 am

For Makefiles, is there a special target that will be executed
whenever make is interrupted, killed or the likes? Or, whenever it
exits?

I often create a temp directory in my Makefile:
TMPDIR := $(shell mktemp -d /tmp.XXXXXXX)
but I don't see a clean and reliable way to *remove* that temp
directory, especially if make fails or is interrupted.

Thanks,
Markus

Maxim Yegorushkin

2007-06-28, 7:28 am

On 26 Jun, 11:50, Markus Dehmann <markus.dehm...@gmail.com> wrote:

> For Makefiles, is there a special target that will be executed
> whenever make is interrupted, killed or the likes? Or, whenever it
> exits?


There are. Please see http://www.gnu.org/software/make/ma...Special-Targets

Markus Dehmann

2007-06-29, 1:22 pm

On Jun 28, 6:34 am, Maxim Yegorushkin <maxim.yegorush...@gmail.com>
wrote:
> On 26 Jun, 11:50, Markus Dehmann <markus.dehm...@gmail.com> wrote:
>
>
> There are. Please seehttp://www.gnu.org/software/make/manual/make.html.gz#Special-Targets


I don't find any special target there that would be executed when make
is interrupted.

There is a link "Interrupting or Killing make" (http://www.gnu.org/
software/make/manual/make.html.gz#Interrupts), but there it just
explains that an interrupt (e.g. Ctrl-C) will have the effect that the
target that is currently built will be removed. But what I want is
that my TMPDIR gets removed, so it would need some special INTERRUPT
target. I guess I could work around it by writing a wrapper around
make, but I think such a target should be in make in the first place.

--Markus

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com