help-make
[Top][All Lists]
Advanced

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

Re: ignore errors on specific command


From: David Boyce
Subject: Re: ignore errors on specific command
Date: Wed, 31 Mar 2010 07:17:16 -0400

On Wed, Mar 31, 2010 at 7:03 AM, Payal <address@hidden> wrote:
> On the same line how do I turn OFF echoing of cmd2 and cmd3 only.

Impossible. It's important to understand the boundary between make and
the shell, which can cause a great deal of confusion. Make does not
see this line as a sequence of 3 commands; it sees it as, well, a
line. Make has no understanding of the semantics of the text, or even
what language it's written in. It simply passes the line to the shell,
which does all the processing. You can tell make to echo all or
nothing but the rest is up to the shell. And the shell is not capable
of doing this either, though it's possible to fake it via

        @echo "cmd1 && cmd3"; cmd1 && cmd2 && cmd3

This may seem inconsistent with my previous response but that's
because the shell supports a -e flag which says "exit on any command
failure". POSIX says that make must behave as if it had passed -e to
the shell, which in almost all cases means the same as actually
passing -e to the shell. So this is an area where make can have some
effect on the behavior of the shell, but that's about the limit.

> So, to ignore errors from cmd3, I have to do,
>
>     cmd1 ; cmd2 ; cmd3 || true
>
> right?

Yes, modulo the discussion about ':'. Again, note that this is not a
make issue; the same would apply if you were running the command line
at a shell prompt.

David Boyce




reply via email to

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