help-make
[Top][All Lists]
Advanced

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

Re: Trapping failed commands


From: Jason Pearce
Subject: Re: Trapping failed commands
Date: Wed, 02 Feb 2005 08:26:55 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910

Or you can let Make handle it all with no reliance on shells at all.

http://www.gnu.org/software/make/manual/html_chapter/make_5.html#SEC56


To ignore errors in a command line, write a `-' at the beginning of the line's text (after the initial tab). The `-' is discarded before the command is passed to the shell for execution.

For example,

clean:
       -rm -f *.o



David Boyce wrote:

At 09:27 PM 2/1/2005, Paul D. Smith wrote:

%% address@hidden (Vite Schnell) writes:

  vs> I'm trying to prevent Make from exiting upon receiving a non-zero
  vs> exit status value from a command.  Is there any way I can "trap" a
  vs> failure in order to keep processing other targets?

foo:
      command || true


I prefer to save a fork/exec and also remove an unnecessary dependence on PATH:

foo:
        command ||:

Of course there are some shells for which "true" is a builtin but ":" has been one since the beginning of time.

-dsb



_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make






reply via email to

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