On Tue, 2014-02-18 at 02:14 -0800, Rakesh Sharma wrote: > What's going on here? Apparently, the construct $(macro) picks up the > $1/$2/... values from the macro in which it was placed. However, the > construct $(call macro) picks up the $1/$2 ... values from its' own > argument list. And, that is also why when we write $(macro,,) this > seems to rid the problem of the unintentional grabbing of the parent > macro's arguments.
This is definitely correct behavior. When make sees $(call foo), that's an invocation of the user-defined function "foo". In preparation for calling that user-defined function, make will bind the special argument variables $1, $2, etc. to the arguments to the user-defined function. Here there are no arguments given in this invocation, so they are all bound to the empty value. When make sees $(foo) that's a straightforward expansion of the macro named "foo". No special operations are involved, it just looks up the macro named "foo", expands (or not, if "foo" is simple) the value, and uses the result. There's no special handling of $1, etc. As for "$(foo,,)", that's expanding the variable named, literally, "foo,,". Since that variable likely doesn't exist this will always expand to the empty string (unless you defined it of course). _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
