help-make
[Top][All Lists]
Advanced

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

Re: "last" target?


From: Philip Guenther
Subject: Re: "last" target?
Date: Tue, 25 Nov 2008 13:19:37 -0800

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




reply via email to

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