On Tue, Nov 25, 2008 at 6:16 AM, Herta Van den Eynde
<[EMAIL PROTECTED]> 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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to