help-make
[Top][All Lists]
Advanced

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

Re: Make eating all @ at the beginning of command line


From: Paul Smith
Subject: Re: Make eating all @ at the beginning of command line
Date: Mon, 15 Nov 2010 08:16:37 -0500

On Mon, 2010-11-15 at 12:25 +0000, Krzysztof Cieniuch wrote:
> make is eating all @ characters when silencing command line
> e.g.
> foo: bar
>     @echo "do foo"
>     @@echo "do foo"
>     @@@echo "do foo"
>     touch foo
> 
> It doesn't matter how many @ you put up front. In above example all echo 
> commands will be passed to shell without preceding @. Is this a bug or 
> feature ;-)

This is intended behavior.  The POSIX spec for make is slightly
ambiguous about this but it does say:

        An execution line is built from the command line by removing ANY
        prefix characters.

(emphasis mine).  GNU make does it this way so that if you write
something like:

        COMMAND = @echo hi
        all: ; @$(COMMAND)

it works rather than giving a syntax error.  I'm sure that many
makefiles rely on this behavior whether they know it or not.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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