make: Value Function
1
1 8.8 The 'value' Function
1 ========================
1
1 The 'value' function provides a way for you to use the value of a
1 variable _without_ having it expanded. Please note that this does not
1 undo expansions which have already occurred; for example if you create a
1 simply expanded variable its value is expanded during the definition; in
1 that case the 'value' function will return the same result as using the
1 variable directly.
1
1 The syntax of the 'value' function is:
1
1 $(value VARIABLE)
1
1 Note that VARIABLE is the _name_ of a variable, not a _reference_ to
1 that variable. Therefore you would not normally use a '$' or
1 parentheses when writing it. (You can, however, use a variable
1 reference in the name if you want the name not to be a constant.)
1
1 The result of this function is a string containing the value of
1 VARIABLE, without any expansion occurring. For example, in this
1 makefile:
1
1 FOO = $PATH
1
1 all:
1 @echo $(FOO)
1 @echo $(value FOO)
1
1 The first output line would be 'ATH', since the "$P" would be expanded
1 as a 'make' variable, while the second output line would be the current
1 value of your '$PATH' environment variable, since the 'value' function
1 avoided the expansion.
1
1 The 'value' function is most often used in conjunction with the
1 'eval' function (⇒Eval Function).
1