[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. 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-prerequisites 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; see section 5.8 Using Empty Commands.)

Users use many different shell programs, but commands in makefiles are always interpreted by `/bin/sh' unless the makefile specifies otherwise. See section Command Execution.

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.

5.1 Command Echoing  How to control when commands are echoed.
5.2 Command Execution  How commands are executed.
5.3 Parallel Execution  How commands can be executed in parallel.
5.4 Errors in Commands  What happens after a command execution error.
5.5 Interrupting or Killing make  What happens when a command is interrupted.
5.6 Recursive Use of make  Invoking make from makefiles.
5.7 Defining Canned Command Sequences  Defining canned sequences of commands.
5.8 Using Empty Commands  Defining useful, do-nothing commands.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Jeff Bailey on December, 25 2002 using texi2html