DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(make.info.gz) Command Syntax

Info Catalog (make.info.gz) Commands (make.info.gz) Commands (make.info.gz) Echoing
 
 5.1 Command Syntax
 ==================
 
 Makefiles have the unusual property that there are really two distinct
 syntaxes in one file.  Most of the makefile uses `make' syntax (
 Writing Makefiles Makefiles.).  However, commands are meant to be
 interpreted by the shell and so they are written using shell syntax.
 The `make' program does not try to understand shell syntax: it performs
 only a very few specific translations on the content of the command
 before handing it to the shell.
 
    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.  _Any_ line in the makefile that begins with a
 tab and appears in a "rule context" (that is, after a rule has been
 started until another rule or variable definition) will be considered a
 command line for that rule.  Blank lines and lines of just comments may
 appear among the command lines; they are ignored.
 
    Some consequences of these rules include:
 
    * A blank line that begins with a tab is not blank: it's an empty
      command ( Empty Commands).
 
    * A comment in a command line is not a `make' comment; it will be
      passed to the shell as-is.  Whether the shell treats it as a
      comment or not depends on your shell.
 
    * A variable definition in a "rule context" which is indented by a
      tab as the first character on the line, will be considered a
      command line, not a `make' variable definition, and passed to the
      shell.
 
    * A conditional expression (`ifdef', `ifeq', etc.  Syntax of
      Conditionals Conditional Syntax.) in a "rule context" which is
      indented by a tab as the first character on the line, will be
      considered a command line and be passed to the shell.
 
 

Menu

 
* Splitting Lines             Breaking long command lines for readability.
* Variables in Commands       Using `make' variables in commands.
 
Info Catalog (make.info.gz) Commands (make.info.gz) Commands (make.info.gz) Echoing
automatically generated byinfo2html