GNU Info

Info Node: (make.info)If Function

(make.info)If Function


Next: Call Function Prev: Foreach Function Up: Functions
Enter node , (file) or (file)node

The `if' Function
=================

   The `if' function provides support for conditional expansion in a
functional context (as opposed to the GNU `make' makefile conditionals
such as `ifeq' (Note: Syntax of Conditionals.).

   An `if' function call can contain either two or three arguments:

     $(if CONDITION,THEN-PART[,ELSE-PART])

   The first argument, CONDITION, first has all preceding and trailing
whitespace stripped, then is expanded.  If it expands to any non-empty
string, then the condition is considered to be true.  If it expands to
an empty string, the condition is considered to be false.

   If the condition is true then the second argument, THEN-PART, is
evaluated and this is used as the result of the evaluation of the entire
`if' function.

   If the condition is false then the third argument, ELSE-PART, is
evaluated and this is the result of the `if' function.  If there is no
third argument, the `if' function evaluates to nothing (the empty
string).

   Note that only one of the THEN-PART or the ELSE-PART will be
evaluated, never both.  Thus, either can contain side-effects (such as
`shell' function calls, etc.)


automatically generated by info2www version 1.2.2.9