DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(make.info.gz) Rule Syntax

Info Catalog (make.info.gz) Rule Example (make.info.gz) Rules (make.info.gz) Prerequisite Types
 
 4.2 Rule Syntax
 ===============
 
 In general, a rule looks like this:
 
      TARGETS : PREREQUISITES
              COMMAND
              ...
 
 or like this:
 
      TARGETS : PREREQUISITES ; COMMAND
              COMMAND
              ...
 
    The TARGETS are file names, separated by spaces.  Wildcard
 characters may be used ( Using Wildcard Characters in File Names
 Wildcards.) and a name of the form `A(M)' represents member M in
 archive file A ( Archive Members as Targets Archive Members.).
 Usually there is only one target per rule, but occasionally there is a
 reason to have more ( Multiple Targets in a Rule Multiple
 Targets.).
 
    The COMMAND lines start with a tab character.  The first command may
 appear on the line after the prerequisites, with a tab character, or may
 appear on the same line, with a semicolon.  Either way, the effect is
 the same.  There are other differences in the syntax of command lines.
  Writing the Commands in Rules Commands.
 
    Because dollar signs are used to start `make' variable references,
 if you really want a dollar sign in a target or prerequisite you must
 write two of them, `$$' ( How to Use Variables Using Variables.).
 If you have enabled secondary expansion ( Secondary Expansion)
 and you want a literal dollar sign in the prerequisites lise, you must
 actually write _four_ dollar signs (`$$$$').
 
    You may split a long line by inserting a backslash followed by a
 newline, but this is not required, as `make' places no limit on the
 length of a line in a makefile.
 
    A rule tells `make' two things: when the targets are out of date,
 and how to update them when necessary.
 
    The criterion for being out of date is specified in terms of the
 PREREQUISITES, which consist of file names separated by spaces.
 (Wildcards and archive members ( Archives) are allowed here too.)
 A target is out of date if it does not exist or if it is older than any
 of the prerequisites (by comparison of last-modification times).  The
 idea is that the contents of the target file are computed based on
 information in the prerequisites, so if any of the prerequisites
 changes, the contents of the existing target file are no longer
 necessarily valid.
 
    How to update is specified by COMMANDS.  These are lines to be
 executed by the shell (normally `sh'), but with some extra features
 ( Writing the Commands in Rules Commands.).
 
Info Catalog (make.info.gz) Rule Example (make.info.gz) Rules (make.info.gz) Prerequisite Types
automatically generated byinfo2html