Partager via


Makefile Preprocessing Operators 

The DEFINED operator is a logical operator that acts on a macro name. The expression DEFINED (macroname) is true if macroname is defined. DEFINED in combination with !IF or !ELSE IF is equivalent to !IFDEF or !ELSE IFDEF. However, unlike these directives, DEFINED can be used in complex expressions using binary logical operators.

The EXIST operator is a logical operator that acts on a file-system path. EXIST (path) is true if path exists. The result from EXIST can be used in binary expressions. If path contains spaces, enclose it in double quotation marks.

Integer constants can use the unary operators for numerical negation (–), one's complement (~), and logical negation (!).

Constant expressions can use the following binary operators.

Operator Description Operator Description

+

Addition

||

Logical OR

Subtraction

<<

Left shift

*

Multiplication

>>

Right shift

/

Division

==

Equality

%

Modulus

!=

Inequality

&

Bitwise AND

<

Less than

|

Bitwise OR

>

Greater than

^

Bitwise XOR

<=

Less than or equal to

&&

Logical AND

>=

Greater than or equal to

To compare two strings, use the equality (==) operator and the inequality (!=) operator. Enclose strings in double quotation marks.

See Also

Concepts

Expressions in Makefile Preprocessing