Lines Matching full:variable
11 @c Combine the variable and function indices:
140 * MAKEFILES Variable:: The environment can specify extra makefiles.
141 * MAKEFILE_LIST Variable:: Discover which makefiles have been read.
221 * MAKE Variable:: The special effects of using @samp{$(MAKE)}.
229 * Reference:: How to use the value of a variable.
231 * Advanced:: Advanced features for referencing a variable.
233 * Setting:: How to set a variable in the makefile.
235 of a variable.
236 * Override Directive:: How to set a variable in the makefile even if
238 * Defining:: An alternate way to set a variable
240 * Environment:: Variable values can come from the environment.
241 * Target-specific:: Variable values can be defined on a per-target
243 * Pattern-specific:: Target-specific variable values can be applied
248 * Substitution Refs:: Referencing a variable with
250 * Computed Names:: Computing the name of the variable to refer to.
266 * Value Function:: Return the un-expanded value of a variable.
268 * Origin Function:: Find where a variable got its value.
269 * Flavor Function:: Find out the flavor of a variable.
283 * Overriding:: How to override a variable to specify
662 @code{.DEFAULT_GOAL} special variable (@pxref{Special Variables, ,
736 the risk and simplify the makefile by using a variable. @dfn{Variables}
745 It is standard practice for every makefile to have a variable named
748 define such a variable @code{objects} with a line like this in the
760 substitute the variable's value by writing @samp{$(objects)}
763 Here is how the complete simple makefile looks when you use a variable
812 Here is the entire example, with both of these changes, and a variable
938 * MAKEFILES Variable:: The environment can specify extra makefiles.
939 * MAKEFILE_LIST Variable:: Discover which makefiles have been read.
952 @dfn{implicit rules}, @dfn{variable definitions}, @dfn{directives},
974 @cindex variable definition
976 A @dfn{variable definition} is a line that specifies a text string
977 value for a variable that can be substituted into the text later. The
978 simple makefile example shows a variable definition for @code{objects}
996 Defining a variable from a verbatim string containing multiple lines
1018 definition of the variable, but rather kept intact in the value of the
1019 variable. When the variable is expanded they will either be treated
1021 context in which the variable is evaluated.
1072 @node Include, MAKEFILES Variable, Makefile Names, Makefiles
1099 the file names contain any variable or function references, they are
1123 common set of variable definitions
1180 @node MAKEFILES Variable, MAKEFILE_LIST Variable, Include, Makefiles
1181 @section The Variable @code{MAKEFILES}
1182 @cindex makefile, and @code{MAKEFILES} variable
1183 @cindex including (@code{MAKEFILES} variable)
1186 If the environment variable @code{MAKEFILES} is defined, @code{make}
1194 @cindex recursion, and @code{MAKEFILES} variable
1198 variable
1210 @node MAKEFILE_LIST Variable, Special Variables, MAKEFILES Variable, Makefiles
1212 @section The Variable @code{MAKEFILE_LIST}
1213 @cindex makefiles, and @code{MAKEFILE_LIST} variable
1214 @cindex including (@code{MAKEFILE_LIST} variable)
1218 @code{MAKEFILES} variable, the command line, the default files, or
1220 appended to the @code{MAKEFILE_LIST} variable. They are added right
1224 word in this variable, it will be the name of the current makefile.
1257 variable definitions.
1259 @node Special Variables, Remaking Makefiles, MAKEFILE_LIST Variable, Makefiles
1275 @code{.DEFAULT_GOAL} variable allows you to discover the current
1321 This variable is set only if this instance of @code{make} has
1325 variable). You should not set, modify, or export this variable.
1334 to this variable will be ignored; it will always return its special
1339 @c The second special variable is @code{.TARGETS}. When expanded, the
1342 @c mentioned in the makefile to be listed in this variable, even if it
1345 @c considered a target for the purposes of this variable.
1378 Supports target-specific and pattern-specific variable assignments.
1379 @xref{Target-specific, ,Target-specific Variable Values}.
1477 include one in the other, and add more targets or variable definitions.
1532 direct impact on how variable and function expansion happens; this is
1547 @subheading Variable Assignment
1554 Variable definitions are parsed as follows:
1568 immediate if the variable was previously set as a simple variable
1624 expansion will have no effect, since all variable and function
1628 variable or function reference in the makefile. In this case the
1642 first (unescaped) variable reference to @var{ONEVAR} is expanded,
1643 while the second (escaped) variable reference is simply unescaped,
1644 without being recognized as a variable reference. Now during the
1646 contains no variable or function references it remains the static
1648 to the variable @var{TWOVAR}, which is expanded to the value
1691 the secondary expansion, the @code{$@@} variable is set to the name of
1712 phase, especially of the target name variable @code{$$@@}, behaves
1726 @code{$$<} variable evaluates to the first prerequisite in the first
1761 pattern rules the @code{$$*} variable is set to the pattern stem. As
1935 Because dollar signs are used to start @code{make} variable
2033 functionality can be simulated by setting the environment variable
2082 Targets, ,Empty Target Files to Record Events}. (The automatic variable
2086 Wildcard expansion does not happen when you define a variable. Thus, if
2094 then the value of the variable @code{objects} is the actual string
2171 does not normally take place when a variable is set, or inside the
2253 The value of the @code{make} variable @code{VPATH} specifies a list of
2267 In the @code{VPATH} variable, directory names are separated by colons or
2304 Similar to the @code{VPATH} variable, but more selective, is the
2320 blanks, just like the search path used in the @code{VPATH} variable.
2354 just like (and before) the directories in the @code{VPATH} variable.
2458 directories, you can use the @code{GPATH} variable to indicate this to
2490 (The variable @code{CFLAGS} exists so you can specify flags for C
2496 want to mention in the commands. The automatic variable @samp{$<} is
2578 via the @code{.LIBPATTERNS} variable. Each word in the value of this
2579 variable is a pattern string. When a prerequisite like
2589 variable to an empty value.
2655 makefile will often contain a variable which lists a number of
2822 automatic variable @samp{$?} is used to print only those files that have
3043 to be absolutely identical, since the automatic variable @samp{$@@}
3074 much as the variable @samp{$@@} allows you to vary the commands.
3103 have a variable, such as @code{objects}, containing a list of all the
3120 a variable that you set with a command argument to @code{make}
3231 Here @samp{$<} is the automatic variable that holds the name of the
3232 prerequisite and @samp{$@@} is the automatic variable that holds the name
3474 (This example uses a substitution variable reference to translate the
3531 has been started until another rule or variable definition) will be
3551 A variable definition in a ``rule context'' which is indented by a tab
3553 not a @code{make} variable definition, and passed to the shell.
3667 @code{make} variable then use the variable in the command. In this
3691 (@pxref{Target-specific, ,Target-specific Variable Values}) to obtain
3692 a tighter correspondence between the variable and the command that
3697 @cindex variable references in commands
3701 any variable references in them (@pxref{Reference,Basics of Variable
3706 Variable and function references in commands have identical syntax and
3711 keep clear in your mind whether the variable you want to reference is
3712 a @code{make} variable (use a single dollar sign) or a shell variable
3839 The program used as the shell is taken from the variable @code{SHELL}.
3840 If this variable is not set in your makefile, the program
3844 Unlike most variables, the variable @code{SHELL} is never set from the
3845 environment. This is because the @code{SHELL} environment variable is
3862 set this variable, and therefore it is most likely set specifically to
3864 not suitable for @code{make}, you can set the variable
3877 On MS-DOS, if @code{SHELL} is not set, the value of the variable
3881 The processing of lines that set the variable @code{SHELL} in Makefiles
3905 In each of the directories in the @code{PATH} variable, in order.
4192 processed any @code{-C} options) it sets the variable @code{CURDIR} to
4197 set in the makefile (by default, an environment variable @code{CURDIR}
4198 will not override this value). Note that setting this variable has no
4203 * MAKE Variable:: The special effects of using @samp{$(MAKE)}.
4210 @node MAKE Variable, Variables/Recursion, Recursion, Recursion
4211 @subsection How the @code{MAKE} Variable Works
4213 @cindex recursion, and @code{MAKE} variable
4215 Recursive @code{make} commands should always use the variable @code{MAKE},
4225 The value of this variable is the file name with which @code{make} was
4233 As a special feature, using the variable @code{MAKE} in the commands of
4236 Using the @code{MAKE} variable has the same effect as using a @samp{+}
4239 is only enabled if the @code{MAKE} variable appears directly in the
4240 command script: it does not apply if the @code{MAKE} variable is
4241 referenced through expansion of another variable. In the latter case
4257 line of a rule contains the variable @code{MAKE}, the flags @samp{-t},
4266 @node Variables/Recursion, Options/Recursion, MAKE Variable, Recursion
4276 Variable values of the top-level @code{make} can be passed to the
4283 To pass down, or @dfn{export}, a variable, @code{make} adds the variable
4286 of variable values. @xref{Environment, ,Variables from the
4289 Except by explicit request, @code{make} exports a variable only if it
4292 Some shells cannot cope with environment variable names consisting of
4296 The value of the @code{make} variable @code{SHELL} is not exported.
4297 Instead, the value of the @code{SHELL} variable from the invoking
4302 The special variable @code{MAKEFLAGS} is always exported (unless you
4305 @code{make} automatically passes down variable values that were defined
4306 on the command line, by putting them in the @code{MAKEFLAGS} variable.
4324 export @var{variable} @dots{}
4329 If you want to @emph{prevent} a variable from being exported, use the
4333 unexport @var{variable} @dots{}
4339 which expand to a (list of) variable names to be (un)exported.
4341 As a convenience, you can define a variable and export it at the same
4345 export @var{variable} = value
4352 @var{variable} = value
4353 export @var{variable}
4360 export @var{variable} := value
4367 @var{variable} := value
4368 export @var{variable}
4374 export @var{variable} += value
4381 @var{variable} += value
4382 export @var{variable}
4401 Any variable given in an @code{unexport} directive will still @emph{not}
4428 As a special feature, the variable @code{MAKELEVEL} is changed when it
4429 is passed down from level to level. This variable's value is a string
4441 You can use the variable @code{MAKEFILES} to cause all sub-@code{make}
4443 a whitespace-separated list of file names. This variable, if defined in
4446 before the usual or specified ones. @xref{MAKEFILES Variable, ,The
4447 Variable @code{MAKEFILES}}.@refill
4456 sub-@code{make} through the variable @code{MAKEFLAGS}. This variable is
4466 @cindex command line variable definitions, and recursion
4468 @cindex recursion, and command line variable definitions
4471 @code{MAKEFLAGS} that contain @samp{=}, @code{make} treats as variable
4523 The command line variable definitions really appear in the variable
4525 variable. If you do want to pass flags down normally, but don't want to
4526 pass down the command line variable definitions, you can reset
4547 A similar variable @code{MFLAGS} exists also, for historical
4549 does not contain the command line variable definitions, and it always
4570 The @code{MAKEFLAGS} variable can also be useful if you want to have
4576 variable is set only for compatibility; @code{make} does not interpret a
4646 sequence is actually a variable, so the name must not conflict with other
4647 variable names.
4660 Here @code{run-yacc} is the name of the variable being defined;
4662 commands. The @code{define} directive does not expand variable references
4664 parentheses, variable names, and so on, all become part of the value of the
4665 variable you are defining.
4674 To use the canned sequence, substitute the variable into the commands of a
4675 rule. You can substitute it like any other variable
4676 (@pxref{Reference, ,Basics of Variable References}).
4678 variables, all the variable references you wrote inside the @code{define}
4687 @samp{foo.y} will be substituted for the variable @samp{$^} when it occurs in
4773 @cindex variable
4775 @cindex recursive variable expansion
4776 @cindex simple variable expansion
4778 A @dfn{variable} is a name defined in a makefile to represent a string
4779 of text, called the variable's @dfn{value}. These values are
4787 variable definitions using @samp{=}, and the bodies of variable
4794 A variable name may be any sequence of characters not containing @samp{:},
4796 variable names containing characters other than letters, numbers, and
4802 Variable names are case-sensitive. The names @samp{foo}, @samp{FOO},
4805 It is traditional to use upper case letters in variable names, but we
4806 recommend using lower case letters for variable names that serve internal
4816 * Reference:: How to use the value of a variable.
4818 * Advanced:: Advanced features for referencing a variable.
4820 * Setting:: How to set a variable in the makefile.
4822 of a variable.
4823 * Override Directive:: How to set a variable in the makefile even if
4825 * Defining:: An alternate way to set a variable
4827 * Environment:: Variable values can come from the environment.
4828 * Target-specific:: Variable values can be defined on a per-target
4830 * Pattern-specific:: Target-specific variable values can be applied
4835 @section Basics of Variable References
4838 @cindex @code{$}, in variable reference
4839 @cindex dollar sign (@code{$}), in variable reference
4841 To substitute a variable's value, write a dollar sign followed by the name
4842 of the variable in parentheses or braces: either @samp{$(foo)} or
4843 @samp{$@{foo@}} is a valid reference to the variable @code{foo}. This
4847 Variable references can be used in any context: targets, prerequisites,
4848 commands, most directives, and new variable values. Here is an
4849 example of a common case, where a variable holds the names of all the
4862 Variable references work by strict textual substitution. Thus, the rule
4874 the variable value are ignored in variable assignments, the value of
4880 variable name. Thus, you could reference the variable @code{x} with
4887 @cindex recursive variable expansion
4892 There are two ways that a variable in GNU @code{make} can have a value;
4897 The first flavor of variable is a @dfn{recursively expanded} variable.
4902 these references are expanded whenever this variable is substituted (in
4920 This flavor of variable is the only sort supported by other versions of
4932 cannot append something on the end of a variable, as in
4939 because it will cause an infinite loop in the variable expansion.
4941 @cindex loops in variable expansion
4946 referenced in the definition will be executed every time the variable is
4960 The value of a simply expanded variable is scanned
4962 functions, when the variable is defined. The actual value of the simply
4963 expanded variable is the result of expanding the text that you write.
4965 values @emph{as of the time this variable
4981 When a simply expanded variable is referenced, its value is substituted
4987 also shows use of the variable @code{MAKELEVEL}, which is changed
5017 languages. They allow you to redefine a variable using its own value (or
5022 @cindex spaces, in variable values
5023 @cindex whitespace, in variable values
5026 variable values. Leading whitespace characters are discarded from your
5027 input before substitution of variable references and function calls;
5028 this means you can include leading spaces in a variable value by
5029 protecting them with variable references, like this:
5037 Here the value of the variable @code{space} is precisely one space. The
5039 Since trailing space characters are @emph{not} stripped from variable
5042 variable value, it is a good idea to put a comment like that at the end
5044 want any whitespace characters at the end of your variable value, you
5053 Here the value of the variable @code{dir} is @w{@samp{/foo/bar }}
5057 @cindex conditional variable assignment
5061 is called a conditional variable assignment operator, because it only
5062 has an effect if the variable is not yet defined. This statement:
5078 Note that a variable set to an empty value is still defined, so
5079 @samp{?=} will not set that variable.
5089 * Substitution Refs:: Referencing a variable with
5091 * Computed Names:: Computing the name of the variable to refer to.
5096 @cindex modified variable reference
5097 @cindex substitution variable reference
5103 A @dfn{substitution reference} substitutes the value of a variable with
5107 of the variable @var{var}, replace every @var{a} at the end of a word with
5150 @subsection Computed Variable Names
5151 @cindex nested variable reference
5152 @cindex computed variable name
5156 @cindex @code{$}, in variable name
5157 @cindex dollar sign (@code{$}), in variable name
5159 Computed variable names are a complicated concept needed only for
5161 consider them, except to know that making a variable with a dollar sign
5166 Variables may be referenced inside the name of a variable. This is
5167 called a @dfn{computed variable name} or a @dfn{nested variable
5179 to @samp{z}. Here the name of the variable to reference is not stated
5181 @samp{$(x)} here is nested within the outer variable reference.
5198 References to recursively-expanded variables within a variable name are
5212 Nested variable references can also contain modified references and
5234 entire string becomes @samp{$(variable2)}, a simple variable reference
5237 A computed variable name need not consist entirely of a single variable
5238 reference. It can contain several variable references, as well as some
5276 Computed variable names can also be used in substitution references:
5291 The only restriction on this sort of use of nested variable references
5315 attempts to give @samp{foo} the value of the variable @samp{sort a d b g
5321 You can also use computed variable names in the left-hand side of a
5322 variable assignment, or in a @code{define} directive, as in:
5336 Note that @dfn{nested variable references} are quite different from
5344 @cindex value, how a variable gets it
5380 To set a variable from the makefile, write a line starting with the
5381 variable name followed by @samp{=} or @samp{:=}. Whatever follows the
5389 defines a variable named @code{objects}. Whitespace around the variable
5394 definitions can contain variable references which will be expanded before
5397 The variable name may contain function and variable references, which
5398 are expanded when the line is read to find the actual variable name to use.
5400 There is no limit on the length of the value of a variable except the
5401 amount of swapping space on the computer. When a variable definition is
5407 Most variable names are considered to have the empty string as a value if
5415 If you'd like a variable to be set to a value only if it's not already
5417 @samp{=}. These two settings of the variable @samp{FOO} are identical
5439 Often it is useful to add more text to the value of a variable already defined.
5447 This takes the value of the variable @code{objects}, and adds the text
5468 When the variable in question has not been defined before, @samp{+=}
5470 variable. However, when there @emph{is} a previous definition, exactly
5471 what @samp{+=} does depends on what flavor of variable you defined
5475 When you add to a variable's value with @samp{+=}, @code{make} acts
5477 definition of the variable. If you defined it first with @samp{:=},
5478 making it a simply-expanded variable, @samp{+=} adds to that
5485 variable := value
5486 variable += more
5494 variable := value
5495 variable := $(variable) more
5498 On the other hand, when you use @samp{+=} with a variable
5501 recursively-expanded variable, @code{make} does not expand the value you set
5502 for variable and function references immediately. Instead it stores the text
5503 verbatim, and saves these variable and function references to be expanded
5504 later, when you refer to the new variable (@pxref{Flavors, ,The Two Flavors
5505 of Variables}). When you use @samp{+=} on a recursively-expanded variable,
5511 variable = value
5512 variable += more
5522 variable = $(temp) more
5527 except that of course it never defines a variable called @code{temp}.
5528 The importance of this comes when the variable's old value contains
5529 variable references. Take this common example:
5538 The first line defines the @code{CFLAGS} variable with a reference to another
5539 variable, @code{includes}. (@code{CFLAGS} is used by the rules for C
5542 variable, meaning @w{@samp{$(includes) -O}} is @emph{not} expanded when
5554 redefines @code{CFLAGS} as a simply-expanded variable; this means
5556 variable. If @code{includes} is not yet defined, we get @w{@samp{ -O
5560 the reference to @code{includes}, so if that variable gets defined at
5570 If a variable has been set with a command argument
5573 the variable in the makefile even though it was set with a command
5578 override @var{variable} = @var{value}
5585 override @var{variable} := @var{value}
5588 To append more text to a variable defined on the command line, use:
5591 override @var{variable} += @var{more text}
5631 @cindex verbatim variable definition
5635 Another way to set the value of a variable is to use the @code{define}
5643 variable and nothing more. The value to give the variable appears on the
5646 works just like @samp{=}: it creates a recursively-expanded variable
5648 The variable name may contain function and variable references, which
5649 are expanded when the directive is read to find the actual variable name
5668 part of the variable's value (except for the final newline which precedes
5685 If you want variable definitions made with @code{define} to take
5686 precedence over command-line variable definitions, you can use the
5705 @code{make} is run. Every environment variable that @code{make} sees
5706 when it starts up is transformed into a @code{make} variable with the
5713 Thus, by setting the variable @code{CFLAGS} in your environment, you can
5736 Such problems would be especially likely with the variable
5740 @code{SHELL} environment variable in a special way; see @ref{Choosing
5744 @section Target-specific Variable Values
5748 Variable values in @code{make} are usually global; that is, they are the
5753 The other exception is @dfn{target-specific variable values}. This
5754 feature allows you to define different values for the same variable,
5759 Set a target-specific variable value like this:
5762 @var{target} @dots{} : @var{variable-assignment}
5769 @var{target} @dots{} : override @var{variable-assignment}
5776 @var{target} @dots{} : export @var{variable-assignment}
5779 Multiple @var{target} values create a target-specific variable value for
5782 The @var{variable-assignment} can be any valid form of assignment;
5785 @var{variable-assignment} are evaluated within the context of the
5786 target: thus, any previously-defined target-specific variable values
5787 will be in effect. Note that this variable is actually distinct from
5792 variable. Variables provided on the command-line (and in the
5795 variable value to be preferred.
5798 you define a target-specific variable that variable value is also in
5800 prerequisites, etc.@: (unless those prerequisites override that variable
5801 with their own target-specific variable value). So, for example, a
5819 the same target-specific variable, then the first target to be built
5825 @section Pattern-specific Variable Values
5829 In addition to target-specific variable values
5830 (@pxref{Target-specific, ,Target-specific Variable Values}), GNU
5831 @code{make} supports pattern-specific variable values. In this form,
5832 the variable is defined for any target that matches the pattern
5840 Set a pattern-specific variable value like this:
5843 @var{pattern} @dots{} : @var{variable-assignment}
5850 @var{pattern} @dots{} : override @var{variable-assignment}
5854 where @var{pattern} is a %-pattern. As with target-specific variable
5855 values, multiple @var{pattern} values create a pattern-specific variable
5856 value for each pattern individually. The @var{variable-assignment} can
5857 be any valid form of assignment. Any command-line variable setting will
5876 value of one variable to another, or the value of a variable to
5891 of libraries if the @code{CC} variable is @samp{gcc}, and a different
5914 by parentheses. Variable substitution is performed on both arguments and
5933 When the variable @code{CC} has the value @samp{gcc}, the above example has
5942 When the variable @code{CC} has any other value, the effect is this:
5950 variable assignment and then using the variable unconditionally:
6029 Expand all variable references in @var{arg1} and @var{arg2} and
6033 Often you want to test if a variable has a non-empty value. When the
6057 Expand all variable references in @var{arg1} and @var{arg2} and
6061 @item ifdef @var{variable-name}
6062 The @code{ifdef} form takes the @emph{name} of a variable as its
6063 argument, not a reference to a variable. The value of that variable
6066 never been defined have an empty value. The text @var{variable-name}
6067 is expanded, so it could be a variable or function that expands
6068 to the name of a variable. For example:
6078 The variable reference @code{$(foo)} is expanded, yielding @code{bar},
6079 which is considered to be the name of a variable. The variable
6083 Note that @code{ifdef} only tests whether a variable has a value. It
6084 does not expand the variable to see if that value is nonempty.
6114 @item ifndef @var{variable-name}
6115 If the variable @var{variable-name} has an empty value, the
6118 @var{variable-name} are identical to the @code{ifdef} directive.
6155 @samp{-t} by using the variable @code{MAKEFLAGS} together with the
6193 call, just as a variable might be substituted.
6202 * Value Function:: Return the un-expanded value of a variable.
6204 * Origin Function:: Find where a variable got its value.
6205 * Flavor Function:: Find out the flavor of a variable.
6217 A function call resembles a variable reference. It looks like this:
6241 themselves contain other function calls or variable references, it is
6255 by variable substitution. First define variables @code{comma} and
6409 Replacing the variable reference @w{@samp{$(needs_made)}} with the
6444 of strings (such as file names) in a variable. For example:
6587 @code{patsubst}. Suppose that a makefile uses the @code{VPATH} variable
6606 value of the variable @code{CFLAGS}, which is passed automatically to the C
6869 value of @var{list}, the variable named by the expanded value of @var{var}
6871 contains references to that variable, so its expansion will be different
6879 This simple example sets the variable @samp{files} to the list of all files
6900 a name, with an additional variable:
6909 Here we use the variable @code{find_files} this way. We use plain @samp{=}
6910 to define a recursively-expanding variable, so that its value contains an
6912 a simply-expanded variable would not do, since @code{wildcard} would be
6915 The @code{foreach} function has no permanent effect on the variable
6919 @code{foreach}. The variable @var{var} is a simply-expanded variable
6924 You must take care when using complex variable expressions that result in
6925 variable names because many strange things are valid variable names, but
6933 might be useful if the value of @code{find_files} references the variable
6945 value of a variable, then use @code{call} to expand it with different
6951 $(call @var{variable},@var{param},@var{param},@dots{})
6955 temporary variables @code{$(1)}, @code{$(2)}, etc. The variable
6956 @code{$(0)} will contain @var{variable}. There is no maximum number of
6960 Then @var{variable} is expanded as a @code{make} variable in the context
6962 the value of @var{variable} will resolve to the first @var{param} in the
6965 Note that @var{variable} is the @emph{name} of a variable, not a
6966 @emph{reference} to that variable. Therefore you would not normally use
6968 variable reference in the name if you want the name not to be a
6971 If @var{variable} is the name of a builtin function, the builtin function
6972 is always invoked (even if a @code{make} variable by that name also
6976 assigning them to temporary variables. This means that @var{variable}
7004 Now the variable LS contains @code{/bin/ls} or similar.
7037 variable @emph{without} having it expanded. Please note that this
7039 you create a simply expanded variable its value is expanded during the
7041 same result as using the variable directly.
7046 $(value @var{variable})
7049 Note that @var{variable} is the @emph{name} of a variable; not a
7050 @emph{reference} to that variable. Therefore you would not normally
7052 a variable reference in the name if you want the name not to be a
7056 @var{variable}, without any expansion occurring. For example, in this
7071 expanded as a @code{make} variable, while the second output line would
7072 be the current value of your @code{$PATH} environment variable, since
7148 @cindex origin of variable
7152 a variable. Specifically, it tells you where it came from.
7157 $(origin @var{variable})
7160 Note that @var{variable} is the @emph{name} of a variable to inquire about;
7161 not a @emph{reference} to that variable. Therefore you would not normally
7163 variable reference in the name if you want the name not to be a constant.)
7165 The result of this function is a string telling you how the variable
7166 @var{variable} was defined:
7171 if @var{variable} was never defined.
7175 if @var{variable} has a default definition, as is usual with @code{CC}
7177 Note that if you have redefined a default variable, the @code{origin}
7182 if @var{variable} was defined as an environment variable and the
7187 if @var{variable} was defined as an environment variable and the
7193 if @var{variable} was defined in a makefile.
7197 if @var{variable} was defined on the command line.
7201 if @var{variable} was defined with an @code{override} directive in a
7206 if @var{variable} is an automatic variable defined for the
7212 determine if you want to believe the value of a variable. For example,
7214 @file{bar}. You want a variable @code{bletch} to be defined in @file{bar}
7257 @cindex flavor of variable
7261 variables; it tells you something @emph{about} a variable.
7262 Specifically, it tells you the flavor of a variable (@pxref{Flavors,
7268 $(flavor @var{variable})
7271 Note that @var{variable} is the @emph{name} of a variable to inquire about;
7272 not a @emph{reference} to that variable. Therefore you would not normally
7274 variable reference in the name if you want the name not to be a constant.)
7277 variable @var{variable}:
7282 if @var{variable} was never defined.
7286 if @var{variable} is a recursively expanded variable.
7290 if @var{variable} is a simply expanded variable.
7359 it inside a command script or on the right side of a recursive variable
7373 @code{make} variable @code{ERROR1} is defined. Or,
7443 * Overriding:: How to override a variable to specify
7483 within your makefile using the @code{.DEFAULT_GOAL} variable
7493 parsed as a switch or variable definition, respectively). Even
7498 @code{Make} will set the special variable @code{MAKECMDGOALS} to the
7500 on the command line, this variable is empty. Note that this variable
7695 @samp{$@{MAKE@}} (@xref{MAKE Variable, ,How the @code{MAKE} Variable Works}.)
7777 An argument that contains @samp{=} specifies the value of a variable:
7778 @samp{@var{v}=@var{x}} sets the value of the variable @var{v} to @var{x}.
7780 variable in the makefile are ignored; we say they have been
7784 compilers. For example, in a properly written makefile, the variable
7804 other special characters in the value of a variable when you override
7807 The variable @code{CFLAGS} is only one of many standard variables that
7815 When you override a variable with a command argument, you can define either
7816 a recursively-expanded variable or a simply-expanded variable. The
7817 examples shown above make a recursively-expanded variable; to make a
7818 simply-expanded variable, write @samp{:=} instead of @samp{=}. But, unless
7819 you want to include a variable reference or function call in the
7821 variable you create.
7823 There is one way that the makefile can change a variable that you have
7825 that looks like this: @samp{override @var{variable} = @var{value}}
8067 Print the data base (rules and variable values) that results from
8073 contains filename and linenumber information for command and variable
8193 undefined variable. This can be helpful when you are trying to debug
8222 implicit rule works. For example, the variable @code{CFLAGS} controls the
8624 @file{.@var{x}} source file uses the variable @code{COMPILE.@var{x}}.
8630 Every rule that produces an object file uses the variable
8631 @code{OUTPUT_OPTION}. @code{make} defines this variable either to
8667 name.) If a variable value contains more than one argument, separate them
8963 @strong{after} any variable or function expansions, which take place
9126 automatic variable values are available: they only have values within
9134 automatic variable values to be used in prerequisite lists.
9140 @vindex @@ @r{(automatic variable)}
9149 @vindex % @r{(automatic variable)}
9157 @vindex < @r{(automatic variable)}
9164 @vindex ? @r{(automatic variable)}
9173 @vindex ^ @r{(automatic variable)}
9182 see the @samp{$|} variable, below.
9187 @vindex + @r{(automatic variable)}
9195 @vindex | @r{(automatic variable)}
9201 @vindex * @r{(automatic variable)}
9207 @cindex stem, variable for
9250 @vindex @@D @r{(automatic variable)}
9258 @vindex @@F @r{(automatic variable)}
9265 @vindex *D @r{(automatic variable)}
9268 @vindex *F @r{(automatic variable)}
9274 @vindex %D @r{(automatic variable)}
9277 @vindex %F @r{(automatic variable)}
9286 @vindex <D @r{(automatic variable)}
9289 @vindex <F @r{(automatic variable)}
9295 @vindex ^D @r{(automatic variable)}
9298 @vindex ^F @r{(automatic variable)}
9304 @vindex +D @r{(automatic variable)}
9307 @vindex +F @r{(automatic variable)}
9314 @vindex ?D @r{(automatic variable)}
9317 @vindex ?F @r{(automatic variable)}
9325 @w{``the variable @code{<}''} as we would write for ordinary variables
9328 deep significance; @samp{$<} refers to the variable named @code{<} just
9329 as @samp{$(CFLAGS)} refers to the variable named @code{CFLAGS}.
9605 The variable @code{SUFFIXES} is defined to the default list of suffixes
9608 this variable.
9813 Implicit rules such as this one are written using the automatic variable
9955 The @code{VPATH} variable and its special meaning.
9971 Options passed through the variable @code{MAKEFLAGS} to recursive
9976 The automatic variable @code{$%} is set to the member name
9986 Substitution variable references.
9987 @xref{Reference, ,Basics of Variable References}.
9994 Execution of recursive commands to run @code{make} via the variable
10033 The automatic variable @code{$^} containing a list of all prerequisites
10035 did. @xref{Automatic Variables}. The automatic variable
10049 Modified variable references using pattern substitution come from
10050 SunOS 4. @xref{Reference, ,Basics of Variable References}.
10064 The @samp{+=} syntax to append to the value of a variable comes from SunOS
10095 Pass command-line variable assignments automatically through the
10096 variable @code{MAKE} to recursive @code{make} invocations.
10104 Make verbatim variable definitions with @code{define}.
10136 Specify extra makefiles to read with an environment variable.
10137 @xref{MAKEFILES Variable, ,The Variable @code{MAKEFILES}}.
10157 variable @code{MAKELEVEL}. @xref{Recursion, ,Recursive Use of @code{make}}.
10160 Provide any goals given on the command line in the variable
10171 Provide computed variable references.
10172 @xref{Reference, ,Basics of Variable References}.
10184 The built-in variable @samp{MAKE_VERSION} gives the version number of
10233 In some Unix @code{make}s, the automatic variable @code{$*} appearing in
10238 @vindex * @r{(automatic variable), unsupported bizarre usage}
10311 @item define @var{variable}
10314 Define a multi-line, recursively-expanded variable.@*
10317 @item ifdef @var{variable}
10318 @itemx ifndef @var{variable}
10338 @item override @var{variable} = @var{value}
10339 @itemx override @var{variable} := @var{value}
10340 @itemx override @var{variable} += @var{value}
10341 @itemx override @var{variable} ?= @var{value}
10342 @itemx override define @var{variable}
10345 Define a variable, overriding any previous definition, even one from
10354 @item export @var{variable}
10355 @itemx export @var{variable} = @var{value}
10356 @itemx export @var{variable} := @var{value}
10357 @itemx export @var{variable} += @var{value}
10358 @itemx export @var{variable} ?= @var{value}
10359 @itemx unexport @var{variable}
10360 Tell @code{make} whether or not to export a particular variable to child
10488 @item $(origin @var{variable})
10490 Return a string describing how the @code{make} variable @var{variable} was
10494 @item $(flavor @var{variable})
10496 Return a string describing the flavor of the @code{make} variable
10497 @var{variable}.@*
10508 Evaluate the variable @var{var} replacing any references to @code{$(1)},
10520 Evaluates to the contents of the variable @var{var}, with no expansion
10591 @xref{MAKEFILES Variable, ,The Variable @code{MAKEFILES}}.
10603 variable is handled specially when importing from and exporting to the
10610 @code{SHELL}. @xref{Execution, ,MAKESHELL variable}.
10615 Using this variable in commands has special meaning.
10616 @xref{MAKE Variable, ,How the @code{MAKE} Variable Works}.
10637 variable has no effect on the operation of @code{make}.@*
10643 @code{-C} options are processed, if any). Setting this variable has no
10710 @code{make} command (such as a variable assignment). Command scripts
10756 @item Recursive variable `@var{xxx}' references itself (eventually). Stop.
10757 This means you've defined a normal (recursive) @code{make} variable
10763 @item Unterminated variable reference. Stop.
10765 or brace in your variable or function reference.
10792 environment variable to @samp{make -j2}. In this case, the
10801 algorithms to determine this (@pxref{MAKE Variable, ,How the @code{MAKE}
10802 Variable Works}). If the makefile is constructed such that the parent