UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 20.2 Command-Line SyntaxChapter 20
The make Utility
Next: 20.4 Macros
 

20.3 Description File Lines

Instructions in the description file are interpreted as single lines. If an instruction must span more than one input line, use a backslash (\) at the end of the line so that the next line is considered a continuation. The description file may contain any of the following types of lines:

Blank lines

Blank lines are ignored.

Comment lines

A pound sign (#) can be used at the beginning of a line or anywhere in the middle. make ignores everything after the #.

Dependency lines

Depending on one or more targets, certain commands that follow are executed. Possible formats include:

targets : prerequisites
targets :: prerequisites

In the first form, subsequent commands are executed if the prerequisites are met. The second form is a variant that lets you specify the same targets on more than one dependency line. In both forms, if no prerequisites are supplied, subsequent commands are always executed (whenever any of the targets are specified). No tab should precede any targets. (At the end of a dependency line, you can specify a command, preceded by a semicolon; however, commands are typically entered on their own lines, preceded by a tab.)

Targets of the form library(member) represent members of archive libraries, e.g., libguide.a(dontpanic.o).

Suffix rules

These specify that files ending with the first suffix can be prerequisites for files ending with the second suffix (assuming the root filenames are the same). Either of these formats can be used:

.suffix.suffix:
.suffix:

The second form means that the root filename depends on the filename with the corresponding suffix.

Macro definitions

These have the following form:

name = string

Blank space is optional around the =.

Include statements

Similar to the C include directive, these have the form:

include file

make processes the value of file for macro expansions before attempting to open the file.

Command lines

These lines are where you give the commands to actually rebuild those files that are out of date. Commands are grouped below the dependency line and are typed on lines that begin with a tab. If a command is preceded by a hyphen (-), make ignores any error returned. If a command is preceded by an at sign (@), the command line won't echo on the display (unless make is called with -n). Further advice on command lines is given below.


Previous: 20.2 Command-Line SyntaxUNIX in a Nutshell: System V EditionNext: 20.4 Macros
20.2 Command-Line SyntaxBook Index20.4 Macros

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System