/[make]/make/doc/make.texi
ViewVC logotype

Diff of /make/doc/make.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27 by psmith, Fri Apr 8 12:51:20 2005 UTC revision 1.28 by psmith, Tue May 3 13:57:21 2005 UTC
# Line 671  from @code{rm} or any other command. Line 671  from @code{rm} or any other command.
671  By default, @code{make} starts with the first target (not targets whose  By default, @code{make} starts with the first target (not targets whose
672  names start with @samp{.}).  This is called the @dfn{default goal}.  names start with @samp{.}).  This is called the @dfn{default goal}.
673  (@dfn{Goals} are the targets that @code{make} strives ultimately to  (@dfn{Goals} are the targets that @code{make} strives ultimately to
674  update.  @xref{Goals, , Arguments to Specify the Goals}.)  update.    You can override this behavior using the command line
675    (@pxref{Goals, , Arguments to Specify the Goals}) or with the
676    @code{.DEFAULT_GOAL} special variable (@pxref{Special Variables, ,
677    Other Special Variables}).
678  @cindex default goal  @cindex default goal
679  @cindex goal, default  @cindex goal, default
680  @cindex goal  @cindex goal
# Line 1276  if they are set by a makefile or on the Line 1279  if they are set by a makefile or on the
1279    
1280  @table @code  @table @code
1281    
1282    @vindex $(.DEFAULT_GOAL)
1283    @vindex .DEFAULT_GOAL @r{(define default goal)}
1284    @item .DEFAULT_GOAL
1285    Sets the default goal to be used if no targets were specified on the
1286    command line (@pxref{Goals, , Arguments to Specify the Goals}).  The
1287    @code{.DEFAULT_GOAL} variable allows you to discover the current
1288    default goal, restart the default goal selection algorithm by clearing
1289    its value, or to explicitly set the default goal. The following
1290    example illustrates these cases:
1291    
1292    @example
1293    @group
1294    # Query the default goal.
1295    ifeq ($(.DEFAULT_GOAL),)
1296      $(warning no default goal is set)
1297    endif
1298    
1299    .PHONY: foo
1300    foo: ; @@echo $@@
1301    
1302    $(warning default target is $(.DEFAULT_GOAL))
1303    
1304    # Reset the default goal.
1305    .DEFAULT_GOAL :=
1306    
1307    .PHONY: bar
1308    bar: ; @@echo $@@
1309    
1310    $(warning default target is $(.DEFAULT_GOAL))
1311    
1312    # Set our own.
1313    .DEFAULT_GOAL := foo
1314    @end group
1315    @end example
1316    
1317    This makefile prints:
1318    
1319    @example
1320    @group
1321    no default goal is set
1322    default goal is foo
1323    default goal is bar
1324    foo
1325    @end group
1326    @end example
1327    
1328    Note that assigning more than one target name to .DEFAULT_GOAL is
1329    illegal and will result in an error.
1330    
1331  @vindex $(.VARIABLES)  @vindex $(.VARIABLES)
1332  @vindex .VARIABLES @r{(list of variables)}  @vindex .VARIABLES @r{(list of variables)}
1333  @item .VARIABLES  @item .VARIABLES
# Line 6870  targets that start with a period).  Ther Line 6922  targets that start with a period).  Ther
6922  written so that the first target is for compiling the entire program or  written so that the first target is for compiling the entire program or
6923  programs they describe.  If the first rule in the makefile has several  programs they describe.  If the first rule in the makefile has several
6924  targets, only the first target in the rule becomes the default goal, not  targets, only the first target in the rule becomes the default goal, not
6925  the whole list.  the whole list.  You can manage the selection of the default goal from
6926    within your makefile using the @code{.DEFAULT_GOAL} variable
6927  You can specify a different goal or goals with arguments to @code{make}.  (@pxref{Special Variables, , Other Special Variables}).
6928  Use the name of the goal as an argument.  If you specify several goals,  
6929  @code{make} processes each of them in turn, in the order you name them.  You can also specify a different goal or goals with command-line
6930    arguments to @code{make}.  Use the name of the goal as an argument.
6931    If you specify several goals, @code{make} processes each of them in
6932    turn, in the order you name them.
6933    
6934  Any target in the makefile may be specified as a goal (unless it  Any target in the makefile may be specified as a goal (unless it
6935  starts with @samp{-} or contains an @samp{=}, in which case it will be  starts with @samp{-} or contains an @samp{=}, in which case it will be

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26