manpagez: man pages & more
info make
Home | html | info | man

File: make.info,  Node: Value Function,  Next: Eval Function,  Prev: Call Function,  Up: Functions

8.9 The 'value' Function
========================

The 'value' function provides a way for you to use the value of a
variable _without_ having it expanded.  Please note that this does not
undo expansions which have already occurred; for example if you create a
simply expanded variable its value is expanded during the definition; in
that case the 'value' function will return the same result as using the
variable directly.

   The syntax of the 'value' function is:

     $(value VARIABLE)

   Note that VARIABLE is the _name_ of a variable, not a _reference_ to
that variable.  Therefore you would not normally use a '$' 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 containing the value of
VARIABLE, without any expansion occurring.  For example, in this
makefile:

     FOO = $PATH

     all:
             @echo $(FOO)
             @echo $(value FOO)

The first output line would be 'ATH', since the "$P" would be expanded
as a 'make' variable, while the second output line would be the current
value of your '$PATH' environment variable, since the 'value' function
avoided the expansion.

   The 'value' function is most often used in conjunction with the
'eval' function (*note Eval Function::).

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.