/[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.28 by psmith, Tue May 3 13:57:21 2005 UTC revision 1.29 by psmith, Sun May 8 16:50:59 2005 UTC
# Line 8  Line 8 
8  @c FSF publishers: format makebook.texi instead of using this file directly.  @c FSF publishers: format makebook.texi instead of using this file directly.
9    
10  @set RCSID $Id$  @set RCSID $Id$
11  @set EDITION 0.61  @set EDITION 0.70
12  @set VERSION 3.80  @set VERSION 3.81
13  @set UPDATED 23 Feb 2003  @set UPDATED 07 May 2005
14  @set UPDATE-MONTH Feb 2003  @set UPDATE-MONTH May 2005
15  @c ISBN provided by Lisa M. Opus Goldstein <opus@gnu.org>, 5 May 2004  @c ISBN provided by Lisa M. Opus Goldstein <opus@gnu.org>, 5 May 2004
16  @set ISBN 1-882114-83-5  @set ISBN 1-882114-83-5
17    
# Line 39  This is Edition @value{EDITION}, last up Line 39  This is Edition @value{EDITION}, last up
39  of @cite{The GNU Make Manual}, for @code{make}, Version @value{VERSION}.  of @cite{The GNU Make Manual}, for @code{make}, Version @value{VERSION}.
40    
41  Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,  Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
42  1998, 1999, 2000, 2002, 2003, 2004  1998, 1999, 2000, 2002, 2003, 2004, 2005
43  Free Software Foundation, Inc.  Free Software Foundation, Inc.
44    
45  Permission is granted to copy, distribute and/or modify this document  Permission is granted to copy, distribute and/or modify this document
# Line 162  Writing Makefiles Line 162  Writing Makefiles
162  * Overriding Makefiles::        How to override part of one makefile  * Overriding Makefiles::        How to override part of one makefile
163                                    with another makefile.                                    with another makefile.
164  * Reading Makefiles::           How makefiles are parsed.  * Reading Makefiles::           How makefiles are parsed.
165    * Secondary Expansion::         How and when secondary expansion is performed.
166    
167  Writing Rules  Writing Rules
168    
# Line 640  on the header file @file{defs.h}. Line 641  on the header file @file{defs.h}.
641  A shell command follows each line that contains a target and  A shell command follows each line that contains a target and
642  prerequisites.  These shell commands say how to update the target file.  prerequisites.  These shell commands say how to update the target file.
643  A tab character must come at the beginning of every command line to  A tab character must come at the beginning of every command line to
644  distinguish commands lines from other lines in the makefile.  (Bear in  distinguish command lines from other lines in the makefile.  (Bear in
645  mind that @code{make} does not know anything about how the commands  mind that @code{make} does not know anything about how the commands
646  work.  It is up to you to supply commands that will update the target  work.  It is up to you to supply commands that will update the target
647  file properly.  All @code{make} does is execute the commands in the rule  file properly.  All @code{make} does is execute the commands in the rule
# Line 956  reading a data base called the @dfn{make Line 957  reading a data base called the @dfn{make
957  * Overriding Makefiles::        How to override part of one makefile  * Overriding Makefiles::        How to override part of one makefile
958                                    with another makefile.                                    with another makefile.
959  * Reading Makefiles::           How makefiles are parsed.  * Reading Makefiles::           How makefiles are parsed.
960    * Secondary Expansion::         How and when secondary expansion is performed.
961  @end menu  @end menu
962    
963  @node Makefile Contents, Makefile Names, Makefiles, Makefiles  @node Makefile Contents, Makefile Names, Makefiles, Makefiles
# Line 1224  in the makefiles.  @xref{Include, , Incl Line 1226  in the makefiles.  @xref{Include, , Incl
1226  @section The Variable @code{MAKEFILE_LIST}  @section The Variable @code{MAKEFILE_LIST}
1227  @cindex makefiles, and @code{MAKEFILE_LIST} variable  @cindex makefiles, and @code{MAKEFILE_LIST} variable
1228  @cindex including (@code{MAKEFILE_LIST} variable)  @cindex including (@code{MAKEFILE_LIST} variable)
1229    @vindex MAKEFILE_LIST
1230    
1231  As @code{make} reads various makefiles, including any obtained from the  As @code{make} reads various makefiles, including any obtained from the
1232  @code{MAKEFILES} variable, the command line, the default files, or  @code{MAKEFILES} variable, the command line, the default files, or
# Line 1279  if they are set by a makefile or on the Line 1282  if they are set by a makefile or on the
1282    
1283  @table @code  @table @code
1284    
 @vindex $(.DEFAULT_GOAL)  
1285  @vindex .DEFAULT_GOAL @r{(define default goal)}  @vindex .DEFAULT_GOAL @r{(define default goal)}
1286  @item .DEFAULT_GOAL  @item .DEFAULT_GOAL
1287  Sets the default goal to be used if no targets were specified on the  Sets the default goal to be used if no targets were specified on the
# Line 1299  endif Line 1301  endif
1301  .PHONY: foo  .PHONY: foo
1302  foo: ; @@echo $@@  foo: ; @@echo $@@
1303    
1304  $(warning default target is $(.DEFAULT_GOAL))  $(warning default goal is $(.DEFAULT_GOAL))
1305    
1306  # Reset the default goal.  # Reset the default goal.
1307  .DEFAULT_GOAL :=  .DEFAULT_GOAL :=
# Line 1307  $(warning default target is $(.DEFAULT_G Line 1309  $(warning default target is $(.DEFAULT_G
1309  .PHONY: bar  .PHONY: bar
1310  bar: ; @@echo $@@  bar: ; @@echo $@@
1311    
1312  $(warning default target is $(.DEFAULT_GOAL))  $(warning default goal is $(.DEFAULT_GOAL))
1313    
1314  # Set our own.  # Set our own.
1315  .DEFAULT_GOAL := foo  .DEFAULT_GOAL := foo
# Line 1325  foo Line 1327  foo
1327  @end group  @end group
1328  @end example  @end example
1329    
1330  Note that assigning more than one target name to .DEFAULT_GOAL is  Note that assigning more than one target name to @code{.DEFAULT_GOAL} is
1331  illegal and will result in an error.  illegal and will result in an error.
1332    
 @vindex $(.VARIABLES)  
1333  @vindex .VARIABLES @r{(list of variables)}  @vindex .VARIABLES @r{(list of variables)}
1334  @item .VARIABLES  @item .VARIABLES
1335  Expands to a list of the @emph{names} of all global variables defined  Expands to a list of the @emph{names} of all global variables defined
# Line 1339  defined in a target-specific context.  N Line 1340  defined in a target-specific context.  N
1340  to this variable will be ignored; it will always return its special  to this variable will be ignored; it will always return its special
1341  value.  value.
1342    
 @c @vindex $(.TARGETS)  
1343  @c @vindex .TARGETS @r{(list of targets)}  @c @vindex .TARGETS @r{(list of targets)}
1344  @c @item .TARGETS  @c @item .TARGETS
1345  @c The second special variable is @code{.TARGETS}.  When expanded, the  @c The second special variable is @code{.TARGETS}.  When expanded, the
# Line 1350  value. Line 1350  value.
1350  @c file must appear as a target, on the left-hand side of a ``:'', to be  @c file must appear as a target, on the left-hand side of a ``:'', to be
1351  @c considered a target for the purposes of this variable.  @c considered a target for the purposes of this variable.
1352    
 @vindex $(.FEATURES)  
1353  @vindex .FEATURES @r{(list of supported features)}  @vindex .FEATURES @r{(list of supported features)}
1354  @item .FEATURES  @item .FEATURES
1355  Expands to a list of special features supported by this version of  Expands to a list of special features supported by this version of
# Line 1508  commands to prevent @code{make} from sea Line 1507  commands to prevent @code{make} from sea
1507  build it---otherwise it would apply the same match-anything rule to  build it---otherwise it would apply the same match-anything rule to
1508  @file{force} itself and create a prerequisite loop!  @file{force} itself and create a prerequisite loop!
1509    
1510  @node Reading Makefiles,  , Overriding Makefiles, Makefiles  @node Reading Makefiles,  Secondary Expansion, Overriding Makefiles, Makefiles
1511  @section How @code{make} Reads a Makefile  @section How @code{make} Reads a Makefile
1512  @cindex reading makefiles  @cindex reading makefiles
1513  @cindex makefile, parsing  @cindex makefile, parsing
# Line 1569  immediate if the variable was previously Line 1568  immediate if the variable was previously
1568    
1569  All instances of conditional syntax are parsed immediately, in their  All instances of conditional syntax are parsed immediately, in their
1570  entirety; this includes the @code{ifdef}, @code{ifeq}, @code{ifndef},  entirety; this includes the @code{ifdef}, @code{ifeq}, @code{ifndef},
1571  and @code{ifneq} forms.  and @code{ifneq} forms.  Of course this means that automatic variables
1572    cannot be used in conditional statements, as automatic variables are
1573    not set until the command script for that rule is invoked.  If you
1574    need to use automatic variables in a conditional you @emph{must} use
1575    shell conditional syntax, in your command script proper, for these
1576    tests, not @code{make} conditionals.
1577    
1578  @subheading Rule Definition  @subheading Rule Definition
1579  @cindex target, expansion  @cindex target, expansion
# Line 1590  and the commands used to construct the t Line 1594  and the commands used to construct the t
1594  general rule is true for explicit rules, pattern rules, suffix rules,  general rule is true for explicit rules, pattern rules, suffix rules,
1595  static pattern rules, and simple prerequisite definitions.  static pattern rules, and simple prerequisite definitions.
1596    
1597    @node Secondary Expansion, , Reading Makefiles, Makefiles
1598    @section Secondary Expansion
1599    @cindex secondary expansion
1600    @cindex expansion, secondary
1601    
1602    In the previous section we learned that GNU @code{make} works in two
1603    distinct phases: a read-in phase and a target-update phase
1604    (@pxref{Reading Makefiles, , How @code{make} Reads a Makefile}).
1605    There is an extra wrinkle that comes in between those two phases,
1606    right at the end of the read-in phase: at that time, all the
1607    prerequisites of all of the targets are expanded a @emph{second time}.
1608    In most circumstances this secondary expansion will have no effect,
1609    since all variable and function references will have been expanded
1610    during the initial parsing of the makefiles.  In order to take
1611    advantage of the secondary expansion phase of the parser, then, it's
1612    necessary to @emph{escape} the variable or function reference in the
1613    makefile.  In this case the first expansion merely un-escapes the
1614    reference but doesn't expand it, and expansion is left to the
1615    secondary expansion phase.  For example, consider this makefile:
1616    
1617    @example
1618    ONEVAR = onefile
1619    TWOVAR = twofile
1620    myfile: $(ONEVAR) $$(TWOVAR)
1621    @end example
1622    
1623    After the first expansion phase the prerequisites list of the
1624    @file{myfile} target will be @code{onefile} and @code{$(TWOVAR)}; the
1625    first (unescaped) variable reference to @var{ONEVAR} is expanded,
1626    while the second (escaped) variable reference is simply unescaped,
1627    without being recognized as a variable reference.  Now during the
1628    secondary expansion the first word is expanded again but since it
1629    contains no variable or function references it remains the static
1630    value @file{onefile}, while the second word is now a normal reference
1631    to the variable @var{TWOVAR}, which is expanded to the value
1632    @file{twofile}.  The final result is that there are two prerequisites,
1633    @file{onefile} and @file{twofile}.
1634    
1635    Obviously, this is not a very interesting case since the same result
1636    could more easily have been achieved simply by having both variables
1637    appear, unescaped, in the prerequisites list.  One difference becomes
1638    apparent if the variables are reset; consider this example:
1639    
1640    @example
1641    AVAR = top
1642    onefile: $(AVAR)
1643    twofile: $$(AVAR)
1644    AVAR = bottom
1645    @end example
1646    
1647    Here the prerequisite of @file{onefile} will be expanded immediately,
1648    and resolve to the value @file{top}, while the prerequisite of
1649    @file{twofile} will not be full expanded until the secondary expansion
1650    and yield a value of @file{bottom}.
1651    
1652    This is marginally more exciting, but the true power of this feature
1653    only becomes apparent when you discover that secondary expansions
1654    always take place within the scope of the automatic variables for that
1655    target.  This means that you can use variables such as @code{$@@},
1656    @code{$*}, etc. during the second expansion and they will have their
1657    expected values, just as in the command script.  All you have to do is
1658    defer the expansion by escaping the @code{$}.  Also, secondary
1659    expansion occurs for both explicit and implicit (pattern) rules.
1660    Knowing this, the possible uses for this feature are almost endless.
1661    For example:
1662    
1663    @example
1664    main_OBJS := main.o try.o test.o
1665    lib_OBJS := lib.o api.o
1666    
1667    main lib: $$($$@@_OBJS)
1668    @end example
1669    
1670    Here, after the initial expansion the prerequisites of both the
1671    @file{main} and @file{lib} targets will be @code{$($@@_OBJS)}.  During
1672    the secondary expansion, the @code{$@@} variable is set to the name of
1673    the target and so the expansion for the @file{main} target will yield
1674    @code{$(main_OBJS)}, or @code{main.o try.o test.o}, while the
1675    secondary expansion for the @file{lib} target will yield
1676    @code{$(lib_OBJS)}, or @code{lib.o api.o}.
1677    
1678    You can also mix functions here, as long as they are properly escaped:
1679    
1680    @example
1681    main_SRCS := main.c try.c test.c
1682    lib_SRCS := lib.c api.c
1683    
1684    main lib: $$(patsubst %.c,%.o,$$($$@@_SRCS))
1685    @end example
1686    
1687    This version allows users to specify source files rather than object
1688    files, but gives the same resulting prerequisites list as the previous
1689    example.
1690    
1691    Evaluation of automatic variables during the secondary expansion
1692    phase, especially of the target name variable @code{$$@@}, behaves
1693    similarly to evaluation within command scripts.  However, there are
1694    some subtle differences and ``corner cases'' which come into play for
1695    the different types of rule definitions that @code{make} understands.
1696    The subtleties of using the different automatic variables are
1697    described below.
1698    
1699    @subheading Secondary Expansion of Explicit Rules
1700    @cindex secondary expansion and explicit rules
1701    @cindex explicit rules, secondary expansion of
1702    
1703    During the secondary expansion of explicit rules, @code{$$@@} and
1704    @code{$$%} evaluate, respectively, to the file name of the target and,
1705    when the target is an archive member, the target member name.  The
1706    @code{$$<} variable evaluates to the first prerequisite in the first
1707    rule for this target.  @code{$$^} and @code{$$+} evaluate to the list
1708    of all prerequisites of rules @emph{that have already appeared} for
1709    the same target (@code{$$+} with repetitions and @code{$$^}
1710    without). The following example will help illustrate these behaviors:
1711    
1712    @example
1713    foo: foo.1 bar.1 $$< $$^ $$+    # line #1
1714    
1715    foo: foo.2 bar.2 $$< $$^ $$+    # line #2
1716    
1717    foo: foo.3 bar.3 $$< $$^ $$+    # line #3
1718    @end example
1719    
1720    For the first line, all three variables (@code{$$<}, @code{$$^}, and
1721    @code{$$+}) expand to the empty string. For the second line, they will
1722    have values @code{foo.1}, @code{foo.1 bar.1}, and @code{foo.1 bar.1}
1723    respectively. For the third they will have values @code{foo.1},
1724    @code{foo.1 bar.1 foo.2 bar.2}, and @code{foo.1 bar.1 foo.2 bar.2}
1725    respectively.
1726    
1727    Rules undergo secondary expansion in makefile order, except that
1728    the rule with the command script is always evaluated last.
1729    
1730    The variables @code{$$?} and @code{$$*} are not available and expand
1731    to the empty string.
1732    
1733    @subheading Secondary Expansion of Static Pattern Rules
1734    @cindex secondary expansion and static pattern rules
1735    @cindex static pattern rules, secondary expansion of
1736    
1737    Rules for secondary expansion of static pattern rules are identical to
1738    those for explicit rules, above, with one exception: for static
1739    pattern rules the @code{$$*} variable is set to the pattern stem.  As
1740    with explicit rules, @code{$$?} is not available and expands to the
1741    empty string.
1742    
1743    @subheading Secondary Expansion of Implicit Rules
1744    @cindex secondary expansion and implicit rules
1745    @cindex implicit rules, secondary expansion of
1746    
1747    As @code{make} searches for an implicit rule, it substitutes the stem
1748    and then performs secondary expansion for every rule with a matching
1749    target pattern.  The value of the automatic variables is derived in
1750    the same fashion as for static pattern rules.  As an example:
1751    
1752    @example
1753    foo: bar
1754    
1755    foo foz: fo%: bo%
1756    
1757    %oo: $$< $$^ $$+ $$*
1758    @end example
1759    
1760    When the implicit rule is tried for target @file{foo}, @code{$$<}
1761    expands to @file{bar}, @code{$$^} expands to @file{bar boo},
1762    @code{$$+} also expands to @file{bar boo}, and @code{$$*} expands to
1763    @file{f}.
1764    
1765    Note that the directory prefix (D), as described in @ref{Implicit Rule
1766    Search, ,Implicit Rule Search Algorithm}, is appended (after
1767    expansion) to all the patterns in the prerequisites list.  As an
1768    example:
1769    
1770    @example
1771    /tmp/foo.o:
1772    
1773    %.o: $$(addsuffix /%.c,foo bar) foo.h
1774    @end example
1775    
1776    The prerequisite list after the secondary expansion and directory
1777    prefix reconstruction will be @file{/tmp/foo/foo.c /tmp/var/bar/foo.c
1778    foo.h}.  If you are not interested in this reconstruction, you can use
1779    @code{$$*} instead of @code{%} in the prerequisites list.
1780    
1781  @node Rules, Commands, Makefiles, Top  @node Rules, Commands, Makefiles, Top
1782  @chapter Writing Rules  @chapter Writing Rules
1783  @cindex writing rules  @cindex writing rules
# Line 1719  same.  @xref{Commands, ,Writing the Comm Line 1907  same.  @xref{Commands, ,Writing the Comm
1907  @cindex rule, and @code{$}  @cindex rule, and @code{$}
1908  Because dollar signs are used to start variable references, if you really  Because dollar signs are used to start variable references, if you really
1909  want a dollar sign in a rule you must write two of them, @samp{$$}  want a dollar sign in a rule you must write two of them, @samp{$$}
1910  (@pxref{Using Variables, ,How to Use Variables}).  (@pxref{Using Variables, ,How to Use Variables}).  In prerequisite
1911    lists you must actually write @emph{four} dollar signs (@samp{$$$$}),
1912    due to secondary expansion (@pxref{Secondary Expansion}).
1913  You may split a long line by inserting a backslash  You may split a long line by inserting a backslash
1914  followed by a newline, but this is not required, as @code{make} places no  followed by a newline, but this is not required, as @code{make} places no
1915  limit on the length of a line in a makefile.  limit on the length of a line in a makefile.
# Line 3248  with no further work from you.  @xref{Re Line 3438  with no further work from you.  @xref{Re
3438    
3439  Note that the @samp{.d} files contain target definitions; you should  Note that the @samp{.d} files contain target definitions; you should
3440  be sure to place the @code{include} directive @emph{after} the first,  be sure to place the @code{include} directive @emph{after} the first,
3441  default target in your makefiles or run the risk of having a random  default goal in your makefiles or run the risk of having a random
3442  object file become the default target.  object file become the default goal.
3443  @xref{How Make Works}.  @xref{How Make Works}.
3444    
3445  @node Commands, Using Variables, Rules, Top  @node Commands, Using Variables, Rules, Top
# Line 3442  on MS-DOS unaltered if you have e.g. @fi Line 3632  on MS-DOS unaltered if you have e.g. @fi
3632  directory along your @code{PATH}.  directory along your @code{PATH}.
3633    
3634  @cindex environment, @code{SHELL} in  @cindex environment, @code{SHELL} in
3635    @vindex MAKESHELL @r{(MS-DOS alternative to @code{SHELL})}
3636  Unlike most variables, the variable @code{SHELL} is never set from the  Unlike most variables, the variable @code{SHELL} is never set from the
3637  environment.  This is because the @code{SHELL} environment variable is  environment.  This is because the @code{SHELL} environment variable is
3638  used to specify your personal choice of shell program for interactive  used to specify your personal choice of shell program for interactive
# Line 5580  compare them.  If they are different, th Line 5771  compare them.  If they are different, th
5771  effective; otherwise, the @var{text-if-false}, if any, is effective.  effective; otherwise, the @var{text-if-false}, if any, is effective.
5772    
5773  @item ifdef @var{variable-name}  @item ifdef @var{variable-name}
5774  If the variable @var{variable-name} has a non-empty value, the  The @code{ifdef} form takes the @emph{name} of a variable as its
5775  @var{text-if-true} is effective; otherwise, the @var{text-if-false},  argument, not a reference to a variable.  The value of that variable
5776  if any, is effective.  Variables that have never been defined have an  has a non-empty value, the @var{text-if-true} is effective; otherwise,
5777  empty value.  The variable @var{variable-name} is itself expanded, so  the @var{text-if-false}, if any, is effective.  Variables that have
5778  it could be a variable or function that expands to the name of a  never been defined have an empty value.  The text @var{variable-name}
5779  variable.  is expanded, so it could be a variable or function that expands
5780    to the name of a variable.  For example:
5781    
5782    @example
5783    bar = true
5784    foo = bar
5785    ifdef $(foo)
5786    frobozz = yes
5787    endif
5788    @end example
5789    
5790    The variable reference @code{$(foo)} is expanded, yielding @code{bar},
5791    which is considered to be the name of a variable.  The variable
5792    @code{bar} is not expanded, but its value is examined to determine if
5793    it is non-empty.
5794    
5795  Note that @code{ifdef} only tests whether a variable has a value.  It  Note that @code{ifdef} only tests whether a variable has a value.  It
5796  does not expand the variable to see if that value is nonempty.  does not expand the variable to see if that value is nonempty.
# Line 5621  sets @samp{frobozz} to @samp{no}. Line 5826  sets @samp{frobozz} to @samp{no}.
5826  @item ifndef @var{variable-name}  @item ifndef @var{variable-name}
5827  If the variable @var{variable-name} has an empty value, the  If the variable @var{variable-name} has an empty value, the
5828  @var{text-if-true} is effective; otherwise, the @var{text-if-false},  @var{text-if-true} is effective; otherwise, the @var{text-if-false},
5829  if any, is effective.  if any, is effective.  The rules for expansion and testing of
5830    @var{variable-name} are identical to the @code{ifdef} directive.
5831  @end table  @end table
5832    
5833  Extra spaces are allowed and ignored at the beginning of the conditional  Extra spaces are allowed and ignored at the beginning of the conditional
# Line 6937  parsed as a switch or variable definitio Line 7143  parsed as a switch or variable definitio
7143  targets not in the makefile may be specified, if @code{make} can find  targets not in the makefile may be specified, if @code{make} can find
7144  implicit rules that say how to make them.  implicit rules that say how to make them.
7145    
 @cindex @code{MAKECMDGOALS}  
7146  @vindex MAKECMDGOALS  @vindex MAKECMDGOALS
7147  @code{Make} will set the special variable @code{MAKECMDGOALS} to the  @code{Make} will set the special variable @code{MAKECMDGOALS} to the
7148  list of goals you specified on the command line.  If no goals were given  list of goals you specified on the command line.  If no goals were given
# Line 8536  for the source file name. Line 8741  for the source file name.
8741  It's very important that you recognize the limited scope in which  It's very important that you recognize the limited scope in which
8742  automatic variable values are available: they only have values within  automatic variable values are available: they only have values within
8743  the command script.  In particular, you cannot use them anywhere  the command script.  In particular, you cannot use them anywhere
8744  within the target or prerequisite lists of a rule; they have no value  within the target list of a rule; they have no value there and will
8745  there and will expand to the empty string.  A common mistake is  expand to the empty string.  Also, they cannot be accessed directly
8746  attempting to use @code{$@@} within the prerequisites list in a rule;  within the prerequisite list of a rule.  A common mistake is
8747  this will not work.  However, see below for information on the  attempting to use @code{$@@} within the prerequisites list; this will
8748  SysV-style @code{$$@@} variables.  not work.  However, there is a special feature of GNU @code{make},
8749    secondary expansion (@pxref{Secondary Expansion}), which will allow
8750    automatic variable values to be used in prerequisite lists.
8751    
8752  Here is a table of automatic variables:  Here is a table of automatic variables:
8753    
# Line 8738  deep significance; @samp{$<} refers to t Line 8945  deep significance; @samp{$<} refers to t
8945  as @samp{$(CFLAGS)} refers to the variable named @code{CFLAGS}.  as @samp{$(CFLAGS)} refers to the variable named @code{CFLAGS}.
8946  You could just as well use @samp{$(<)} in place of @samp{$<}.  You could just as well use @samp{$(<)} in place of @samp{$<}.
8947    
 @vindex $$@@  
 @vindex $$(@@D)  
 @vindex $$(@@F)  
 @cindex $$@@, support for  
 GNU @code{make} provides support for the SysV @code{make} feature that  
 allows special variable references @code{$$@@}, @code{$$(@@D)}, and  
 @code{$$(@@F)} (note the required double-''$''!) to appear with the  
 @emph{prerequisites list} (normal automatic variables are available  
 only within a command script).  When appearing in a prerequisites  
 list, these variables are expanded to the name of the target, the  
 directory component of the target, and the file component of the  
 target, respectively.  
   
 Note that these variables are available only within explicit and  
 static pattern (@pxref{Static Pattern, ,Static Pattern Rules}) rules;  
 they have no special significance within implicit (suffix or pattern)  
 rules.  Also note that while SysV @code{make} actually expands its  
 entire prerequisite list @emph{twice}, GNU @code{make} does not behave  
 this way: instead it simply expands these special variables without  
 re-expanding any other part of the prerequisites list.  
   
 This somewhat bizarre feature is included only to provide some  
 compatibility with SysV makefiles.  In a native GNU @code{make} file  
 there are other ways to accomplish the same results.  This feature is  
 disabled if the special pseudo target @code{.POSIX} is defined.  
   
8948  @node Pattern Match, Match-Anything Rules, Automatic Variables, Pattern Rules  @node Pattern Match, Match-Anything Rules, Automatic Variables, Pattern Rules
8949  @subsection How Patterns Match  @subsection How Patterns Match
8950    
# Line 10160  built, but rather only a prerequisite). Line 10341  built, but rather only a prerequisite).
10341  The former means that you didn't provide any targets to be built on the  The former means that you didn't provide any targets to be built on the
10342  command line, and @code{make} couldn't find any makefiles to read in.  command line, and @code{make} couldn't find any makefiles to read in.
10343  The latter means that some makefile was found, but it didn't contain any  The latter means that some makefile was found, but it didn't contain any
10344  default target and none was given on the command line.  GNU @code{make}  default goal and none was given on the command line.  GNU @code{make}
10345  has nothing to do in these situations.  has nothing to do in these situations.
10346  @xref{Makefile Arguments, ,Arguments to Specify the Makefile}.@refill  @xref{Makefile Arguments, ,Arguments to Specify the Makefile}.@refill
10347    

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

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