4.3. Using Variables

Variables are an important part of all makefiles used in a project. Variables are used for many purposes; the most important of which is to have structured and easily understandable makefiles. This section contains more information about variables used in makefiles.

4.3.1. Defining Variables

Variables can be defined in a usual way by typing in the variable name, followed by an equal sign. The equal sign is followed by the value that is assigned to the variable. Note that there may be space characters on one or both sides of the equal sign. A typical variable assignment may be as follows:

CFLAGS = -g –O2

Another example of defining the C compiler name is as follows:

CC = gcc

This variable than can be used in other parts ...

Get Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming Environment, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.