[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: commenting a *make* directive that is a *shell* command
From: |
Greg Chicares |
Subject: |
Re: commenting a *make* directive that is a *shell* command |
Date: |
Mon, 13 Feb 2006 15:47:56 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
On 2006-2-13 13:50 UTC, Robert P. J. Day wrote:
>
> all:
> # $(warning whatever)
>
> that command above has a leading tab so, according to the docs, it
> should be treated as a shell command. but it's clearly the make
> warning built-in and, even with that "#", it's processed by make as a
> warning. why?
The manual says this of $(error):
| Note that the error is generated whenever this function is evaluated.
| So, if you put it inside a command script or on the right side of a
| recursive variable assignment, it won't be evaluated until later.
| The text will be expanded before the error is generated.
and $(warning) works the same way.
Make needs to pass the command
# $(warning whatever)
to the shell; when it does so, it evaluates '$(warning whatever)'.
Make doesn't require that the shell interpret a command beginning
with '#' as a comment. The manual says:
| `#' in a line of a makefile starts a comment. [...but...]
| Within a command script (if the line begins with a TAB character)
| the entire line is passed to the shell, just as with any other line
| that begins with a TAB. The shell decides how to interpret the text:
| whether or not this is a comment is up to the shell.
> if i remove that leading tab, then, of course, it's commented out
> and does what i would have expected. so what's happening above?
In that case, it's not a shell command that happens to begin with '#';
it's a make comment.