/usr/share/doc/make-doc/make.html/Running.html is in make-doc 4.1-2.
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 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/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.73, last updated 15 January 2016,
of The GNU Make Manual, for GNU make version 4.1.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009, 2010, 2011, 2012, 2013, 2014 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.3 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 the freedom to copy and
modify this GNU manual. Buying copies from the FSF supports it in
developing GNU and promoting software freedom." -->
<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU make: Running</title>
<meta name="description" content="GNU make: Running">
<meta name="keywords" content="GNU make: Running">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Implicit-Rules.html#Implicit-Rules" rel="next" title="Implicit Rules">
<link href="Functions.html#Guile-Function" rel="prev" title="Guile Function">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space: nowrap}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: serif; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Running"></a>
<div class="header">
<p>
Next: <a href="Implicit-Rules.html#Implicit-Rules" accesskey="n" rel="next">Implicit Rules</a>, Previous: <a href="Functions.html#Functions" accesskey="p" rel="prev">Functions</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="How-to-Run-make"></a>
<h2 class="chapter">9 How to Run <code>make</code></h2>
<p>A makefile that says how to recompile a program can be used in more
than one way. The simplest use is to recompile every file that is out
of date. Usually, makefiles are written so that if you run
<code>make</code> with no arguments, it does just that.
</p>
<p>But you might want to update only some of the files; you might want to use
a different compiler or different compiler options; you might want just to
find out which files are out of date without changing them.
</p>
<p>By giving arguments when you run <code>make</code>, you can do any of these
things and many others.
</p>
<a name="index-exit-status-of-make"></a>
<p>The exit status of <code>make</code> is always one of three values:
</p><dl compact="compact">
<dt><code>0</code></dt>
<dd><p>The exit status is zero if <code>make</code> is successful.
</p></dd>
<dt><code>2</code></dt>
<dd><p>The exit status is two if <code>make</code> encounters any errors.
It will print messages describing the particular errors.
</p></dd>
<dt><code>1</code></dt>
<dd><p>The exit status is one if you use the ‘<samp>-q</samp>’ flag and <code>make</code>
determines that some target is not already up to date.
See <a href="#Instead-of-Execution">Instead of Executing Recipes</a>.
</p></dd>
</dl>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Makefile-Arguments" accesskey="1">Makefile Arguments</a>:</td><td> </td><td align="left" valign="top">How to specify which makefile to use.
</td></tr>
<tr><td align="left" valign="top">• <a href="#Goals" accesskey="2">Goals</a>:</td><td> </td><td align="left" valign="top">How to use goal arguments to specify which
parts of the makefile to use.
</td></tr>
<tr><td align="left" valign="top">• <a href="#Instead-of-Execution" accesskey="3">Instead of Execution</a>:</td><td> </td><td align="left" valign="top">How to use mode flags to specify what
kind of thing to do with the recipes
in the makefile other than simply
execute them.
</td></tr>
<tr><td align="left" valign="top">• <a href="#Avoiding-Compilation" accesskey="4">Avoiding Compilation</a>:</td><td> </td><td align="left" valign="top">How to avoid recompiling certain files.
</td></tr>
<tr><td align="left" valign="top">• <a href="#Overriding" accesskey="5">Overriding</a>:</td><td> </td><td align="left" valign="top">How to override a variable to specify
an alternate compiler and other things.
</td></tr>
<tr><td align="left" valign="top">• <a href="#Testing" accesskey="6">Testing</a>:</td><td> </td><td align="left" valign="top">How to proceed past some errors, to
test compilation.
</td></tr>
<tr><td align="left" valign="top">• <a href="#Options-Summary" accesskey="7">Options Summary</a>:</td><td> </td><td align="left" valign="top">Summary of Options
</td></tr>
</table>
<hr>
<a name="Makefile-Arguments"></a>
<div class="header">
<p>
Next: <a href="#Goals" accesskey="n" rel="next">Goals</a>, Previous: <a href="#Running" accesskey="p" rel="prev">Running</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Arguments-to-Specify-the-Makefile"></a>
<h3 class="section">9.1 Arguments to Specify the Makefile</h3>
<a name="index-_002d_002dfile-1"></a>
<a name="index-_002d_002dmakefile-1"></a>
<a name="index-_002df-1"></a>
<p>The way to specify the name of the makefile is with the ‘<samp>-f</samp>’ or
‘<samp>--file</samp>’ option (‘<samp>--makefile</samp>’ also works). For example,
‘<samp>-f altmake</samp>’ says to use the file <samp>altmake</samp> as the makefile.
</p>
<p>If you use the ‘<samp>-f</samp>’ flag several times and follow each ‘<samp>-f</samp>’
with an argument, all the specified files are used jointly as
makefiles.
</p>
<p>If you do not use the ‘<samp>-f</samp>’ or ‘<samp>--file</samp>’ flag, the default is
to try <samp>GNUmakefile</samp>, <samp>makefile</samp>, and <samp>Makefile</samp>, in
that order, and use the first of these three which exists or can be made
(see <a href="Makefiles.html#Makefiles">Writing Makefiles</a>).
</p>
<hr>
<a name="Goals"></a>
<div class="header">
<p>
Next: <a href="#Instead-of-Execution" accesskey="n" rel="next">Instead of Execution</a>, Previous: <a href="#Makefile-Arguments" accesskey="p" rel="prev">Makefile Arguments</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Arguments-to-Specify-the-Goals"></a>
<h3 class="section">9.2 Arguments to Specify the Goals</h3>
<a name="index-goal_002c-how-to-specify"></a>
<p>The <em>goals</em> are the targets that <code>make</code> should strive ultimately
to update. Other targets are updated as well if they appear as
prerequisites of goals, or prerequisites of prerequisites of goals, etc.
</p>
<p>By default, the goal is the first target in the makefile (not counting
targets that start with a period). Therefore, makefiles are usually
written so that the first target is for compiling the entire program or
programs they describe. If the first rule in the makefile has several
targets, only the first target in the rule becomes the default goal, not
the whole list. You can manage the selection of the default goal from
within your makefile using the <code>.DEFAULT_GOAL</code> variable
(see <a href="Using-Variables.html#Special-Variables">Other Special Variables</a>).
</p>
<p>You can also specify a different goal or goals with command line
arguments to <code>make</code>. Use the name of the goal as an argument.
If you specify several goals, <code>make</code> processes each of them in
turn, in the order you name them.
</p>
<p>Any target in the makefile may be specified as a goal (unless it
starts with ‘<samp>-</samp>’ or contains an ‘<samp>=</samp>’, in which case it will be
parsed as a switch or variable definition, respectively). Even
targets not in the makefile may be specified, if <code>make</code> can find
implicit rules that say how to make them.
</p>
<a name="index-MAKECMDGOALS"></a>
<p><code>Make</code> will set the special variable <code>MAKECMDGOALS</code> to the
list of goals you specified on the command line. If no goals were given
on the command line, this variable is empty. Note that this variable
should be used only in special circumstances.
</p>
<p>An example of appropriate use is to avoid including <samp>.d</samp> files
during <code>clean</code> rules (see <a href="Rules.html#Automatic-Prerequisites">Automatic Prerequisites</a>), so
<code>make</code> won’t create them only to immediately remove them
again:
</p>
<div class="example">
<pre class="example">sources = foo.c bar.c
ifneq ($(MAKECMDGOALS),clean)
include $(sources:.c=.d)
endif
</pre></div>
<p>One use of specifying a goal is if you want to compile only a part of
the program, or only one of several programs. Specify as a goal each
file that you wish to remake. For example, consider a directory containing
several programs, with a makefile that starts like this:
</p>
<div class="example">
<pre class="example">.PHONY: all
all: size nm ld ar as
</pre></div>
<p>If you are working on the program <code>size</code>, you might want to say
‘<samp>make size</samp>’<!-- /@w --> so that only the files of that program are recompiled.
</p>
<p>Another use of specifying a goal is to make files that are not normally
made. For example, there may be a file of debugging output, or a
version of the program that is compiled specially for testing, which has
a rule in the makefile but is not a prerequisite of the default goal.
</p>
<p>Another use of specifying a goal is to run the recipe associated with
a phony target (see <a href="Rules.html#Phony-Targets">Phony Targets</a>) or empty target (see <a href="Rules.html#Empty-Targets">Empty Target Files to Record Events</a>). Many makefiles contain
a phony target named <samp>clean</samp> which deletes everything except source
files. Naturally, this is done only if you request it explicitly with
‘<samp>make clean</samp>’<!-- /@w -->. Following is a list of typical phony and empty
target names. See <a href="Makefile-Conventions.html#Standard-Targets">Standard Targets</a>, for a detailed list of all the
standard target names which GNU software packages use.
</p>
<dl compact="compact">
<dt><samp>all</samp></dt>
<dd><a name="index-all-_0028standard-target_0029"></a>
<p>Make all the top-level targets the makefile knows about.
</p>
</dd>
<dt><samp>clean</samp></dt>
<dd><a name="index-clean-_0028standard-target_0029"></a>
<p>Delete all files that are normally created by running <code>make</code>.
</p>
</dd>
<dt><samp>mostlyclean</samp></dt>
<dd><a name="index-mostlyclean-_0028standard-target_0029"></a>
<p>Like ‘<samp>clean</samp>’, but may refrain from deleting a few files that people
normally don’t want to recompile. For example, the ‘<samp>mostlyclean</samp>’
target for GCC does not delete <samp>libgcc.a</samp>, because recompiling it
is rarely necessary and takes a lot of time.
</p>
</dd>
<dt><samp>distclean</samp></dt>
<dd><a name="index-distclean-_0028standard-target_0029"></a>
</dd>
<dt><samp>realclean</samp></dt>
<dd><a name="index-realclean-_0028standard-target_0029"></a>
</dd>
<dt><samp>clobber</samp></dt>
<dd><a name="index-clobber-_0028standard-target_0029"></a>
<p>Any of these targets might be defined to delete <em>more</em> files than
‘<samp>clean</samp>’ does. For example, this would delete configuration files
or links that you would normally create as preparation for compilation,
even if the makefile itself cannot create these files.
</p>
</dd>
<dt><samp>install</samp></dt>
<dd><a name="index-install-_0028standard-target_0029"></a>
<p>Copy the executable file into a directory that users typically search
for commands; copy any auxiliary files that the executable uses into
the directories where it will look for them.
</p>
</dd>
<dt><samp>print</samp></dt>
<dd><a name="index-print-_0028standard-target_0029"></a>
<p>Print listings of the source files that have changed.
</p>
</dd>
<dt><samp>tar</samp></dt>
<dd><a name="index-tar-_0028standard-target_0029"></a>
<p>Create a tar file of the source files.
</p>
</dd>
<dt><samp>shar</samp></dt>
<dd><a name="index-shar-_0028standard-target_0029"></a>
<p>Create a shell archive (shar file) of the source files.
</p>
</dd>
<dt><samp>dist</samp></dt>
<dd><a name="index-dist-_0028standard-target_0029"></a>
<p>Create a distribution file of the source files. This might
be a tar file, or a shar file, or a compressed version of one of the
above, or even more than one of the above.
</p>
</dd>
<dt><samp>TAGS</samp></dt>
<dd><a name="index-TAGS-_0028standard-target_0029"></a>
<p>Update a tags table for this program.
</p>
</dd>
<dt><samp>check</samp></dt>
<dd><a name="index-check-_0028standard-target_0029"></a>
</dd>
<dt><samp>test</samp></dt>
<dd><a name="index-test-_0028standard-target_0029"></a>
<p>Perform self tests on the program this makefile builds.
</p></dd>
</dl>
<hr>
<a name="Instead-of-Execution"></a>
<div class="header">
<p>
Next: <a href="#Avoiding-Compilation" accesskey="n" rel="next">Avoiding Compilation</a>, Previous: <a href="#Goals" accesskey="p" rel="prev">Goals</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Instead-of-Executing-Recipes"></a>
<h3 class="section">9.3 Instead of Executing Recipes</h3>
<a name="index-execution_002c-instead-of"></a>
<a name="index-recipes_002c-instead-of-executing"></a>
<p>The makefile tells <code>make</code> how to tell whether a target is up to date,
and how to update each target. But updating the targets is not always
what you want. Certain options specify other activities for <code>make</code>.
</p>
<dl compact="compact">
<dt>‘<samp>-n</samp>’</dt>
<dt>‘<samp>--just-print</samp>’</dt>
<dt>‘<samp>--dry-run</samp>’</dt>
<dt>‘<samp>--recon</samp>’</dt>
<dd><a name="index-_002d_002djust_002dprint-1"></a>
<a name="index-_002d_002ddry_002drun-1"></a>
<a name="index-_002d_002drecon-1"></a>
<a name="index-_002dn-1"></a>
<p>“No-op”. Causes <code>make</code> to print the recipes that are needed to
make the targets up to date, but not actually execute them. Note that
some recipes are still executed, even with this flag (see <a href="Recipes.html#MAKE-Variable">How the <code>MAKE</code> Variable Works</a>). Also any recipes
needed to update included makefiles are still executed
(see <a href="Makefiles.html#Remaking-Makefiles">How Makefiles Are Remade</a>).
</p>
</dd>
<dt>‘<samp>-t</samp>’</dt>
<dt>‘<samp>--touch</samp>’</dt>
<dd><a name="index-_002d_002dtouch"></a>
<a name="index-touching-files"></a>
<a name="index-target_002c-touching"></a>
<a name="index-_002dt"></a>
<p>“Touch”. Marks targets as up to date without actually changing
them. In other words, <code>make</code> pretends to update the targets but
does not really change their contents; instead only their modified
times are updated.
</p>
</dd>
<dt>‘<samp>-q</samp>’</dt>
<dt>‘<samp>--question</samp>’</dt>
<dd><a name="index-_002d_002dquestion"></a>
<a name="index-_002dq"></a>
<a name="index-question-mode"></a>
<p>“Question”. Silently check whether the targets are up to date, but
do not execute recipes; the exit code shows whether any updates are
needed.
</p>
</dd>
<dt>‘<samp>-W <var>file</var></samp>’</dt>
<dt>‘<samp>--what-if=<var>file</var></samp>’</dt>
<dt>‘<samp>--assume-new=<var>file</var></samp>’</dt>
<dt>‘<samp>--new-file=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dwhat_002dif"></a>
<a name="index-_002dW"></a>
<a name="index-_002d_002dassume_002dnew"></a>
<a name="index-_002d_002dnew_002dfile"></a>
<a name="index-what-if"></a>
<a name="index-files_002c-assuming-new"></a>
<p>“What if”. Each ‘<samp>-W</samp>’ flag is followed by a file name. The given
files’ modification times are recorded by <code>make</code> as being the present
time, although the actual modification times remain the same.
You can use the ‘<samp>-W</samp>’ flag in conjunction with the ‘<samp>-n</samp>’ flag
to see what would happen if you were to modify specific files.
</p></dd>
</dl>
<p>With the ‘<samp>-n</samp>’ flag, <code>make</code> prints the recipe that it would
normally execute but usually does not execute it.
</p>
<p>With the ‘<samp>-t</samp>’ flag, <code>make</code> ignores the recipes in the rules
and uses (in effect) the command <code>touch</code> for each target that needs to
be remade. The <code>touch</code> command is also printed, unless ‘<samp>-s</samp>’ or
<code>.SILENT</code> is used. For speed, <code>make</code> does not actually invoke
the program <code>touch</code>. It does the work directly.
</p>
<p>With the ‘<samp>-q</samp>’ flag, <code>make</code> prints nothing and executes no
recipes, but the exit status code it returns is zero if and only if the
targets to be considered are already up to date. If the exit status is
one, then some updating needs to be done. If <code>make</code> encounters an
error, the exit status is two, so you can distinguish an error from a
target that is not up to date.
</p>
<p>It is an error to use more than one of these three flags in the same
invocation of <code>make</code>.
</p>
<a name="index-_002b_002c-and-recipe-execution"></a>
<p>The ‘<samp>-n</samp>’, ‘<samp>-t</samp>’, and ‘<samp>-q</samp>’ options do not affect recipe
lines that begin with ‘<samp>+</samp>’ characters or contain the strings
‘<samp>$(MAKE)</samp>’ or ‘<samp>${MAKE}</samp>’. Note that only the line containing
the ‘<samp>+</samp>’ character or the strings ‘<samp>$(MAKE)</samp>’ or ‘<samp>${MAKE}</samp>’
is run regardless of these options. Other lines in the same rule are
not run unless they too begin with ‘<samp>+</samp>’ or contain ‘<samp>$(MAKE)</samp>’ or
‘<samp>${MAKE}</samp>’ (See <a href="Recipes.html#MAKE-Variable">How the <code>MAKE</code> Variable Works</a>.)
</p>
<a name="index-phony-targets-and-recipe-execution"></a>
<p>The ‘<samp>-t</samp>’ flag prevents phony targets (see <a href="Rules.html#Phony-Targets">Phony Targets</a>) from
being updated, unless there are recipe lines beginning with ‘<samp>+</samp>’
or containing ‘<samp>$(MAKE)</samp>’ or ‘<samp>${MAKE}</samp>’.
</p>
<p>The ‘<samp>-W</samp>’ flag provides two features:
</p>
<ul>
<li> If you also use the ‘<samp>-n</samp>’ or ‘<samp>-q</samp>’ flag, you can see what
<code>make</code> would do if you were to modify some files.
</li><li> Without the ‘<samp>-n</samp>’ or ‘<samp>-q</samp>’ flag, when <code>make</code> is actually
executing recipes, the ‘<samp>-W</samp>’ flag can direct <code>make</code> to act as
if some files had been modified, without actually running the recipes
for those files.
</li></ul>
<p>Note that the options ‘<samp>-p</samp>’ and ‘<samp>-v</samp>’ allow you to obtain other
information about <code>make</code> or about the makefiles in use
(see <a href="#Options-Summary">Summary of Options</a>).
</p>
<hr>
<a name="Avoiding-Compilation"></a>
<div class="header">
<p>
Next: <a href="#Overriding" accesskey="n" rel="next">Overriding</a>, Previous: <a href="#Instead-of-Execution" accesskey="p" rel="prev">Instead of Execution</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Avoiding-Recompilation-of-Some-Files"></a>
<h3 class="section">9.4 Avoiding Recompilation of Some Files</h3>
<a name="index-_002do"></a>
<a name="index-_002d_002dold_002dfile"></a>
<a name="index-_002d_002dassume_002dold"></a>
<a name="index-files_002c-assuming-old"></a>
<a name="index-files_002c-avoiding-recompilation-of"></a>
<a name="index-recompilation_002c-avoiding"></a>
<p>Sometimes you may have changed a source file but you do not want to
recompile all the files that depend on it. For example, suppose you add
a macro or a declaration to a header file that many other files depend
on. Being conservative, <code>make</code> assumes that any change in the
header file requires recompilation of all dependent files, but you know
that they do not need to be recompiled and you would rather not waste
the time waiting for them to compile.
</p>
<p>If you anticipate the problem before changing the header file, you can
use the ‘<samp>-t</samp>’ flag. This flag tells <code>make</code> not to run the
recipes in the rules, but rather to mark the target up to date by
changing its last-modification date. You would follow this procedure:
</p>
<ol>
<li> Use the command ‘<samp>make</samp>’ to recompile the source files that really
need recompilation, ensuring that the object files are up-to-date
before you begin.
</li><li> Make the changes in the header files.
</li><li> Use the command ‘<samp>make -t</samp>’ to mark all the object files as
up to date. The next time you run <code>make</code>, the changes in the
header files will not cause any recompilation.
</li></ol>
<p>If you have already changed the header file at a time when some files
do need recompilation, it is too late to do this. Instead, you can
use the ‘<samp><span class="nolinebreak">-o</span> <var>file</var></samp>’<!-- /@w --> flag, which marks a specified file as
“old” (see <a href="#Options-Summary">Summary of Options</a>). This means
that the file itself will not be remade, and nothing else will be
remade on its account. Follow this procedure:
</p>
<ol>
<li> Recompile the source files that need compilation for reasons independent
of the particular header file, with ‘<samp>make -o <var>headerfile</var></samp>’.
If several header files are involved, use a separate ‘<samp>-o</samp>’ option
for each header file.
</li><li> Touch all the object files with ‘<samp>make -t</samp>’.
</li></ol>
<hr>
<a name="Overriding"></a>
<div class="header">
<p>
Next: <a href="#Testing" accesskey="n" rel="next">Testing</a>, Previous: <a href="#Avoiding-Compilation" accesskey="p" rel="prev">Avoiding Compilation</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Overriding-Variables"></a>
<h3 class="section">9.5 Overriding Variables</h3>
<a name="index-overriding-variables-with-arguments"></a>
<a name="index-variables_002c-overriding-with-arguments"></a>
<a name="index-command-line-variables"></a>
<a name="index-variables_002c-command-line"></a>
<p>An argument that contains ‘<samp>=</samp>’ specifies the value of a variable:
‘<samp><var>v</var>=<var>x</var></samp>’ sets the value of the variable <var>v</var> to <var>x</var>.
If you specify a value in this way, all ordinary assignments of the same
variable in the makefile are ignored; we say they have been
<em>overridden</em> by the command line argument.
</p>
<p>The most common way to use this facility is to pass extra flags to
compilers. For example, in a properly written makefile, the variable
<code>CFLAGS</code> is included in each recipe that runs the C compiler, so a
file <samp>foo.c</samp> would be compiled something like this:
</p>
<div class="example">
<pre class="example">cc -c $(CFLAGS) foo.c
</pre></div>
<p>Thus, whatever value you set for <code>CFLAGS</code> affects each compilation
that occurs. The makefile probably specifies the usual value for
<code>CFLAGS</code>, like this:
</p>
<div class="example">
<pre class="example">CFLAGS=-g
</pre></div>
<p>Each time you run <code>make</code>, you can override this value if you
wish. For example, if you say ‘<samp>make CFLAGS='-g -O'</samp>’, each C
compilation will be done with ‘<samp>cc -c -g -O</samp>’. (This also
illustrates how you can use quoting in the shell to enclose spaces and
other special characters in the value of a variable when you override
it.)
</p>
<p>The variable <code>CFLAGS</code> is only one of many standard variables that
exist just so that you can change them this way. See <a href="Implicit-Rules.html#Implicit-Variables">Variables Used by Implicit Rules</a>, for a complete list.
</p>
<p>You can also program the makefile to look at additional variables of your
own, giving the user the ability to control other aspects of how the
makefile works by changing the variables.
</p>
<p>When you override a variable with a command line argument, you can
define either a recursively-expanded variable or a simply-expanded
variable. The examples shown above make a recursively-expanded
variable; to make a simply-expanded variable, write ‘<samp>:=</samp>’ or
‘<samp>::=</samp>’ instead of ‘<samp>=</samp>’. But, unless you want to include a
variable reference or function call in the <em>value</em> that you
specify, it makes no difference which kind of variable you create.
</p>
<p>There is one way that the makefile can change a variable that you have
overridden. This is to use the <code>override</code> directive, which is a line
that looks like this: ‘<samp>override <var>variable</var> = <var>value</var></samp>’
(see <a href="Using-Variables.html#Override-Directive">The <code>override</code> Directive</a>).
</p>
<hr>
<a name="Testing"></a>
<div class="header">
<p>
Next: <a href="#Options-Summary" accesskey="n" rel="next">Options Summary</a>, Previous: <a href="#Overriding" accesskey="p" rel="prev">Overriding</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Testing-the-Compilation-of-a-Program"></a>
<h3 class="section">9.6 Testing the Compilation of a Program</h3>
<a name="index-testing-compilation"></a>
<a name="index-compilation_002c-testing"></a>
<p>Normally, when an error happens in executing a shell command, <code>make</code>
gives up immediately, returning a nonzero status. No further recipes are
executed for any target. The error implies that the goal cannot be
correctly remade, and <code>make</code> reports this as soon as it knows.
</p>
<p>When you are compiling a program that you have just changed, this is not
what you want. Instead, you would rather that <code>make</code> try compiling
every file that can be tried, to show you as many compilation errors
as possible.
</p>
<a name="index-_002dk-1"></a>
<a name="index-_002d_002dkeep_002dgoing-1"></a>
<p>On these occasions, you should use the ‘<samp>-k</samp>’ or
‘<samp>--keep-going</samp>’ flag. This tells <code>make</code> to continue to
consider the other prerequisites of the pending targets, remaking them
if necessary, before it gives up and returns nonzero status. For
example, after an error in compiling one object file, ‘<samp>make -k</samp>’
will continue compiling other object files even though it already
knows that linking them will be impossible. In addition to continuing
after failed shell commands, ‘<samp>make -k</samp>’ will continue as much as
possible after discovering that it does not know how to make a target
or prerequisite file. This will always cause an error message, but
without ‘<samp>-k</samp>’, it is a fatal error (see <a href="#Options-Summary">Summary of Options</a>).
</p>
<p>The usual behavior of <code>make</code> assumes that your purpose is to get the
goals up to date; once <code>make</code> learns that this is impossible, it might
as well report the failure immediately. The ‘<samp>-k</samp>’ flag says that the
real purpose is to test as much as possible of the changes made in the
program, perhaps to find several independent problems so that you can
correct them all before the next attempt to compile. This is why Emacs’
<kbd>M-x compile</kbd> command passes the ‘<samp>-k</samp>’ flag by default.
</p>
<hr>
<a name="Options-Summary"></a>
<div class="header">
<p>
Previous: <a href="#Testing" accesskey="p" rel="prev">Testing</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Summary-of-Options"></a>
<h3 class="section">9.7 Summary of Options</h3>
<a name="index-options"></a>
<a name="index-flags"></a>
<a name="index-switches"></a>
<p>Here is a table of all the options <code>make</code> understands:
</p>
<dl compact="compact">
<dt>‘<samp>-b</samp>’</dt>
<dd><a name="index-_002db"></a>
</dd>
<dt>‘<samp>-m</samp>’</dt>
<dd><a name="index-_002dm"></a>
<p>These options are ignored for compatibility with other versions of <code>make</code>.
</p>
</dd>
<dt>‘<samp>-B</samp>’</dt>
<dd><a name="index-_002dB"></a>
</dd>
<dt>‘<samp>--always-make</samp>’</dt>
<dd><a name="index-_002d_002dalways_002dmake"></a>
<p>Consider all targets out-of-date. GNU <code>make</code> proceeds to
consider targets and their prerequisites using the normal algorithms;
however, all targets so considered are always remade regardless of the
status of their prerequisites. To avoid infinite recursion, if
<code>MAKE_RESTARTS</code> (see <a href="Using-Variables.html#Special-Variables">Other Special
Variables</a>) is set to a number greater than 0 this option is disabled
when considering whether to remake makefiles (see <a href="Makefiles.html#Remaking-Makefiles">How Makefiles Are Remade</a>).
</p>
</dd>
<dt>‘<samp>-C <var>dir</var></samp>’</dt>
<dd><a name="index-_002dC-1"></a>
</dd>
<dt>‘<samp>--directory=<var>dir</var></samp>’</dt>
<dd><a name="index-_002d_002ddirectory-1"></a>
<p>Change to directory <var>dir</var> before reading the makefiles. If multiple
‘<samp>-C</samp>’ options are specified, each is interpreted relative to the
previous one: ‘<samp>-C / -C etc</samp>’ is equivalent to ‘<samp>-C /etc</samp>’.
This is typically used with recursive invocations of <code>make</code>
(see <a href="Recipes.html#Recursion">Recursive Use of <code>make</code></a>).
</p>
</dd>
<dt>‘<samp>-d</samp>’</dt>
<dd><a name="index-_002dd"></a>
<p>Print debugging information in addition to normal processing. The
debugging information says which files are being considered for
remaking, which file-times are being compared and with what results,
which files actually need to be remade, which implicit rules are
considered and which are applied—everything interesting about how
<code>make</code> decides what to do. The <code>-d</code> option is equivalent to
‘<samp>--debug=a</samp>’ (see below).
</p>
</dd>
<dt>‘<samp>--debug[=<var>options</var>]</samp>’</dt>
<dd><a name="index-_002d_002ddebug"></a>
<p>Print debugging information in addition to normal processing. Various
levels and types of output can be chosen. With no arguments, print the
“basic” level of debugging. Possible arguments are below; only the
first character is considered, and values must be comma- or
space-separated.
</p>
<dl compact="compact">
<dt><code>a (<i>all</i>)</code></dt>
<dd><p>All types of debugging output are enabled. This is equivalent to using
‘<samp>-d</samp>’.
</p>
</dd>
<dt><code>b (<i>basic</i>)</code></dt>
<dd><p>Basic debugging prints each target that was found to be out-of-date, and
whether the build was successful or not.
</p>
</dd>
<dt><code>v (<i>verbose</i>)</code></dt>
<dd><p>A level above ‘<samp>basic</samp>’; includes messages about which makefiles were
parsed, prerequisites that did not need to be rebuilt, etc. This option
also enables ‘<samp>basic</samp>’ messages.
</p>
</dd>
<dt><code>i (<i>implicit</i>)</code></dt>
<dd><p>Prints messages describing the implicit rule searches for each target.
This option also enables ‘<samp>basic</samp>’ messages.
</p>
</dd>
<dt><code>j (<i>jobs</i>)</code></dt>
<dd><p>Prints messages giving details on the invocation of specific sub-commands.
</p>
</dd>
<dt><code>m (<i>makefile</i>)</code></dt>
<dd><p>By default, the above messages are not enabled while trying to remake
the makefiles. This option enables messages while rebuilding makefiles,
too. Note that the ‘<samp>all</samp>’ option does enable this option. This
option also enables ‘<samp>basic</samp>’ messages.
</p>
</dd>
<dt><code>n (<i>none</i>)</code></dt>
<dd><p>Disable all debugging currently enabled. If additional debugging
flags are encountered after this they will still take effect.
</p></dd>
</dl>
</dd>
<dt>‘<samp>-e</samp>’</dt>
<dd><a name="index-_002de"></a>
</dd>
<dt>‘<samp>--environment-overrides</samp>’</dt>
<dd><a name="index-_002d_002denvironment_002doverrides"></a>
<p>Give variables taken from the environment precedence
over variables from makefiles.
See <a href="Using-Variables.html#Environment">Variables from the Environment</a>.
</p>
</dd>
<dt>‘<samp>--eval=<var>string</var></samp>’</dt>
<dd><a name="index-_002d_002deval"></a>
<p>Evaluate <var>string</var> as makefile syntax. This is a command-line
version of the <code>eval</code> function (see <a href="Functions.html#Eval-Function">Eval Function</a>). The
evaluation is performed after the default rules and variables have
been defined, but before any makefiles are read.
</p>
</dd>
<dt>‘<samp>-f <var>file</var></samp>’</dt>
<dd><a name="index-_002df-2"></a>
</dd>
<dt>‘<samp>--file=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dfile-2"></a>
</dd>
<dt>‘<samp>--makefile=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dmakefile-2"></a>
<p>Read the file named <var>file</var> as a makefile.
See <a href="Makefiles.html#Makefiles">Writing Makefiles</a>.
</p>
</dd>
<dt>‘<samp>-h</samp>’</dt>
<dd><a name="index-_002dh"></a>
</dd>
<dt>‘<samp>--help</samp>’</dt>
<dd><a name="index-_002d_002dhelp"></a>
<p>Remind you of the options that <code>make</code> understands and then exit.
</p>
</dd>
<dt>‘<samp>-i</samp>’</dt>
<dd><a name="index-_002di-1"></a>
</dd>
<dt>‘<samp>--ignore-errors</samp>’</dt>
<dd><a name="index-_002d_002dignore_002derrors-1"></a>
<p>Ignore all errors in recipes executed to remake files.
See <a href="Recipes.html#Errors">Errors in Recipes</a>.
</p>
</dd>
<dt>‘<samp>-I <var>dir</var></samp>’</dt>
<dd><a name="index-_002dI-1"></a>
</dd>
<dt>‘<samp>--include-dir=<var>dir</var></samp>’</dt>
<dd><a name="index-_002d_002dinclude_002ddir-1"></a>
<p>Specifies a directory <var>dir</var> to search for included makefiles.
See <a href="Makefiles.html#Include">Including Other Makefiles</a>. If several ‘<samp>-I</samp>’
options are used to specify several directories, the directories are
searched in the order specified.
</p>
</dd>
<dt>‘<samp>-j [<var>jobs</var>]</samp>’</dt>
<dd><a name="index-_002dj-1"></a>
</dd>
<dt>‘<samp>--jobs[=<var>jobs</var>]</samp>’</dt>
<dd><a name="index-_002d_002djobs-1"></a>
<p>Specifies the number of recipes (jobs) to run simultaneously. With no
argument, <code>make</code> runs as many recipes simultaneously as possible.
If there is more than one ‘<samp>-j</samp>’ option, the last one is effective.
See <a href="Recipes.html#Parallel">Parallel Execution</a>, for more information on how
recipes are run. Note that this option is ignored on MS-DOS.
</p>
</dd>
<dt>‘<samp>-k</samp>’</dt>
<dd><a name="index-_002dk-2"></a>
</dd>
<dt>‘<samp>--keep-going</samp>’</dt>
<dd><a name="index-_002d_002dkeep_002dgoing-2"></a>
<p>Continue as much as possible after an error. While the target that
failed, and those that depend on it, cannot be remade, the other
prerequisites of these targets can be processed all the same.
See <a href="#Testing">Testing the Compilation of a Program</a>.
</p>
</dd>
<dt>‘<samp>-l [<var>load</var>]</samp>’</dt>
<dd><a name="index-_002dl"></a>
</dd>
<dt>‘<samp>--load-average[=<var>load</var>]</samp>’</dt>
<dd><a name="index-_002d_002dload_002daverage-1"></a>
</dd>
<dt>‘<samp>--max-load[=<var>load</var>]</samp>’</dt>
<dd><a name="index-_002d_002dmax_002dload-1"></a>
<p>Specifies that no new recipes should be started if there are other
recipes running and the load average is at least <var>load</var> (a
floating-point number). With no argument, removes a previous load
limit. See <a href="Recipes.html#Parallel">Parallel Execution</a>.
</p>
</dd>
<dt>‘<samp>-L</samp>’</dt>
<dd><a name="index-_002dL"></a>
</dd>
<dt>‘<samp>--check-symlink-times</samp>’</dt>
<dd><a name="index-_002d_002dcheck_002dsymlink_002dtimes"></a>
<p>On systems that support symbolic links, this option causes <code>make</code>
to consider the timestamps on any symbolic links in addition to the
timestamp on the file referenced by those links. When this option is
provided, the most recent timestamp among the file and the symbolic
links is taken as the modification time for this target file.
</p>
</dd>
<dt>‘<samp>-n</samp>’</dt>
<dd><a name="index-_002dn-2"></a>
</dd>
<dt>‘<samp>--just-print</samp>’</dt>
<dd><a name="index-_002d_002djust_002dprint-2"></a>
</dd>
<dt>‘<samp>--dry-run</samp>’</dt>
<dd><a name="index-_002d_002ddry_002drun-2"></a>
</dd>
<dt>‘<samp>--recon</samp>’</dt>
<dd><a name="index-_002d_002drecon-2"></a>
<p>Print the recipe that would be executed, but do not execute it (except
in certain circumstances).
See <a href="#Instead-of-Execution">Instead of Executing Recipes</a>.
</p>
</dd>
<dt>‘<samp>-o <var>file</var></samp>’</dt>
<dd><a name="index-_002do-1"></a>
</dd>
<dt>‘<samp>--old-file=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dold_002dfile-1"></a>
</dd>
<dt>‘<samp>--assume-old=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dassume_002dold-1"></a>
<p>Do not remake the file <var>file</var> even if it is older than its
prerequisites, and do not remake anything on account of changes in
<var>file</var>. Essentially the file is treated as very old and its rules
are ignored. See <a href="#Avoiding-Compilation">Avoiding Recompilation of
Some Files</a>.
</p>
</dd>
<dt>‘<samp>-O[<var>type</var>]</samp>’</dt>
<dd><a name="index-_002dO-1"></a>
</dd>
<dt>‘<samp>--output-sync[=<var>type</var>]</samp>’</dt>
<dd><a name="index-_002d_002doutput_002dsync-1"></a>
<a name="index-output-during-parallel-execution-1"></a>
<a name="index-parallel-execution_002c-output-during-1"></a>
<p>Ensure that the complete output from each recipe is printed in one
uninterrupted sequence. This option is only useful when using the
<code>--jobs</code> option to run multiple recipes simultaneously
(see <a href="Recipes.html#Parallel">Parallel Execution</a>) Without this option output
will be displayed as it is generated by the recipes.
</p>
<p>With no type or the type ‘<samp>target</samp>’, output from the entire recipe
of each target is grouped together. With the type ‘<samp>line</samp>’, output
from each line in the recipe is grouped together. With the type
‘<samp>recurse</samp>’, the output from an entire recursive make is grouped
together. With the type ‘<samp>none</samp>’, no output synchronization is
performed. See <a href="Recipes.html#Parallel-Output">Output During Parallel Execution</a>.
</p>
</dd>
<dt>‘<samp>-p</samp>’</dt>
<dd><a name="index-_002dp"></a>
</dd>
<dt>‘<samp>--print-data-base</samp>’</dt>
<dd><a name="index-_002d_002dprint_002ddata_002dbase"></a>
<a name="index-data-base-of-make-rules"></a>
<a name="index-predefined-rules-and-variables_002c-printing"></a>
<p>Print the data base (rules and variable values) that results from
reading the makefiles; then execute as usual or as otherwise
specified. This also prints the version information given by the
‘<samp>-v</samp>’ switch (see below). To print the data base without trying
to remake any files, use ‘<samp>make <span class="nolinebreak">-qp</span></samp>’<!-- /@w -->. To print the data base
of predefined rules and variables, use ‘<samp>make <span class="nolinebreak">-p</span> <span class="nolinebreak">-f</span> /dev/null</samp>’<!-- /@w -->.
The data base output contains file name and line number information for
recipe and variable definitions, so it can be a useful debugging tool
in complex environments.
</p>
</dd>
<dt>‘<samp>-q</samp>’</dt>
<dd><a name="index-_002dq-1"></a>
</dd>
<dt>‘<samp>--question</samp>’</dt>
<dd><a name="index-_002d_002dquestion-1"></a>
<p>“Question mode”. Do not run any recipes, or print anything; just
return an exit status that is zero if the specified targets are already
up to date, one if any remaking is required, or two if an error is
encountered. See <a href="#Instead-of-Execution">Instead of Executing
Recipes</a>.
</p>
</dd>
<dt>‘<samp>-r</samp>’</dt>
<dd><a name="index-_002dr"></a>
</dd>
<dt>‘<samp>--no-builtin-rules</samp>’</dt>
<dd><a name="index-_002d_002dno_002dbuiltin_002drules"></a>
<p>Eliminate use of the built-in implicit rules (see <a href="Implicit-Rules.html#Implicit-Rules">Using Implicit Rules</a>). You can still define your own by writing
pattern rules (see <a href="Implicit-Rules.html#Pattern-Rules">Defining and Redefining Pattern
Rules</a>). The ‘<samp>-r</samp>’ option also clears out the default list of
suffixes for suffix rules (see <a href="Implicit-Rules.html#Suffix-Rules">Old-Fashioned Suffix
Rules</a>). But you can still define your own suffixes with a rule for
<code>.SUFFIXES</code>, and then define your own suffix rules. Note that only
<em>rules</em> are affected by the <code>-r</code> option; default variables
remain in effect (see <a href="Implicit-Rules.html#Implicit-Variables">Variables Used by Implicit
Rules</a>); see the ‘<samp>-R</samp>’ option below.
</p>
</dd>
<dt>‘<samp>-R</samp>’</dt>
<dd><a name="index-_002dR"></a>
</dd>
<dt>‘<samp>--no-builtin-variables</samp>’</dt>
<dd><a name="index-_002d_002dno_002dbuiltin_002dvariables"></a>
<p>Eliminate use of the built-in rule-specific variables (see <a href="Implicit-Rules.html#Implicit-Variables">Variables Used by Implicit Rules</a>). You can still define
your own, of course. The ‘<samp>-R</samp>’ option also automatically enables
the ‘<samp>-r</samp>’ option (see above), since it doesn’t make sense to have
implicit rules without any definitions for the variables that they use.
</p>
</dd>
<dt>‘<samp>-s</samp>’</dt>
<dd><a name="index-_002ds-1"></a>
</dd>
<dt>‘<samp>--silent</samp>’</dt>
<dd><a name="index-_002d_002dsilent-1"></a>
</dd>
<dt>‘<samp>--quiet</samp>’</dt>
<dd><a name="index-_002d_002dquiet-1"></a>
<p>Silent operation; do not print the recipes as they are executed.
See <a href="Recipes.html#Echoing">Recipe Echoing</a>.
</p>
</dd>
<dt>‘<samp>-S</samp>’</dt>
<dd><a name="index-_002dS"></a>
</dd>
<dt>‘<samp>--no-keep-going</samp>’</dt>
<dd><a name="index-_002d_002dno_002dkeep_002dgoing"></a>
</dd>
<dt>‘<samp>--stop</samp>’</dt>
<dd><a name="index-_002d_002dstop"></a>
<p>Cancel the effect of the ‘<samp>-k</samp>’ option. This is never necessary
except in a recursive <code>make</code> where ‘<samp>-k</samp>’ might be inherited
from the top-level <code>make</code> via <code>MAKEFLAGS</code>
(see <a href="Recipes.html#Recursion">Recursive Use of <code>make</code></a>)
or if you set ‘<samp>-k</samp>’ in <code>MAKEFLAGS</code> in your environment.
</p>
</dd>
<dt>‘<samp>-t</samp>’</dt>
<dd><a name="index-_002dt-1"></a>
</dd>
<dt>‘<samp>--touch</samp>’</dt>
<dd><a name="index-_002d_002dtouch-1"></a>
<p>Touch files (mark them up to date without really changing them)
instead of running their recipes. This is used to pretend that the
recipes were done, in order to fool future invocations of
<code>make</code>. See <a href="#Instead-of-Execution">Instead of Executing Recipes</a>.
</p>
</dd>
<dt>‘<samp>--trace</samp>’</dt>
<dd><a name="index-_002d_002dtrace"></a>
<p>Show tracing information for <code>make</code> execution. Prints the entire
recipe to be executed, even for recipes that are normally silent (due
to <code>.SILENT</code> or ‘<samp>@</samp>’). Also prints the makefile name and
line number where the recipe was defined, and information on why the
target is being rebuilt.
</p>
</dd>
<dt>‘<samp>-v</samp>’</dt>
<dd><a name="index-_002dv"></a>
</dd>
<dt>‘<samp>--version</samp>’</dt>
<dd><a name="index-_002d_002dversion"></a>
<p>Print the version of the <code>make</code> program plus a copyright, a list
of authors, and a notice that there is no warranty; then exit.
</p>
</dd>
<dt>‘<samp>-w</samp>’</dt>
<dd><a name="index-_002dw"></a>
</dd>
<dt>‘<samp>--print-directory</samp>’</dt>
<dd><a name="index-_002d_002dprint_002ddirectory"></a>
<p>Print a message containing the working directory both before and after
executing the makefile. This may be useful for tracking down errors
from complicated nests of recursive <code>make</code> commands.
See <a href="Recipes.html#Recursion">Recursive Use of <code>make</code></a>. (In practice, you
rarely need to specify this option since ‘<samp>make</samp>’ does it for you;
see <a href="Recipes.html#g_t_002dw-Option">The ‘<samp>--print-directory</samp>’ Option</a>.)
</p>
</dd>
<dt>‘<samp>--no-print-directory</samp>’</dt>
<dd><a name="index-_002d_002dno_002dprint_002ddirectory-1"></a>
<p>Disable printing of the working directory under <code>-w</code>.
This option is useful when <code>-w</code> is turned on automatically,
but you do not want to see the extra messages.
See <a href="Recipes.html#g_t_002dw-Option">The ‘<samp>--print-directory</samp>’ Option</a>.
</p>
</dd>
<dt>‘<samp>-W <var>file</var></samp>’</dt>
<dd><a name="index-_002dW-1"></a>
</dd>
<dt>‘<samp>--what-if=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dwhat_002dif-1"></a>
</dd>
<dt>‘<samp>--new-file=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dnew_002dfile-1"></a>
</dd>
<dt>‘<samp>--assume-new=<var>file</var></samp>’</dt>
<dd><a name="index-_002d_002dassume_002dnew-1"></a>
<p>Pretend that the target <var>file</var> has just been modified. When used
with the ‘<samp>-n</samp>’ flag, this shows you what would happen if you were
to modify that file. Without ‘<samp>-n</samp>’, it is almost the same as
running a <code>touch</code> command on the given file before running
<code>make</code>, except that the modification time is changed only in the
imagination of <code>make</code>.
See <a href="#Instead-of-Execution">Instead of Executing Recipes</a>.
</p>
</dd>
<dt>‘<samp>--warn-undefined-variables</samp>’</dt>
<dd><a name="index-_002d_002dwarn_002dundefined_002dvariables"></a>
<a name="index-variables_002c-warning-for-undefined"></a>
<a name="index-undefined-variables_002c-warning-message"></a>
<p>Issue a warning message whenever <code>make</code> sees a reference to an
undefined variable. This can be helpful when you are trying to debug
makefiles which use variables in complex ways.
</p></dd>
</dl>
<hr>
<div class="header">
<p>
Previous: <a href="#Testing" accesskey="p" rel="prev">Testing</a>, Up: <a href="#Running" accesskey="u" rel="up">Running</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|