* Value Function:: Return the un-expanded value of a variable.
* Eval Function:: Evaluate the arguments as makefile syntax.
* Origin Function:: Find where a variable got its value.
+* Flavor Function:: Find out the flavor of a variable.
* Shell Function:: Substitute the output of a shell command.
* Make Control Functions:: Functions that control how make runs.
* Value Function:: Return the un-expanded value of a variable.
* Eval Function:: Evaluate the arguments as makefile syntax.
* Origin Function:: Find where a variable got its value.
+* Flavor Function:: Find out the flavor of a variable.
* Shell Function:: Substitute the output of a shell command.
* Make Control Functions:: Functions that control how make runs.
@end menu
@end group
@end example
-@node Origin Function, Shell Function, Eval Function, Functions
+@node Origin Function, Flavor Function, Eval Function, Functions
@section The @code{origin} Function
@findex origin
@cindex variables, origin of
@samp{environment} or @samp{environment override}.
@xref{Text Functions, , Functions for String Substitution and Analysis}.
-@node Shell Function, Make Control Functions, Origin Function, Functions
+@node Flavor Function, Shell Function, Origin Function, Functions
+@section The @code{flavor} Function
+@findex flavor
+@cindex variables, flavor of
+@cindex flavor of variable
+
+The @code{flavor} function is unlike most other functions (and like
+@code{origin} function) in that it does not operate on the values of
+variables; it tells you something @emph{about} a variable. Specifically,
+it tells you the flavor of a variable
+(@pxref{Flavors, ,The Two Flavors of Variables}).
+
+The syntax of the @code{flavor} function is:
+
+@example
+$(flavor @var{variable})
+@end example
+
+Note that @var{variable} is the @emph{name} of a variable to inquire about;
+not a @emph{reference} to that variable. Therefore you would not normally
+use a @samp{$} or parentheses when writing it. (You can, however, use a
+variable reference in the name if you want the name not to be a constant.)
+
+The result of this function is a string that identifies the flavor of the
+variable @var{variable}:
+
+@table @samp
+@item undefined
+
+if @var{variable} was never defined.
+
+@item recursive
+
+if @var{variable} is a recursively expanded variable.
+
+@item simple
+
+if @var{variable} is a simply expanded variable.
+
+@end table
+
+
+@node Shell Function, Make Control Functions, Flavor Function, Functions
@section The @code{shell} Function
@findex shell
@cindex commands, expansion
defined.@*
@xref{Origin Function, , The @code{origin} Function}.
+@item $(flavor @var{variable})
+
+Return a string describing the flavor of the @code{make} variable
+@var{variable}.@*
+@xref{Flavor Function, , The @code{flavor} Function}.
+
@item $(foreach @var{var},@var{words},@var{text})
Evaluate @var{text} with @var{var} bound to each word in @var{words},
return o;
}
+static char *
+func_flavor (char *o, char **argv, const char *funcname UNUSED)
+{
+ register struct variable *v = lookup_variable (argv[0], strlen (argv[0]));
+
+ if (v == 0)
+ o = variable_buffer_output (o, "undefined", 9);
+ else
+ if (v->recursive)
+ o = variable_buffer_output (o, "recursive", 9);
+ else
+ o = variable_buffer_output (o, "simple", 6);
+
+ return o;
+}
+
#ifdef VMS
# define IS_PATHSEP(c) ((c) == ']')
#else
{ STRING_SIZE_TUPLE("filter-out"), 2, 2, 1, func_filter_filterout},
{ STRING_SIZE_TUPLE("findstring"), 2, 2, 1, func_findstring},
{ STRING_SIZE_TUPLE("firstword"), 0, 1, 1, func_firstword},
+ { STRING_SIZE_TUPLE("flavor"), 0, 1, 1, func_flavor},
{ STRING_SIZE_TUPLE("join"), 2, 2, 1, func_join},
{ STRING_SIZE_TUPLE("lastword"), 0, 1, 1, func_lastword},
{ STRING_SIZE_TUPLE("patsubst"), 3, 3, 1, func_patsubst},