help-make
[Top][All Lists]
Advanced

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

Re: "last" target?


From: Herta Van den Eynde
Subject: Re: "last" target?
Date: Wed, 26 Nov 2008 00:35:29 +0100



2008/11/25 Philip Guenther <address@hidden>
On Tue, Nov 25, 2008 at 6:16 AM, Herta Van den Eynde
<address@hidden> wrote:
> I have a makefile with multiple targets, some of which are prerequisites to
> others, but whichever the user chooses to execute, I always want the
> "cleanup" target to be triggered as the last set of actions.
>
> Is there any way to enforce that?

Without altering the other targets in the makefile?  No.  It sounds
like you're looking for the BSD make ".END" target, but GNU make
doesn't have that.  The closest solution I see with GNU make would be
to rename the makefile to "makefile.real" and then put this in
"makefile":
    all:
            @$(MAKE) -f makefile.real $(MAKECMDGOALS); \
                ret=$$?; stuff-to-always-do-even-if-make-fails; exit $$ret
            stuff-to-do-afterwards-on-success-only
    .PHONY: all

That, or fix this in the thing that calls make.


Philip Guenther

Not the answer I was hoping for, but at least I know to stop looking.

Thanks, Philip.

Kind regards,

Herta

--
"Life on Earth may be expensive,
but it comes with a free ride around the Sun."

reply via email to

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