4.2. The make Rules

Rules are the most important part of a makefile. Rules control how a project should be built. Each rule has a common structure which is discussed in this section. A typical makefile is introduced as an example to show you how rules are written in makefiles.

4.2.1. Anatomy of a Rule

As mentioned earlier, a typical rule looks like the following:

Target: Dependencies
  Commands

A target is the objective of the rule that depends upon a list of dependencies. Commands are used to build the target. The target name is followed by a colon. Commands start with a TAB character.

CAUTION

Each line containing commands starts with a TAB character. The TAB character distinguishes command lines from other lines. A common error is to replace ...

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.