help-make
[Top][All Lists]
Advanced

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

Re: comma can be used in the text of an argument or not?


From: Paul Smith
Subject: Re: comma can be used in the text of an argument or not?
Date: Sat, 30 Apr 2011 08:55:30 -0400

On Sat, 2011-04-30 at 15:52 +0430, ali hagigat wrote:
> 8.1 Function Call Syntax
> Commas and unmatched parentheses or braces cannot appear in the text
> of an argument  written;
> -------------------
> all: ;
> var1=$(subst this,that,this is  a,      text)
> $(warning $(var1))   
> makefile28:3: that is  a,      text
> make: `all' is up to date.
> --------------------
> Why  "," was used successfully then?

The algorithm make uses to parse function arguments, for a function
expecting N arguments, is:
Break up the text after the function name on comma characters, until you
have N arguments (so, the first N-1 commas).
Everything after the N-1'th comma is considered the last argument.

Once that's done, the function will proceed with expanding the arguments
(or not, depending on the function definition).

For functions which have no specific number of arguments (such as call),
then N is essentially infinite (every comma serves as an argument
delimiter)

-- 
-------------------------------------------------------------------------------
 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]