VirtualBox

Changeset 1993 in kBuild for trunk/src/kmk/doc


Ignore:
Timestamp:
Oct 29, 2008 12:37:51 AM (16 years ago)
Author:
bird
Message:

Merged in current GNU Make code (CVS from 2008-10-28). Ref #55.

Location:
trunk/src/kmk/doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/doc/Makefile.am

    r503 r1993  
    11# -*-Makefile-*-, or close enough
    2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
     2# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    33# Foundation, Inc.
    44# This file is part of GNU Make.
    55#
    6 # GNU Make is free software; you can redistribute it and/or modify it under the
    7 # terms of the GNU General Public License as published by the Free Software
    8 # Foundation; either version 2, or (at your option) any later version.
     6# GNU Make is free software; you can redistribute it and/or modify it under
     7# the terms of the GNU General Public License as published by the Free Software
     8# Foundation; either version 3 of the License, or (at your option) any later
     9# version.
    910#
    1011# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
    11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
    12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     13# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
     14# details.
    1315#
    1416# You should have received a copy of the GNU General Public License along with
    15 # GNU Make; see the file COPYING.  If not, write to the Free Software
    16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     17# this program.  If not, see <http://www.gnu.org/licenses/>.
    1718
    1819TEXI2HTML = texi2html
  • trunk/src/kmk/doc/make.texi

    r903 r1993  
    55@include version.texi
    66@set EDITION 0.70
    7 @set RCSID $Id: make.texi,v 1.47 2007/05/11 20:57:21 psmith Exp $
     7@set RCSID $Id: make.texi,v 1.52 2008/05/18 15:11:40 psmith Exp $
    88
    99@settitle GNU @code{make}
     
    2727
    2828Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
    29 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006
     291996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007
    3030Free Software Foundation, Inc.
    3131
     
    3939License.''
    4040
    41 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
    42 this GNU Manual, like GNU software.  Copies published by the Free
    43 Software Foundation raise funds for GNU development.''
     41(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
     42this GNU Manual. Buying copies from GNU Press supports the FSF in
     43developing GNU and promoting software freedom.''
    4444@end quotation
    4545@end copying
     
    9292* Makefiles::                   Makefiles tell @code{make} what to do.
    9393* Rules::                       Rules describe when a file must be remade.
    94 * Commands::                    Commands say how to remake a file.
     94* Recipes::                     Recipes say how to remake a file.
    9595* Using Variables::             You can use variables to avoid repetition.
    9696* Conditionals::                Use or ignore parts of the makefile based
     
    119119Overview of @code{make}
    120120
    121 * Preparing::                   Preparing and Running Make
    122 * Reading::                     On Reading this Text
    123 * Bugs::                        Problems and Bugs
     121* Preparing::                   Preparing and running make
     122* Reading::                     On reading this text
     123* Bugs::                        Problems and bugs
    124124
    125125An Introduction to Makefiles
    126126
    127127* Rule Introduction::           What a rule looks like.
    128 * Simple Makefile::             A Simple Makefile
    129 * How Make Works::              How @code{make} Processes This Makefile
    130 * Variables Simplify::          Variables Make Makefiles Simpler
    131 * make Deduces::                Letting @code{make} Deduce the Commands
    132 * Combine By Prerequisite::     Another Style of Makefile
    133 * Cleanup::                     Rules for Cleaning the Directory
     128* Simple Makefile::             A simple makefile
     129* How Make Works::              How @code{make} processes this makefile
     130* Variables Simplify::          Variables make makefiles simpler
     131* make Deduces::                Letting @code{make} deduce the recipe
     132* Combine By Prerequisite::     Another style of makefile
     133* Cleanup::                     Rules for cleaning the directory
    134134
    135135Writing Makefiles
     
    139139* Include::                     How one makefile can use another makefile.
    140140* MAKEFILES Variable::          The environment can specify extra makefiles.
    141 * MAKEFILE_LIST Variable::      Discover which makefiles have been read.
    142 * Special Variables::           Other special variables.
    143141* Remaking Makefiles::          How makefiles get remade.
    144142* Overriding Makefiles::        How to override part of one makefile
     
    155153* Directory Search::            Searching other directories for source files.
    156154* Phony Targets::               Using a target that is not a real file's name.
    157 * Force Targets::               You can use a target without commands
     155* Force Targets::               You can use a target without a recipe
    158156                                  or prerequisites to mark other targets
    159157                                  as phony.
     
    185183                                  for a specified class of names.
    186184* Search Algorithm::            When and how search paths are applied.
    187 * Commands/Search::             How to write shell commands that work together
     185* Recipes/Search::              How to write recipes that work together
    188186                                  with search paths.
    189187* Implicit/Search::             How search paths affect implicit rules.
     
    195193* Static versus Implicit::      When are they better than implicit rules?
    196194
    197 Writing the Commands in Rules
    198 
    199 * Command Syntax::              Command syntax features and pitfalls.
    200 * Echoing::                     How to control when commands are echoed.
    201 * Execution::                   How commands are executed.
    202 * Parallel::                    How commands can be executed in parallel.
    203 * Errors::                      What happens after a command execution error.
    204 * Interrupts::                  What happens when a command is interrupted.
     195Writing Recipes in Rules
     196
     197* Recipe Syntax::               Recipe syntax features and pitfalls.
     198* Echoing::                     How to control when recipes are echoed.
     199* Execution::                   How recipes are executed.
     200* Parallel::                    How recipes can be executed in parallel.
     201* Errors::                      What happens after a recipe execution error.
     202* Interrupts::                  What happens when a recipe is interrupted.
    205203* Recursion::                   Invoking @code{make} from makefiles.
    206 * Sequences::                   Defining canned sequences of commands.
    207 * Empty Commands::              Defining useful, do-nothing commands.
    208 
    209 Command Syntax
    210 
    211 * Splitting Lines::             Breaking long command lines for readability.
    212 * Variables in Commands::       Using @code{make} variables in commands.
    213 
    214 Command Execution
     204* Sequences::                   Defining canned recipes.
     205* Empty Recipes::               Defining useful, do-nothing recipes.
     206
     207Recipe Syntax
     208
     209* Splitting Lines::             Breaking long recipe lines for readability.
     210* Variables in Recipes::        Using @code{make} variables in recipes.
     211
     212Recipe Execution
    215213
    216214* Choosing the Shell::          How @code{make} chooses the shell used
    217                                   to run commands.
     215                                  to run recipes.
    218216
    219217Recursive Use of @code{make}
     
    243241* Pattern-specific::            Target-specific variable values can be applied
    244242                                  to a group of targets that match a pattern.
     243* Special Variables::           Variables with special meaning or behavior.
    245244
    246245Advanced Features for Reference to Variables
     
    277276                                  parts of the makefile to use.
    278277* Instead of Execution::        How to use mode flags to specify what
    279                                   kind of thing to do with the commands
     278                                  kind of thing to do with the recipes
    280279                                  in the makefile other than simply
    281280                                  execute them.
     
    290289
    291290* Using Implicit::              How to use an existing implicit rule
    292                                   to get the commands for updating a file.
     291                                  to get the recipe for updating a file.
    293292* Catalogue of Rules::          A list of built-in implicit rules.
    294293* Implicit Variables::          How to change what predefined rules do.
    295294* Chained Rules::               How to use a chain of implicit rules.
    296295* Pattern Rules::               How to define new implicit rules.
    297 * Last Resort::                 How to define commands for rules which
     296* Last Resort::                 How to define a recipe for rules which
    298297                                  cannot find any.
    299298* Suffix Rules::                The old-fashioned style of implicit rule.
     
    306305* Pattern Examples::            Examples of pattern rules.
    307306* Automatic Variables::         How to use automatic variables in the
    308                                   commands of implicit rules.
     307                                  recipe of implicit rules.
    309308* Pattern Match::               How patterns match.
    310309* Match-Anything Rules::        Precautions you should take prior to
     
    378377uses the makefile data base and the last-modification times of the files to
    379378decide which of the files need to be updated.  For each of those files, it
    380 issues the commands recorded in the data base.
     379issues the recipes recorded in the data base.
    381380
    382381You can provide command line arguments to @code{make} to control which
     
    432431these messages: it's best to cut and paste them into your report.
    433432When generating this small makefile, be sure to not use any non-free
    434 or unusual tools in your commands: you can almost always emulate what
     433or unusual tools in your recipes: you can almost always emulate what
    435434such a tool would do with simple shell commands.  Finally, be sure to
    436435explain what you expected to occur; this will help us decide whether
     
    490489* How Make Works::              How @code{make} Processes This Makefile
    491490* Variables Simplify::          Variables Make Makefiles Simpler
    492 * make Deduces::                Letting @code{make} Deduce the Commands
     491* make Deduces::                Letting @code{make} Deduce the Recipes
    493492* Combine By Prerequisite::     Another Style of Makefile
    494493* Cleanup::                     Rules for Cleaning the Directory
     
    506505@cindex targets, introduction to
    507506@cindex prerequisites, introduction to
    508 @cindex commands, introduction to
     507@cindex recipes, introduction to
    509508@example
    510509@group
    511510@var{target} @dots{} : @var{prerequisites} @dots{}
    512         @var{command}
     511        @var{recipe}
    513512        @dots{}
    514513        @dots{}
     
    525524
    526525@cindex tabs in rules
    527 A @dfn{command} is an action that @code{make} carries out.
    528 A rule may have more than one command, each on its own line.
     526A @dfn{recipe} is an action that @code{make} carries out.
     527A recipe may have more than one command, each on its own line.
    529528@strong{Please note:} you need to put a tab character at the beginning of
    530 every command line!  This is an obscurity that catches the unwary.
    531 
    532 Usually a command is in a rule with prerequisites and serves to create a
     529every command line!  This is an obscurity that catches the unwary.  If
     530you prefer to prefix your recipes with a character other than tab,
     531you can set the @code{.CMDPREFIX} variable to an alternate character
     532(@pxref{Special Variables}).
     533
     534Usually a recipe is in a rule with prerequisites and serves to create a
    533535target file if any of the prerequisites change.  However, the rule that
    534 specifies commands for the target need not have prerequisites.  For
     536specifies a recipe for the target need not have prerequisites.  For
    535537example, the rule containing the delete command associated with the
    536538target @samp{clean} does not have prerequisites.
     
    538540A @dfn{rule}, then, explains how and when to remake certain files
    539541which are the targets of the particular rule.  @code{make} carries out
    540 the commands on the prerequisites to create or update the target.  A
     542the recipe on the prerequisites to create or update the target.  A
    541543rule can also explain how and when to carry out an action.
    542544@xref{Rules, , Writing Rules}.
     
    615617prerequisites are files such as @samp{main.c} and @samp{defs.h}.
    616618In fact, each @samp{.o} file is both a target and a prerequisite.
    617 Commands include @w{@samp{cc -c main.c}} and @w{@samp{cc -c kbd.c}}.
     619Recipes include @w{@samp{cc -c main.c}} and @w{@samp{cc -c kbd.c}}.
    618620
    619621When a target is a file, it needs to be recompiled or relinked if any
     
    624626on the header file @file{defs.h}.
    625627
    626 A shell command follows each line that contains a target and
    627 prerequisites.  These shell commands say how to update the target file.
    628 A tab character must come at the beginning of every command line to
    629 distinguish command lines from other lines in the makefile.  (Bear in
    630 mind that @code{make} does not know anything about how the commands
    631 work.  It is up to you to supply commands that will update the target
    632 file properly.  All @code{make} does is execute the commands in the rule
    633 you have specified when the target file needs to be updated.)
    634 @cindex shell command
     628A recipe may follow each line that contains a target and
     629prerequisites.  These recipes say how to update the target file.  A
     630tab character (or whatever character is specified by the
     631@code{.CMDPREFIX} variable; @pxref{Special Variables}) must come at
     632the beginning of every line in the recipe to distinguish recipes from
     633other lines in the makefile.  (Bear in mind that @code{make} does not
     634know anything about how the recipes work.  It is up to you to supply
     635recipes that will update the target file properly.  All @code{make}
     636does is execute the commands in the recipe you have specified when the
     637target file needs to be updated.)@refill
     638@cindex recipe
    635639
    636640The target @samp{clean} is not a file, but merely the name of an
    637 action.  Since you
    638 normally
    639 do not want to carry out the actions in this rule, @samp{clean} is not a prerequisite of any other rule.
     641action.  Since you normally do not want to carry out the actions in
     642this rule, @samp{clean} is not a prerequisite of any other rule.
    640643Consequently, @code{make} never does anything with it unless you tell
    641 it specifically.  Note that this rule not only is not a prerequisite, it
    642 also does not have any prerequisites, so the only purpose of the rule
    643 is to run the specified commands.  Targets that do not refer to files
    644 but are just actions are called @dfn{phony targets}.  @xref{Phony
    645 Targets}, for information about this kind of target.  @xref{Errors, ,
    646 Errors in Commands}, to see how to cause @code{make} to ignore errors
    647 from @code{rm} or any other command.
     644it specifically.  Note that this rule not only is not a prerequisite,
     645it also does not have any prerequisites, so the only purpose of the
     646rule is to run the specified recipe.  Targets that do not refer to
     647files but are just actions are called @dfn{phony targets}.
     648@xref{Phony Targets}, for information about this kind of target.
     649@xref{Errors, , Errors in Recipes}, to see how to cause @code{make}
     650to ignore errors from @code{rm} or any other command.
    648651@cindex @code{clean} target
    649652@cindex @code{rm} (shell command)
     
    793796
    794797@node make Deduces, Combine By Prerequisite, Variables Simplify, Introduction
    795 @section Letting @code{make} Deduce the Commands
    796 @cindex deducing commands (implicit rules)
     798@section Letting @code{make} Deduce the Recipes
     799@cindex deducing recipes (implicit rules)
    797800@cindex implicit rule, introduction to
    798801@cindex rule, implicit, introduction to
    799802
    800 It is not necessary to spell out the commands for compiling the individual
     803It is not necessary to spell out the recipes for compiling the individual
    801804C source files, because @code{make} can figure them out: it has an
    802805@dfn{implicit rule} for updating a @samp{.o} file from a correspondingly
    803806named @samp{.c} file using a @samp{cc -c} command.  For example, it will
    804 use the command @samp{cc -c main.c -o main.o} to compile @file{main.c} into
    805 @file{main.o}.  We can therefore omit the commands from the rules for the
     807use the recipe @samp{cc -c main.c -o main.o} to compile @file{main.c} into
     808@file{main.o}.  We can therefore omit the recipes from the rules for the
    806809object files.  @xref{Implicit Rules, ,Using Implicit Rules}.@refill
    807810
    808811When a @samp{.c} file is used automatically in this way, it is also
    809812automatically added to the list of prerequisites.  We can therefore omit
    810 the @samp{.c} files from the prerequisites, provided we omit the commands.
     813the @samp{.c} files from the prerequisites, provided we omit the recipe.
    811814
    812815Here is the entire example, with both of these changes, and a variable
     
    839842This is how we would write the makefile in actual practice.  (The
    840843complications associated with @samp{clean} are described elsewhere.
    841 See @ref{Phony Targets}, and @ref{Errors, ,Errors in Commands}.)
     844See @ref{Phony Targets}, and @ref{Errors, ,Errors in Recipes}.)
    842845
    843846Because implicit rules are so convenient, they are important.  You
     
    912915called @file{clean} and causes it to continue in spite of errors from
    913916@code{rm}.  (See @ref{Phony Targets}, and @ref{Errors, ,Errors in
    914 Commands}.)
     917Recipes}.)
    915918
    916919@noindent
     
    937940* Include::                     How one makefile can use another makefile.
    938941* MAKEFILES Variable::          The environment can specify extra makefiles.
    939 * MAKEFILE_LIST Variable::      Discover which makefiles have been read.
    940 * Special Variables::           Other special variables.
    941942* Remaking Makefiles::          How makefiles get remade.
    942943* Overriding Makefiles::        How to override part of one makefile
     
    961962called the rule's @dfn{targets}.  It lists the other files that the
    962963targets depend on, called the @dfn{prerequisites} of the target, and
    963 may also give commands to use to create or update the targets.
     964may also give a recipe to use to create or update the targets.
    964965@xref{Rules, ,Writing Rules}.
    965966
     
    969970An @dfn{implicit rule} says when and how to remake a class of files
    970971based on their names.  It describes how a target may depend on a file
    971 with a name similar to the target and gives commands to create or
     972with a name similar to the target and gives a recipe to create or
    972973update such a target.  @xref{Implicit Rules, ,Using Implicit Rules}.
    973974
     
    982983@cindex directive
    983984@item
    984 A @dfn{directive} is a command for @code{make} to do something special while
    985 reading the makefile.  These include:
     985A @dfn{directive} is an instruction for @code{make} to do something
     986special while reading the makefile.  These include:
    986987
    987988@itemize @bullet
     
    10141015start of a comment) inside a variable reference or function call.
    10151016
    1016 Within a command script (if the line begins with a TAB character) the
    1017 entire line is passed to the shell, just as with any other line that
    1018 begins with a TAB.  The shell decides how to interpret the text:
    1019 whether or not this is a comment is up to the shell.
     1017Comments within a recipe are passed to the shell, just as with any
     1018other recipe text.  The shell decides how to interpret it: whether or
     1019not this is a comment is up to the shell.
    10201020
    10211021Within a @code{define} directive, comments are not ignored during the
    10221022definition of the variable, but rather kept intact in the value of the
    10231023variable.  When the variable is expanded they will either be treated
    1024 as @code{make} comments or as command script text, depending on the
    1025 context in which the variable is evaluated.
     1024as @code{make} comments or as recipe text, depending on the context in
     1025which the variable is evaluated.
    10261026@end itemize
    10271027
     
    10961096
    10971097Extra spaces are allowed and ignored at the beginning of the line, but
    1098 a tab is not allowed.  (If the line begins with a tab, it will be
    1099 considered a command line.)  Whitespace is required between
     1098the first character must not be a tab (or the value of
     1099@code{.CMDPREFIX})---if the line begins with a tab, it will be
     1100considered a recipe line.  Whitespace is required between
    11001101@code{include} and the file names, and between file names; extra
    11011102whitespace is ignored there and at the end of the directive.  A
     
    11821183@code{sinclude} is another name for @w{@code{-include}}.
    11831184
    1184 @node MAKEFILES Variable, MAKEFILE_LIST Variable, Include, Makefiles
     1185@node MAKEFILES Variable, Remaking Makefiles, Include, Makefiles
    11851186@section The Variable @code{MAKEFILES}
    11861187@cindex makefile, and @code{MAKEFILES} variable
     
    12121213in the makefiles.  @xref{Include, , Including Other Makefiles}.
    12131214
    1214 @node MAKEFILE_LIST Variable, Special Variables, MAKEFILES Variable, Makefiles
    1215 @comment  node-name,  next,  previous,  up
    1216 @section The Variable @code{MAKEFILE_LIST}
    1217 @cindex makefiles, and @code{MAKEFILE_LIST} variable
    1218 @cindex including (@code{MAKEFILE_LIST} variable)
    1219 @vindex MAKEFILE_LIST
    1220 
    1221 As @code{make} reads various makefiles, including any obtained from the
    1222 @code{MAKEFILES} variable, the command line, the default files, or
    1223 from @code{include} directives, their names will be automatically
    1224 appended to the @code{MAKEFILE_LIST} variable.  They are added right
    1225 before @code{make} begins to parse them.
    1226 
    1227 This means that if the first thing a makefile does is examine the last
    1228 word in this variable, it will be the name of the current makefile.
    1229 Once the current makefile has used @code{include}, however, the last
    1230 word will be the just-included makefile.
    1231 
    1232 If a makefile named @code{Makefile} has this content:
    1233 
    1234 @example
    1235 @group
    1236 name1 := $(lastword $(MAKEFILE_LIST))
    1237 
    1238 include inc.mk
    1239 
    1240 name2 := $(lastword $(MAKEFILE_LIST))
    1241 
    1242 all:
    1243         @@echo name1 = $(name1)
    1244         @@echo name2 = $(name2)
    1245 @end group
    1246 @end example
    1247 
    1248 @noindent
    1249 then you would expect to see this output:
    1250 
    1251 @example
    1252 @group
    1253 name1 = Makefile
    1254 name2 = inc.mk
    1255 @end group
    1256 @end example
    1257 
    1258 @xref{Text Functions}, for more information on the @code{lastword}
    1259 function used above.  @xref{Flavors, The Two Flavors of Variables},
    1260 for more information on simply-expanded (@code{:=}) variable
    1261 definitions.
    1262 
    1263 @node Special Variables, Remaking Makefiles, MAKEFILE_LIST Variable, Makefiles
    1264 @comment  node-name,  next,  previous,  up
    1265 @section Other Special Variables
    1266 @cindex makefiles, and special variables
    1267 @cindex special variables
    1268 
    1269 GNU @code{make} also supports other special variables.  Unless
    1270 otherwise documented here, these values lose their special properties
    1271 if they are set by a makefile or on the command line.
    1272 
    1273 @table @code
    1274 
    1275 @vindex .DEFAULT_GOAL @r{(define default goal)}
    1276 @item .DEFAULT_GOAL
    1277 Sets the default goal to be used if no targets were specified on the
    1278 command line (@pxref{Goals, , Arguments to Specify the Goals}).  The
    1279 @code{.DEFAULT_GOAL} variable allows you to discover the current
    1280 default goal, restart the default goal selection algorithm by clearing
    1281 its value, or to explicitly set the default goal.  The following
    1282 example illustrates these cases:
    1283 
    1284 @example
    1285 @group
    1286 # Query the default goal.
    1287 ifeq ($(.DEFAULT_GOAL),)
    1288   $(warning no default goal is set)
    1289 endif
    1290 
    1291 .PHONY: foo
    1292 foo: ; @@echo $@@
    1293 
    1294 $(warning default goal is $(.DEFAULT_GOAL))
    1295 
    1296 # Reset the default goal.
    1297 .DEFAULT_GOAL :=
    1298 
    1299 .PHONY: bar
    1300 bar: ; @@echo $@@
    1301 
    1302 $(warning default goal is $(.DEFAULT_GOAL))
    1303 
    1304 # Set our own.
    1305 .DEFAULT_GOAL := foo
    1306 @end group
    1307 @end example
    1308 
    1309 This makefile prints:
    1310 
    1311 @example
    1312 @group
    1313 no default goal is set
    1314 default goal is foo
    1315 default goal is bar
    1316 foo
    1317 @end group
    1318 @end example
    1319 
    1320 Note that assigning more than one target name to @code{.DEFAULT_GOAL} is
    1321 illegal and will result in an error.
    1322 
    1323 @vindex MAKE_RESTARTS @r{(number of times @code{make} has restarted)}
    1324 @item MAKE_RESTARTS
    1325 This variable is set only if this instance of @code{make} has
    1326 restarted (@pxref{Remaking Makefiles, , How Makefiles Are Remade}): it
    1327 will contain the number of times this instance has restarted.  Note
    1328 this is not the same as recursion (counted by the @code{MAKELEVEL}
    1329 variable).  You should not set, modify, or export this variable.
    1330 
    1331 @vindex .VARIABLES @r{(list of variables)}
    1332 @item .VARIABLES
    1333 Expands to a list of the @emph{names} of all global variables defined
    1334 so far.  This includes variables which have empty values, as well as
    1335 built-in variables (@pxref{Implicit Variables, , Variables Used by
    1336 Implicit Rules}), but does not include any variables which are only
    1337 defined in a target-specific context.  Note that any value you assign
    1338 to this variable will be ignored; it will always return its special
    1339 value.
    1340 
    1341 @c @vindex .TARGETS @r{(list of targets)}
    1342 @c @item .TARGETS
    1343 @c The second special variable is @code{.TARGETS}.  When expanded, the
    1344 @c value consists of a list of all targets defined in all makefiles read
    1345 @c up until that point.  Note it's not enough for a file to be simply
    1346 @c mentioned in the makefile to be listed in this variable, even if it
    1347 @c would match an implicit rule and become an ``implicit target''.  The
    1348 @c file must appear as a target, on the left-hand side of a ``:'', to be
    1349 @c considered a target for the purposes of this variable.
    1350 
    1351 @vindex .FEATURES @r{(list of supported features)}
    1352 @item .FEATURES
    1353 Expands to a list of special features supported by this version of
    1354 @code{make}.  Possible values include:
    1355 
    1356 @table @samp
    1357 
    1358 @item archives
    1359 Supports @code{ar} (archive) files using special filename syntax.
    1360 @xref{Archives, ,Using @code{make} to Update Archive Files}.
    1361 
    1362 @item check-symlink
    1363 Supports the @code{-L} (@code{--check-symlink-times}) flag.
    1364 @xref{Options Summary, ,Summary of Options}.
    1365 
    1366 @item else-if
    1367 Supports ``else if'' non-nested conditionals.  @xref{Conditional
    1368 Syntax, ,Syntax of Conditionals}.
    1369 
    1370 @item jobserver
    1371 Supports ``job server'' enhanced parallel builds.  @xref{Parallel,
    1372 ,Parallel Execution}.
    1373 
    1374 @item second-expansion
    1375 Supports secondary expansion of prerequisite lists.
    1376 
    1377 @item order-only
    1378 Supports order-only prerequisites.  @xref{Prerequisite Types, ,Types
    1379 of Prerequisites}.
    1380 
    1381 @item target-specific
    1382 Supports target-specific and pattern-specific variable assignments.
    1383 @xref{Target-specific, ,Target-specific Variable Values}.
    1384 
    1385 @end table
    1386 
    1387 @vindex .INCLUDE_DIRS @r{(list of include directories)}
    1388 @item .INCLUDE_DIRS
    1389 Expands to a list of directories that @code{make} searches for
    1390 included makefiles (@pxref{Include, , Including Other Makefiles}).
    1391 
    1392 @end table
    1393 
    1394 @node Remaking Makefiles, Overriding Makefiles, Special Variables, Makefiles
     1215@node Remaking Makefiles, Overriding Makefiles, MAKEFILES Variable, Makefiles
    13951216@section How Makefiles Are Remade
    13961217
     
    14131234date.)@refill
    14141235
    1415 If you know that one or more of your makefiles cannot be remade and you
    1416 want to keep @code{make} from performing an implicit rule search on
    1417 them, perhaps for efficiency reasons, you can use any normal method of
    1418 preventing implicit rule lookup to do so.  For example, you can write an
    1419 explicit rule with the makefile as the target, and an empty command
    1420 string (@pxref{Empty Commands, ,Using Empty Commands}).
     1236If you know that one or more of your makefiles cannot be remade and
     1237you want to keep @code{make} from performing an implicit rule search
     1238on them, perhaps for efficiency reasons, you can use any normal method
     1239of preventing implicit rule lookup to do so.  For example, you can
     1240write an explicit rule with the makefile as the target, and an empty
     1241recipe (@pxref{Empty Recipes, ,Using Empty Recipes}).
    14211242
    14221243If the makefiles specify a double-colon rule to remake a file with
    1423 commands but no prerequisites, that file will always be remade
     1244a recipe but no prerequisites, that file will always be remade
    14241245(@pxref{Double-Colon}).  In the case of makefiles, a makefile that has a
    1425 double-colon rule with commands but no prerequisites will be remade every
     1246double-colon rule with a recipe but no prerequisites will be remade every
    14261247time @code{make} is run, and then again after @code{make} starts over
    14271248and reads the makefiles in again.  This would cause an infinite loop:
     
    14291250else.  So, to avoid this, @code{make} will @strong{not} attempt to
    14301251remake makefiles which are specified as targets of a double-colon rule
    1431 with commands but no prerequisites.@refill
     1252with a recipe but no prerequisites.@refill
    14321253
    14331254If you do not specify any makefiles to be read with @samp{-f} or
     
    14481269
    14491270When you use the @samp{-t} or @samp{--touch} option
    1450 (@pxref{Instead of Execution, ,Instead of Executing the Commands}),
     1271(@pxref{Instead of Execution, ,Instead of Executing the Recipe}),
    14511272you would not want to use an out-of-date makefile to decide which
    14521273targets to touch.  So the @samp{-t} option has no effect on updating
     
    14561277out-of-date makefile would result in the wrong output for other targets.
    14571278Thus, @samp{make -f mfile -n foo} will update @file{mfile}, read it in,
    1458 and then print the commands to update @file{foo} and its prerequisites
    1459 without running them.  The commands printed for @file{foo} will be those
     1279and then print the recipe to update @file{foo} and its prerequisites
     1280without running it.  The recipe printed for @file{foo} will be the one
    14601281specified in the updated contents of @file{mfile}.
    14611282
     
    14671288
    14681289Thus, @samp{make -f mfile -n mfile foo} would read the makefile
    1469 @file{mfile}, print the commands needed to update it without actually
    1470 running them, and then print the commands needed to update @file{foo}
    1471 without running them.  The commands for @file{foo} will be those
     1290@file{mfile}, print the recipe needed to update it without actually
     1291running it, and then print the recipe needed to update @file{foo}
     1292without running that.  The recipe for @file{foo} will be the one
    14721293specified by the existing contents of @file{mfile}.
    14731294
     
    14801301another makefile.  You can often use the @samp{include} directive to
    14811302include one in the other, and add more targets or variable definitions.
    1482 However, if the two makefiles give different commands for the same
    1483 target, @code{make} will not let you just do this.  But there is another way.
     1303However, it is illegal for two makefiles to give different recipes for
     1304the same target.  But there is another way.
    14841305
    14851306@cindex match-anything rule, used to override
     
    15041325
    15051326If you say @samp{make foo}, @code{make} will find @file{GNUmakefile},
    1506 read it, and see that to make @file{foo}, it needs to run the command
     1327read it, and see that to make @file{foo}, it needs to run the recipe
    15071328@samp{frobnicate > foo}.  If you say @samp{make bar}, @code{make} will
    15081329find no way to make @file{bar} in @file{GNUmakefile}, so it will use the
    1509 commands from the pattern rule: @samp{make -f Makefile bar}.  If
     1330recipe from the pattern rule: @samp{make -f Makefile bar}.  If
    15101331@file{Makefile} provides a rule for updating @file{bar}, @code{make}
    15111332will apply the rule.  And likewise for any other target that
     
    15141335The way this works is that the pattern rule has a pattern of just
    15151336@samp{%}, so it matches any target whatever.  The rule specifies a
    1516 prerequisite @file{force}, to guarantee that the commands will be run even
    1517 if the target file already exists.  We give @file{force} target empty
    1518 commands to prevent @code{make} from searching for an implicit rule to
     1337prerequisite @file{force}, to guarantee that the recipe will be run even
     1338if the target file already exists.  We give the @file{force} target an
     1339empty recipe to prevent @code{make} from searching for an implicit rule to
    15191340build it---otherwise it would apply the same match-anything rule to
    15201341@file{force} itself and create a prerequisite loop!
     
    15421363construct as the makefile is parsed.  We say that expansion is
    15431364@dfn{deferred} if expansion is not performed immediately.  Expansion of
    1544 deferred construct is not performed until either the construct appears
     1365a deferred construct is not performed until either the construct appears
    15451366later in an immediate context, or until the second phase.
    15461367
     
    15731394(@samp{:=}), and deferred otherwise.
    15741395
    1575 @subheading Conditional Statements
     1396@subheading Conditional Directives
    15761397@cindex ifdef, expansion
    15771398@cindex ifeq, expansion
     
    15791400@cindex ifneq, expansion
    15801401
    1581 All instances of conditional syntax are parsed immediately, in their
    1582 entirety; this includes the @code{ifdef}, @code{ifeq}, @code{ifndef},
    1583 and @code{ifneq} forms.  Of course this means that automatic variables
    1584 cannot be used in conditional statements, as automatic variables are
    1585 not set until the command script for that rule is invoked.  If you
    1586 need to use automatic variables in a conditional you @emph{must} use
    1587 shell conditional syntax, in your command script proper, for these
    1588 tests, not @code{make} conditionals.
     1402Conditional directives are parsed immediately.  This means, for
     1403example, that automatic variables cannot be used in conditional
     1404directives, as automatic variables are not set until the recipe for
     1405that rule is invoked.  If you need to use automatic variables in a
     1406conditional directive you @emph{must} move the condition into the
     1407recipe and use shell conditional syntax instead.
    15891408
    15901409@subheading Rule Definition
     
    16031422
    16041423That is, the target and prerequisite sections are expanded immediately,
    1605 and the commands used to construct the target are always deferred.  This
     1424and the recipe used to construct the target is always deferred.  This
    16061425general rule is true for explicit rules, pattern rules, suffix rules,
    16071426static pattern rules, and simple prerequisite definitions.
     
    16771496target.  This means that you can use variables such as @code{$@@},
    16781497@code{$*}, etc. during the second expansion and they will have their
    1679 expected values, just as in the command script.  All you have to do is
    1680 defer the expansion by escaping the @code{$}.  Also, secondary
    1681 expansion occurs for both explicit and implicit (pattern) rules.
    1682 Knowing this, the possible uses for this feature increase
    1683 dramatically.  For example:
     1498expected values, just as in the recipe.  All you have to do is defer
     1499the expansion by escaping the @code{$}.  Also, secondary expansion
     1500occurs for both explicit and implicit (pattern) rules.  Knowing this,
     1501the possible uses for this feature increase dramatically.  For
     1502example:
    16841503
    16851504@example
     
    16991518@code{$(lib_OBJS)}, or @code{lib.o api.o}.
    17001519
    1701 You can also mix functions here, as long as they are properly escaped:
     1520You can also mix in functions here, as long as they are properly escaped:
    17021521
    17031522@example
     
    17151534Evaluation of automatic variables during the secondary expansion
    17161535phase, especially of the target name variable @code{$$@@}, behaves
    1717 similarly to evaluation within command scripts.  However, there are
    1718 some subtle differences and ``corner cases'' which come into play for
    1719 the different types of rule definitions that @code{make} understands.
    1720 The subtleties of using the different automatic variables are
    1721 described below.
     1536similarly to evaluation within recipes.  However, there are some
     1537subtle differences and ``corner cases'' which come into play for the
     1538different types of rule definitions that @code{make} understands.  The
     1539subtleties of using the different automatic variables are described
     1540below.
    17221541
    17231542@subheading Secondary Expansion of Explicit Rules
     
    17521571
    17531572Rules undergo secondary expansion in makefile order, except that
    1754 the rule with the command script is always evaluated last.
     1573the rule with the recipe is always evaluated last.
    17551574
    17561575The variables @code{$$?} and @code{$$*} are not available and expand
     
    18091628@code{$$*} instead of @code{%} in the prerequisites list.
    18101629
    1811 @node Rules, Commands, Makefiles, Top
     1630@node Rules, Recipes, Makefiles, Top
    18121631@chapter Writing Rules
    18131632@cindex writing rules
     
    18191638certain files, called the rule's @dfn{targets} (most often only one per rule).
    18201639It lists the other files that are the @dfn{prerequisites} of the target, and
    1821 @dfn{commands} to use to create or update the target.
     1640the @dfn{recipe} to use to create or update the target.
    18221641
    18231642@cindex default goal
     
    18451664* Directory Search::            Searching other directories for source files.
    18461665* Phony Targets::               Using a target that is not a real file's name.
    1847 * Force Targets::               You can use a target without commands
     1666* Force Targets::               You can use a target without recipes
    18481667                                  or prerequisites to mark other targets
    18491668                                  as phony.
     
    18741693
    18751694Its target is @file{foo.o} and its prerequisites are @file{foo.c} and
    1876 @file{defs.h}.  It has one command, which is @samp{cc -c -g foo.c}.
    1877 The command line starts with a tab to identify it as a command.
     1695@file{defs.h}.  It has one command in the recipe: @samp{cc -c -g foo.c}.
     1696The recipe starts with a tab to identify it as a recipe.
    18781697
    18791698This rule says two things:
     
    18871706@item
    18881707How to update the file @file{foo.o}: by running @code{cc} as stated.
    1889 The command does not explicitly mention @file{defs.h}, but we presume
     1708The recipe does not explicitly mention @file{defs.h}, but we presume
    18901709that @file{foo.c} includes it, and that that is why @file{defs.h} was
    18911710added to the prerequisites.
     
    19021721@example
    19031722@var{targets} : @var{prerequisites}
    1904         @var{command}
     1723        @var{recipe}
    19051724        @dots{}
    19061725@end example
     
    19101729
    19111730@example
    1912 @var{targets} : @var{prerequisites} ; @var{command}
    1913         @var{command}
     1731@var{targets} : @var{prerequisites} ; @var{recipe}
     1732        @var{recipe}
    19141733        @dots{}
    19151734@end example
     
    19261745(@pxref{Multiple Targets, , Multiple Targets in a Rule}).@refill
    19271746
    1928 @cindex commands
     1747@cindex recipes
    19291748@cindex tab character (in commands)
    1930 The @var{command} lines start with a tab character.  The first command may
    1931 appear on the line after the prerequisites, with a tab character, or may
    1932 appear on the same line, with a semicolon.  Either way, the effect is the
    1933 same.  There are other differences in the syntax of command lines.
    1934 @xref{Commands, ,Writing the Commands in Rules}.
     1749The @var{recipe} lines start with a tab character (or the first
     1750character in the value of the @code{.CMDPREFIX} variable;
     1751@pxref{Special Variables}).  The first recipe line may appear on the line
     1752after the prerequisites, with a tab character, or may appear on the
     1753same line, with a semicolon.  Either way, the effect is the same.
     1754There are other differences in the syntax of recipes.
     1755@xref{Recipes, ,Writing Recipes in Rules}.
    19351756
    19361757@cindex dollar sign (@code{$}), in rules
     
    19641785valid.
    19651786
    1966 How to update is specified by @var{commands}.  These are lines to be
    1967 executed by the shell (normally @samp{sh}), but with some extra features
    1968 (@pxref{Commands, ,Writing the Commands in Rules}).
     1787How to update is specified by a @var{recipe}.  This is one or more
     1788lines to be executed by the shell (normally @samp{sh}), but with some
     1789extra features (@pxref{Recipes, ,Writing Recipes in Rules}).
    19691790
    19701791@node Prerequisite Types, Wildcards, Rule Syntax, Rules
     
    19821803previous section, and @dfn{order-only} prerequisites.  A normal
    19831804prerequisite makes two statements: first, it imposes an order of
    1984 execution of build commands: any commands necessary to build any of a
    1985 target's prerequisites will be fully executed before any commands
     1805execution of recipes: any recipes necessary to build any of a
     1806target's prerequisites will be fully executed before any recipe
    19861807necessary to build the target.  Second, it imposes a dependency
    19871808relationship: if any prerequisite is newer than the target, then the
     
    20701891
    20711892Wildcard expansion is performed by @code{make} automatically in
    2072 targets and in prerequisites.  In commands the shell is responsible
     1893targets and in prerequisites.  In recipes, the shell is responsible
    20731894for wildcard expansion.  In other contexts, wildcard expansion happens
    20741895only if you request it explicitly with the @code{wildcard} function.
     
    20891910@subsection Wildcard Examples
    20901911
    2091 Wildcards can be used in the commands of a rule, where they are expanded
     1912Wildcards can be used in the recipe of a rule, where they are expanded
    20921913by the shell.  For example, here is a rule to delete all the object files:
    20931914
     
    21291950then the value of the variable @code{objects} is the actual string
    21301951@samp{*.o}.  However, if you use the value of @code{objects} in a target,
    2131 prerequisite or command, wildcard expansion will take place at that time.
     1952prerequisite, or recipe, wildcard expansion will take place at that time.
    21321953To set @code{objects} to the expansion, instead use:
    21331954
     
    22762097                                  for a specified class of names.
    22772098* Search Algorithm::            When and how search paths are applied.
    2278 * Commands/Search::             How to write shell commands that work together
     2099* Recipes/Search::             How to write recipes that work together
    22792100                                  with search paths.
    22802101* Implicit/Search::             How search paths affect implicit rules.
     
    22972118them, that file may become the prerequisite (see below).  Rules may then
    22982119specify the names of files in the prerequisite list as if they all
    2299 existed in the current directory.  @xref{Commands/Search, ,Writing Shell
    2300 Commands with Directory Search}.
     2120existed in the current directory.  @xref{Recipes/Search, ,Writing Recipes with Directory Search}.
    23012121
    23022122In the @code{VPATH} variable, directory names are separated by colons or
     
    24332253@file{bar}, then @file{blish}.
    24342254
    2435 @node Search Algorithm, Commands/Search, Selective Search, Directory Search
     2255@node Search Algorithm, Recipes/Search, Selective Search, Directory Search
    24362256@subsection How Directory Searches are Performed
    24372257@cindex algorithm for directory search
     
    25002320rebuilt using the expanded path.
    25012321
    2502 @node Commands/Search, Implicit/Search, Search Algorithm, Directory Search
    2503 @subsection Writing Shell Commands with Directory Search
    2504 @cindex shell command, and directory search
    2505 @cindex directory search (@code{VPATH}), and shell commands
     2322@node Recipes/Search, Implicit/Search, Search Algorithm, Directory Search
     2323@subsection Writing Recipes with Directory Search
     2324@cindex recipes, and directory search
     2325@cindex directory search (@code{VPATH}), and recipes
    25062326
    25072327When a prerequisite is found in another directory through directory search,
    2508 this cannot change the commands of the rule; they will execute as written.
    2509 Therefore, you must write the commands with care so that they will look for
     2328this cannot change the recipe of the rule; they will execute as written.
     2329Therefore, you must write the recipe with care so that it will look for
    25102330the prerequisite in the directory where @code{make} finds it.
    25112331
     
    25292349
    25302350Often the prerequisites include header files as well, which you do not
    2531 want to mention in the commands.  The automatic variable @samp{$<} is
     2351want to mention in the recipe.  The automatic variable @samp{$<} is
    25322352just the first prerequisite:
    25332353
     
    25382358@end example
    25392359
    2540 @node Implicit/Search, Libraries/Search, Commands/Search, Directory Search
     2360@node Implicit/Search, Libraries/Search, Recipes/Search, Directory Search
    25412361@subsection Directory Search and Implicit Rules
    25422362@cindex @code{VPATH}, and implicit rules
     
    25592379directories, the implicit rule for C compilation is applied.
    25602380
    2561 The commands of implicit rules normally use automatic variables as a
     2381The recipes of implicit rules normally use automatic variables as a
    25622382matter of necessity; consequently they will use the file names found by
    25632383directory search with no extra effort.
     
    26302450@cindex targets without a file
    26312451
    2632 A phony target is one that is not really the name of a file.  It is just a
    2633 name for some commands to be executed when you make an explicit request.
    2634 There are two reasons to use a phony target: to avoid a conflict with
    2635 a file of the same name, and to improve performance.
    2636 
    2637 If you write a rule whose commands will not create the target file, the
    2638 commands will be executed every time the target comes up for remaking.
     2452A phony target is one that is not really the name of a file; rather it
     2453is just a name for a recipe to be executed when you make an explicit
     2454request.  There are two reasons to use a phony target: to avoid a
     2455conflict with a file of the same name, and to improve performance.
     2456
     2457If you write a rule whose recipe will not create the target file, the
     2458recipe will be executed every time the target comes up for remaking.
    26392459Here is an example:
    26402460
     
    26562476named @file{clean} in this directory.  Since it has no prerequisites, the
    26572477file @file{clean} would inevitably be considered up to date, and its
    2658 commands would not be executed.  To avoid this problem, you can explicitly
     2478recipe would not be executed.  To avoid this problem, you can explicitly
    26592479declare the target to be phony, using the special target @code{.PHONY}
    26602480(@pxref{Special Targets, ,Special Built-in Target Names}) as follows:
     
    26652485
    26662486@noindent
    2667 Once this is done, @samp{make clean} will run the commands regardless of
     2487Once this is done, @samp{make clean} will run the recipe regardless of
    26682488whether there is a file named @file{clean}.
    26692489
     
    26902510makefile will often contain a variable which lists a number of
    26912511subdirectories to be built.  One way to handle this is with one rule
    2692 whose command is a shell loop over the subdirectories, like this:
     2512whose recipe is a shell loop over the subdirectories, like this:
    26932513
    26942514@example
     
    27032523@end example
    27042524
    2705 There are a few problems with this method, however.  First, any error
    2706 detected in a submake is not noted by this rule, so it will continue to
    2707 build the rest of the directories even when one fails.  This can be
     2525There are problems with this method, however.  First, any error
     2526detected in a submake is ignored by this rule, so it will continue
     2527to build the rest of the directories even when one fails.  This can be
    27082528overcome by adding shell commands to note the error and exit, but then
    2709 it will do so even if @code{make} is invoked with the @code{-k} option,
    2710 which is unfortunate.  Second, and perhaps more importantly, you cannot
    2711 take advantage of @code{make}'s ability to build targets in parallel
    2712 (@pxref{Parallel, ,Parallel Execution}), since there is only one rule.
     2529it will do so even if @code{make} is invoked with the @code{-k}
     2530option, which is unfortunate.  Second, and perhaps more importantly,
     2531you cannot take advantage of @code{make}'s ability to build targets in
     2532parallel (@pxref{Parallel, ,Parallel Execution}), since there is only
     2533one rule.
    27132534
    27142535By declaring the subdirectories as phony targets (you must do this as
     
    27372558
    27382559A phony target should not be a prerequisite of a real target file; if it
    2739 is, its commands are run every time @code{make} goes to update that
     2560is, its recipe will be run every time @code{make} goes to update that
    27402561file.  As long as a phony target is never a prerequisite of a real
    2741 target, the phony target commands will be executed only when the phony
     2562target, the phony target recipe will be executed only when the phony
    27422563target is a specified goal (@pxref{Goals, ,Arguments to Specify the
    27432564Goals}).
     
    27882609
    27892610@node Force Targets, Empty Targets, Phony Targets, Rules
    2790 @section Rules without Commands or Prerequisites
     2611@section Rules without Recipes or Prerequisites
    27912612@cindex force targets
    27922613@cindex targets, force
    27932614@cindex @code{FORCE}
    2794 @cindex rule, no commands or prerequisites
    2795 
    2796 If a rule has no prerequisites or commands, and the target of the rule
     2615@cindex rule, no recipe or prerequisites
     2616
     2617If a rule has no prerequisites or recipe, and the target of the rule
    27972618is a nonexistent file, then @code{make} imagines this target to have
    27982619been updated whenever its rule is run.  This implies that all targets
    2799 depending on this one will always have their commands run.
     2620depending on this one will always have their recipe run.
    28002621
    28012622An example will illustrate this:
     
    28102631
    28112632Here the target @samp{FORCE} satisfies the special conditions, so the
    2812 target @file{clean} that depends on it is forced to run its commands.
    2813 There is nothing special about the name @samp{FORCE}, but that is one name
    2814 commonly used this way.
     2633target @file{clean} that depends on it is forced to run its recipe.
     2634There is nothing special about the name @samp{FORCE}, but that is one
     2635name commonly used this way.
    28152636
    28162637As you can see, using @samp{FORCE} this way has the same results as using
     
    28282649
    28292650The @dfn{empty target} is a variant of the phony target; it is used to hold
    2830 commands for an action that you request explicitly from time to time.
     2651recipes for an action that you request explicitly from time to time.
    28312652Unlike a phony target, this target file can really exist; but the file's
    28322653contents do not matter, and usually are empty.
    28332654
    28342655The purpose of the empty target file is to record, with its
    2835 last-modification time, when the rule's commands were last executed.  It
    2836 does so because one of the commands is a @code{touch} command to update the
    2837 target file.
     2656last-modification time, when the rule's recipe was last executed.  It
     2657does so because one of the commands in the recipe is a @code{touch}
     2658command to update the target file.
    28382659
    28392660The empty target file should have some prerequisites (otherwise it
    28402661doesn't make sense).  When you ask to remake the empty target, the
    2841 commands are executed if any prerequisite is more recent than the target;
     2662recipe is executed if any prerequisite is more recent than the target;
    28422663in other words, if a prerequisite has changed since the last time you
    28432664remade the target.  Here is an example:
     
    28722693The prerequisites of the special target @code{.PHONY} are considered to
    28732694be phony targets.  When it is time to consider such a target,
    2874 @code{make} will run its commands unconditionally, regardless of
     2695@code{make} will run its recipe unconditionally, regardless of
    28752696whether a file with that name exists or what its last-modification
    28762697time is.  @xref{Phony Targets, ,Phony Targets}.
     
    28862707@item .DEFAULT
    28872708
    2888 The commands specified for @code{.DEFAULT} are used for any target for
     2709The recipe specified for @code{.DEFAULT} is used for any target for
    28892710which no rules are found (either explicit rules or implicit rules).
    2890 @xref{Last Resort}.  If @code{.DEFAULT} commands are specified, every
     2711@xref{Last Resort}.  If a @code{.DEFAULT} recipe is specified, every
    28912712file mentioned as a prerequisite, but not as a target in a rule, will have
    2892 these commands executed on its behalf.  @xref{Implicit Rule Search,
     2713that recipe executed on its behalf.  @xref{Implicit Rule Search,
    28932714,Implicit Rule Search Algorithm}.
    28942715
     
    29002721The targets which @code{.PRECIOUS} depends on are given the following
    29012722special treatment: if @code{make} is killed or interrupted during the
    2902 execution of their commands, the target is not deleted.
     2723execution of their recipes, the target is not deleted.
    29032724@xref{Interrupts, ,Interrupting or Killing @code{make}}.  Also, if the
    29042725target is an intermediate file, it will not be deleted after it is no
     
    29472768If @code{.DELETE_ON_ERROR} is mentioned as a target anywhere in the
    29482769makefile, then @code{make} will delete the target of a rule if it has
    2949 changed and its commands exit with a nonzero exit status, just as it
    2950 does when it receives a signal.  @xref{Errors, ,Errors in Commands}.
     2770changed and its recipe exits with a nonzero exit status, just as it
     2771does when it receives a signal.  @xref{Errors, ,Errors in Recipes}.
    29512772
    29522773@findex .IGNORE
     
    29542775
    29552776If you specify prerequisites for @code{.IGNORE}, then @code{make} will
    2956 ignore errors in execution of the commands run for those particular
    2957 files.  The commands for @code{.IGNORE} are not meaningful.
     2777ignore errors in execution of the recipe for those particular files.
     2778The recipe for @code{.IGNORE} (if any) is ignored.
    29582779
    29592780If mentioned as a target with no prerequisites, @code{.IGNORE} says to
    2960 ignore errors in execution of commands for all files.  This usage of
     2781ignore errors in execution of recipes for all files.  This usage of
    29612782@samp{.IGNORE} is supported only for historical compatibility.  Since
    2962 this affects every command in the makefile, it is not very useful; we
     2783this affects every recipe in the makefile, it is not very useful; we
    29632784recommend you use the more selective ways to ignore errors in specific
    2964 commands.  @xref{Errors, ,Errors in Commands}.
     2785recipes.  @xref{Errors, ,Errors in Recipes}.
    29652786
    29662787@findex .LOW_RESOLUTION_TIME
     
    29692790If you specify prerequisites for @code{.LOW_RESOLUTION_TIME},
    29702791@command{make} assumes that these files are created by commands that
    2971 generate low resolution time stamps.  The commands for
    2972 @code{.LOW_RESOLUTION_TIME} are not meaningful.
    2973 
    2974 The high resolution file time stamps of many modern hosts lessen the
    2975 chance of @command{make} incorrectly concluding that a file is up to
    2976 date.  Unfortunately, these hosts provide no way to set a high
    2977 resolution file time stamp, so commands like @samp{cp -p} that
    2978 explicitly set a file's time stamp must discard its subsecond part.  If
    2979 a file is created by such a command, you should list it as a
    2980 prerequisite of @code{.LOW_RESOLUTION_TIME} so that @command{make} does
    2981 not mistakenly conclude that the file is out of date.  For example:
     2792generate low resolution time stamps.  The recipe for the
     2793@code{.LOW_RESOLUTION_TIME} target are ignored.
     2794
     2795The high resolution file time stamps of many modern file systems
     2796lessen the chance of @command{make} incorrectly concluding that a file
     2797is up to date.  Unfortunately, some hosts do not provide a way to set a
     2798high resolution file time stamp, so commands like @samp{cp -p} that
     2799explicitly set a file's time stamp must discard its subsecond part.
     2800If a file is created by such a command, you should list it as a
     2801prerequisite of @code{.LOW_RESOLUTION_TIME} so that @command{make}
     2802does not mistakenly conclude that the file is out of date.  For
     2803example:
    29822804
    29832805@example
     
    30042826
    30052827If you specify prerequisites for @code{.SILENT}, then @code{make} will
    3006 not print the commands to remake those particular files before executing
    3007 them.  The commands for @code{.SILENT} are not meaningful.
     2828not print the recipe used to remake those particular files before
     2829executing them.  The recipe for @code{.SILENT} is ignored.
    30082830
    30092831If mentioned as a target with no prerequisites, @code{.SILENT} says not
    3010 to print any commands before executing them.  This usage of
     2832to print any recipes before executing them.  This usage of
    30112833@samp{.SILENT} is supported only for historical compatibility.  We
    3012 recommend you use the more selective ways to silence specific commands.
    3013 @xref{Echoing, ,Command Echoing}.  If you want to silence all commands
     2834recommend you use the more selective ways to silence specific recipes.
     2835@xref{Echoing, ,Recipe Echoing}.  If you want to silence all recipes
    30142836for a particular run of @code{make}, use the @samp{-s} or
    30152837@w{@samp{--silent}} option (@pxref{Options Summary}).
     
    30302852of @code{make} will be run serially, even if the @samp{-j} option is
    30312853given.  Any recursively invoked @code{make} command will still run
    3032 commands in parallel (unless its makefile also contains this target).
     2854recipes in parallel (unless its makefile also contains this target).
    30332855Any prerequisites on this target are ignored.
    30342856@end table
     
    30512873
    30522874A rule with multiple targets is equivalent to writing many rules, each with
    3053 one target, and all identical aside from that.  The same commands apply to
    3054 all the targets, but their effects may vary because you can substitute the
    3055 actual target name into the command using @samp{$@@}.  The rule contributes
     2875one target, and all identical aside from that.  The same recipe applies to
     2876all the targets, but its effect may vary because you can substitute the
     2877actual target name into the recipe using @samp{$@@}.  The rule contributes
    30562878the same prerequisites to all the targets also.
    30572879
     
    30602882@itemize @bullet
    30612883@item
    3062 You want just prerequisites, no commands.  For example:
     2884You want just prerequisites, no recipe.  For example:
    30632885
    30642886@example
     
    30712893
    30722894@item
    3073 Similar commands work for all the targets.  The commands do not need
     2895Similar recipes work for all the targets.  The recipes do not need
    30742896to be absolutely identical, since the automatic variable @samp{$@@}
    30752897can be used to substitute the particular target to be remade into the
     
    31022924@end itemize
    31032925
    3104 Suppose you would like to vary the prerequisites according to the target,
    3105 much as the variable @samp{$@@} allows you to vary the commands.
    3106 You cannot do this with multiple targets in an ordinary rule, but you can
    3107 do it with a @dfn{static pattern rule}.
    3108 @xref{Static Pattern, ,Static Pattern Rules}.
     2926Suppose you would like to vary the prerequisites according to the
     2927target, much as the variable @samp{$@@} allows you to vary the recipe.
     2928You cannot do this with multiple targets in an ordinary rule, but you
     2929can do it with a @dfn{static pattern rule}.  @xref{Static Pattern,
     2930,Static Pattern Rules}.
    31092931
    31102932@node Multiple Rules, Static Pattern, Multiple Targets, Rules
     
    31182940mentioned in all the rules are merged into one list of prerequisites for
    31192941the target.  If the target is older than any prerequisite from any rule,
    3120 the commands are executed.
    3121 
    3122 There can only be one set of commands to be executed for a file.  If
    3123 more than one rule gives commands for the same file, @code{make} uses
    3124 the last set given and prints an error message.  (As a special case,
    3125 if the file's name begins with a dot, no error message is printed.
    3126 This odd behavior is only for compatibility with other implementations
    3127 of @code{make}@dots{} you should avoid using it).  Occasionally it is
    3128 useful to have the same target invoke multiple commands which are
     2942the recipe is executed.
     2943
     2944There can only be one recipe to be executed for a file.  If more than
     2945one rule gives a recipe for the same file, @code{make} uses the last
     2946one given and prints an error message.  (As a special case, if the
     2947file's name begins with a dot, no error message is printed.  This odd
     2948behavior is only for compatibility with other implementations of
     2949@code{make}@dots{} you should avoid using it).  Occasionally it is
     2950useful to have the same target invoke multiple recipes which are
    31292951defined in different parts of your makefile; you can use
    31302952@dfn{double-colon rules} (@pxref{Double-Colon}) for this.
     
    31482970you wish to add the additional prerequisite intermittently.
    31492971
    3150 Another wrinkle is that the additional prerequisites could be specified with
    3151 a variable that you set with a command argument to @code{make}
    3152 (@pxref{Overriding, ,Overriding Variables}).  For example,
     2972Another wrinkle is that the additional prerequisites could be
     2973specified with a variable that you set with a command line argument to
     2974@code{make} (@pxref{Overriding, ,Overriding Variables}).  For example,
    31532975
    31542976@example
     
    31642986will not.
    31652987
    3166 If none of the explicit rules for a target has commands, then @code{make}
    3167 searches for an applicable implicit rule to find some commands
     2988If none of the explicit rules for a target has a recipe, then @code{make}
     2989searches for an applicable implicit rule to find one
    31682990@pxref{Implicit Rules, ,Using Implicit Rules}).
    31692991
     
    31963018@example
    31973019@var{targets} @dots{}: @var{target-pattern}: @var{prereq-patterns} @dots{}
    3198         @var{commands}
     3020        @var{recipe}
    31993021        @dots{}
    32003022@end example
     
    33113133
    33123134An implicit rule @emph{can} apply to any target that matches its pattern,
    3313 but it @emph{does} apply only when the target has no commands otherwise
     3135but it @emph{does} apply only when the target has no recipe otherwise
    33143136specified, and only when the prerequisites can be found.  If more than one
    33153137implicit rule appears applicable, only one applies; the choice depends on
     
    33193141that you specify in the rule.  It cannot apply to any other target and it
    33203142invariably does apply to each of the targets specified.  If two conflicting
    3321 rules apply, and both have commands, that's an error.
     3143rules apply, and both have recipes, that's an error.
    33223144
    33233145The static pattern rule can be better than an implicit rule for these
     
    33523174When a target appears in multiple rules, all the rules must be the same
    33533175type: all ordinary, or all double-colon.  If they are double-colon, each
    3354 of them is independent of the others.  Each double-colon rule's commands
    3355 are executed if the target is older than any prerequisites of that rule.
    3356 If there are no prerequisites for that rule, its commands are always
     3176of them is independent of the others.  Each double-colon rule's recipe
     3177is executed if the target is older than any prerequisites of that rule.
     3178If there are no prerequisites for that rule, its recipe is always
    33573179executed (even if the target already exists).  This can result in
    33583180executing none, any, or all of the double-colon rules.
     
    33643186The double-colon rules for a target are executed in the order they appear
    33653187in the makefile.  However, the cases where double-colon rules really make
    3366 sense are those where the order of executing the commands would not matter.
     3188sense are those where the order of executing the recipes would not matter.
    33673189
    33683190Double-colon rules are somewhat obscure and not often very useful; they
     
    33713193cases are rare.
    33723194
    3373 Each double-colon rule should specify commands; if it does not, an
     3195Each double-colon rule should specify a recipe; if it does not, an
    33743196implicit rule will be used if one applies.
    33753197@xref{Implicit Rules, ,Using Implicit Rules}.
     
    35163338@xref{How Make Works}.
    35173339
    3518 @node Commands, Using Variables, Rules, Top
    3519 @chapter Writing the Commands in Rules
    3520 @cindex commands, how to write
    3521 @cindex rule commands
    3522 @cindex writing rule commands
    3523 
    3524 The commands of a rule consist of one or more shell command lines to
     3340@node Recipes, Using Variables, Rules, Top
     3341@chapter Writing Recipes in Rules
     3342@cindex recipes
     3343@cindex recipes, how to write
     3344@cindex writing recipes
     3345
     3346The recipe of a rule consists of one or more shell command lines to
    35253347be executed, one at a time, in the order they appear.  Typically, the
    35263348result of executing these commands is that the target of the rule is
    35273349brought up to date.
    35283350
    3529 Users use many different shell programs, but commands in makefiles are
     3351Users use many different shell programs, but recipes in makefiles are
    35303352always interpreted by @file{/bin/sh} unless the makefile specifies
    35313353otherwise.  @xref{Execution, ,Command Execution}.
    35323354
    35333355@menu
    3534 * Command Syntax::              Command syntax features and pitfalls.
    3535 * Echoing::                     How to control when commands are echoed.
    3536 * Execution::                   How commands are executed.
    3537 * Parallel::                    How commands can be executed in parallel.
    3538 * Errors::                      What happens after a command execution error.
    3539 * Interrupts::                  What happens when a command is interrupted.
     3356* Recipe Syntax::               Recipe syntax features and pitfalls.
     3357* Echoing::                     How to control when recipes are echoed.
     3358* Execution::                   How recipes are executed.
     3359* Parallel::                    How recipes can be executed in parallel.
     3360* Errors::                      What happens after a recipe execution error.
     3361* Interrupts::                  What happens when a recipe is interrupted.
    35403362* Recursion::                   Invoking @code{make} from makefiles.
    3541 * Sequences::                   Defining canned sequences of commands.
    3542 * Empty Commands::              Defining useful, do-nothing commands.
     3363* Sequences::                   Defining canned recipes.
     3364* Empty Recipes::               Defining useful, do-nothing recipes.
    35433365@end menu
    35443366
    3545 @node Command Syntax, Echoing, Commands, Commands
    3546 @section Command Syntax
    3547 @cindex command syntax
    3548 @cindex syntax of commands
     3367@node Recipe Syntax, Echoing, Recipes, Recipes
     3368@section Recipe Syntax
     3369@cindex recipe syntax
     3370@cindex syntax of recipe
    35493371
    35503372Makefiles have the unusual property that there are really two distinct
    35513373syntaxes in one file.  Most of the makefile uses @code{make} syntax
    3552 (@pxref{Makefiles, ,Writing Makefiles}).  However, commands are meant to be
    3553 interpreted by the shell and so they are written using shell syntax.
    3554 The @code{make} program does not try to understand shell syntax: it
    3555 performs only a very few specific translations on the content of the
    3556 command before handing it to the shell.
    3557 
    3558 Each command line must start with a tab, except that the first command
    3559 line may be attached to the target-and-prerequisites line with a
    3560 semicolon in between.  @emph{Any} line in the makefile that begins
    3561 with a tab and appears in a ``rule context'' (that is, after a rule
    3562 has been started until another rule or variable definition) will be
    3563 considered a command line for that rule.  Blank lines and lines of
    3564 just comments may appear among the command lines; they are ignored.
     3374(@pxref{Makefiles, ,Writing Makefiles}).  However, recipes are meant
     3375to be interpreted by the shell and so they are written using shell
     3376syntax.  The @code{make} program does not try to understand shell
     3377syntax: it performs only a very few specific translations on the
     3378content of the recipe before handing it to the shell.
     3379
     3380Each line in the recipe must start with a tab (or the first character
     3381in the value of the @code{.CMDPREFIX} variable; @pxref{Special
     3382Variables}), except that the first recipe line may be attached to the
     3383target-and-prerequisites line with a semicolon in between.  @emph{Any}
     3384line in the makefile that begins with a tab and appears in a ``rule
     3385context'' (that is, after a rule has been started until another rule
     3386or variable definition) will be considered part of a recipe for that
     3387rule.  Blank lines and lines of just comments may appear among the
     3388recipe lines; they are ignored.
    35653389
    35663390Some consequences of these rules include:
     
    35693393@item
    35703394A blank line that begins with a tab is not blank: it's an empty
    3571 command (@pxref{Empty Commands}).
    3572 
    3573 @cindex comments, in commands
    3574 @cindex commands, comments in
    3575 @cindex @code{#} (comments), in commands
     3395recipe (@pxref{Empty Recipes}).
     3396
     3397@cindex comments, in recipes
     3398@cindex recipes, comments in
     3399@cindex @code{#} (comments), in recipes
    35763400@item
    3577 A comment in a command line is not a @code{make} comment; it will be
     3401A comment in a recipe is not a @code{make} comment; it will be
    35783402passed to the shell as-is.  Whether the shell treats it as a comment
    35793403or not depends on your shell.
     
    35813405@item
    35823406A variable definition in a ``rule context'' which is indented by a tab
    3583 as the first character on the line, will be considered a command line,
    3584 not a @code{make} variable definition, and passed to the shell.
     3407as the first character on the line, will be considered part of a
     3408recipe, not a @code{make} variable definition, and passed to the
     3409shell.
    35853410
    35863411@item
     
    35883413etc. @pxref{Conditional Syntax, ,Syntax of Conditionals}) in a ``rule
    35893414context'' which is indented by a tab as the first character on the
    3590 line, will be considered a command line and be passed to the shell.
     3415line, will be considered part of a recipe and be passed to the shell.
    35913416
    35923417@end itemize
    35933418
    35943419@menu
    3595 * Splitting Lines::             Breaking long command lines for readability.
    3596 * Variables in Commands::       Using @code{make} variables in commands.
     3420* Splitting Lines::             Breaking long recipe lines for readability.
     3421* Variables in Recipes::        Using @code{make} variables in recipes.
    35973422@end menu
    35983423
    3599 @node Splitting Lines, Variables in Commands, Command Syntax, Command Syntax
    3600 @subsection Splitting Command Lines
    3601 @cindex commands, splitting
    3602 @cindex splitting commands
    3603 @cindex commands, backslash (@code{\}) in
    3604 @cindex commands, quoting newlines in
    3605 @cindex backslash (@code{\}), in commands
    3606 @cindex @code{\} (backslash), in commands
    3607 @cindex quoting newline, in commands
    3608 @cindex newline, quoting, in commands
    3609 
    3610 One of the few ways in which @code{make} does interpret command lines
    3611 is checking for a backslash just before the newline.  As in normal
    3612 makefile syntax, a single command can be split into multiple lines in
    3613 the makefile by placing a backslash before each newline.  A sequence
    3614 of lines like this is considered a single command, and one instance of
    3615 the shell will be invoked to run it.
     3424@node Splitting Lines, Variables in Recipes, Recipe Syntax, Recipe Syntax
     3425@subsection Splitting Recipe Lines
     3426@cindex recipes, splitting
     3427@cindex splitting recipes
     3428@cindex recipes, backslash (@code{\}) in
     3429@cindex recipes, quoting newlines in
     3430@cindex backslash (@code{\}), in recipes
     3431@cindex @code{\} (backslash), in recipes
     3432@cindex quoting newline, in recipes
     3433@cindex newline, quoting, in recipes
     3434
     3435One of the few ways in which @code{make} does interpret recipes is
     3436checking for a backslash just before the newline.  As in normal
     3437makefile syntax, a single logical recipe line can be split into
     3438multiple physical lines in the makefile by placing a backslash before
     3439each newline.  A sequence of lines like this is considered a single
     3440recipe line, and one instance of the shell will be invoked to run it.
    36163441
    36173442However, in contrast to how they are treated in other places in a
    36183443makefile, backslash-newline pairs are @emph{not} removed from the
    3619 command.  Both the backslash and the newline characters are preserved
     3444recipe.  Both the backslash and the newline characters are preserved
    36203445and passed to the shell.  How the backslash-newline is interpreted
    3621 depends on your shell.  If the first character of the next line
    3622 after the backslash-newline is a tab, then that tab (and only that
    3623 tab) is removed.  Whitespace is never added to the command.
    3624 
    3625 For example, this makefile:
     3446depends on your shell.  If the first character of the next line after
     3447the backslash-newline is the recipe prefix character (a tab by
     3448default; @pxref{Special Variables}), then that character (and only
     3449that character) is removed.  Whitespace is never added to the recipe.
     3450
     3451For example, the recipe for the all target in this makefile:
    36263452
    36273453@example
     
    36623488
    36633489@noindent
    3664 will run one shell with a command script of:
     3490will invoke one shell with a command of:
    36653491
    36663492@example
     
    36973523or even be a syntax error.  One simple way of handling this is to
    36983524place the quoted string, or even the entire command, into a
    3699 @code{make} variable then use the variable in the command.  In this
     3525@code{make} variable then use the variable in the recipe.  In this
    37003526situation the newline quoting rules for makefiles will be used, and
    37013527the backslash-newline will be removed.  If we rewrite our example
     
    37223548If you like, you can also use target-specific variables
    37233549(@pxref{Target-specific, ,Target-specific Variable Values}) to obtain
    3724 a tighter correspondence between the variable and the command that
     3550a tighter correspondence between the variable and the recipe that
    37253551uses it.
    37263552
    3727 @node Variables in Commands,  , Splitting Lines, Command Syntax
    3728 @subsection Using Variables in Commands
    3729 @cindex variable references in commands
    3730 @cindex commands, using variables in
    3731 
    3732 The other way in which @code{make} processes commands is by expanding
     3553@node Variables in Recipes,  , Splitting Lines, Recipe Syntax
     3554@subsection Using Variables in Recipes
     3555@cindex variable references in recipes
     3556@cindex recipes, using variables in
     3557
     3558The other way in which @code{make} processes recipes is by expanding
    37333559any variable references in them (@pxref{Reference,Basics of Variable
    37343560References}).  This occurs after make has finished reading all the
    37353561makefiles and the target is determined to be out of date; so, the
    3736 commands for targets which are not rebuilt are never expanded.
    3737 
    3738 Variable and function references in commands have identical syntax and
     3562recipes for targets which are not rebuilt are never expanded.
     3563
     3564Variable and function references in recipes have identical syntax and
    37393565semantics to references elsewhere in the makefile.  They also have the
    37403566same quoting rules: if you want a dollar sign to appear in your
    3741 command, you must double it (@samp{$$}).  For shells like the default
     3567recipe, you must double it (@samp{$$}).  For shells like the default
    37423568shell, that use dollar signs to introduce variables, it's important to
    37433569keep clear in your mind whether the variable you want to reference is
     
    37773603@end example
    37783604
    3779 @node Echoing, Execution, Command Syntax, Commands
    3780 @section Command Echoing
    3781 @cindex echoing of commands
     3605@node Echoing, Execution, Recipe Syntax, Recipes
     3606@section Recipe Echoing
     3607@cindex echoing of recipes
    37823608@cindex silent operation
    3783 @cindex @code{@@} (in commands)
    3784 @cindex commands, echoing
    3785 @cindex printing of commands
    3786 
    3787 Normally @code{make} prints each command line before it is executed.
    3788 We call this @dfn{echoing} because it gives the appearance that you
    3789 are typing the commands yourself.
     3609@cindex @code{@@} (in recipes)
     3610@cindex recipes, echoing
     3611@cindex printing of recipes
     3612
     3613Normally @code{make} prints each line of the recipe before it is
     3614executed.  We call this @dfn{echoing} because it gives the appearance
     3615that you are typing the lines yourself.
    37903616
    37913617When a line starts with @samp{@@}, the echoing of that line is suppressed.
    3792 The @samp{@@} is discarded before the command is passed to the shell.
     3618The @samp{@@} is discarded before the line is passed to the shell.
    37933619Typically you would use this for a command whose only effect is to print
    37943620something, such as an @code{echo} command to indicate progress through
     
    38043630@cindex @code{--recon}
    38053631When @code{make} is given the flag @samp{-n} or @samp{--just-print}
    3806 it only echoes commands, it won't execute them.  @xref{Options Summary,
     3632it only echoes recipes, it won't execute them.  @xref{Options Summary,
    38073633,Summary of Options}.  In this case and only this case, even the
    3808 commands starting with @samp{@@} are printed.  This flag is useful for
    3809 finding out which commands @code{make} thinks are necessary without
     3634recipe lines starting with @samp{@@} are printed.  This flag is useful for
     3635finding out which recipes @code{make} thinks are necessary without
    38103636actually doing them.
    38113637
     
    38153641@findex .SILENT
    38163642The @samp{-s} or @samp{--silent}
    3817 flag to @code{make} prevents all echoing, as if all commands
     3643flag to @code{make} prevents all echoing, as if all recipes
    38183644started with @samp{@@}.  A rule in the makefile for the special target
    38193645@code{.SILENT} without prerequisites has the same effect
     
    38213647@code{.SILENT} is essentially obsolete since @samp{@@} is more flexible.@refill
    38223648
    3823 @node Execution, Parallel, Echoing, Commands
    3824 @section Command Execution
    3825 @cindex commands, execution
    3826 @cindex execution, of commands
    3827 @cindex shell command, execution
    3828 @vindex @code{SHELL} @r{(command execution)}
    3829 
    3830 When it is time to execute commands to update a target, they are
    3831 executed by invoking a new subshell for each command line.  (In
     3649@node Execution, Parallel, Echoing, Recipes
     3650@section Recipe Execution
     3651@cindex recipe, execution
     3652@cindex execution, of recipes
     3653@vindex @code{SHELL} @r{(recipe execution)}
     3654
     3655When it is time to execute recipes to update a target, they are
     3656executed by invoking a new subshell for each line of the recipe.  (In
    38323657practice, @code{make} may take shortcuts that do not affect the
    38333658results.)
    38343659
    38353660@cindex @code{cd} (shell command)
    3836 @cindex shell variables, setting in commands
    3837 @cindex commands setting shell variables
     3661@cindex shell variables, setting in recipes
     3662@cindex recipes setting shell variables
    38383663@strong{Please note:} this implies that setting shell variables and
    38393664invoking shell commands such as @code{cd} that set a context local to
    3840 each process will not affect the following command lines.@footnote{On
     3665each process will not affect the following lines in the recipe.@footnote{On
    38413666MS-DOS, the value of current working directory is @strong{global}, so
    3842 changing it @emph{will} affect the following command lines on those
     3667changing it @emph{will} affect the following recipe lines on those
    38433668systems.}  If you want to use @code{cd} to affect the next statement,
    3844 put both statements in a single command line.  Then @code{make} will
     3669put both statements in a single recipe line.  Then @code{make} will
    38453670invoke one shell to run the entire line, and the shell will execute
    38463671the statements in sequence.  For example:
     
    38603685@menu
    38613686* Choosing the Shell::          How @code{make} chooses the shell used
    3862                                   to run commands.
     3687                                  to run recipes.
    38633688@end menu
    38643689
     
    38823707
    38833708Furthermore, when you do set @code{SHELL} in your makefile that value
    3884 is @emph{not} exported in the environment to commands that @code{make}
    3885 invokes.  Instead, the value inherited from the user's environment, if
    3886 any, is exported.  You can override this behavior by explicitly
    3887 exporting @code{SHELL} (@pxref{Variables/Recursion, ,Communicating
    3888 Variables to a Sub-@code{make}}), forcing it to be passed in the
    3889 environment to commands.
     3709is @emph{not} exported in the environment to recipe lines that
     3710@code{make} invokes.  Instead, the value inherited from the user's
     3711environment, if any, is exported.  You can override this behavior by
     3712explicitly exporting @code{SHELL} (@pxref{Variables/Recursion,
     3713,Communicating Variables to a Sub-@code{make}}), forcing it to be
     3714passed in the environment to recipe lines.
    38903715
    38913716@vindex @code{MAKESHELL} @r{(MS-DOS alternative to @code{SHELL})}
     
    39623787directory along your @code{PATH}.
    39633788
    3964 @node Parallel, Errors, Execution, Commands
     3789@node Parallel, Errors, Execution, Recipes
    39653790@section Parallel Execution
    3966 @cindex commands, execution in parallel
     3791@cindex recipes, execution in parallel
    39673792@cindex parallel execution
    39683793@cindex execution, in parallel
     
    39713796@cindex @code{--jobs}
    39723797
    3973 GNU @code{make} knows how to execute several commands at once.
    3974 Normally, @code{make} will execute only one command at a time, waiting
     3798GNU @code{make} knows how to execute several recipes at once.
     3799Normally, @code{make} will execute only one recipe at a time, waiting
    39753800for it to finish before executing the next.  However, the @samp{-j} or
    3976 @samp{--jobs} option tells @code{make} to execute many commands
     3801@samp{--jobs} option tells @code{make} to execute many recipes
    39773802simultaneously.  You can inhibit parallelism in a particular makefile
    39783803with the @code{.NOTPARALLEL} pseudo-target (@pxref{Special
     
    39833808
    39843809If the @samp{-j} option is followed by an integer, this is the number of
    3985 commands to execute at once; this is called the number of @dfn{job slots}.
     3810recipes to execute at once; this is called the number of @dfn{job slots}.
    39863811If there is nothing looking like an integer after the @samp{-j} option,
    39873812there is no limit on the number of job slots.  The default number of job
    39883813slots is one, which means serial execution (one thing at a time).
    39893814
    3990 One unpleasant consequence of running several commands simultaneously is
    3991 that output generated by the commands appears whenever each command
    3992 sends it, so messages from different commands may be interspersed.
     3815One unpleasant consequence of running several recipes simultaneously is
     3816that output generated by the recipes appears whenever each recipe
     3817sends it, so messages from different recipes may be interspersed.
    39933818
    39943819Another problem is that two processes cannot both take input from the
    3995 same device; so to make sure that only one command tries to take input
     3820same device; so to make sure that only one recipe tries to take input
    39963821from the terminal at once, @code{make} will invalidate the standard
    3997 input streams of all but one running command.  This means that
     3822input streams of all but one running recipe.  This means that
    39983823attempting to read from standard input will usually be a fatal error (a
    39993824@samp{Broken pipe} signal) for most child processes if there are
     
    40023827@cindex standard input
    40033828
    4004 It is unpredictable which command will have a valid standard input stream
     3829It is unpredictable which recipe will have a valid standard input stream
    40053830(which will come from the terminal, or wherever you redirect the standard
    4006 input of @code{make}).  The first command run will always get it first, and
    4007 the first command started after that one finishes will get it next, and so
     3831input of @code{make}).  The first recipe run will always get it first, and
     3832the first recipe started after that one finishes will get it next, and so
    40083833on.
    40093834
    40103835We will change how this aspect of @code{make} works if we find a better
    4011 alternative.  In the mean time, you should not rely on any command using
     3836alternative.  In the mean time, you should not rely on any recipe using
    40123837standard input at all if you are using the parallel execution feature; but
    40133838if you are not using this feature, then standard input works normally in
    4014 all commands.
     3839all recipes.
    40153840
    40163841Finally, handling recursive @code{make} invocations raises issues.  For
     
    40183843@ref{Options/Recursion, ,Communicating Options to a Sub-@code{make}}.
    40193844
    4020 If a command fails (is killed by a signal or exits with a nonzero
    4021 status), and errors are not ignored for that command
    4022 (@pxref{Errors, ,Errors in Commands}),
    4023 the remaining command lines to remake the same target will not be run.
    4024 If a command fails and the @samp{-k} or @samp{--keep-going}
     3845If a recipe fails (is killed by a signal or exits with a nonzero
     3846status), and errors are not ignored for that recipe
     3847(@pxref{Errors, ,Errors in Recipes}),
     3848the remaining recipe lines to remake the same target will not be run.
     3849If a recipe fails and the @samp{-k} or @samp{--keep-going}
    40253850option was not given
    40263851(@pxref{Options Summary, ,Summary of Options}),
     
    40583883By default, there is no load limit.
    40593884
    4060 @node Errors, Interrupts, Parallel, Commands
    4061 @section Errors in Commands
    4062 @cindex errors (in commands)
    4063 @cindex commands, errors in
     3885@node Errors, Interrupts, Parallel, Recipes
     3886@section Errors in Recipes
     3887@cindex errors (in recipes)
     3888@cindex recipes, errors in
    40643889@cindex exit status (errors)
    40653890
    4066 After each shell command returns, @code{make} looks at its exit status.
    4067 If the command completed successfully, the next command line is executed
    4068 in a new shell; after the last command line is finished, the rule is
    4069 finished.
     3891After each shell invocation returns, @code{make} looks at its exit
     3892status.  If the shell completed successfully (the exit status is
     3893zero), the next line in the recipe is executed in a new shell; after
     3894the last line is finished, the rule is finished.
    40703895
    40713896If there is an error (the exit status is nonzero), @code{make} gives up on
    40723897the current rule, and perhaps on all rules.
    40733898
    4074 Sometimes the failure of a certain command does not indicate a problem.
     3899Sometimes the failure of a certain recipe line does not indicate a problem.
    40753900For example, you may use the @code{mkdir} command to ensure that a
    40763901directory exists.  If the directory already exists, @code{mkdir} will
    40773902report an error, but you probably want @code{make} to continue regardless.
    40783903
    4079 @cindex @code{-} (in commands)
    4080 To ignore errors in a command line, write a @samp{-} at the beginning of
    4081 the line's text (after the initial tab).  The @samp{-} is discarded before
    4082 the command is passed to the shell for execution.
     3904@cindex @code{-} (in recipes)
     3905To ignore errors in a recipe line, write a @samp{-} at the beginning
     3906of the line's text (after the initial tab).  The @samp{-} is discarded
     3907before the line is passed to the shell for execution.
    40833908
    40843909For example,
     
    40933918
    40943919@noindent
    4095 This causes @code{rm} to continue even if it is unable to remove a file.
     3920This causes @code{make} to continue even if @code{rm} is unable to
     3921remove a file.
    40963922
    40973923@cindex @code{-i}
     
    40993925@findex .IGNORE
    41003926When you run @code{make} with the @samp{-i} or @samp{--ignore-errors}
    4101 flag, errors are ignored in all commands of all rules.  A rule in the
     3927flag, errors are ignored in all recipes of all rules.  A rule in the
    41023928makefile for the special target @code{.IGNORE} has the same effect, if
    41033929there are no prerequisites.  These ways of ignoring errors are obsolete
     
    41073933@samp{-i} flag, @code{make} treats an error return just like success,
    41083934except that it prints out a message that tells you the status code
    4109 the command exited with, and says that the error has been ignored.
     3935the shell exited with, and says that the error has been ignored.
    41103936
    41113937When an error happens that @code{make} has not been told to ignore,
    41123938it implies that the current target cannot be correctly remade, and neither
    41133939can any other that depends on it either directly or indirectly.  No further
    4114 commands will be executed for these targets, since their preconditions
     3940recipes will be executed for these targets, since their preconditions
    41153941have not been achieved.
    41163942
     
    41413967@cindex removal of target files
    41423968@cindex target, deleting on error
    4143 Usually when a command fails, if it has changed the target file at all,
     3969Usually when a recipe line fails, if it has changed the target file at all,
    41443970the file is corrupted and cannot be used---or at least it is not
    41453971completely updated.  Yet the file's time stamp says that it is now up to
    41463972date, so the next time @code{make} runs, it will not try to update that
    4147 file.  The situation is just the same as when the command is killed by a
     3973file.  The situation is just the same as when the shell is killed by a
    41483974signal; @pxref{Interrupts}.  So generally the right thing to do is to
    4149 delete the target file if the command fails after beginning to change
     3975delete the target file if the recipe fails after beginning to change
    41503976the file.  @code{make} will do this if @code{.DELETE_ON_ERROR} appears
    41513977as a target.  This is almost always what you want @code{make} to do, but
     
    41533979request it.
    41543980
    4155 @node Interrupts, Recursion, Errors, Commands
     3981@node Interrupts, Recursion, Errors, Recipes
    41563982@section Interrupting or Killing @code{make}
    41573983@cindex interrupt
     
    41623988@cindex killing (interruption)
    41633989
    4164 If @code{make} gets a fatal signal while a command is executing, it may
    4165 delete the target file that the command was supposed to update.  This is
     3990If @code{make} gets a fatal signal while a shell is executing, it may
     3991delete the target file that the recipe was supposed to update.  This is
    41663992done if the target file's last-modification time has changed since
    41673993@code{make} first checked it.
     
    41884014times to prevent other sorts of trouble.
    41894015
    4190 @node Recursion, Sequences, Interrupts, Commands
     4016@node Recursion, Sequences, Interrupts, Recipes
    41914017@section Recursive Use of @code{make}
    41924018@cindex recursion
     
    42584084
    42594085The value of this variable is the file name with which @code{make} was
    4260 invoked.  If this file name was @file{/bin/make}, then the command executed
     4086invoked.  If this file name was @file{/bin/make}, then the recipe executed
    42614087is @samp{cd subdir && /bin/make}.  If you use a special version of
    42624088@code{make} to run the top-level makefile, the same special version will be
     
    42644090@cindex @code{cd} (shell command)
    42654091
    4266 @cindex +, and commands
    4267 As a special feature, using the variable @code{MAKE} in the commands of
     4092@cindex +, and recipes
     4093As a special feature, using the variable @code{MAKE} in the recipe of
    42684094a rule alters the effects of the @samp{-t} (@samp{--touch}), @samp{-n}
    42694095(@samp{--just-print}), or @samp{-q} (@w{@samp{--question}}) option.
    42704096Using the @code{MAKE} variable has the same effect as using a @samp{+}
    4271 character at the beginning of the command line.  @xref{Instead of
    4272 Execution, ,Instead of Executing the Commands}.  This special feature
     4097character at the beginning of the recipe line.  @xref{Instead of
     4098Execution, ,Instead of Executing the Recipes}.  This special feature
    42734099is only enabled if the @code{MAKE} variable appears directly in the
    4274 command script: it does not apply if the @code{MAKE} variable is
    4275 referenced through expansion of another variable.  In the latter case
    4276 you must use the @samp{+} token to get these special effects.@refill
     4100recipe: it does not apply if the @code{MAKE} variable is referenced
     4101through expansion of another variable.  In the latter case you must
     4102use the @samp{+} token to get these special effects.@refill
    42774103
    42784104Consider the command @samp{make -t} in the above example.  (The
    42794105@samp{-t} option marks targets as up to date without actually running
    4280 any commands; see @ref{Instead of Execution}.)  Following the usual
     4106any recipes; see @ref{Instead of Execution}.)  Following the usual
    42814107definition of @samp{-t}, a @samp{make -t} command in the example would
    42824108create a file named @file{subsystem} and do nothing else.  What you
    4283 really want it to do is run @samp{@w{cd subdir &&} @w{make -t}}; but that would
    4284 require executing the command, and @samp{-t} says not to execute
    4285 commands.@refill
     4109really want it to do is run @samp{@w{cd subdir &&} @w{make -t}}; but
     4110that would require executing the recipe, and @samp{-t} says not to
     4111execute recipes.@refill
    42864112@cindex @code{-t}, and recursion
    42874113@cindex recursion, and @code{-t}
    42884114@cindex @code{--touch}, and recursion
    42894115
    4290 The special feature makes this do what you want: whenever a command
     4116The special feature makes this do what you want: whenever a recipe
    42914117line of a rule contains the variable @code{MAKE}, the flags @samp{-t},
    4292 @samp{-n} and @samp{-q} do not apply to that line.  Command lines
     4118@samp{-n} and @samp{-q} do not apply to that line.  Recipe lines
    42934119containing @code{MAKE} are executed normally despite the presence of a
    4294 flag that causes most commands not to be run.  The usual
     4120flag that causes most recipes not to be run.  The usual
    42954121@code{MAKEFLAGS} mechanism passes the flags to the sub-@code{make}
    42964122(@pxref{Options/Recursion, ,Communicating Options to a
    42974123Sub-@code{make}}), so your request to touch the files, or print the
    4298 commands, is propagated to the subsystem.@refill
     4124recipes, is propagated to the subsystem.@refill
    42994125
    43004126@node Variables/Recursion, Options/Recursion, MAKE Variable, Recursion
     
    43154141,Summary of Options}).@refill
    43164142
    4317 To pass down, or @dfn{export}, a variable, @code{make} adds the variable
    4318 and its value to the environment for running each command.  The
    4319 sub-@code{make}, in turn, uses the environment to initialize its table
    4320 of variable values.  @xref{Environment, ,Variables from the
    4321 Environment}.
     4143To pass down, or @dfn{export}, a variable, @code{make} adds the
     4144variable and its value to the environment for running each line of the
     4145recipe.  The sub-@code{make}, in turn, uses the environment to
     4146initialize its table of variable values.  @xref{Environment,
     4147,Variables from the Environment}.
    43224148
    43234149Except by explicit request, @code{make} exports a variable only if it
     
    44544280by itself earlier (in an included makefile, perhaps).  You
    44554281@strong{cannot} use @code{export} and @code{unexport} by themselves to
    4456 have variables exported for some commands and not for others.  The last
     4282have variables exported for some recipes and not for others.  The last
    44574283@code{export} or @code{unexport} directive that appears by itself
    44584284determines the behavior for the entire run of @code{make}.@refill
     
    44654291@samp{0} for the top-level @code{make}; @samp{1} for a sub-@code{make},
    44664292@samp{2} for a sub-sub-@code{make}, and so on.  The incrementation
    4467 happens when @code{make} sets up the environment for a command.@refill
     4293happens when @code{make} sets up the environment for a recipe.@refill
    44684294
    44694295The main use of @code{MAKELEVEL} is to test it in a conditional
     
    45344360ensure that there are only @samp{N} jobs running at the same time
    45354361between them all.  Note that any job that is marked recursive
    4536 (@pxref{Instead of Execution, ,Instead of Executing the Commands})
     4362(@pxref{Instead of Execution, ,Instead of Executing the Recipes})
    45374363doesn't count against the total jobs (otherwise we could get @samp{N}
    45384364sub-@code{make}s running and have no slots left over for any real work!)
     
    46704496disable it.
    46714497
    4672 @node Sequences, Empty Commands, Recursion, Commands
    4673 @section Defining Canned Command Sequences
     4498@node Sequences, Empty Recipes, Recursion, Recipes
     4499@section Defining Canned Recipes
     4500@cindex canned recipes
     4501@cindex recipes, canned
    46744502@cindex sequences of commands
    46754503@cindex commands, sequences of
    46764504
    4677 When the same sequence of commands is useful in making various targets, you
    4678 can define it as a canned sequence with the @code{define} directive, and
    4679 refer to the canned sequence from the rules for those targets.  The canned
    4680 sequence is actually a variable, so the name must not conflict with other
    4681 variable names.
    4682 
    4683 Here is an example of defining a canned sequence of commands:
     4505When the same sequence of commands is useful in making various
     4506targets, you can define it as a canned sequence with the @code{define}
     4507directive, and refer to the canned sequence from the recipes for those
     4508targets.  The canned sequence is actually a variable, so the name must
     4509not conflict with other variable names.
     4510
     4511Here is an example of defining a canned recipes:
    46844512
    46854513@example
     
    47064534rule's target file name.
    47074535
    4708 To use the canned sequence, substitute the variable into the commands of a
     4536To use the canned sequence, substitute the variable into the recipe of a
    47094537rule.  You can substitute it like any other variable
    47104538(@pxref{Reference, ,Basics of Variable References}).
     
    47304558@cindex -, and @code{define}
    47314559@cindex +, and @code{define}
    4732 In command execution, each line of a canned sequence is treated just as
     4560In recipe execution, each line of a canned sequence is treated just as
    47334561if the line appeared on its own in the rule, preceded by a tab.  In
    47344562particular, @code{make} invokes a separate subshell for each line.  You
    47354563can use the special prefix characters that affect command lines
    47364564(@samp{@@}, @samp{-}, and @samp{+}) on each line of a canned sequence.
    4737 @xref{Commands, ,Writing the Commands in Rules}.
     4565@xref{Recipes, ,Writing Recipes in Rules}.
    47384566For example, using this canned sequence:
    47394567
     
    47484576@noindent
    47494577@code{make} will not echo the first line, the @code{echo} command.
    4750 But it @emph{will} echo the following two command lines.
    4751 
    4752 On the other hand, prefix characters on the command line that refers to
     4578But it @emph{will} echo the following two recipe lines.
     4579
     4580On the other hand, prefix characters on the recipe line that refers to
    47534581a canned sequence apply to every line in the sequence.  So the rule:
    47544582
     
    47594587
    47604588@noindent
    4761 does not echo @emph{any} commands.
    4762 (@xref{Echoing, ,Command Echoing}, for a full explanation of @samp{@@}.)
    4763 
    4764 @node Empty Commands,  , Sequences, Commands
    4765 @section Using Empty Commands
    4766 @cindex empty commands
    4767 @cindex commands, empty
    4768 
    4769 It is sometimes useful to define commands which do nothing.  This is done
    4770 simply by giving a command that consists of nothing but whitespace.  For
     4589does not echo @emph{any} recipe lines.
     4590(@xref{Echoing, ,Recipe Echoing}, for a full explanation of @samp{@@}.)
     4591
     4592@node Empty Recipes,  , Sequences, Recipes
     4593@section Using Empty Recipes
     4594@cindex empty recipes
     4595@cindex recipes, empty
     4596
     4597It is sometimes useful to define recipes which do nothing.  This is done
     4598simply by giving a recipe that consists of nothing but whitespace.  For
    47714599example:
    47724600
     
    47764604
    47774605@noindent
    4778 defines an empty command string for @file{target}.  You could also use a
    4779 line beginning with a tab character to define an empty command string,
     4606defines an empty recipe for @file{target}.  You could also use a line
     4607beginning with a recipe prefix character to define an empty recipe,
    47804608but this would be confusing because such a line looks empty.
    47814609
    4782 @findex .DEFAULT@r{, and empty commands}
    4783 You may be wondering why you would want to define a command string that
     4610@findex .DEFAULT@r{, and empty recipes}
     4611You may be wondering why you would want to define a recipe that
    47844612does nothing.  The only reason this is useful is to prevent a target
    4785 from getting implicit commands (from implicit rules or the
     4613from getting implicit recipes (from implicit rules or the
    47864614@code{.DEFAULT} special target; @pxref{Implicit Rules} and
    47874615@pxref{Last Resort, ,Defining Last-Resort Default Rules}).@refill
     
    47974625@end ignore
    47984626
    4799 You may be inclined to define empty command strings for targets that are
     4627You may be inclined to define empty recipes for targets that are
    48004628not actual files, but only exist so that their prerequisites can be
    48014629remade.  However, this is not the best way to do that, because the
     
    48034631@xref{Phony Targets, ,Phony Targets}, for a better way to do this.
    48044632
    4805 @node Using Variables, Conditionals, Commands, Top
     4633@node Using Variables, Conditionals, Recipes, Top
    48064634@chapter How to Use Variables
    48074635@cindex variable
     
    48124640A @dfn{variable} is a name defined in a makefile to represent a string
    48134641of text, called the variable's @dfn{value}.  These values are
    4814 substituted by explicit request into targets, prerequisites, commands,
     4642substituted by explicit request into targets, prerequisites, recipes,
    48154643and other parts of the makefile.  (In some other versions of @code{make},
    48164644variables are called @dfn{macros}.)
     
    48184646
    48194647Variables and functions in all parts of a makefile are expanded when
    4820 read, except for the shell commands in rules, the right-hand sides of
    4821 variable definitions using @samp{=}, and the bodies of variable
    4822 definitions using the @code{define} directive.@refill
     4648read, except for in recipes, the right-hand sides of variable
     4649definitions using @samp{=}, and the bodies of variable definitions
     4650using the @code{define} directive.@refill
    48234651
    48244652Variables can represent lists of file names, options to pass to compilers,
     
    48644692* Pattern-specific::            Target-specific variable values can be applied
    48654693                                  to a group of targets that match a pattern.
     4694* Special Variables::           Variables with special meaning or behavior.
    48664695@end menu
    48674696
     
    48774706@samp{$@{foo@}} is a valid reference to the variable @code{foo}.  This
    48784707special significance of @samp{$} is why you must write @samp{$$} to have
    4879 the effect of a single dollar sign in a file name or command.
     4708the effect of a single dollar sign in a file name or recipe.
    48804709
    48814710Variable references can be used in any context: targets, prerequisites,
    4882 commands, most directives, and new variable values.  Here is an
     4711recipes, most directives, and new variable values.  Here is an
    48834712example of a common case, where a variable holds the names of all the
    48844713object files in a program:
     
    49624791
    49634792@noindent
    4964 will do what was intended: when @samp{CFLAGS} is expanded in a command,
     4793will do what was intended: when @samp{CFLAGS} is expanded in a recipe,
    49654794it will expand to @samp{-Ifoo -Ibar -O}.  A major disadvantage is that you
    49664795cannot append something on the end of a variable, as in
     
    50384867@noindent
    50394868An advantage of this use of @samp{:=} is that a typical
    5040 `descend into a directory' command then looks like this:
     4869`descend into a directory' recipe then looks like this:
    50414870
    50424871@example
     
    56865515You may nest @code{define} directives: @code{make} will keep track of
    56875516nested directives and report an error if they are not all properly
    5688 closed with @code{endef}.  Note that lines beginning with tab
    5689 characters are considered part of a command script, so any
    5690 @code{define} or @code{endef} strings appearing on such a line will
    5691 not be considered @code{make} operators.
     5517closed with @code{endef}.  Note that lines beginning with the recipe
     5518prefix character are considered part of a recipe, so any @code{define}
     5519or @code{endef} strings appearing on such a line will not be
     5520considered @code{make} operators.
    56925521
    56935522@example
     
    57045533
    57055534@need 800
    5706 When used in a command script, the previous example is functionally
    5707 equivalent to this:
     5535When used in a recipe, the previous example is functionally equivalent
     5536to this:
    57085537
    57095538@example
     
    57155544shell commands.  However, note that using two separate lines means
    57165545@code{make} will invoke the shell twice, running an independent subshell
    5717 for each line.  @xref{Execution, ,Command Execution}.
     5546for each line.  @xref{Execution, ,Recipe Execution}.
    57185547
    57195548If you want variable definitions made with @code{define} to take
     
    57525581and therefore are not affected by the value in the environment.)
    57535582
    5754 When @code{make} runs a command script, variables defined in the
    5755 makefile are placed into the environment of that command.  This allows
     5583When @code{make} runs a recipe, variables defined in the
     5584makefile are placed into the environment of each shell.  This allows
    57565585you to pass values to sub-@code{make} invocations (@pxref{Recursion,
    57575586,Recursive Use of @code{make}}).  By default, only variables that came
     
    57895618based on the target that @code{make} is currently building.  As with
    57905619automatic variables, these values are only available within the context
    5791 of a target's command script (and in other target-specific assignments).
     5620of a target's recipe (and in other target-specific assignments).
    57925621
    57935622Set a target-specific variable value like this:
     
    58245653
    58255654Target-specific variables have the same priority as any other makefile
    5826 variable.  Variables provided on the command-line (and in the
     5655variable.  Variables provided on the command line (and in the
    58275656environment if the @samp{-e} option is in force) will take precedence.
    58285657Specifying the @code{override} directive will allow the target-specific
     
    58425671
    58435672@noindent
    5844 will set @code{CFLAGS} to @samp{-g} in the command script for
    5845 @file{prog}, but it will also set @code{CFLAGS} to @samp{-g} in the
    5846 command scripts that create @file{prog.o}, @file{foo.o}, and
    5847 @file{bar.o}, and any command scripts which create their
    5848 prerequisites.
     5673will set @code{CFLAGS} to @samp{-g} in the recipe for @file{prog}, but
     5674it will also set @code{CFLAGS} to @samp{-g} in the recipes that create
     5675@file{prog.o}, @file{foo.o}, and @file{bar.o}, and any recipes which
     5676create their prerequisites.
    58495677
    58505678Be aware that a given prerequisite will only be built once per
     
    58565684ignore the target-specific values from any other targets.
    58575685
    5858 @node Pattern-specific,  , Target-specific, Using Variables
     5686@node Pattern-specific, Special Variables, Target-specific, Using Variables
    58595687@section Pattern-specific Variable Values
    58605688@cindex pattern-specific variables
     
    58895717values, multiple @var{pattern} values create a pattern-specific variable
    58905718value for each pattern individually.  The @var{variable-assignment} can
    5891 be any valid form of assignment.  Any command-line variable setting will
     5719be any valid form of assignment.  Any command line variable setting will
    58925720take precedence, unless @code{override} is specified.
    58935721
     
    59025730matching the pattern @code{%.o}.
    59035731
     5732@node Special Variables,  , Pattern-specific, Using Variables
     5733@comment  node-name,  next,  previous,  up
     5734@section Other Special Variables
     5735@cindex makefiles, and special variables
     5736@cindex special variables
     5737
     5738GNU @code{make} supports some variables that have special properties.
     5739
     5740@table @code
     5741
     5742@vindex MAKEFILE_LIST @r{(list of parsed makefiles)}
     5743@cindex makefiles, and @code{MAKEFILE_LIST} variable
     5744@cindex including (@code{MAKEFILE_LIST} variable)
     5745@item MAKEFILE_LIST
     5746Contains the name of each makefile that is parsed by @code{make}, in
     5747the order in which it was parsed.  The name is appended just
     5748before @code{make} begins to parse the makefile.  Thus, if the first
     5749thing a makefile does is examine the last word in this variable, it
     5750will be the name of the current makefile.  Once the current makefile
     5751has used @code{include}, however, the last word will be the
     5752just-included makefile.
     5753
     5754If a makefile named @code{Makefile} has this content:
     5755
     5756@example
     5757@group
     5758name1 := $(lastword $(MAKEFILE_LIST))
     5759
     5760include inc.mk
     5761
     5762name2 := $(lastword $(MAKEFILE_LIST))
     5763
     5764all:
     5765        @@echo name1 = $(name1)
     5766        @@echo name2 = $(name2)
     5767@end group
     5768@end example
     5769
     5770@noindent
     5771then you would expect to see this output:
     5772
     5773@example
     5774@group
     5775name1 = Makefile
     5776name2 = inc.mk
     5777@end group
     5778@end example
     5779
     5780@vindex .DEFAULT_GOAL @r{(define default goal)}
     5781@item .DEFAULT_GOAL
     5782Sets the default goal to be used if no targets were specified on the
     5783command line (@pxref{Goals, , Arguments to Specify the Goals}).  The
     5784@code{.DEFAULT_GOAL} variable allows you to discover the current
     5785default goal, restart the default goal selection algorithm by clearing
     5786its value, or to explicitly set the default goal.  The following
     5787example illustrates these cases:
     5788
     5789@example
     5790@group
     5791# Query the default goal.
     5792ifeq ($(.DEFAULT_GOAL),)
     5793  $(warning no default goal is set)
     5794endif
     5795
     5796.PHONY: foo
     5797foo: ; @@echo $@@
     5798
     5799$(warning default goal is $(.DEFAULT_GOAL))
     5800
     5801# Reset the default goal.
     5802.DEFAULT_GOAL :=
     5803
     5804.PHONY: bar
     5805bar: ; @@echo $@@
     5806
     5807$(warning default goal is $(.DEFAULT_GOAL))
     5808
     5809# Set our own.
     5810.DEFAULT_GOAL := foo
     5811@end group
     5812@end example
     5813
     5814This makefile prints:
     5815
     5816@example
     5817@group
     5818no default goal is set
     5819default goal is foo
     5820default goal is bar
     5821foo
     5822@end group
     5823@end example
     5824
     5825Note that assigning more than one target name to @code{.DEFAULT_GOAL} is
     5826illegal and will result in an error.
     5827
     5828@vindex MAKE_RESTARTS @r{(number of times @code{make} has restarted)}
     5829@item MAKE_RESTARTS
     5830This variable is set only if this instance of @code{make} has
     5831restarted (@pxref{Remaking Makefiles, , How Makefiles Are Remade}): it
     5832will contain the number of times this instance has restarted.  Note
     5833this is not the same as recursion (counted by the @code{MAKELEVEL}
     5834variable).  You should not set, modify, or export this variable.
     5835
     5836@vindex .CMDPREFIX @r{(change the recipe prefix character)}
     5837@item .CMDPREFIX
     5838The first character of the value of this variable is used as the
     5839character make assumes is introducing a recipe line.  If the variable
     5840is empty (as it is by default) that character is the standard tab
     5841character.  For example, this is a valid makefile:
     5842
     5843@example
     5844@group
     5845.CMDPREFIX = >
     5846all:
     5847> @@echo Hello, world
     5848@end group
     5849@end example
     5850
     5851The value of @code{.CMDPREFIX} can be changed multiple times; once set
     5852it stays in effect for all rules parsed until it is modified.
     5853
     5854@vindex .VARIABLES @r{(list of variables)}
     5855@item .VARIABLES
     5856Expands to a list of the @emph{names} of all global variables defined
     5857so far.  This includes variables which have empty values, as well as
     5858built-in variables (@pxref{Implicit Variables, , Variables Used by
     5859Implicit Rules}), but does not include any variables which are only
     5860defined in a target-specific context.  Note that any value you assign
     5861to this variable will be ignored; it will always return its special
     5862value.
     5863
     5864@c @vindex .TARGETS @r{(list of targets)}
     5865@c @item .TARGETS
     5866@c The second special variable is @code{.TARGETS}.  When expanded, the
     5867@c value consists of a list of all targets defined in all makefiles read
     5868@c up until that point.  Note it's not enough for a file to be simply
     5869@c mentioned in the makefile to be listed in this variable, even if it
     5870@c would match an implicit rule and become an ``implicit target''.  The
     5871@c file must appear as a target, on the left-hand side of a ``:'', to be
     5872@c considered a target for the purposes of this variable.
     5873
     5874@vindex .FEATURES @r{(list of supported features)}
     5875@item .FEATURES
     5876Expands to a list of special features supported by this version of
     5877@code{make}.  Possible values include:
     5878
     5879@table @samp
     5880
     5881@item archives
     5882Supports @code{ar} (archive) files using special filename syntax.
     5883@xref{Archives, ,Using @code{make} to Update Archive Files}.
     5884
     5885@item check-symlink
     5886Supports the @code{-L} (@code{--check-symlink-times}) flag.
     5887@xref{Options Summary, ,Summary of Options}.
     5888
     5889@item else-if
     5890Supports ``else if'' non-nested conditionals.  @xref{Conditional
     5891Syntax, ,Syntax of Conditionals}.
     5892
     5893@item jobserver
     5894Supports ``job server'' enhanced parallel builds.  @xref{Parallel,
     5895,Parallel Execution}.
     5896
     5897@item second-expansion
     5898Supports secondary expansion of prerequisite lists.
     5899
     5900@item order-only
     5901Supports order-only prerequisites.  @xref{Prerequisite Types, ,Types
     5902of Prerequisites}.
     5903
     5904@item target-specific
     5905Supports target-specific and pattern-specific variable assignments.
     5906@xref{Target-specific, ,Target-specific Variable Values}.
     5907
     5908@end table
     5909
     5910@vindex .INCLUDE_DIRS @r{(list of include directories)}
     5911@item .INCLUDE_DIRS
     5912Expands to a list of directories that @code{make} searches for
     5913included makefiles (@pxref{Include, , Including Other Makefiles}).
     5914
     5915@end table
     5916
    59045917@node Conditionals, Functions, Using Variables, Top
    59055918@chapter Conditional Parts of Makefiles
    59065919
    59075920@cindex conditionals
    5908 A @dfn{conditional} causes part of a makefile to be obeyed or ignored
    5909 depending on the values of variables.  Conditionals can compare the
    5910 value of one variable to another, or the value of a variable to
    5911 a constant string.  Conditionals control what @code{make} actually
    5912 ``sees'' in the makefile, so they @emph{cannot} be used to control shell
    5913 commands at the time of execution.@refill
     5921A @dfn{conditional} directive causes part of a makefile to be obeyed
     5922or ignored depending on the values of variables.  Conditionals can
     5923compare the value of one variable to another, or the value of a
     5924variable to a constant string.  Conditionals control what @code{make}
     5925actually ``sees'' in the makefile, so they @emph{cannot} be used to
     5926control recipes at the time of execution.@refill
    59145927
    59155928@menu
     
    59225935@section Example of a Conditional
    59235936
    5924 The following example of a conditional tells @code{make} to use one set
    5925 of libraries if the @code{CC} variable is @samp{gcc}, and a different
    5926 set of libraries otherwise.  It works by controlling which of two
    5927 command lines will be used as the command for a rule.  The result is
    5928 that @samp{CC=gcc} as an argument to @code{make} changes not only which
     5937The following example of a conditional tells @code{make} to use one
     5938set of libraries if the @code{CC} variable is @samp{gcc}, and a
     5939different set of libraries otherwise.  It works by controlling which
     5940of two recipe lines will be used for the rule.  The result is that
     5941@samp{CC=gcc} as an argument to @code{make} changes not only which
    59295942compiler is used but also which libraries are linked.
    59305943
     
    61536166@end table
    61546167
    6155 Extra spaces are allowed and ignored at the beginning of the conditional
    6156 directive line, but a tab is not allowed.  (If the line begins with a tab,
    6157 it will be considered a command for a rule.)  Aside from this, extra spaces
    6158 or tabs may be inserted with no effect anywhere except within the directive
    6159 name or within an argument.  A comment starting with @samp{#} may appear at
    6160 the end of the line.
     6168Extra spaces are allowed and ignored at the beginning of the
     6169conditional directive line, but a tab is not allowed.  (If the line
     6170begins with a tab, it will be considered part of a recipe for a rule.)
     6171Aside from this, extra spaces or tabs may be inserted with no effect
     6172anywhere except within the directive name or within an argument.  A
     6173comment starting with @samp{#} may appear at the end of the line.
    61616174
    61626175The other two directives that play a part in a conditional are @code{else}
     
    61756188@code{make} evaluates conditionals when it reads a makefile.
    61766189Consequently, you cannot use automatic variables in the tests of
    6177 conditionals because they are not defined until commands are run
     6190conditionals because they are not defined until recipes are run
    61786191(@pxref{Automatic Variables}).
    61796192
     
    62126225
    62136226@noindent
    6214 The @samp{+} prefix marks those command lines as ``recursive'' so
    6215 that they will be executed despite use of the @samp{-t} flag.
     6227The @samp{+} prefix marks those recipe lines as ``recursive'' so that
     6228they will be executed despite use of the @samp{-t} flag.
    62166229@xref{Recursion, ,Recursive Use of @code{make}}.
    62176230
     
    62206233@cindex functions
    62216234
    6222 @dfn{Functions} allow you to do text processing in the makefile to compute
    6223 the files to operate on or the commands to use.  You use a function in a
    6224 @dfn{function call}, where you give the name of the function and some text
    6225 (the @dfn{arguments}) for the function to operate on.  The result of the
    6226 function's processing is substituted into the makefile at the point of the
    6227 call, just as a variable might be substituted.
     6235@dfn{Functions} allow you to do text processing in the makefile to
     6236compute the files to operate on or the commands to use in recipes.
     6237You use a function in a @dfn{function call}, where you give the name
     6238of the function and some text (the @dfn{arguments}) for the function
     6239to operate on.  The result of the function's processing is substituted
     6240into the makefile at the point of the call, just as a variable might
     6241be substituted.
    62286242
    62296243@menu
     
    72387252@item automatic
    72397253
    7240 if @var{variable} is an automatic variable defined for the
    7241 execution of the commands for each rule
    7242 (@pxref{Automatic Variables}).
     7254if @var{variable} is an automatic variable defined for the execution
     7255of the recipe for each rule (@pxref{Automatic Variables}).
    72437256@end table
    72447257
     
    73307343@section The @code{shell} Function
    73317344@findex shell
    7332 @cindex commands, expansion
     7345@cindex command expansion
    73337346@cindex backquotes
    73347347@cindex shell command, function for
     
    73897402@cindex error, stopping on
    73907403@cindex stopping make
    7391 Generates a fatal error where the message is @var{text}.  Note that the
    7392 error is generated whenever this function is evaluated.  So, if you put
    7393 it inside a command script or on the right side of a recursive variable
    7394 assignment, it won't be evaluated until later.  The @var{text} will be
    7395 expanded before the error is generated.
     7404Generates a fatal error where the message is @var{text}.  Note that
     7405the error is generated whenever this function is evaluated.  So, if
     7406you put it inside a recipe or on the right side of a recursive
     7407variable assignment, it won't be evaluated until later.  The
     7408@var{text} will be expanded before the error is generated.
    73967409
    73977410For example,
     
    74637476The exit status is one if you use the @samp{-q} flag and @code{make}
    74647477determines that some target is not already up to date.
    7465 @xref{Instead of Execution, ,Instead of Executing the Commands}.
     7478@xref{Instead of Execution, ,Instead of Executing the Recipes}.
    74667479@end table
    74677480
     
    74717484                                  parts of the makefile to use.
    74727485* Instead of Execution::        How to use mode flags to specify what
    7473                                   kind of thing to do with the commands
     7486                                  kind of thing to do with the recipes
    74747487                                  in the makefile other than simply
    74757488                                  execute them.
     
    75187531(@pxref{Special Variables, , Other Special Variables}).
    75197532
    7520 You can also specify a different goal or goals with command-line
     7533You can also specify a different goal or goals with command line
    75217534arguments to @code{make}.  Use the name of the goal as an argument.
    75227535If you specify several goals, @code{make} processes each of them in
     
    75687581a rule in the makefile but is not a prerequisite of the default goal.
    75697582
    7570 Another use of specifying a goal is to run the commands associated with
     7583Another use of specifying a goal is to run the recipe associated with
    75717584a phony target (@pxref{Phony Targets}) or empty target (@pxref{Empty
    75727585Targets, ,Empty Target Files to Record Events}).  Many makefiles contain
     
    76407653
    76417654@node Instead of Execution, Avoiding Compilation, Goals, Running
    7642 @section Instead of Executing the Commands
     7655@section Instead of Executing the Recipes
    76437656@cindex execution, instead of
    7644 @cindex commands, instead of executing
     7657@cindex recipes, instead of executing
    76457658
    76467659The makefile tells @code{make} how to tell whether a target is up to date,
     
    76597672@cindex @code{-n}
    76607673
    7661 ``No-op''.  The activity is to print what commands would be used to make
    7662 the targets up to date, but not actually execute them.
     7674``No-op''.  The activity is to print what recipe would be used to make
     7675the targets up to date, but not actually execute it.
    76637676
    76647677@item -t
     
    76807693
    76817694``Question''.  The activity is to find out silently whether the targets
    7682 are up to date already; but execute no commands in either case.  In other
     7695are up to date already; but execute no recipe in either case.  In other
    76837696words, neither compilation nor output will occur.
    76847697
     
    77017714@end table
    77027715
    7703 With the @samp{-n} flag, @code{make} prints the commands that it would
    7704 normally execute but does not execute them.
    7705 
    7706 With the @samp{-t} flag, @code{make} ignores the commands in the rules
     7716With the @samp{-n} flag, @code{make} prints the recipe that it would
     7717normally execute but does not execute it.
     7718
     7719With the @samp{-t} flag, @code{make} ignores the recipes in the rules
    77077720and uses (in effect) the command @code{touch} for each target that needs to
    77087721be remade.  The @code{touch} command is also printed, unless @samp{-s} or
     
    77117724
    77127725With the @samp{-q} flag, @code{make} prints nothing and executes no
    7713 commands, but the exit status code it returns is zero if and only if the
     7726recipes, but the exit status code it returns is zero if and only if the
    77147727targets to be considered are already up to date.  If the exit status is
    77157728one, then some updating needs to be done.  If @code{make} encounters an
     
    77207733invocation of @code{make}.
    77217734
    7722 @cindex +, and command execution
    7723 The @samp{-n}, @samp{-t}, and @samp{-q} options do not affect command
     7735@cindex +, and recipe execution
     7736The @samp{-n}, @samp{-t}, and @samp{-q} options do not affect recipe
    77247737lines that begin with @samp{+} characters or contain the strings
    77257738@samp{$(MAKE)} or @samp{$@{MAKE@}}.  Note that only the line containing
     
    77387751@item
    77397752Without the @samp{-n} or @samp{-q} flag, when @code{make} is actually
    7740 executing commands, the @samp{-W} flag can direct @code{make} to act
    7741 as if some files had been modified, without actually modifying the
    7742 files.@refill
     7753executing recipes, the @samp{-W} flag can direct @code{make} to act as
     7754if some files had been modified, without actually running the recipes
     7755for those files.@refill
    77437756@end itemize
    77447757
     
    77667779If you anticipate the problem before changing the header file, you can
    77677780use the @samp{-t} flag.  This flag tells @code{make} not to run the
    7768 commands in the rules, but rather to mark the target up to date by
     7781recipes in the rules, but rather to mark the target up to date by
    77697782changing its last-modification date.  You would follow this procedure:
    77707783
     
    78177830The most common way to use this facility is to pass extra flags to
    78187831compilers.  For example, in a properly written makefile, the variable
    7819 @code{CFLAGS} is included in each command that runs the C compiler, so a
     7832@code{CFLAGS} is included in each recipe that runs the C compiler, so a
    78207833file @file{foo.c} would be compiled something like this:
    78217834
     
    78477860makefile works by changing the variables.
    78487861
    7849 When you override a variable with a command argument, you can define either
    7850 a recursively-expanded variable or a simply-expanded variable.  The
    7851 examples shown above make a recursively-expanded variable; to make a
    7852 simply-expanded variable, write @samp{:=} instead of @samp{=}.  But, unless
    7853 you want to include a variable reference or function call in the
    7854 @emph{value} that you specify, it makes no difference which kind of
    7855 variable you create.
     7862When you override a variable with a command line argument, you can
     7863define either a recursively-expanded variable or a simply-expanded
     7864variable.  The examples shown above make a recursively-expanded
     7865variable; to make a simply-expanded variable, write @samp{:=} instead
     7866of @samp{=}.  But, unless you want to include a variable reference or
     7867function call in the @emph{value} that you specify, it makes no
     7868difference which kind of variable you create.
    78567869
    78577870There is one way that the makefile can change a variable that you have
     
    78667879
    78677880Normally, when an error happens in executing a shell command, @code{make}
    7868 gives up immediately, returning a nonzero status.  No further commands are
     7881gives up immediately, returning a nonzero status.  No further recipes are
    78697882executed for any target.  The error implies that the goal cannot be
    78707883correctly remade, and @code{make} reports this as soon as it knows.
     
    80158028@itemx --ignore-errors
    80168029@cindex @code{--ignore-errors}
    8017 Ignore all errors in commands executed to remake files.
    8018 @xref{Errors, ,Errors in Commands}.
     8030Ignore all errors in recipes executed to remake files.
     8031@xref{Errors, ,Errors in Recipes}.
    80198032
    80208033@item -I @var{dir}
     
    80318044@itemx --jobs[=@var{jobs}]
    80328045@cindex @code{--jobs}
    8033 Specifies the number of jobs (commands) to run simultaneously.  With no
    8034 argument, @code{make} runs as many jobs simultaneously as possible.  If
    8035 there is more than one @samp{-j} option, the last one is effective.
    8036 @xref{Parallel, ,Parallel Execution},
    8037 for more information on how commands are run.
    8038 Note that this option is ignored on MS-DOS.
     8046Specifies the number of recipes (jobs) to run simultaneously.  With no
     8047argument, @code{make} runs as many recipes simultaneously as possible.
     8048If there is more than one @samp{-j} option, the last one is effective.
     8049@xref{Parallel, ,Parallel Execution}, for more information on how
     8050recipes are run.  Note that this option is ignored on MS-DOS.
    80398051
    80408052@item -k
     
    80538065@itemx --max-load[=@var{load}]
    80548066@cindex @code{--max-load}
    8055 Specifies that no new jobs (commands) should be started if there are
    8056 other jobs running and the load average is at least @var{load} (a
     8067Specifies that no new recipes should be started if there are other
     8068recipes running and the load average is at least @var{load} (a
    80578069floating-point number).  With no argument, removes a previous load
    80588070limit.  @xref{Parallel, ,Parallel Execution}.
     
    80788090@c Extra blank line here makes the table look better.
    80798091
    8080 Print the commands that would be executed, but do not execute them.
    8081 @xref{Instead of Execution, ,Instead of Executing the Commands}.
     8092Print the recipe that would be executed, but do not execute it.
     8093@xref{Instead of Execution, ,Instead of Executing the Recipes}.
    80828094
    80838095@item -o @var{file}
     
    81008112@cindex predefined rules and variables, printing
    81018113Print the data base (rules and variable values) that results from
    8102 reading the makefiles; then execute as usual or as otherwise specified.
    8103 This also prints the version information given by the @samp{-v} switch
    8104 (see below).  To print the data base without trying to remake any files,
    8105 use @w{@samp{make -qp}}.  To print the data base of predefined rules and
    8106 variables, use @w{@samp{make -p -f /dev/null}}.  The data base output
    8107 contains filename and linenumber information for command and variable
    8108 definitions, so it can be a useful debugging tool in complex environments.
     8114reading the makefiles; then execute as usual or as otherwise
     8115specified.  This also prints the version information given by the
     8116@samp{-v} switch (see below).  To print the data base without trying
     8117to remake any files, use @w{@samp{make -qp}}.  To print the data base
     8118of predefined rules and variables, use @w{@samp{make -p -f /dev/null}}.
     8119The data base output contains filename and linenumber information for
     8120recipe and variable definitions, so it can be a useful debugging tool
     8121in complex environments.
    81098122
    81108123@item -q
     
    81128125@itemx --question
    81138126@cindex @code{--question}
    8114 ``Question mode''.  Do not run any commands, or print anything; just
     8127``Question mode''.  Do not run any recipes, or print anything; just
    81158128return an exit status that is zero if the specified targets are already
    81168129up to date, one if any remaking is required, or two if an error is
    81178130encountered.  @xref{Instead of Execution, ,Instead of Executing the
    8118 Commands}.@refill
     8131Recipes}.@refill
    81198132
    81208133@item -r
     
    81518164@c Extra blank line here makes the table look better.
    81528165
    8153 Silent operation; do not print the commands as they are executed.
    8154 @xref{Echoing, ,Command Echoing}.
     8166Silent operation; do not print the recipes as they are executed.
     8167@xref{Echoing, ,Recipe Echoing}.
    81558168
    81568169@item -S
     
    81758188
    81768189Touch files (mark them up to date without really changing them)
    8177 instead of running their commands.  This is used to pretend that the
    8178 commands were done, in order to fool future invocations of
    8179 @code{make}.  @xref{Instead of Execution, ,Instead of Executing the Commands}.
     8190instead of running their recipes.  This is used to pretend that the
     8191recipes were done, in order to fool future invocations of
     8192@code{make}.  @xref{Instead of Execution, ,Instead of Executing the Recipes}.
    81808193
    81818194@item -v
     
    82188231@code{make}, except that the modification time is changed only in the
    82198232imagination of @code{make}.
    8220 @xref{Instead of Execution, ,Instead of Executing the Commands}.
     8233@xref{Instead of Execution, ,Instead of Executing the Recipes}.
    82218234
    82228235@item --warn-undefined-variables
     
    82528265@end iftex
    82538266
    8254 The built-in implicit rules use several variables in their commands so
     8267The built-in implicit rules use several variables in their recipes so
    82558268that, by changing the values of the variables, you can change the way the
    82568269implicit rule works.  For example, the variable @code{CFLAGS} controls the
     
    82748287@menu
    82758288* Using Implicit::              How to use an existing implicit rule
    8276                                   to get the commands for updating a file.
     8289                                  to get the recipes for updating a file.
    82778290* Catalogue of Rules::          A list of built-in implicit rules.
    82788291* Implicit Variables::          How to change what predefined rules do.
    82798292* Chained Rules::               How to use a chain of implicit rules.
    82808293* Pattern Rules::               How to define new implicit rules.
    8281 * Last Resort::                 How to define commands for rules which
     8294* Last Resort::                 How to define recipes for rules which
    82828295                                  cannot find any.
    82838296* Suffix Rules::                The old-fashioned style of implicit rule.
     
    82918304@cindex rule, implicit, how to use
    82928305
    8293 To allow @code{make} to find a customary method for updating a target file,
    8294 all you have to do is refrain from specifying commands yourself.  Either
    8295 write a rule with no command lines, or don't write a rule at all.  Then
    8296 @code{make} will figure out which implicit rule to use based on which
    8297 kind of source file exists or can be made.
     8306To allow @code{make} to find a customary method for updating a target
     8307file, all you have to do is refrain from specifying recipes yourself.
     8308Either write a rule with no recipe, or don't write a rule at all.
     8309Then @code{make} will figure out which implicit rule to use based on
     8310which kind of source file exists or can be made.
    82988311
    82998312For example, suppose the makefile looks like this:
     
    83098322This happens whether or not the file @file{foo.o} currently exists.
    83108323
    8311 If an implicit rule is found, it can supply both commands and one or
     8324If an implicit rule is found, it can supply both a recipe and one or
    83128325more prerequisites (the source files).  You would want to write a rule
    8313 for @file{foo.o} with no command lines if you need to specify additional
     8326for @file{foo.o} with no recipe if you need to specify additional
    83148327prerequisites, such as header files, that the implicit rule cannot
    83158328supply.
     
    83388351
    83398352In general, @code{make} searches for an implicit rule for each target, and
    8340 for each double-colon rule, that has no commands.  A file that is mentioned
     8353for each double-colon rule, that has no recipe.  A file that is mentioned
    83418354only as a prerequisite is considered a target whose rule specifies nothing,
    83428355so implicit rule search happens for it.  @xref{Implicit Rule Search, ,Implicit Rule Search Algorithm}, for the
     
    83618374
    83628375If you do not want an implicit rule to be used for a target that has no
    8363 commands, you can give that target empty commands by writing a semicolon
    8364 (@pxref{Empty Commands, ,Defining Empty Commands}).
     8376recipe, you can give that target an empty recipe by writing a semicolon
     8377(@pxref{Empty Recipes, ,Defining Empty Recipes}).
    83658378
    83668379@node Catalogue of Rules, Implicit Variables, Using Implicit, Implicit Rules
     
    84088421@pindex .c
    84098422@file{@var{n}.o} is made automatically from @file{@var{n}.c} with
    8410 a command of the form @samp{$(CC) -c $(CPPFLAGS) $(CFLAGS)}.@refill
     8423a recipe of the form @samp{$(CC) -c $(CPPFLAGS) $(CFLAGS)}.@refill
    84118424
    84128425@item Compiling C++ programs
     
    84178430@pindex .C
    84188431@file{@var{n}.o} is made automatically from @file{@var{n}.cc},
    8419 @file{@var{n}.cpp}, or @file{@var{n}.C} with a command of the form
     8432@file{@var{n}.cpp}, or @file{@var{n}.C} with a recipe of the form
    84208433@samp{$(CXX) -c $(CPPFLAGS) $(CXXFLAGS)}.  We encourage you to use the
    84218434suffix @samp{.cc} for C++ source files instead of @samp{.C}.@refill
     
    84268439@pindex .p
    84278440@file{@var{n}.o} is made automatically from @file{@var{n}.p}
    8428 with the command @samp{$(PC) -c $(PFLAGS)}.@refill
     8441with the recipe @samp{$(PC) -c $(PFLAGS)}.@refill
    84298442
    84308443@item Compiling Fortran and Ratfor programs
     
    84378450@file{@var{n}.o} is made automatically from @file{@var{n}.r},
    84388451@file{@var{n}.F} or @file{@var{n}.f} by running the
    8439 Fortran compiler.  The precise command used is as follows:@refill
     8452Fortran compiler.  The precise recipe used is as follows:@refill
    84408453
    84418454@table @samp
     
    84528465@file{@var{n}.F}.  This rule runs just the preprocessor to convert a
    84538466Ratfor or preprocessable Fortran program into a strict Fortran
    8454 program.  The precise command used is as follows:@refill
     8467program.  The precise recipe used is as follows:@refill
    84558468
    84568469@table @samp
     
    84678480@pindex .def
    84688481@pindex .mod
    8469 @file{@var{n}.sym} is made from @file{@var{n}.def} with a command
     8482@file{@var{n}.sym} is made from @file{@var{n}.def} with a recipe
    84708483of the form @samp{$(M2C) $(M2FLAGS) $(DEFFLAGS)}.  @file{@var{n}.o}
    84718484is made from @file{@var{n}.mod}; the form is:
     
    84788491@pindex .s
    84798492@file{@var{n}.o} is made automatically from @file{@var{n}.s} by
    8480 running the assembler, @code{as}.  The precise command is
     8493running the assembler, @code{as}.  The precise recipe is
    84818494@samp{$(AS) $(ASFLAGS)}.@refill
    84828495
    84838496@pindex .S
    84848497@file{@var{n}.s} is made automatically from @file{@var{n}.S} by
    8485 running the C preprocessor, @code{cpp}.  The precise command is
     8498running the C preprocessor, @code{cpp}.  The precise recipe is
    84868499@w{@samp{$(CPP) $(CPPFLAGS)}}.
    84878500
     
    84928505@file{@var{n}} is made automatically from @file{@var{n}.o} by running
    84938506the linker (usually called @code{ld}) via the C compiler.  The precise
    8494 command used is @w{@samp{$(CC) $(LDFLAGS) @var{n}.o $(LOADLIBES) $(LDLIBS)}}.
     8507recipe used is @w{@samp{$(CC) $(LDFLAGS) @var{n}.o $(LOADLIBES) $(LDLIBS)}}.
    84958508
    84968509This rule does the right thing for a simple program with only one
     
    85218534In more complicated cases, such as when there is no object file whose
    85228535name derives from the executable file name, you must write an explicit
    8523 command for linking.
     8536recipe for linking.
    85248537
    85258538Each kind of file automatically made into @samp{.o} object files will
     
    85368549@pindex .y
    85378550@file{@var{n}.c} is made automatically from @file{@var{n}.y} by
    8538 running Yacc with the command @samp{$(YACC) $(YFLAGS)}.
     8551running Yacc with the recipe @samp{$(YACC) $(YFLAGS)}.
    85398552
    85408553@item Lex for C programs
     
    85438556@pindex .l
    85448557@file{@var{n}.c} is made automatically from @file{@var{n}.l} by
    8545 running Lex.  The actual command is @samp{$(LEX) $(LFLAGS)}.
     8558running Lex.  The actual recipe is @samp{$(LEX) $(LFLAGS)}.
    85468559
    85478560@item Lex for Ratfor programs
    85488561@file{@var{n}.r} is made automatically from @file{@var{n}.l} by
    8549 running Lex.  The actual command is @samp{$(LEX) $(LFLAGS)}.
     8562running Lex.  The actual recipe is @samp{$(LEX) $(LFLAGS)}.
    85508563
    85518564The convention of using the same suffix @samp{.l} for all Lex files
     
    85728585@pindex .ln
    85738586@file{@var{n}.ln} is made from @file{@var{n}.c} by running @code{lint}.
    8574 The precise command is @w{@samp{$(LINT) $(LINTFLAGS) $(CPPFLAGS) -i}}.
    8575 The same command is used on the C code produced from
     8587The precise recipe is @w{@samp{$(LINT) $(LINTFLAGS) $(CPPFLAGS) -i}}.
     8588The same recipe is used on the C code produced from
    85768589@file{@var{n}.y} or @file{@var{n}.l}.@refill
    85778590
     
    85898602@pindex .w
    85908603@pindex .ch
    8591 @file{@var{n}.dvi} is made from @file{@var{n}.tex} with the command
     8604@file{@var{n}.dvi} is made from @file{@var{n}.tex} with the recipe
    85928605@samp{$(TEX)}.  @file{@var{n}.tex} is made from @file{@var{n}.web} with
    85938606@samp{$(WEAVE)}, or from @file{@var{n}.w} (and from @file{@var{n}.ch} if
     
    86078620@pindex .txinfo
    86088621@file{@var{n}.dvi} is made from @file{@var{n}.texinfo},
    8609 @file{@var{n}.texi}, or @file{@var{n}.txinfo}, with the command
     8622@file{@var{n}.texi}, or @file{@var{n}.txinfo}, with the recipe
    86108623@w{@samp{$(TEXI2DVI) $(TEXI2DVI_FLAGS)}}.  @file{@var{n}.info} is made from
    86118624@file{@var{n}.texinfo}, @file{@var{n}.texi}, or @file{@var{n}.txinfo}, with
    8612 the command @w{@samp{$(MAKEINFO) $(MAKEINFO_FLAGS)}}.
     8625the recipe @w{@samp{$(MAKEINFO) $(MAKEINFO_FLAGS)}}.
    86138626
    86148627@item RCS
     
    86188631Any file @file{@var{n}} is extracted if necessary from an RCS file
    86198632named either @file{@var{n},v} or @file{RCS/@var{n},v}.  The precise
    8620 command used is @w{@samp{$(CO) $(COFLAGS)}}.  @file{@var{n}} will not be
     8633recipe used is @w{@samp{$(CO) $(COFLAGS)}}.  @file{@var{n}} will not be
    86218634extracted from RCS if it already exists, even if the RCS file is
    86228635newer.  The rules for RCS are terminal
     
    86318644Any file @file{@var{n}} is extracted if necessary from an SCCS file
    86328645named either @file{s.@var{n}} or @file{SCCS/s.@var{n}}.  The precise
    8633 command used is @w{@samp{$(GET) $(GFLAGS)}}.  The rules for SCCS are
     8646recipe used is @w{@samp{$(GET) $(GFLAGS)}}.  The rules for SCCS are
    86348647terminal (@pxref{Match-Anything Rules, ,Match-Anything Pattern Rules}),
    86358648so SCCS files cannot be generated from another source; they must
     
    86528665above, which are documented in the following section.
    86538666
    8654 However, the commands in built-in implicit rules actually use
     8667However, the recipes in built-in implicit rules actually use
    86558668variables such as @code{COMPILE.c}, @code{LINK.p}, and
    8656 @code{PREPROCESS.S}, whose values contain the commands listed above.
     8669@code{PREPROCESS.S}, whose values contain the recipes listed above.
    86578670
    86588671@code{make} follows the convention that the rule to compile a
     
    86798692@cindex flags for compilers
    86808693
    8681 The commands in built-in implicit rules make liberal use of certain
     8694The recipes in built-in implicit rules make liberal use of certain
    86828695predefined variables.  You can alter the values of these variables in
    86838696the makefile, with arguments to @code{make}, or in the environment to
     
    86868699the @samp{-R} or @samp{--no-builtin-variables} option.
    86878700
    8688 For example, the command used to compile a C source file actually says
     8701For example, the recipe used to compile a C source file actually says
    86898702@samp{$(CC) -c $(CFLAGS) $(CPPFLAGS)}.  The default values of the variables
    86908703used are @samp{cc} and nothing, resulting in the command @samp{cc -c}.  By
     
    87058718The following tables describe of some of the more commonly-used predefined
    87068719variables.  This list is not exhaustive, and the default values shown here may
    8707 not be what are selected by @code{make} for your environment.  To see the
     8720not be what @code{make} selects for your environment.  To see the
    87088721complete list of predefined variables for your instance of GNU @code{make} you
    87098722can run @samp{make -p} in a directory with no makefiles.
     
    89999012* Pattern Examples::            Examples of pattern rules.
    90009013* Automatic Variables::         How to use automatic variables in the
    9001                                   commands of implicit rules.
     9014                                  recipes of implicit rules.
    90029015* Pattern Match::               How patterns match.
    90039016* Match-Anything Rules::        Precautions you should take prior to
     
    90369049
    90379050@example
    9038 %.o : %.c ; @var{command}@dots{}
     9051%.o : %.c ; @var{recipe}@dots{}
    90399052@end example
    90409053
     
    90549067
    90559068@c !!! The end of of this paragraph should be rewritten.  --bob
    9056 Pattern rules may have more than one target.  Unlike normal rules, this
    9057 does not act as many different rules with the same prerequisites and
    9058 commands.  If a pattern rule has multiple targets, @code{make} knows that
    9059 the rule's commands are responsible for making all of the targets.  The
    9060 commands are executed only once to make all the targets.  When searching
    9061 for a pattern rule to match a target, the target patterns of a rule other
    9062 than the one that matches the target in need of a rule are incidental:
    9063 @code{make} worries only about giving commands and prerequisites to the file
    9064 presently in question.  However, when this file's commands are run, the
    9065 other targets are marked as having been updated themselves.
     9069Pattern rules may have more than one target.  Unlike normal rules,
     9070this does not act as many different rules with the same prerequisites
     9071and recipe.  If a pattern rule has multiple targets, @code{make} knows
     9072that the rule's recipe is responsible for making all of the targets.
     9073The recipe is executed only once to make all the targets.  When
     9074searching for a pattern rule to match a target, the target patterns of
     9075a rule other than the one that matches the target in need of a rule
     9076are incidental: @code{make} worries only about giving a recipe and
     9077prerequisites to the file presently in question.  However, when this
     9078file's recipe is run, the other targets are marked as having been
     9079updated themselves.
    90669080@cindex multiple targets, in pattern rule
    90679081@cindex target, multiple in pattern rule
     
    90919105@noindent
    90929106defines a rule that can make any file @file{@var{x}.o} from
    9093 @file{@var{x}.c}.  The command uses the automatic variables @samp{$@@} and
     9107@file{@var{x}.c}.  The recipe uses the automatic variables @samp{$@@} and
    90949108@samp{$<} to substitute the names of the target file and the source file
    90959109in each case where the rule applies (@pxref{Automatic Variables}).@refill
     
    91229136@noindent
    91239137@c The following paragraph is rewritten to avoid overfull hboxes
    9124 This tells @code{make} that the command @samp{bison -d @var{x}.y} will
     9138This tells @code{make} that the recipe @samp{bison -d @var{x}.y} will
    91259139make both @file{@var{x}.tab.c} and @file{@var{x}.tab.h}.  If the file
    91269140@file{foo} depends on the files @file{parse.tab.o} and @file{scan.o}
    91279141and the file @file{scan.o} depends on the file @file{parse.tab.h},
    9128 when @file{parse.y} is changed, the command @samp{bison -d parse.y}
     9142when @file{parse.y} is changed, the recipe @samp{bison -d parse.y}
    91299143will be executed only once, and the prerequisites of both
    91309144@file{parse.tab.o} and @file{scan.o} will be satisfied.  (Presumably
     
    91429156Suppose you are writing a pattern rule to compile a @samp{.c} file into a
    91439157@samp{.o} file: how do you write the @samp{cc} command so that it operates
    9144 on the right source file name?  You cannot write the name in the command,
     9158on the right source file name?  You cannot write the name in the recipe,
    91459159because the name is different each time the implicit rule is applied.
    91469160
     
    91559169It's very important that you recognize the limited scope in which
    91569170automatic variable values are available: they only have values within
    9157 the command script.  In particular, you cannot use them anywhere
     9171the recipe.  In particular, you cannot use them anywhere
    91589172within the target list of a rule; they have no value there and will
    91599173expand to the empty string.  Also, they cannot be accessed directly
     
    91749188rule that has multiple targets (@pxref{Pattern Intro, ,Introduction to
    91759189Pattern Rules}), @samp{$@@} is the name of whichever target caused the
    9176 rule's commands to be run.
     9190rule's recipe to be run.
    91779191
    91789192@vindex $%
     
    91879201@vindex < @r{(automatic variable)}
    91889202@item $<
    9189 The name of the first prerequisite.  If the target got its commands from
     9203The name of the first prerequisite.  If the target got its recipe from
    91909204an implicit rule, this will be the first prerequisite added by the
    91919205implicit rule (@pxref{Implicit Rules}).
     
    91969210The names of all the prerequisites that are newer than the target, with
    91979211spaces between them.  For prerequisites which are archive members, only
    9198 the member named is used (@pxref{Archives}).
     9212the named member is used (@pxref{Archives}).
    91999213@cindex prerequisites, list of changed
    92009214@cindex list of changed prerequisites
     
    92049218@item $^
    92059219The names of all the prerequisites, with spaces between them.  For
    9206 prerequisites which are archive members, only the member named is used
     9220prerequisites which are archive members, only the named member is used
    92079221(@pxref{Archives}).  A target has only one prerequisite on each other file
    92089222it depends on, no matter how many times each file is listed as a
     
    94539467Special built-in dummy pattern rules are provided solely to recognize
    94549468certain file names so that nonterminal match-anything rules will not be
    9455 considered.  These dummy rules have no prerequisites and no commands, and
     9469considered.  These dummy rules have no prerequisites and no recipes, and
    94569470they are ignored for all other purposes.  For example, the built-in
    94579471implicit rule
     
    94749488You can override a built-in implicit rule (or one you have defined
    94759489yourself) by defining a new pattern rule with the same target and
    9476 prerequisites, but different commands.  When the new rule is defined, the
     9490prerequisites, but a different recipe.  When the new rule is defined, the
    94779491built-in one is replaced.  The new rule's position in the sequence of
    94789492implicit rules is determined by where you write the new rule.
    94799493
    94809494You can cancel a built-in implicit rule by defining a pattern rule with the
    9481 same target and prerequisites, but no commands.  For example, the following
     9495same target and prerequisites, but no recipe.  For example, the following
    94829496would cancel the rule that runs the assembler:
    94839497
     
    94959509Rules}).  This is just like any other pattern rule; the only thing
    94969510special about it is that it will match any target.  So such a rule's
    9497 commands are used for all targets and prerequisites that have no commands
     9511recipe is used for all targets and prerequisites that have no recipe
    94989512of their own and for which no other implicit rule applies.
    94999513
     
    95119525
    95129526@findex .DEFAULT
    9513 You can instead define commands to be used for targets for which there
    9514 are no rules at all, even ones which don't specify commands.  You do
     9527You can instead define a recipe to be used for targets for which there
     9528are no rules at all, even ones which don't specify recipes.  You do
    95159529this by writing a rule for the target @code{.DEFAULT}.  Such a rule's
    9516 commands are used for all prerequisites which do not appear as targets in
     9530recipe is used for all prerequisites which do not appear as targets in
    95179531any explicit rule, and for which no implicit rule applies.  Naturally,
    95189532there is no @code{.DEFAULT} rule unless you write one.
    95199533
    9520 If you use @code{.DEFAULT} with no commands or prerequisites:
     9534If you use @code{.DEFAULT} with no recipe or prerequisites:
    95219535
    95229536@example
     
    95259539
    95269540@noindent
    9527 the commands previously stored for @code{.DEFAULT} are cleared.
    9528 Then @code{make} acts as if you had never defined @code{.DEFAULT} at all.
    9529 
    9530 If you do not want a target to get the commands from a match-anything
    9531 pattern rule or @code{.DEFAULT}, but you also do not want any commands
    9532 to be run for the target, you can give it empty commands (@pxref{Empty
    9533 Commands, ,Defining Empty Commands}).@refill
     9541the recipe previously stored for @code{.DEFAULT} is cleared.  Then
     9542@code{make} acts as if you had never defined @code{.DEFAULT} at all.
     9543
     9544If you do not want a target to get the recipe from a match-anything
     9545pattern rule or @code{.DEFAULT}, but you also do not want any recipe
     9546to be run for the target, you can give it an empty recipe
     9547(@pxref{Empty Recipes, ,Defining Empty Recipes}).@refill
    95349548
    95359549You can use a last-resort rule to override part of another makefile.
     
    95999613@samp{.o} files using this pattern rule also depend on @file{foo.h}.
    96009614
    9601 Suffix rules with no commands are also meaningless.  They do not remove
    9602 previous rules as do pattern rules with no commands (@pxref{Canceling
    9603 Rules, , Canceling Implicit Rules}).  They simply enter the suffix or pair of suffixes concatenated as
    9604 a target in the data base.@refill
     9615Suffix rules with no recipe are also meaningless.  They do not remove
     9616previous rules as do pattern rules with no recipe (@pxref{Canceling
     9617Rules, , Canceling Implicit Rules}).  They simply enter the suffix or
     9618pair of suffixes concatenated as a target in the data base.@refill
    96059619
    96069620@findex .SUFFIXES
     
    96459659Here is the procedure @code{make} uses for searching for an implicit rule
    96469660for a target @var{t}.  This procedure is followed for each double-colon
    9647 rule with no commands, for each target of ordinary rules none of which have
    9648 commands, and for each prerequisite that is not the target of any rule.  It
     9661rule with no recipe, for each target of ordinary rules none of which have
     9662a recipe, and for each prerequisite that is not the target of any rule.  It
    96499663is also followed recursively for prerequisites that come from implicit
    96509664rules, in the search for a chain of rules.
     
    96759689
    96769690@item
    9677 Remove from the list all rules with no commands.
     9691Remove from the list all rules with no recipe.
    96789692
    96799693@item
     
    97259739@item
    97269740If no implicit rule applies, the rule for @code{.DEFAULT}, if any,
    9727 applies.  In that case, give @var{t} the same commands that
    9728 @code{.DEFAULT} has.  Otherwise, there are no commands for @var{t}.
     9741applies.  In that case, give @var{t} the same recipe that
     9742@code{.DEFAULT} has.  Otherwise, there is no recipe for @var{t}.
    97299743@end enumerate
    97309744
    9731 Once a rule that applies has been found, for each target pattern of the
    9732 rule other than the one that matched @var{t} or @var{n}, the @samp{%} in
    9733 the pattern is replaced with @var{s} and the resultant file name is stored
    9734 until the commands to remake the target file @var{t} are executed.  After
    9735 these commands are executed, each of these stored file names are entered
    9736 into the data base and marked as having been updated and having the same
    9737 update status as the file @var{t}.
    9738 
    9739 When the commands of a pattern rule are executed for @var{t}, the automatic
    9740 variables are set corresponding to the target and prerequisites.
    9741 @xref{Automatic Variables}.
     9745Once a rule that applies has been found, for each target pattern of
     9746the rule other than the one that matched @var{t} or @var{n}, the
     9747@samp{%} in the pattern is replaced with @var{s} and the resultant
     9748file name is stored until the recipe to remake the target file @var{t}
     9749is executed.  After the recipe is executed, each of these stored file
     9750names are entered into the data base and marked as having been updated
     9751and having the same update status as the file @var{t}.
     9752
     9753When the recipe of a pattern rule is executed for @var{t}, the
     9754automatic variables are set corresponding to the target and
     9755prerequisites.  @xref{Automatic Variables}.
    97429756
    97439757@node Archives, Features, Implicit Rules, Top
     
    97719785@noindent
    97729786This construct is available only in targets and prerequisites, not in
    9773 commands!  Most programs that you might use in commands do not support this
    9774 syntax and cannot act directly on archive members.  Only @code{ar} and
    9775 other programs specifically designed to operate on archives can do so.
    9776 Therefore, valid commands to update an archive member target probably must
    9777 use @code{ar}.  For example, this rule says to create a member
    9778 @file{hack.o} in archive @file{foolib} by copying the file @file{hack.o}:
     9787recipes!  Most programs that you might use in recipes do not support
     9788this syntax and cannot act directly on archive members.  Only
     9789@code{ar} and other programs specifically designed to operate on
     9790archives can do so.  Therefore, valid recipes to update an archive
     9791member target probably must use @code{ar}.  For example, this rule
     9792says to create a member @file{hack.o} in archive @file{foolib} by
     9793copying the file @file{hack.o}:
    97799794
    97809795@example
     
    98299844@samp{(} and @samp{)} from being interpreted specially by the shell) in
    98309845the presence of a file @file{bar.c} is enough to cause the following
    9831 commands to be run, even without a makefile:
     9846recipe to be run, even without a makefile:
    98329847
    98339848@example
     
    98479862it may be useful in a makefile to pretend that it does.  If you write an
    98489863archive member target @file{foo.a(dir/file.o)}, @code{make} will perform
    9849 automatic updating with this command:
     9864automatic updating with this recipe:
    98509865
    98519866@example
     
    99129927
    99139928Possibly a future version of @code{make} will provide a mechanism to
    9914 circumvent this problem by serializing all commands that operate on the
     9929circumvent this problem by serializing all recipes that operate on the
    99159930same archive file.  But for the time being, you must either write your
    99169931makefiles to avoid this problem in some other way, or not use @code{-j}.
     
    1001810033
    1001910034@item
    10020 The command-line options @samp{-b} and @samp{-m}, accepted and
     10035The command line options @samp{-b} and @samp{-m}, accepted and
    1002110036ignored.  In System V @code{make}, these options actually do something.
    1002210037
     
    1003510050@item
    1003610051The arrangement of lines and backslash-newline combinations in
    10037 commands is retained when the commands are printed, so they appear as
     10052recipes is retained when the recipes are printed, so they appear as
    1003810053they do in the makefile, except for the stripping of initial
    1003910054whitespace.
     
    1006910084The ``what if'' flag (@samp{-W} in GNU @code{make}) was (as far as we know)
    1007010085invented by Andrew Hume in @code{mk}.
    10071 @xref{Instead of Execution, ,Instead of Executing the Commands}.
     10086@xref{Instead of Execution, ,Instead of Executing the Recipes}.
    1007210087
    1007310088@item
    1007410089The concept of doing several things at once (parallelism) exists in
    1007510090many incarnations of @code{make} and similar programs, though not in the
    10076 System V or BSD implementations.  @xref{Execution, ,Command Execution}.
     10091System V or BSD implementations.  @xref{Execution, ,Recipe Execution}.
    1007710092
    1007810093@item
     
    1008610101
    1008710102@item
    10088 The special significance of @samp{+} characters preceding command lines
    10089 (@pxref{Instead of Execution, ,Instead of Executing the Commands}) is
    10090 mandated by
    10091 @cite{IEEE Standard 1003.2-1992} (POSIX.2).
     10103The special significance of @samp{+} characters preceding recipe lines
     10104(@pxref{Instead of Execution, ,Instead of Executing the Recipes}) is
     10105mandated by @cite{IEEE Standard 1003.2-1992} (POSIX.2).
    1009210106
    1009310107@item
     
    1012310137
    1012410138@item
    10125 Pass command-line variable assignments automatically through the
     10139Pass command line variable assignments automatically through the
    1012610140variable @code{MAKE} to recursive @code{make} invocations.
    1012710141@xref{Recursion, ,Recursive Use of @code{make}}.
     
    1025510269
    1025610270@item
    10257 In System V and 4.3 BSD @code{make}, files found by @code{VPATH} search
    10258 (@pxref{Directory Search, ,Searching Directories for Prerequisites}) have their names changed inside command
    10259 strings.  We feel it is much cleaner to always use automatic variables
    10260 and thus make this feature obsolete.@refill
     10271In System V and 4.3 BSD @code{make}, files found by @code{VPATH}
     10272search (@pxref{Directory Search, ,Searching Directories for
     10273Prerequisites}) have their names changed inside recipes.  We feel it
     10274is much cleaner to always use automatic variables and thus make this
     10275feature obsolete.@refill
    1026110276
    1026210277@item
     
    1026910284
    1027010285@item
    10271 In some Unix @code{make}s, implicit rule search
    10272 (@pxref{Implicit Rules, ,Using Implicit Rules}) is apparently done for
    10273 @emph{all} targets, not just those without commands.  This means you can
     10286In some Unix @code{make}s, implicit rule search (@pxref{Implicit
     10287Rules, ,Using Implicit Rules}) is apparently done for @emph{all}
     10288targets, not just those without recipes.  This means you can
    1027410289do:@refill
    1027510290
     
    1029510310
    1029610311@item
    10297 It appears that in SVR4 @code{make}, a suffix rule can be specified with
    10298 no commands, and it is treated as if it had empty commands
    10299 (@pxref{Empty Commands}).  For example:
     10312It appears that in SVR4 @code{make}, a suffix rule can be specified
     10313with no recipe, and it is treated as if it had an empty recipe
     10314(@pxref{Empty Recipes}).  For example:
    1030010315
    1030110316@example
     
    1030610321will override the built-in @file{.c.a} suffix rule.
    1030710322
    10308 We feel that it is cleaner for a rule without commands to always simply
     10323We feel that it is cleaner for a rule without a recipe to always simply
    1030910324add to the prerequisite list for the target.  The above example can be
    1031010325easily rewritten to get the desired behavior in GNU @code{make}:
     
    1031910334Program}).  The @samp{-e} flag tells the shell to exit as soon as any
    1032010335program it runs returns a nonzero status.  We feel it is cleaner to
    10321 write each shell command line to stand on its own and not require this
     10336write each line of the recipe to stand on its own and not require this
    1032210337special treatment.
    1032310338@end itemize
     
    1057110586newer than the target, with spaces between them.
    1057210587For prerequisites which are archive members, only
    10573 the member named is used (@pxref{Archives}).
     10588the named member is used (@pxref{Archives}).
    1057410589
    1057510590@item $^
    1057610591@itemx $+
    1057710592The names of all the prerequisites, with spaces between them.  For
    10578 prerequisites which are archive members, only the member named is used
     10593prerequisites which are archive members, only the named member is used
    1057910594(@pxref{Archives}).  The value of @code{$^} omits duplicate
    1058010595prerequisites, while @code{$+} retains them and preserves their order.
     
    1063010645The name of the system default command interpreter, usually @file{/bin/sh}.
    1063110646You can set @code{SHELL} in the makefile to change the shell used to run
    10632 commands.  @xref{Execution, ,Command Execution}.  The @code{SHELL}
     10647recipes.  @xref{Execution, ,Recipe Execution}.  The @code{SHELL}
    1063310648variable is handled specially when importing from and exporting to the
    1063410649environment.  @xref{Choosing the Shell}.
     
    1064210657@item MAKE
    1064310658
    10644 The name with which @code{make} was invoked.
    10645 Using this variable in commands has special meaning.
    10646 @xref{MAKE Variable, ,How the @code{MAKE} Variable Works}.
     10659The name with which @code{make} was invoked.  Using this variable in
     10660recipes has special meaning.  @xref{MAKE Variable, ,How the
     10661@code{MAKE} Variable Works}.
    1064710662
    1064810663@item MAKELEVEL
     
    1065710672@xref{Options/Recursion, ,Communicating Options to a Sub-@code{make}}.
    1065810673
    10659 It is @emph{never} appropriate to use @code{MAKEFLAGS} directly on a
    10660 command line: its contents may not be quoted correctly for use in the
     10674It is @emph{never} appropriate to use @code{MAKEFLAGS} directly in a
     10675recipe line: its contents may not be quoted correctly for use in the
    1066110676shell.  Always allow recursive @code{make}'s to obtain these values
    1066210677through the environment from its parent.
     
    1069410709
    1069510710Sometimes @code{make} errors are not fatal, especially in the presence
    10696 of a @code{-} prefix on a command script line, or the @code{-k} command
    10697 line option.  Errors that are fatal are prefixed with the string
     10711of a @code{-} prefix on a recipe line, or the @code{-k} command line
     10712option.  Errors that are fatal are prefixed with the string
    1069810713@code{***}.
    1069910714
     
    1070910724@itemx [@var{foo}] @var{signal description}
    1071010725These errors are not really @code{make} errors at all.  They mean that a
    10711 program that @code{make} invoked as part of a command script returned a
     10726program that @code{make} invoked as part of a recipe returned a
    1071210727non-0 error code (@samp{Error @var{NN}}), which @code{make} interprets
    1071310728as failure, or it exited in some other abnormal fashion (with a
    10714 signal of some type).  @xref{Errors, ,Errors in Commands}.
     10729signal of some type).  @xref{Errors, ,Errors in Recipes}.
    1071510730
    1071610731If no @code{***} is attached to the message, then the subprocess failed
     
    1072010735@item missing separator.  Stop.
    1072110736@itemx missing separator (did you mean TAB instead of 8 spaces?).  Stop.
    10722 This means that @code{make} could not understand much of anything about
    10723 the command line it just read.  GNU @code{make} looks for various kinds
    10724 of separators (@code{:}, @code{=}, TAB characters, etc.) to help it
    10725 decide what kind of commandline it's seeing.  This means it couldn't
    10726 find a valid one.
    10727 
    10728 One of the most common reasons for this message is that you (or perhaps
    10729 your oh-so-helpful editor, as is the case with many MS-Windows editors)
    10730 have attempted to indent your command scripts with spaces instead of a
    10731 TAB character.  In this case, @code{make} will use the second form of
    10732 the error above.  Remember that every line in the command script must
    10733 begin with a TAB character.  Eight spaces do not count.  @xref{Rule
    10734 Syntax}.
    10735 
    10736 @item commands commence before first target.  Stop.
    10737 @itemx missing rule before commands.  Stop.
    10738 This means the first thing in the makefile seems to be part of a command
    10739 script: it begins with a TAB character and doesn't appear to be a legal
    10740 @code{make} command (such as a variable assignment).  Command scripts
    10741 must always be associated with a target.
     10737This means that @code{make} could not understand much of anything
     10738about the makefile line it just read.  GNU @code{make} looks for
     10739various separators (@code{:}, @code{=}, recipe prefix characters,
     10740etc.) to indicate what kind of line it's parsing.  This message means
     10741it couldn't find a valid one.
     10742
     10743One of the most common reasons for this message is that you (or
     10744perhaps your oh-so-helpful editor, as is the case with many MS-Windows
     10745editors) have attempted to indent your recipe lines with spaces
     10746instead of a tab character.  In this case, @code{make} will use the
     10747second form of the error above.  Remember that every line in the
     10748recipe must begin with a tab character (unless you set
     10749@code{.CMDPREFIX}; @pxref{Special Variables}).  Eight spaces do not
     10750count.  @xref{Rule Syntax}.
     10751
     10752@item recipe commences before first target.  Stop.
     10753@itemx missing rule before recipe.  Stop.
     10754This means the first thing in the makefile seems to be part of a
     10755recipe: it begins with a recipe prefix character and doesn't appear to
     10756be a legal @code{make} directive (such as a variable assignment).
     10757Recipes must always be associated with a target.
    1074210758
    1074310759The second form is generated if the line has a semicolon as the first
     
    1077110787(second form) was not found.
    1077210788
    10773 @item warning: overriding commands for target `@var{xxx}'
    10774 @itemx warning: ignoring old commands for target `@var{xxx}'
    10775 GNU @code{make} allows commands to be specified only once per target
    10776 (except for double-colon rules).  If you give commands for a target
    10777 which already has been defined to have commands, this warning is issued
    10778 and the second set of commands will overwrite the first set.
    10779 @xref{Multiple Rules, ,Multiple Rules for One Target}.
     10789@item warning: overriding recipe for target `@var{xxx}'
     10790@itemx warning: ignoring old recipe for target `@var{xxx}'
     10791GNU @code{make} allows only one recipe to be specified per target
     10792(except for double-colon rules).  If you give a recipe for a target
     10793which already has been defined to have one, this warning is issued and
     10794the second recipe will overwrite the first.  @xref{Multiple Rules,
     10795,Multiple Rules for One Target}.
    1078010796
    1078110797@item Circular @var{xxx} <- @var{yyy} dependency dropped.
     
    1101711033
    1101811034@group
    11019 .PHONY: tar
    1102011035tar:    $(OBJS)
    1102111036        $(CC) $(LDFLAGS) -o $@@ $(OBJS) $(LIBS)
     
    1111811133@end example
    1111911134
    11120 @raisesections
     11135@node GNU Free Documentation License, Concept Index, Complex Makefile, Top
     11136@appendixsec GNU Free Documentation License
     11137@cindex FDL, GNU Free Documentation License
    1112111138@include fdl.texi
    11122 @lowersections
    1112311139
    1112411140@node Concept Index, Name Index, GNU Free Documentation License, Top
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette