--- make-doc-non-dfsg-3.81.orig/doc/make/make_6.html
+++ make-doc-non-dfsg-3.81/doc/make/make_6.html
@@ -0,0 +1,1267 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
+<html>
+<!-- This file documents the GNU make utility, which determines
+automatically which pieces of a large program need to be recompiled,
+and issues the commands to recompile them.
+
+This is Edition 0.70, last updated 1 April 2006,
+of The GNU Make Manual, for GNU make version 3.81.
+
+Copyright C 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
+and with the Back-Cover Texts as in (a) below.  A copy of the
+license is included in the section entitled "GNU Free Documentation
+License."
+
+(a) The FSF's Back-Cover Text is: "You have freedom to copy and modify
+this GNU Manual, like GNU software.  Copies published by the Free
+Software Foundation raise funds for GNU development."
+
+ -->
+<!-- Created on August, 17 2009 by texi2html 1.78 -->
+<!--
+Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
+            Karl Berry  <karl@freefriends.org>
+            Olaf Bachmann <obachman@mathematik.uni-kl.de>
+            and many others.
+Maintained by: Many creative people.
+Send bugs and suggestions to <texi2html-bug@nongnu.org>
+
+-->
+<head>
+<title>GNU make: 6. How to Use Variables</title>
+
+<meta name="description" content="GNU make: 6. How to Use Variables">
+<meta name="keywords" content="GNU make: 6. How to Use Variables">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="texi2html 1.78">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+pre.display {font-family: serif}
+pre.format {font-family: serif}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: serif; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: serif; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.roman {font-family:serif; font-weight:normal;}
+span.sansserif {font-family:sans-serif; font-weight:normal;}
+ul.toc {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
+
+<a name="Using-Variables"></a>
+<a name="SEC74"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="make_5.html#SEC73" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC75" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make_5.html#SEC56" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h1 class="chapter"> 6. How to Use Variables </h1>
+
+<p>A <em>variable</em> is a name defined in a makefile to represent a string
+of text, called the variable's <em>value</em>.  These values are
+substituted by explicit request into targets, prerequisites, commands,
+and other parts of the makefile.  (In some other versions of <code>make</code>,
+variables are called <em>macros</em>.)
+<a name="IDX240"></a>
+</p>
+<p>Variables and functions in all parts of a makefile are expanded when
+read, except for the shell commands in rules, the right-hand sides of
+variable definitions using &lsquo;<samp>=</samp>&rsquo;, and the bodies of variable
+definitions using the <code>define</code> directive.
+</p>
+<p>Variables can represent lists of file names, options to pass to compilers,
+programs to run, directories to look in for source files, directories to
+write output in, or anything else you can imagine.
+</p>
+<p>A variable name may be any sequence of characters not containing &lsquo;<samp>:</samp>&rsquo;,
+&lsquo;<samp>#</samp>&rsquo;, &lsquo;<samp>=</samp>&rsquo;, or leading or trailing whitespace.  However,
+variable names containing characters other than letters, numbers, and
+underscores should be avoided, as they may be given special meanings in the
+future, and with some shells they cannot be passed through the environment to a
+sub-<code>make</code>
+(see section <a href="make_5.html#SEC69">Communicating Variables to a Sub-<code>make</code></a>).
+</p>
+<p>Variable names are case-sensitive.  The names &lsquo;<samp>foo</samp>&rsquo;, &lsquo;<samp>FOO</samp>&rsquo;,
+and &lsquo;<samp>Foo</samp>&rsquo; all refer to different variables.
+</p>
+<p>It is traditional to use upper case letters in variable names, but we
+recommend using lower case letters for variable names that serve internal
+purposes in the makefile, and reserving upper case for parameters that
+control implicit rules or for parameters that the user should override with
+command options (see section <a href="make_9.html#SEC110">Overriding Variables</a>).
+</p>
+<p>A few variables have names that are a single punctuation character or
+just a few characters.  These are the <em>automatic variables</em>, and
+they have particular specialized uses.  See section <a href="make_10.html#SEC121">Automatic Variables</a>.
+</p>
+<table class="menu" border="0" cellspacing="0">
+<tr><td align="left" valign="top"><a href="#SEC75">6.1 Basics of Variable References</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   How to use the value of a variable.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC76">6.2 The Two Flavors of Variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                     Variables come in two flavors.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC77">6.3 Advanced Features for Reference to Variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                    Advanced features for referencing a variable.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC80">6.4 How Variables Get Their Values</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                      All the ways variables get their values.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC81">6.5 Setting Variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                     How to set a variable in the makefile.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC82">6.6 Appending More Text to Variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   How to append more text to the old value
+                                  of a variable.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC83">6.7 The <code>override</code> Directive</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">          How to set a variable in the makefile even if
+                                  the user has set it with a command argument.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC84">6.8 Defining Variables Verbatim</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                    An alternate way to set a variable
+                                  to a verbatim string.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC85">6.9 Variables from the Environment</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                 Variable values can come from the environment.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC86">6.10 Target-specific Variable Values</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Variable values can be defined on a per-target
+                                  basis.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC87">6.11 Pattern-specific Variable Values</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            Target-specific variable values can be applied
+                                  to a group of targets that match a pattern.
+</td></tr>
+</table>
+
+<hr size="6">
+<a name="Reference"></a>
+<a name="SEC75"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC74" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC76" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.1 Basics of Variable References </h2>
+
+<p>To substitute a variable's value, write a dollar sign followed by the name
+of the variable in parentheses or braces: either &lsquo;<samp>$(foo)</samp>&rsquo; or
+&lsquo;<samp>${foo}</samp>&rsquo; is a valid reference to the variable <code>foo</code>.  This
+special significance of &lsquo;<samp>$</samp>&rsquo; is why you must write &lsquo;<samp>$$</samp>&rsquo; to have
+the effect of a single dollar sign in a file name or command.
+</p>
+<p>Variable references can be used in any context: targets, prerequisites,
+commands, most directives, and new variable values.  Here is an
+example of a common case, where a variable holds the names of all the
+object files in a program:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">objects = program.o foo.o utils.o
+program : $(objects)
+        cc -o program $(objects)
+
+$(objects) : defs.h
+</pre></td></tr></table>
+
+<p>Variable references work by strict textual substitution.  Thus, the rule
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">foo = c
+prog.o : prog.$(foo)
+        $(foo)$(foo) -$(foo) prog.$(foo)
+</pre></td></tr></table>
+
+<p>could be used to compile a C program &lsquo;<tt>prog.c</tt>&rsquo;.  Since spaces before
+the variable value are ignored in variable assignments, the value of
+<code>foo</code> is precisely &lsquo;<samp>c</samp>&rsquo;.  (Don't actually write your makefiles
+this way!)
+</p>
+<p>A dollar sign followed by a character other than a dollar sign,
+open-parenthesis or open-brace treats that single character as the
+variable name.  Thus, you could reference the variable <code>x</code> with
+&lsquo;<samp>$x</samp>&rsquo;.  However, this practice is strongly discouraged, except in
+the case of the automatic variables (see section <a href="make_10.html#SEC121">Automatic Variables</a>).
+</p>
+<hr size="6">
+<a name="Flavors"></a>
+<a name="SEC76"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC75" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC77" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.2 The Two Flavors of Variables </h2>
+
+<p>There are two ways that a variable in GNU <code>make</code> can have a value;
+we call them the two <em>flavors</em> of variables.  The two flavors are
+distinguished in how they are defined and in what they do when expanded.
+</p>
+<a name="IDX241"></a>
+<p>The first flavor of variable is a <em>recursively expanded</em> variable.
+Variables of this sort are defined by lines using &lsquo;<samp>=</samp>&rsquo;
+(see section <a href="#SEC81">Setting Variables</a>) or by the <code>define</code> directive
+(see section <a href="#SEC84">Defining Variables Verbatim</a>).  The value you specify
+is installed verbatim; if it contains references to other variables,
+these references are expanded whenever this variable is substituted (in
+the course of expanding some other string).  When this happens, it is
+called <em>recursive expansion</em>.
+</p>
+<p>For example,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">foo = $(bar)
+bar = $(ugh)
+ugh = Huh?
+
+all:;echo $(foo)
+</pre></td></tr></table>
+
+<p>will echo &lsquo;<samp>Huh?</samp>&rsquo;: &lsquo;<samp>$(foo)</samp>&rsquo; expands to &lsquo;<samp>$(bar)</samp>&rsquo; which
+expands to &lsquo;<samp>$(ugh)</samp>&rsquo; which finally expands to &lsquo;<samp>Huh?</samp>&rsquo;.
+</p>
+<p>This flavor of variable is the only sort supported by other versions of
+<code>make</code>.  It has its advantages and its disadvantages.  An advantage
+(most would say) is that:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">CFLAGS = $(include_dirs) -O
+include_dirs = -Ifoo -Ibar
+</pre></td></tr></table>
+
+<p>will do what was intended: when &lsquo;<samp>CFLAGS</samp>&rsquo; is expanded in a command,
+it will expand to &lsquo;<samp>-Ifoo -Ibar -O</samp>&rsquo;.  A major disadvantage is that you
+cannot append something on the end of a variable, as in
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">CFLAGS = $(CFLAGS) -O
+</pre></td></tr></table>
+
+<p>because it will cause an infinite loop in the variable expansion.
+(Actually <code>make</code> detects the infinite loop and reports an error.)
+<a name="IDX242"></a>
+<a name="IDX243"></a>
+</p>
+<p>Another disadvantage is that any functions
+(see section <a href="make_8.html#SEC92">Functions for Transforming Text</a>)
+referenced in the definition will be executed every time the variable is
+expanded.  This makes <code>make</code> run slower; worse, it causes the
+<code>wildcard</code> and <code>shell</code> functions to give unpredictable results
+because you cannot easily control when they are called, or even how many
+times.
+</p>
+<p>To avoid all the problems and inconveniences of recursively expanded
+variables, there is another flavor: simply expanded variables.
+</p>
+<a name="IDX244"></a>
+<a name="IDX245"></a>
+<a name="IDX246"></a>
+<p><em>Simply expanded variables</em> are defined by lines using &lsquo;<samp>:=</samp>&rsquo;
+(see section <a href="#SEC81">Setting Variables</a>).
+The value of a simply expanded variable is scanned
+once and for all, expanding any references to other variables and
+functions, when the variable is defined.  The actual value of the simply
+expanded variable is the result of expanding the text that you write.
+It does not contain any references to other variables; it contains their
+values <em>as of the time this variable was defined</em>.  Therefore,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">x := foo
+y := $(x) bar
+x := later
+</pre></td></tr></table>
+
+<p>is equivalent to
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">y := foo bar
+x := later
+</pre></td></tr></table>
+
+<p>When a simply expanded variable is referenced, its value is substituted
+verbatim.
+</p>
+<p>Here is a somewhat more complicated example, illustrating the use of
+&lsquo;<samp>:=</samp>&rsquo; in conjunction with the <code>shell</code> function.
+(See section <a href="make_8.html#SEC103">The <code>shell</code> Function</a>.)  This example
+also shows use of the variable <code>MAKELEVEL</code>, which is changed
+when it is passed down from level to level.
+(See section <a href="make_5.html#SEC69">Communicating Variables to a Sub-<code>make</code></a>, for information about <code>MAKELEVEL</code>.)
+</p>
+<a name="IDX247"></a>
+<a name="IDX248"></a>
+<table><tr><td>&nbsp;</td><td><pre class="example">ifeq (0,${MAKELEVEL})
+whoami    := $(shell whoami)
+host-type := $(shell arch)
+MAKE := ${MAKE} host-type=${host-type} whoami=${whoami}
+endif
+</pre></td></tr></table>
+
+<p>An advantage of this use of &lsquo;<samp>:=</samp>&rsquo; is that a typical
+`descend into a directory' command then looks like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">${subdirs}:
+        ${MAKE} -C $@ all
+</pre></td></tr></table>
+
+<p>Simply expanded variables generally make complicated makefile programming
+more predictable because they work like variables in most programming
+languages.  They allow you to redefine a variable using its own value (or
+its value processed in some way by one of the expansion functions) and to
+use the expansion functions much more efficiently
+(see section <a href="make_8.html#SEC92">Functions for Transforming Text</a>).
+</p>
+<a name="IDX249"></a>
+<a name="IDX250"></a>
+<a name="IDX251"></a>
+<p>You can also use them to introduce controlled leading whitespace into
+variable values.  Leading whitespace characters are discarded from your
+input before substitution of variable references and function calls;
+this means you can include leading spaces in a variable value by
+protecting them with variable references, like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">nullstring :=
+space := $(nullstring) # end of the line
+</pre></td></tr></table>
+
+<p>Here the value of the variable <code>space</code> is precisely one space.  The
+comment &lsquo;<samp># end of the line</samp>&rsquo; is included here just for clarity.
+Since trailing space characters are <em>not</em> stripped from variable
+values, just a space at the end of the line would have the same effect
+(but be rather hard to read).  If you put whitespace at the end of a
+variable value, it is a good idea to put a comment like that at the end
+of the line to make your intent clear.  Conversely, if you do <em>not</em>
+want any whitespace characters at the end of your variable value, you
+must remember not to put a random comment on the end of the line after
+some whitespace, such as this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">dir := /foo/bar    # directory to put the frobs in
+</pre></td></tr></table>
+
+<p>Here the value of the variable <code>dir</code> is &lsquo;<samp>/foo/bar    </samp>&rsquo;
+(with four trailing spaces), which was probably not the intention.
+(Imagine something like &lsquo;<samp>$(dir)/file</samp>&rsquo; with this definition!)
+</p>
+<a name="IDX252"></a>
+<a name="IDX253"></a>
+<a name="IDX254"></a>
+<p>There is another assignment operator for variables, &lsquo;<samp>?=</samp>&rsquo;.  This
+is called a conditional variable assignment operator, because it only
+has an effect if the variable is not yet defined.  This statement:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">FOO ?= bar
+</pre></td></tr></table>
+
+<p>is exactly equivalent to this
+(see section <a href="make_8.html#SEC101">The <code>origin</code> Function</a>):
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">ifeq ($(origin FOO), undefined)
+  FOO = bar
+endif
+</pre></td></tr></table>
+
+<p>Note that a variable set to an empty value is still defined, so
+&lsquo;<samp>?=</samp>&rsquo; will not set that variable.
+</p>
+<hr size="6">
+<a name="Advanced"></a>
+<a name="SEC77"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC76" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC78" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.3 Advanced Features for Reference to Variables </h2>
+
+<p>This section describes some advanced features you can use to reference
+variables in more flexible ways.
+</p>
+<table class="menu" border="0" cellspacing="0">
+<tr><td align="left" valign="top"><a href="#SEC78">6.3.1 Substitution References</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">           Referencing a variable with
+                                  substitutions on the value.
+</td></tr>
+<tr><td align="left" valign="top"><a href="#SEC79">6.3.2 Computed Variable Names</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">              Computing the name of the variable to refer to.
+</td></tr>
+</table>
+
+<hr size="6">
+<a name="Substitution-Refs"></a>
+<a name="SEC78"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC77" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC79" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC77" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h3 class="subsection"> 6.3.1 Substitution References </h3>
+
+<p>A <em>substitution reference</em> substitutes the value of a variable with
+alterations that you specify.  It has the form
+&lsquo;<samp>$(<var>var</var>:<var>a</var>=<var>b</var>)</samp>&rsquo; (or
+&lsquo;<samp>${<var>var</var>:<var>a</var>=<var>b</var>}</samp>&rsquo;) and its meaning is to take the value
+of the variable <var>var</var>, replace every <var>a</var> at the end of a word with
+<var>b</var> in that value, and substitute the resulting string.
+</p>
+<p>When we say &ldquo;at the end of a word&rdquo;, we mean that <var>a</var> must appear
+either followed by whitespace or at the end of the value in order to be
+replaced; other occurrences of <var>a</var> in the value are unaltered.  For
+example:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">foo := a.o b.o c.o
+bar := $(foo:.o=.c)
+</pre></td></tr></table>
+
+<p>sets &lsquo;<samp>bar</samp>&rsquo; to &lsquo;<samp>a.c b.c c.c</samp>&rsquo;.  See section <a href="#SEC81">Setting Variables</a>.
+</p>
+<p>A substitution reference is actually an abbreviation for use of the
+<code>patsubst</code> expansion function (see section <a href="make_8.html#SEC94">Functions for String Substitution and Analysis</a>).  We provide
+substitution references as well as <code>patsubst</code> for compatibility with
+other implementations of <code>make</code>.
+</p>
+<a name="IDX255"></a>
+<p>Another type of substitution reference lets you use the full power of
+the <code>patsubst</code> function.  It has the same form
+&lsquo;<samp>$(<var>var</var>:<var>a</var>=<var>b</var>)</samp>&rsquo; described above, except that now
+<var>a</var> must contain a single &lsquo;<samp>%</samp>&rsquo; character.  This case is
+equivalent to &lsquo;<samp>$(patsubst <var>a</var>,<var>b</var>,$(<var>var</var>))</samp>&rsquo;.
+See section <a href="make_8.html#SEC94">Functions for String Substitution and Analysis</a>,
+for a description of the <code>patsubst</code> function.
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">For example:
+
+foo := a.o b.o c.o
+bar := $(foo:%.o=%.c)
+</pre></td></tr></table>
+
+<p>sets &lsquo;<samp>bar</samp>&rsquo; to &lsquo;<samp>a.c b.c c.c</samp>&rsquo;.
+</p>
+<hr size="6">
+<a name="Computed-Names"></a>
+<a name="SEC79"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC78" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC80" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC77" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h3 class="subsection"> 6.3.2 Computed Variable Names </h3>
+
+<p>Computed variable names are a complicated concept needed only for
+sophisticated makefile programming.  For most purposes you need not
+consider them, except to know that making a variable with a dollar sign
+in its name might have strange results.  However, if you are the type
+that wants to understand everything, or you are actually interested in
+what they do, read on.
+</p>
+<p>Variables may be referenced inside the name of a variable.  This is
+called a <em>computed variable name</em> or a <em>nested variable
+reference</em>.  For example,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">x = y
+y = z
+a := $($(x))
+</pre></td></tr></table>
+
+<p>defines <code>a</code> as &lsquo;<samp>z</samp>&rsquo;: the &lsquo;<samp>$(x)</samp>&rsquo; inside &lsquo;<samp>$($(x))</samp>&rsquo; expands
+to &lsquo;<samp>y</samp>&rsquo;, so &lsquo;<samp>$($(x))</samp>&rsquo; expands to &lsquo;<samp>$(y)</samp>&rsquo; which in turn expands
+to &lsquo;<samp>z</samp>&rsquo;.  Here the name of the variable to reference is not stated
+explicitly; it is computed by expansion of &lsquo;<samp>$(x)</samp>&rsquo;.  The reference
+&lsquo;<samp>$(x)</samp>&rsquo; here is nested within the outer variable reference.
+</p>
+<p>The previous example shows two levels of nesting, but any number of levels
+is possible.  For example, here are three levels:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">x = y
+y = z
+z = u
+a := $($($(x)))
+</pre></td></tr></table>
+
+<p>Here the innermost &lsquo;<samp>$(x)</samp>&rsquo; expands to &lsquo;<samp>y</samp>&rsquo;, so &lsquo;<samp>$($(x))</samp>&rsquo;
+expands to &lsquo;<samp>$(y)</samp>&rsquo; which in turn expands to &lsquo;<samp>z</samp>&rsquo;; now we have
+&lsquo;<samp>$(z)</samp>&rsquo;, which becomes &lsquo;<samp>u</samp>&rsquo;.
+</p>
+<p>References to recursively-expanded variables within a variable name are
+reexpanded in the usual fashion.  For example:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">x = $(y)
+y = z
+z = Hello
+a := $($(x))
+</pre></td></tr></table>
+
+<p>defines <code>a</code> as &lsquo;<samp>Hello</samp>&rsquo;: &lsquo;<samp>$($(x))</samp>&rsquo; becomes &lsquo;<samp>$($(y))</samp>&rsquo;
+which becomes &lsquo;<samp>$(z)</samp>&rsquo; which becomes &lsquo;<samp>Hello</samp>&rsquo;.
+</p>
+<p>Nested variable references can also contain modified references and
+function invocations (see section <a href="make_8.html#SEC92">Functions for Transforming Text</a>),
+just like any other reference.
+For example, using the <code>subst</code> function
+(see section <a href="make_8.html#SEC94">Functions for String Substitution and Analysis</a>):
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">x = variable1
+variable2 := Hello
+y = $(subst 1,2,$(x))
+z = y
+a := $($($(z)))
+</pre></td></tr></table>
+
+<p>eventually defines <code>a</code> as &lsquo;<samp>Hello</samp>&rsquo;.  It is doubtful that anyone
+would ever want to write a nested reference as convoluted as this one, but
+it works: &lsquo;<samp>$($($(z)))</samp>&rsquo; expands to &lsquo;<samp>$($(y))</samp>&rsquo; which becomes
+&lsquo;<samp>$($(subst 1,2,$(x)))</samp>&rsquo;.  This gets the value &lsquo;<samp>variable1</samp>&rsquo; from
+<code>x</code> and changes it by substitution to &lsquo;<samp>variable2</samp>&rsquo;, so that the
+entire string becomes &lsquo;<samp>$(variable2)</samp>&rsquo;, a simple variable reference
+whose value is &lsquo;<samp>Hello</samp>&rsquo;.
+</p>
+<p>A computed variable name need not consist entirely of a single variable
+reference.  It can contain several variable references, as well as some
+invariant text.  For example,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">a_dirs := dira dirb
+1_dirs := dir1 dir2
+
+a_files := filea fileb
+1_files := file1 file2
+
+ifeq &quot;$(use_a)&quot; &quot;yes&quot;
+a1 := a
+else
+a1 := 1
+endif
+
+ifeq &quot;$(use_dirs)&quot; &quot;yes&quot;
+df := dirs
+else
+df := files
+endif
+
+dirs := $($(a1)_$(df))
+</pre></td></tr></table>
+
+<p>will give <code>dirs</code> the same value as <code>a_dirs</code>, <code>1_dirs</code>,
+<code>a_files</code> or <code>1_files</code> depending on the settings of <code>use_a</code>
+and <code>use_dirs</code>.
+</p>
+<p>Computed variable names can also be used in substitution references:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">a_objects := a.o b.o c.o
+1_objects := 1.o 2.o 3.o
+
+sources := $($(a1)_objects:.o=.c)
+</pre></td></tr></table>
+
+<p>defines <code>sources</code> as either &lsquo;<samp>a.c b.c c.c</samp>&rsquo; or &lsquo;<samp>1.c 2.c 3.c</samp>&rsquo;,
+depending on the value of <code>a1</code>.
+</p>
+<p>The only restriction on this sort of use of nested variable references
+is that they cannot specify part of the name of a function to be called.
+This is because the test for a recognized function name is done before
+the expansion of nested references.  For example,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">ifdef do_sort
+func := sort
+else
+func := strip
+endif
+
+bar := a d b g q c
+
+foo := $($(func) $(bar))
+</pre></td></tr></table>
+
+<p>attempts to give &lsquo;<samp>foo</samp>&rsquo; the value of the variable &lsquo;<samp>sort a d b g
+q c</samp>&rsquo; or &lsquo;<samp>strip a d b g q c</samp>&rsquo;, rather than giving &lsquo;<samp>a d b g q c</samp>&rsquo;
+as the argument to either the <code>sort</code> or the <code>strip</code> function.
+This restriction could be removed in the future if that change is shown
+to be a good idea.
+</p>
+<p>You can also use computed variable names in the left-hand side of a
+variable assignment, or in a <code>define</code> directive, as in:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">dir = foo
+$(dir)_sources := $(wildcard $(dir)/*.c)
+define $(dir)_print
+lpr $($(dir)_sources)
+endef
+</pre></td></tr></table>
+
+<p>This example defines the variables &lsquo;<samp>dir</samp>&rsquo;, &lsquo;<samp>foo_sources</samp>&rsquo;, and
+&lsquo;<samp>foo_print</samp>&rsquo;.
+</p>
+<p>Note that <em>nested variable references</em> are quite different from
+<em>recursively expanded variables</em>
+(see section <a href="#SEC76">The Two Flavors of Variables</a>), though both are
+used together in complex ways when doing makefile programming.
+</p>
+<hr size="6">
+<a name="Values"></a>
+<a name="SEC80"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC79" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC81" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.4 How Variables Get Their Values </h2>
+
+<p>Variables can get values in several different ways:
+</p>
+<ul>
+<li>
+You can specify an overriding value when you run <code>make</code>.
+See section <a href="make_9.html#SEC110">Overriding Variables</a>.
+
+</li><li>
+You can specify a value in the makefile, either
+with an assignment (see section <a href="#SEC81">Setting Variables</a>) or with a
+verbatim definition (see section <a href="#SEC84">Defining Variables Verbatim</a>).
+
+</li><li>
+Variables in the environment become <code>make</code> variables.
+See section <a href="#SEC85">Variables from the Environment</a>.
+
+</li><li>
+Several <em>automatic</em> variables are given new values for each rule.
+Each of these has a single conventional use.
+See section <a href="make_10.html#SEC121">Automatic Variables</a>.
+
+</li><li>
+Several variables have constant initial values.
+See section <a href="make_10.html#SEC116">Variables Used by Implicit Rules</a>.
+</li></ul>
+
+<hr size="6">
+<a name="Setting"></a>
+<a name="SEC81"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC80" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC82" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.5 Setting Variables </h2>
+
+<p>To set a variable from the makefile, write a line starting with the
+variable name followed by &lsquo;<samp>=</samp>&rsquo; or &lsquo;<samp>:=</samp>&rsquo;.  Whatever follows the
+&lsquo;<samp>=</samp>&rsquo; or &lsquo;<samp>:=</samp>&rsquo; on the line becomes the value.  For example,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">objects = main.o foo.o bar.o utils.o
+</pre></td></tr></table>
+
+<p>defines a variable named <code>objects</code>.  Whitespace around the variable
+name and immediately after the &lsquo;<samp>=</samp>&rsquo; is ignored.
+</p>
+<p>Variables defined with &lsquo;<samp>=</samp>&rsquo; are <em>recursively expanded</em> variables.
+Variables defined with &lsquo;<samp>:=</samp>&rsquo; are <em>simply expanded</em> variables; these
+definitions can contain variable references which will be expanded before
+the definition is made.  See section <a href="#SEC76">The Two Flavors of Variables</a>.
+</p>
+<p>The variable name may contain function and variable references, which
+are expanded when the line is read to find the actual variable name to use.
+</p>
+<p>There is no limit on the length of the value of a variable except the
+amount of swapping space on the computer.  When a variable definition is
+long, it is a good idea to break it into several lines by inserting
+backslash-newline at convenient places in the definition.  This will not
+affect the functioning of <code>make</code>, but it will make the makefile easier
+to read.
+</p>
+<p>Most variable names are considered to have the empty string as a value if
+you have never set them.  Several variables have built-in initial values
+that are not empty, but you can set them in the usual ways
+(see section <a href="make_10.html#SEC116">Variables Used by Implicit Rules</a>).
+Several special variables are set
+automatically to a new value for each rule; these are called the
+<em>automatic</em> variables (see section <a href="make_10.html#SEC121">Automatic Variables</a>).
+</p>
+<p>If you'd like a variable to be set to a value only if it's not already
+set, then you can use the shorthand operator &lsquo;<samp>?=</samp>&rsquo; instead of
+&lsquo;<samp>=</samp>&rsquo;.  These two settings of the variable &lsquo;<samp>FOO</samp>&rsquo; are identical
+(see section <a href="make_8.html#SEC101">The <code>origin</code> Function</a>):
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">FOO ?= bar
+</pre></td></tr></table>
+
+<p>and
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">ifeq ($(origin FOO), undefined)
+FOO = bar
+endif
+</pre></td></tr></table>
+
+<hr size="6">
+<a name="Appending"></a>
+<a name="SEC82"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC81" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC83" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.6 Appending More Text to Variables </h2>
+
+<p>Often it is useful to add more text to the value of a variable already defined.
+You do this with a line containing &lsquo;<samp>+=</samp>&rsquo;, like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">objects += another.o
+</pre></td></tr></table>
+
+<p>This takes the value of the variable <code>objects</code>, and adds the text
+&lsquo;<samp>another.o</samp>&rsquo; to it (preceded by a single space).  Thus:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">objects = main.o foo.o bar.o utils.o
+objects += another.o
+</pre></td></tr></table>
+
+<p>sets <code>objects</code> to &lsquo;<samp>main.o foo.o bar.o utils.o another.o</samp>&rsquo;.
+</p>
+<p>Using &lsquo;<samp>+=</samp>&rsquo; is similar to:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">objects = main.o foo.o bar.o utils.o
+objects := $(objects) another.o
+</pre></td></tr></table>
+
+<p>but differs in ways that become important when you use more complex values.
+</p>
+<p>When the variable in question has not been defined before, &lsquo;<samp>+=</samp>&rsquo;
+acts just like normal &lsquo;<samp>=</samp>&rsquo;: it defines a recursively-expanded
+variable.  However, when there <em>is</em> a previous definition, exactly
+what &lsquo;<samp>+=</samp>&rsquo; does depends on what flavor of variable you defined
+originally.  See section <a href="#SEC76">The Two Flavors of Variables</a>, for an
+explanation of the two flavors of variables.
+</p>
+<p>When you add to a variable's value with &lsquo;<samp>+=</samp>&rsquo;, <code>make</code> acts
+essentially as if you had included the extra text in the initial
+definition of the variable.  If you defined it first with &lsquo;<samp>:=</samp>&rsquo;,
+making it a simply-expanded variable, &lsquo;<samp>+=</samp>&rsquo; adds to that
+simply-expanded definition, and expands the new text before appending it
+to the old value just as &lsquo;<samp>:=</samp>&rsquo; does
+(see <a href="#SEC81">Setting Variables</a>, for a full explanation of &lsquo;<samp>:=</samp>&rsquo;).
+In fact,
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">variable := value
+variable += more
+</pre></td></tr></table>
+
+<p>is exactly equivalent to:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">variable := value
+variable := $(variable) more
+</pre></td></tr></table>
+
+<p>On the other hand, when you use &lsquo;<samp>+=</samp>&rsquo; with a variable that you defined
+first to be recursively-expanded using plain &lsquo;<samp>=</samp>&rsquo;, <code>make</code> does
+something a bit different.  Recall that when you define a
+recursively-expanded variable, <code>make</code> does not expand the value you set
+for variable and function references immediately.  Instead it stores the text
+verbatim, and saves these variable and function references to be expanded
+later, when you refer to the new variable (see section <a href="#SEC76">The Two Flavors of Variables</a>).  When you use &lsquo;<samp>+=</samp>&rsquo; on a recursively-expanded variable,
+it is this unexpanded text to which <code>make</code> appends the new text you
+specify.
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">variable = value
+variable += more
+</pre></td></tr></table>
+
+<p>is roughly equivalent to:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">temp = value
+variable = $(temp) more
+</pre></td></tr></table>
+
+<p>except that of course it never defines a variable called <code>temp</code>.
+The importance of this comes when the variable's old value contains
+variable references.  Take this common example:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">CFLAGS = $(includes) -O
+&hellip;
+CFLAGS += -pg # enable profiling
+</pre></td></tr></table>
+
+<p>The first line defines the <code>CFLAGS</code> variable with a reference to another
+variable, <code>includes</code>.  (<code>CFLAGS</code> is used by the rules for C
+compilation; see section <a href="make_10.html#SEC115">Catalogue of Implicit Rules</a>.)
+Using &lsquo;<samp>=</samp>&rsquo; for the definition makes <code>CFLAGS</code> a recursively-expanded
+variable, meaning &lsquo;<samp>$(includes) -O</samp>&rsquo; is <em>not</em> expanded when
+<code>make</code> processes the definition of <code>CFLAGS</code>.  Thus, <code>includes</code>
+need not be defined yet for its value to take effect.  It only has to be
+defined before any reference to <code>CFLAGS</code>.  If we tried to append to the
+value of <code>CFLAGS</code> without using &lsquo;<samp>+=</samp>&rsquo;, we might do it like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">CFLAGS := $(CFLAGS) -pg # enable profiling
+</pre></td></tr></table>
+
+<p>This is pretty close, but not quite what we want.  Using &lsquo;<samp>:=</samp>&rsquo;
+redefines <code>CFLAGS</code> as a simply-expanded variable; this means
+<code>make</code> expands the text &lsquo;<samp>$(CFLAGS) -pg</samp>&rsquo; before setting the
+variable.  If <code>includes</code> is not yet defined, we get &lsquo;<samp> -O
+-pg</samp>&rsquo;, and a later definition of <code>includes</code> will have no effect.
+Conversely, by using &lsquo;<samp>+=</samp>&rsquo; we set <code>CFLAGS</code> to the
+<em>unexpanded</em> value &lsquo;<samp>$(includes) -O -pg</samp>&rsquo;.  Thus we preserve
+the reference to <code>includes</code>, so if that variable gets defined at
+any later point, a reference like &lsquo;<samp>$(CFLAGS)</samp>&rsquo; still uses its
+value.
+</p>
+<hr size="6">
+<a name="Override-Directive"></a>
+<a name="SEC83"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC82" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC84" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.7 The <code>override</code> Directive </h2>
+
+<p>If a variable has been set with a command argument
+(see section <a href="make_9.html#SEC110">Overriding Variables</a>),
+then ordinary assignments in the makefile are ignored.  If you want to set
+the variable in the makefile even though it was set with a command
+argument, you can use an <code>override</code> directive, which is a line that
+looks like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">override <var>variable</var> = <var>value</var>
+</pre></td></tr></table>
+
+<p>or
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">override <var>variable</var> := <var>value</var>
+</pre></td></tr></table>
+
+<p>To append more text to a variable defined on the command line, use:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">override <var>variable</var> += <var>more text</var>
+</pre></td></tr></table>
+
+<p>See section <a href="#SEC82">Appending More Text to Variables</a>.
+</p>
+<p>The <code>override</code> directive was not invented for escalation in the war
+between makefiles and command arguments.  It was invented so you can alter
+and add to values that the user specifies with command arguments.
+</p>
+<p>For example, suppose you always want the &lsquo;<samp>-g</samp>&rsquo; switch when you run the
+C compiler, but you would like to allow the user to specify the other
+switches with a command argument just as usual.  You could use this
+<code>override</code> directive:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">override CFLAGS += -g
+</pre></td></tr></table>
+
+<p>You can also use <code>override</code> directives with <code>define</code> directives.
+This is done as you might expect:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">override define foo
+bar
+endef
+</pre></td></tr></table>
+
+<p>See section <a href="#SEC84">Defining Variables Verbatim</a>.
+</p>
+<hr size="6">
+<a name="Defining"></a>
+<a name="SEC84"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC83" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC85" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.8 Defining Variables Verbatim </h2>
+
+<p>Another way to set the value of a variable is to use the <code>define</code>
+directive.  This directive has an unusual syntax which allows newline
+characters to be included in the value, which is convenient for defining
+both canned sequences of commands
+(see section <a href="make_5.html#SEC72">Defining Canned Command Sequences</a>), and also
+sections of makefile syntax to use with <code>eval</code> (see section <a href="make_8.html#SEC100">The <code>eval</code> Function</a>).
+</p>
+<p>The <code>define</code> directive is followed on the same line by the name of the
+variable and nothing more.  The value to give the variable appears on the
+following lines.  The end of the value is marked by a line containing just
+the word <code>endef</code>.  Aside from this difference in syntax, <code>define</code>
+works just like &lsquo;<samp>=</samp>&rsquo;: it creates a recursively-expanded variable
+(see section <a href="#SEC76">The Two Flavors of Variables</a>).
+The variable name may contain function and variable references, which
+are expanded when the directive is read to find the actual variable name
+to use.
+</p>
+<p>You may nest <code>define</code> directives: <code>make</code> will keep track of
+nested directives and report an error if they are not all properly
+closed with <code>endef</code>.  Note that lines beginning with tab
+characters are considered part of a command script, so any
+<code>define</code> or <code>endef</code> strings appearing on such a line will
+not be considered <code>make</code> operators.
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">define two-lines
+echo foo
+echo $(bar)
+endef
+</pre></td></tr></table>
+
+<p>The value in an ordinary assignment cannot contain a newline; but the
+newlines that separate the lines of the value in a <code>define</code> become
+part of the variable's value (except for the final newline which precedes
+the <code>endef</code> and is not considered part of the value).
+</p>
+<p>When used in a command script, the previous example is functionally
+equivalent to this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">two-lines = echo foo; echo $(bar)
+</pre></td></tr></table>
+
+<p>since two commands separated by semicolon behave much like two separate
+shell commands.  However, note that using two separate lines means
+<code>make</code> will invoke the shell twice, running an independent subshell
+for each line.  See section <a href="make_5.html#SEC61">Command Execution</a>.
+</p>
+<p>If you want variable definitions made with <code>define</code> to take
+precedence over command-line variable definitions, you can use the
+<code>override</code> directive together with <code>define</code>:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">override define two-lines
+foo
+$(bar)
+endef
+</pre></td></tr></table>
+
+<p>See section <a href="#SEC83">The <code>override</code> Directive</a>.
+</p>
+<hr size="6">
+<a name="Environment"></a>
+<a name="SEC85"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC84" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC86" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.9 Variables from the Environment </h2>
+
+<p>Variables in <code>make</code> can come from the environment in which
+<code>make</code> is run.  Every environment variable that <code>make</code> sees
+when it starts up is transformed into a <code>make</code> variable with the
+same name and value.  However, an explicit assignment in the makefile,
+or with a command argument, overrides the environment.  (If the
+&lsquo;<samp>-e</samp>&rsquo; flag is specified, then values from the environment override
+assignments in the makefile.  See section <a href="make_9.html#SEC112">Summary of Options</a>.  But this is not recommended practice.)
+</p>
+<p>Thus, by setting the variable <code>CFLAGS</code> in your environment, you can
+cause all C compilations in most makefiles to use the compiler switches you
+prefer.  This is safe for variables with standard or conventional meanings
+because you know that no makefile will use them for other things.  (Note
+this is not totally reliable; some makefiles set <code>CFLAGS</code> explicitly
+and therefore are not affected by the value in the environment.)
+</p>
+<p>When <code>make</code> runs a command script, variables defined in the
+makefile are placed into the environment of that command.  This allows
+you to pass values to sub-<code>make</code> invocations (see section <a href="make_5.html#SEC67">Recursive Use of <code>make</code></a>).  By default, only variables that came
+from the environment or the command line are passed to recursive
+invocations.  You can use the <code>export</code> directive to pass other
+variables.  See section <a href="make_5.html#SEC69">Communicating Variables to a Sub-<code>make</code></a>, for full details.
+</p>
+<p>Other use of variables from the environment is not recommended.  It is not
+wise for makefiles to depend for their functioning on environment variables
+set up outside their control, since this would cause different users to get
+different results from the same makefile.  This is against the whole
+purpose of most makefiles.
+</p>
+<a name="IDX256"></a>
+<p>Such problems would be especially likely with the variable
+<code>SHELL</code>, which is normally present in the environment to specify
+the user's choice of interactive shell.  It would be very undesirable
+for this choice to affect <code>make</code>; so, <code>make</code> handles the
+<code>SHELL</code> environment variable in a special way; see <a href="make_5.html#SEC62">Choosing the Shell</a>.
+</p>
+<hr size="6">
+<a name="Target_002dspecific"></a>
+<a name="SEC86"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC85" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC87" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.10 Target-specific Variable Values </h2>
+
+<p>Variable values in <code>make</code> are usually global; that is, they are the
+same regardless of where they are evaluated (unless they're reset, of
+course).  One exception to that is automatic variables
+(see section <a href="make_10.html#SEC121">Automatic Variables</a>).
+</p>
+<p>The other exception is <em>target-specific variable values</em>.  This
+feature allows you to define different values for the same variable,
+based on the target that <code>make</code> is currently building.  As with
+automatic variables, these values are only available within the context
+of a target's command script (and in other target-specific assignments).
+</p>
+<p>Set a target-specific variable value like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example"><var>target</var> &hellip; : <var>variable-assignment</var>
+</pre></td></tr></table>
+
+<p>or like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example"><var>target</var> &hellip; : override <var>variable-assignment</var>
+</pre></td></tr></table>
+
+<p>or like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example"><var>target</var> &hellip; : export <var>variable-assignment</var>
+</pre></td></tr></table>
+
+<p>Multiple <var>target</var> values create a target-specific variable value for
+each member of the target list individually.
+</p>
+<p>The <var>variable-assignment</var> can be any valid form of assignment;
+recursive (&lsquo;<samp>=</samp>&rsquo;), static (&lsquo;<samp>:=</samp>&rsquo;), appending (&lsquo;<samp>+=</samp>&rsquo;), or
+conditional (&lsquo;<samp>?=</samp>&rsquo;).  All variables that appear within the
+<var>variable-assignment</var> are evaluated within the context of the
+target: thus, any previously-defined target-specific variable values
+will be in effect.  Note that this variable is actually distinct from
+any &ldquo;global&rdquo; value: the two variables do not have to have the same
+flavor (recursive vs. static).
+</p>
+<p>Target-specific variables have the same priority as any other makefile
+variable.  Variables provided on the command-line (and in the
+environment if the &lsquo;<samp>-e</samp>&rsquo; option is in force) will take precedence.
+Specifying the <code>override</code> directive will allow the target-specific
+variable value to be preferred.
+</p>
+<p>There is one more special feature of target-specific variables: when
+you define a target-specific variable that variable value is also in
+effect for all prerequisites of this target, and all their
+prerequisites, etc. (unless those prerequisites override that variable
+with their own target-specific variable value).  So, for example, a
+statement like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">prog : CFLAGS = -g
+prog : prog.o foo.o bar.o
+</pre></td></tr></table>
+
+<p>will set <code>CFLAGS</code> to &lsquo;<samp>-g</samp>&rsquo; in the command script for
+&lsquo;<tt>prog</tt>&rsquo;, but it will also set <code>CFLAGS</code> to &lsquo;<samp>-g</samp>&rsquo; in the
+command scripts that create &lsquo;<tt>prog.o</tt>&rsquo;, &lsquo;<tt>foo.o</tt>&rsquo;, and
+&lsquo;<tt>bar.o</tt>&rsquo;, and any command scripts which create their
+prerequisites.
+</p>
+<p>Be aware that a given prerequisite will only be built once per
+invocation of make, at most.  If the same file is a prerequisite of
+multiple targets, and each of those targets has a different value for
+the same target-specific variable, then the first target to be built
+will cause that prerequisite to be built and the prerequisite will
+inherit the target-specific value from the first target.  It will
+ignore the target-specific values from any other targets.
+</p>
+<hr size="6">
+<a name="Pattern_002dspecific"></a>
+<a name="SEC87"></a>
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC86" title="Previous section in reading order"> &lt; </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next section in reading order"> &gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<h2 class="section"> 6.11 Pattern-specific Variable Values </h2>
+
+<p>In addition to target-specific variable values
+(see section <a href="#SEC86">Target-specific Variable Values</a>), GNU
+<code>make</code> supports pattern-specific variable values.  In this form,
+the variable is defined for any target that matches the pattern
+specified.  If a target matches more than one pattern, all the
+matching pattern-specific variables are interpreted in the order in
+which they were defined in the makefile, and collected together into
+one set.  Variables defined in this way are searched after any
+target-specific variables defined explicitly for that target, and
+before target-specific variables defined for the parent target.
+</p>
+<p>Set a pattern-specific variable value like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example"><var>pattern</var> &hellip; : <var>variable-assignment</var>
+</pre></td></tr></table>
+
+<p>or like this:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example"><var>pattern</var> &hellip; : override <var>variable-assignment</var>
+</pre></td></tr></table>
+
+<p>where <var>pattern</var> is a %-pattern.  As with target-specific variable
+values, multiple <var>pattern</var> values create a pattern-specific variable
+value for each pattern individually.  The <var>variable-assignment</var> can
+be any valid form of assignment.  Any command-line variable setting will
+take precedence, unless <code>override</code> is specified.
+</p>
+<p>For example:
+</p>
+<table><tr><td>&nbsp;</td><td><pre class="example">%.o : CFLAGS = -O
+</pre></td></tr></table>
+
+<p>will assign <code>CFLAGS</code> the value of &lsquo;<samp>-O</samp>&rsquo; for all targets
+matching the pattern <code>%.o</code>.
+</p>
+<hr size="6">
+<table cellpadding="1" cellspacing="1" border="0">
+<tr><td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
+<td valign="middle" align="left">[<a href="make_7.html#SEC88" title="Next chapter"> &gt;&gt; </a>]</td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left"> &nbsp; </td>
+<td valign="middle" align="left">[<a href="make.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
+<td valign="middle" align="left">[<a href="make_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
+<td valign="middle" align="left">[<a href="make_19.html#SEC148" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="make_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
+</tr></table>
+<p>
+ <font size="-1">
+  This document was generated by <em>Manoj Srivastava</em> on <em>August, 17 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78</em></a>.
+ </font>
+ <br>
+
+</p>
+</body>
+</html>
