f78 Writing the Commands in Rules Contents|Index|Previous|Next

Writing the Commands in Rules

The commands of a rule consist of shell command lines to be executed one by one. Each command line must start with a tab, except that the first command line may be attached to the target-and-dependencies line with a semicolon in between. Blank lines and lines of just comments may appear among the command lines; they are ignored. (But beware, an apparently “blank” line that begins with a tab is not blank! It is an empty command.)

Users use many different shell programs, but commands in make-files are always interpreted by ‘/bin/sh’ unless the makefile specifies otherwise.

The shell that is in use determines whether comments can be written on command lines, and what syntax they use. When the shell is ‘/bin/sh’, a ‘#’ starts a comment that extends to the end of the line. The ‘#’ does not have to be at the beginning of a line. Text on a line before a ‘#’ is not part of the comment.

See the following documentation for more discussion.

Command Echoing

Command Execution

Parallel Execution

Errors in Commands

Interrupting or Killing make

Recursive Use of make

How the MAKE Variable Works

Communicating Variables to a Sub-make

Communicating Options to a Sub-< 400 /FONT>make

The ‘--print-directory’ Option

Defining Canned Command Sequences

Using Empty Commands

0