make: Rule Syntax

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