/usr/share/doc/make-doc/make_12.html is in make-doc 3.81-5.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | <!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: 12. Features of GNU make</title>
<meta name="description" content="GNU make: 12. Features of GNU make">
<meta name="keywords" content="GNU make: 12. Features of GNU make">
<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="Features"></a>
<a name="SEC134"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="make_11.html#SEC133" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="make_13.html#SEC135" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="make_11.html#SEC128" title="Beginning of this chapter or previous chapter"> << </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_13.html#SEC135" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </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"> 12. Features of GNU <code>make</code> </h1>
<p>Here is a summary of the features of GNU <code>make</code>, for comparison
with and credit to other versions of <code>make</code>. We consider the
features of <code>make</code> in 4.2 BSD systems as a baseline. If you are
concerned with writing portable makefiles, you should not use the
features of <code>make</code> listed here, nor the ones in <a href="make_13.html#SEC135">Incompatibilities and Missing Features</a>.
</p>
<p>Many features come from the version of <code>make</code> in System V.
</p>
<ul>
<li>
The <code>VPATH</code> variable and its special meaning.
See section <a href="make_4.html#SEC38">Searching Directories for Prerequisites</a>.
This feature exists in System V <code>make</code>, but is undocumented.
It is documented in 4.3 BSD <code>make</code> (which says it mimics System V's
<code>VPATH</code> feature).
</li><li>
Included makefiles. See section <a href="make_3.html#SEC16">Including Other Makefiles</a>.
Allowing multiple files to be included with a single directive is a GNU
extension.
</li><li>
Variables are read from and communicated via the environment.
See section <a href="make_6.html#SEC85">Variables from the Environment</a>.
</li><li>
Options passed through the variable <code>MAKEFLAGS</code> to recursive
invocations of <code>make</code>.
See section <a href="make_5.html#SEC70">Communicating Options to a Sub-<code>make</code></a>.
</li><li>
The automatic variable <code>$%</code> is set to the member name
in an archive reference. See section <a href="make_10.html#SEC121">Automatic Variables</a>.
</li><li>
The automatic variables <code>$@</code>, <code>$*</code>, <code>$<</code>, <code>$%</code>,
and <code>$?</code> have corresponding forms like <code>$(@F)</code> and
<code>$(@D)</code>. We have generalized this to <code>$^</code> as an obvious
extension. See section <a href="make_10.html#SEC121">Automatic Variables</a>.
</li><li>
Substitution variable references.
See section <a href="make_6.html#SEC75">Basics of Variable References</a>.
</li><li>
The command-line options ‘<samp>-b</samp>’ and ‘<samp>-m</samp>’, accepted and
ignored. In System V <code>make</code>, these options actually do something.
</li><li>
Execution of recursive commands to run <code>make</code> via the variable
<code>MAKE</code> even if ‘<samp>-n</samp>’, ‘<samp>-q</samp>’ or ‘<samp>-t</samp>’ is specified.
See section <a href="make_5.html#SEC67">Recursive Use of <code>make</code></a>.
</li><li>
Support for suffix ‘<samp>.a</samp>’ in suffix rules. See section <a href="make_11.html#SEC133">Suffix Rules for Archive Files</a>. This feature is obsolete in GNU <code>make</code>, because the
general feature of rule chaining (see section <a href="make_10.html#SEC117">Chains of Implicit Rules</a>) allows one pattern rule for installing members in an
archive (see section <a href="make_11.html#SEC130">Implicit Rule for Archive Member Targets</a>) to be sufficient.
</li><li>
The arrangement of lines and backslash-newline combinations in
commands is retained when the commands are printed, so they appear as
they do in the makefile, except for the stripping of initial
whitespace.
</li></ul>
<p>The following features were inspired by various other versions of
<code>make</code>. In some cases it is unclear exactly which versions inspired
which others.
</p>
<ul>
<li>
Pattern rules using ‘<samp>%</samp>’.
This has been implemented in several versions of <code>make</code>.
We're not sure who invented it first, but it's been spread around a bit.
See section <a href="make_10.html#SEC118">Defining and Redefining Pattern Rules</a>.
</li><li>
Rule chaining and implicit intermediate files.
This was implemented by Stu Feldman in his version of <code>make</code>
for AT&T Eighth Edition Research Unix, and later by Andrew Hume of
AT&T Bell Labs in his <code>mk</code> program (where he terms it
“transitive closure”). We do not really know if
we got this from either of them or thought it up ourselves at the
same time. See section <a href="make_10.html#SEC117">Chains of Implicit Rules</a>.
</li><li>
The automatic variable <code>$^</code> containing a list of all prerequisites
of the current target. We did not invent this, but we have no idea who
did. See section <a href="make_10.html#SEC121">Automatic Variables</a>. The automatic variable
<code>$+</code> is a simple extension of <code>$^</code>.
</li><li>
The “what if” flag (‘<samp>-W</samp>’ in GNU <code>make</code>) was (as far as we know)
invented by Andrew Hume in <code>mk</code>.
See section <a href="make_9.html#SEC108">Instead of Executing the Commands</a>.
</li><li>
The concept of doing several things at once (parallelism) exists in
many incarnations of <code>make</code> and similar programs, though not in the
System V or BSD implementations. See section <a href="make_5.html#SEC61">Command Execution</a>.
</li><li>
Modified variable references using pattern substitution come from
SunOS 4. See section <a href="make_6.html#SEC75">Basics of Variable References</a>.
This functionality was provided in GNU <code>make</code> by the
<code>patsubst</code> function before the alternate syntax was implemented
for compatibility with SunOS 4. It is not altogether clear who
inspired whom, since GNU <code>make</code> had <code>patsubst</code> before SunOS
4 was released.
</li><li>
The special significance of ‘<samp>+</samp>’ characters preceding command lines
(see section <a href="make_9.html#SEC108">Instead of Executing the Commands</a>) is
mandated by
<cite>IEEE Standard 1003.2-1992</cite> (POSIX.2).
</li><li>
The ‘<samp>+=</samp>’ syntax to append to the value of a variable comes from SunOS
4 <code>make</code>. See section <a href="make_6.html#SEC82">Appending More Text to Variables</a>.
</li><li>
The syntax ‘<samp><var>archive</var>(<var>mem1</var> <var>mem2</var>…)</samp>’ to list
multiple members in a single archive file comes from SunOS 4 <code>make</code>.
See section <a href="make_11.html#SEC129">Archive Members as Targets</a>.
</li><li>
The <code>-include</code> directive to include makefiles with no error for a
nonexistent file comes from SunOS 4 <code>make</code>. (But note that SunOS 4
<code>make</code> does not allow multiple makefiles to be specified in one
<code>-include</code> directive.) The same feature appears with the name
<code>sinclude</code> in SGI <code>make</code> and perhaps others.
</li></ul>
<p>The remaining features are inventions new in GNU <code>make</code>:
</p>
<ul>
<li>
Use the ‘<samp>-v</samp>’ or ‘<samp>--version</samp>’ option to print version and
copyright information.
</li><li>
Use the ‘<samp>-h</samp>’ or ‘<samp>--help</samp>’ option to summarize the options to
<code>make</code>.
</li><li>
Simply-expanded variables. See section <a href="make_6.html#SEC76">The Two Flavors of Variables</a>.
</li><li>
Pass command-line variable assignments automatically through the
variable <code>MAKE</code> to recursive <code>make</code> invocations.
See section <a href="make_5.html#SEC67">Recursive Use of <code>make</code></a>.
</li><li>
Use the ‘<samp>-C</samp>’ or ‘<samp>--directory</samp>’ command option to change
directory. See section <a href="make_9.html#SEC112">Summary of Options</a>.
</li><li>
Make verbatim variable definitions with <code>define</code>.
See section <a href="make_6.html#SEC84">Defining Variables Verbatim</a>.
</li><li>
Declare phony targets with the special target <code>.PHONY</code>.
<p>Andrew Hume of AT&T Bell Labs implemented a similar feature with a
different syntax in his <code>mk</code> program. This seems to be a case of
parallel discovery. See section <a href="make_4.html#SEC45">Phony Targets</a>.
</p>
</li><li>
Manipulate text by calling functions.
See section <a href="make_8.html#SEC92">Functions for Transforming Text</a>.
</li><li>
Use the ‘<samp>-o</samp>’ or ‘<samp>--old-file</samp>’
option to pretend a file's modification-time is old.
See section <a href="make_9.html#SEC109">Avoiding Recompilation of Some Files</a>.
</li><li>
Conditional execution.
<p>This feature has been implemented numerous times in various versions
of <code>make</code>; it seems a natural extension derived from the features
of the C preprocessor and similar macro languages and is not a
revolutionary concept. See section <a href="make_7.html#SEC88">Conditional Parts of Makefiles</a>.
</p>
</li><li>
Specify a search path for included makefiles.
See section <a href="make_3.html#SEC16">Including Other Makefiles</a>.
</li><li>
Specify extra makefiles to read with an environment variable.
See section <a href="make_3.html#SEC17">The Variable <code>MAKEFILES</code></a>.
</li><li>
Strip leading sequences of ‘<samp>./</samp>’ from file names, so that
‘<tt>./<var>file</var></tt>’ and ‘<tt><var>file</var></tt>’ are considered to be the
same file.
</li><li>
Use a special search method for library prerequisites written in the
form ‘<samp>-l<var>name</var></samp>’.
See section <a href="make_4.html#SEC44">Directory Search for Link Libraries</a>.
</li><li>
Allow suffixes for suffix rules
(see section <a href="make_10.html#SEC126">Old-Fashioned Suffix Rules</a>) to contain any
characters. In other versions of <code>make</code>, they must begin with
‘<samp>.</samp>’ and not contain any ‘<samp>/</samp>’ characters.
</li><li>
Keep track of the current level of <code>make</code> recursion using the
variable <code>MAKELEVEL</code>. See section <a href="make_5.html#SEC67">Recursive Use of <code>make</code></a>.
</li><li>
Provide any goals given on the command line in the variable
<code>MAKECMDGOALS</code>. See section <a href="make_9.html#SEC107">Arguments to Specify the Goals</a>.
</li><li>
Specify static pattern rules. See section <a href="make_4.html#SEC51">Static Pattern Rules</a>.
</li><li>
Provide selective <code>vpath</code> search.
See section <a href="make_4.html#SEC38">Searching Directories for Prerequisites</a>.
</li><li>
Provide computed variable references.
See section <a href="make_6.html#SEC75">Basics of Variable References</a>.
</li><li>
Update makefiles. See section <a href="make_3.html#SEC20">How Makefiles Are Remade</a>.
System V <code>make</code> has a very, very limited form of this
functionality in that it will check out SCCS files for makefiles.
</li><li>
Various new built-in implicit rules.
See section <a href="make_10.html#SEC115">Catalogue of Implicit Rules</a>.
</li><li>
The built-in variable ‘<samp>MAKE_VERSION</samp>’ gives the version number of
<code>make</code>.
<a name="IDX630"></a>
</li></ul>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="make_11.html#SEC128" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="make_13.html#SEC135" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </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>
|