help-make
[Top][All Lists]
Advanced

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

Re: commenting a *make* directive that is a *shell* command


From: Paul D. Smith
Subject: Re: commenting a *make* directive that is a *shell* command
Date: Mon, 13 Feb 2006 10:55:49 -0500

%% "Robert P. J. Day" <address@hidden> writes:

  rpjd> all:
  rpjd>         # $(warning whatever)

  rpjd> that command above has a leading tab so, according to the docs,
  rpjd> it should be treated as a shell command.  but it's clearly the
  rpjd> make warning built-in and, even with that "#", it's processed by
  rpjd> make as a warning.  why?

Just like any other command: when make sees it needs to invoke the
command line it first expands it, then it sends the result of the
expansion to the shell.

In this case, the act of expanding the string causes the warning to fire
and print the warning (since that's what the warning function does).
The result of expanding the $(warning ...) function is the empty string,
so the string "# " is first printed by make (since you don't prefix the
line by "@"), then it is passed to the shell for execution.  The shell
sees this as a comment (in most shells anyway) and doesn't do anything.


Hope this makes things more clear.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]