%% "Robert P. J. Day" <[EMAIL PROTECTED]> writes: rpjd> just want to clarify a simple point about calling make "macros". rpjd> as i read in the ORA make book, if you define a "macro" that rpjd> takes no args, you can invoke it with
rpjd> $(macro-name) rpjd> if, however, it takes args, you need to use rpjd> $(call macro-name,args ...) rpjd> the book is not completely clear on this point but, if the macro rpjd> takes no args, is it entirely equivalent to invoke it with rpjd> "call", even though that's unnecessary? If a user-defined function "takes no arguments" then it's not a user-defined function. What is the difference between a normal variable and a "function that takes no arguments"? If there are no arguments, then it's just a normal variable and it's just expanded normally. However, you're correct that in the special case where call is invoked and not passed any arguments, the variable is simply expanded. So, saying "$(call FOO)" is exactly identically equivalent to saying "$(FOO)" (except a tiny bit slower). The GNU make manual doesn't use the term "macro" almost anywhere. Here are a few bits from the manual that you might have missed: > A "variable" is a name defined in a makefile to represent a string of > text, called the variable's "value". These values are substituted by > explicit request into targets, prerequisites, commands, and other parts > of the makefile. (In some other versions of `make', variables are > called "macros".) And: > The `call' function is unique in that it can be used to create new > parameterized functions. You can write a complex expression as the > value of a variable, then use `call' to expand it with different values. > > The syntax of the `call' function is: > > $(call VARIABLE,PARAM,PARAM,...) > > When `make' expands this function, it assigns each PARAM to > temporary variables `$(1)', `$(2)', etc. The variable `$(0)' will > contain VARIABLE. There is no maximum number of parameter arguments. > There is no minimum, either, but it doesn't make sense to use `call' > with no parameters. The last sentence is not elaborated on, but see above. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> 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 _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
