Conditional Parts of Makefiles A conditional causes part of a makefile to be obeyed or ignored depending on the values of variables. Conditionals can compare the value of one variable to another, or the value of a variable to a constant string. It works by controlling which of two command lines will be used as the command for a rule. The ifeq directive begins the conditional, and specifies the condition. It contains two arguments, separated by a comma and surrounded by parentheses.
Variable substitution is performed on both arguments and then they are compared.
The else directive causes the following lines to be obeyed if the previous conditional failed. In the example above, this means that the second alternative linking command is used whenever the first alternative is not used. It is optional to have an else in a conditional. The endif directive ends the conditional. Every conditional must end with an endif .