home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GCC258_3.LHA / gcc / info / make.info-2 < prev    next >
Encoding:
GNU Info File  |  1993-12-07  |  48.1 KB  |  1,211 lines

  1. This is Info file make.info, produced by Makeinfo-1.54 from the input
  2. file ./make.texinfo.
  3.  
  4.    This file documents the GNU Make utility, which determines
  5. automatically which pieces of a large program need to be recompiled,
  6. and issues the commands to recompile them.
  7.  
  8.    This is Edition 0.43, last updated 26 July 1993, of `The GNU Make
  9. Manual', for `make', Version 3.68 Beta.
  10.  
  11.    Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
  12. Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Free Software Foundation.
  27.  
  28. 
  29. File: make.info,  Node: Rule Syntax,  Next: Wildcards,  Prev: Rule Example,  Up: Rules
  30.  
  31. Rule Syntax
  32. ===========
  33.  
  34.    In general, a rule looks like this:
  35.  
  36.      TARGETS : DEPENDENCIES
  37.              COMMAND
  38.              ...
  39.  
  40. or like this:
  41.  
  42.      TARGETS : DEPENDENCIES ; COMMAND
  43.              COMMAND
  44.              ...
  45.  
  46.    The TARGETS are file names, separated by spaces.  Wildcard
  47. characters may be used (*note Using Wildcard Characters in File Names:
  48. Wildcards.) and a name of the form `A(M)' represents member M in
  49. archive file A (*note Archive Members as Targets: Archive Members.).
  50. Usually there is only one target per rule, but occasionally there is a
  51. reason to have more (*note Multiple Targets in a Rule: Multiple
  52. Targets.).
  53.  
  54.    The COMMAND lines start with a tab character.  The first command may
  55. appear on the line after the dependencies, with a tab character, or may
  56. appear on the same line, with a semicolon.  Either way, the effect is
  57. the same.  *Note Writing the Commands in Rules: Commands.
  58.  
  59.    Because dollar signs are used to start variable references, if you
  60. really want a dollar sign in a rule you must write two of them, `$$'
  61. (*note How to Use Variables: Using Variables.).  You may split a long
  62. line by inserting a backslash followed by a newline, but this is not
  63. required, as `make' places no limit on the length of a line in a
  64. makefile.
  65.  
  66.    A rule tells `make' two things: when the targets are out of date,
  67. and how to update them when necessary.
  68.  
  69.    The criterion for being out of date is specified in terms of the
  70. DEPENDENCIES, which consist of file names separated by spaces.
  71. (Wildcards and archive members (*note Archives::.) are allowed here
  72. too.) A target is out of date if it does not exist or if it is older
  73. than any of the dependencies (by comparison of last-modification
  74. times).  The idea is that the contents of the target file are computed
  75. based on information in the dependencies, so if any of the dependencies
  76. changes, the contents of the existing target file are no longer
  77. necessarily valid.
  78.  
  79.    How to update is specified by COMMANDS.  These are lines to be
  80. executed by the shell (normally `sh'), but with some extra features
  81. (*note Writing the Commands in Rules: Commands.).
  82.  
  83. 
  84. File: make.info,  Node: Wildcards,  Next: Directory Search,  Prev: Rule Syntax,  Up: Rules
  85.  
  86. Using Wildcard Characters in File Names
  87. =======================================
  88.  
  89.    A single file name can specify many files using "wildcard
  90. characters".  The wildcard characters in `make' are `*', `?' and
  91. `[...]', the same as in the Bourne shell.  For example, `*.c' specifies
  92. a list of all the files (in the working directory) whose names end in
  93. `.c'.
  94.  
  95.    The character `~' at the beginning of a file name also has special
  96. significance.  If alone, or followed by a slash, it represents your home
  97. directory.  For example `~/bin' expands to `/home/you/bin'.  If the `~'
  98. is followed by a word, the string represents the home directory of the
  99. user named by that word.  For example `~john/bin' expands to
  100. `/home/john/bin'.
  101.  
  102.    Wildcard expansion happens automatically in targets, in dependencies,
  103. and in commands (where the shell does the expansion).  In other
  104. contexts, wildcard expansion happens only if you request it explicitly
  105. with the `wildcard' function.
  106.  
  107.    The special significance of a wildcard character can be turned off by
  108. preceding it with a backslash.  Thus, `foo\*bar' would refer to a
  109. specific file whose name consists of `foo', an asterisk, and `bar'.
  110.  
  111. * Menu:
  112.  
  113. * Wildcard Examples::           Several examples
  114. * Wildcard Pitfall::            Problems to avoid.
  115. * Wildcard Function::           How to cause wildcard expansion where
  116.                                   it does not normally take place.
  117.  
  118. 
  119. File: make.info,  Node: Wildcard Examples,  Next: Wildcard Pitfall,  Up: Wildcards
  120.  
  121. Wildcard Examples
  122. -----------------
  123.  
  124.    Wildcards can be used in the commands of a rule, where they are
  125. expanded by the shell.  For example, here is a rule to delete all the
  126. object files:
  127.  
  128.      clean:
  129.              rm -f *.o
  130.  
  131.    Wildcards are also useful in the dependencies of a rule.  With the
  132. following rule in the makefile, `make print' will print all the `.c'
  133. files that have changed since the last time you printed them:
  134.  
  135.      print: *.c
  136.              lpr -p $?
  137.              touch print
  138.  
  139. This rule uses `print' as an empty target file; see *Note Empty Target
  140. Files to Record Events: Empty Targets.  (The automatic variable `$?' is
  141. used to print only those files that have changed; see *Note Automatic
  142. Variables: Automatic.)
  143.  
  144.    Wildcard expansion does not happen when you define a variable.
  145. Thus, if you write this:
  146.  
  147.      objects = *.o
  148.  
  149. then the value of the variable `objects' is the actual string `*.o'.
  150. However, if you use the value of `objects' in a target, dependency or
  151. command, wildcard expansion will take place at that time.  To set
  152. `objects' to the expansion, instead use:
  153.  
  154.      objects := $(wildcard *.o)
  155.  
  156. *Note Wildcard Function::.
  157.  
  158. 
  159. File: make.info,  Node: Wildcard Pitfall,  Next: Wildcard Function,  Prev: Wildcard Examples,  Up: Wildcards
  160.  
  161. Pitfalls of Using Wildcards
  162. ---------------------------
  163.  
  164.    Now here is an example of a naive way of using wildcard expansion,
  165. that does not do what you would intend.  Suppose you would like to say
  166. that the executable file `foo' is made from all the object files in the
  167. directory, and you write this:
  168.  
  169.      objects = *.o
  170.      
  171.      foo : $(objects)
  172.              cc -o foo $(CFLAGS) $(objects)
  173.  
  174. The value of `objects' is the actual string `*.o'.  Wildcard expansion
  175. happens in the rule for `foo', so that each *existing* `.o' file
  176. becomes a dependency of `foo' and will be recompiled if necessary.
  177.  
  178.    But what if you delete all the `.o' files?  Then `*.o' will expand
  179. into *nothing*.  The target `foo' will have no dependencies and would
  180. be remade by linking no object files.  This is not what you want!
  181.  
  182.    Actually it is possible to obtain the desired result with wildcard
  183. expansion, but you need more sophisticated techniques, including the
  184. `wildcard' function and string substitution.  *Note The Function
  185. `wildcard': Wildcard Function.
  186.  
  187. 
  188. File: make.info,  Node: Wildcard Function,  Prev: Wildcard Pitfall,  Up: Wildcards
  189.  
  190. The Function `wildcard'
  191. -----------------------
  192.  
  193.    Wildcard expansion happens automatically in rules.  But wildcard
  194. expansion does not normally take place when a variable is set, or
  195. inside the arguments of a function.  If you want to do wildcard
  196. expansion in such places, you need to use the `wildcard' function, like
  197. this:
  198.  
  199.      $(wildcard PATTERN)
  200.  
  201. This string, used anywhere in a makefile, is replaced by a
  202. space-separated list of names of existing files that match the pattern
  203. PATTERN.
  204.  
  205.    One use of the `wildcard' function is to get a list of all the C
  206. source files in a directory, like this:
  207.  
  208.      $(wildcard *.c)
  209.  
  210.    We can change the list of C source files into a list of object files
  211. by replacing the `.o' suffix with `.c' in the result, like this:
  212.  
  213.      $(patsubst %.c,%.o,$(wildcard *.c))
  214.  
  215. (Here we have used another function, `patsubst'.  *Note Functions for
  216. String Substitution and Analysis: Text Functions.)
  217.  
  218.    Thus, a makefile to compile all C source files in the directory and
  219. then link them together could be written as follows:
  220.  
  221.      objects := $(patsubst %.c,%.o,$(wildcard *.c))
  222.      
  223.      foo : $(objects)
  224.              cc -o foo $(objects)
  225.  
  226. (This takes advantage of the implicit rule for compiling C programs, so
  227. there is no need to write explicit rules for compiling the files.
  228. *Note The Two Flavors of Variables: Flavors, for an explanation of
  229. `:=', which is a variant of `='.)
  230.  
  231. 
  232. File: make.info,  Node: Directory Search,  Next: Phony Targets,  Prev: Wildcards,  Up: Rules
  233.  
  234. Searching Directories for Dependencies
  235. ======================================
  236.  
  237.    For large systems, it is often desirable to put sources in a separate
  238. directory from the binaries.  The "directory search" features of `make'
  239. facilitate this by searching several directories automatically to find
  240. a dependency.  When you redistribute the files among directories, you
  241. do not need to change the individual rules, just the search paths.
  242.  
  243. * Menu:
  244.  
  245. * General Search::              Specifying a search path that applies
  246.                                   to every dependency.
  247. * Selective Search::            Specifying a search path
  248.                                   for a specified class of names.
  249. * Commands/Search::             How to write shell commands that work together
  250.                                   with search paths.
  251. * Implicit/Search::             How search paths affect implicit rules.
  252. * Libraries/Search::            Directory search for link libraries.
  253.  
  254. 
  255. File: make.info,  Node: General Search,  Next: Selective Search,  Up: Directory Search
  256.  
  257. `VPATH': Search Path for All Dependencies
  258. -----------------------------------------
  259.  
  260.    The value of the `make' variable `VPATH' specifies a list of
  261. directories that `make' should search.  Most often, the directories are
  262. expected to contain dependency files that are not in the current
  263. directory; however, `VPATH' specifies a search list that `make' applies
  264. for all files, including files which are targets of rules.
  265.  
  266.    Thus, if a file that is listed as a target or dependency does not
  267. exist in the current directory, `make' searches the directories listed
  268. in `VPATH' for a file with that name.  If a file is found in one of
  269. them, that file becomes the dependency.  Rules may then specify the
  270. names of source files in the dependencies as if they all existed in the
  271. current directory.  *Note Writing Shell Commands with Directory Search:
  272. Commands/Search.
  273.  
  274.    In the `VPATH' variable, directory names are separated by colons.
  275. The order in which directories are listed is the order followed by
  276. `make' in its search.
  277.  
  278.    For example,
  279.  
  280.      VPATH = src:../headers
  281.  
  282. specifies a path containing two directories, `src' and `../headers',
  283. which `make' searches in that order.
  284.  
  285.    With this value of `VPATH', the following rule,
  286.  
  287.      foo.o : foo.c
  288.  
  289. is interpreted as if it were written like this:
  290.  
  291.      foo.o : src/foo.c
  292.  
  293. assuming the file `foo.c' does not exist in the current directory but
  294. is found in the directory `src'.
  295.  
  296. 
  297. File: make.info,  Node: Selective Search,  Next: Commands/Search,  Prev: General Search,  Up: Directory Search
  298.  
  299. The `vpath' Directive
  300. ---------------------
  301.  
  302.    Similar to the `VPATH' variable but more selective is the `vpath'
  303. directive (note lower case), which allows you to specify a search path
  304. for a particular class of file names, those that match a particular
  305. pattern.  Thus you can supply certain search directories for one class
  306. of file names and other directories (or none) for other file names.
  307.  
  308.    There are three forms of the `vpath' directive:
  309.  
  310. `vpath PATTERN DIRECTORIES'
  311.      Specify the search path DIRECTORIES for file names that match
  312.      PATTERN.
  313.  
  314.      The search path, DIRECTORIES, is a colon-separated list of
  315.      directories to be searched, just like the search path used in the
  316.      `VPATH' variable.
  317.  
  318. `vpath PATTERN'
  319.      Clear out the search path associated with PATTERN.
  320.  
  321. `vpath'
  322.      Clear all search paths previously specified with `vpath'
  323.      directives.
  324.  
  325.    A `vpath' pattern is a string containing a `%' character.  The
  326. string must match the file name of a dependency that is being searched
  327. for, the `%' character matching any sequence of zero or more characters
  328. (as in pattern rules; *note Defining and Redefining Pattern Rules:
  329. Pattern Rules.).  For example, `%.h' matches files that end in `.h'.
  330. (If there is no `%', the pattern must match the dependency exactly,
  331. which is not useful very often.)
  332.  
  333.    `%' characters in a `vpath' directive's pattern can be quoted with
  334. preceding backslashes (`\').  Backslashes that would otherwise quote
  335. `%' characters can be quoted with more backslashes.  Backslashes that
  336. quote `%' characters or other backslashes are removed from the pattern
  337. before it is compared to file names.  Backslashes that are not in
  338. danger of quoting `%' characters go unmolested.
  339.  
  340.    When a dependency fails to exist in the current directory, if the
  341. PATTERN in a `vpath' directive matches the name of the dependency file,
  342. then the DIRECTORIES in that directive are searched just like (and
  343. before) the directories in the `VPATH' variable.
  344.  
  345.    For example,
  346.  
  347.      vpath %.h ../headers
  348.  
  349. tells `make' to look for any dependency whose name ends in `.h' in the
  350. directory `../headers' if the file is not found in the current
  351. directory.
  352.  
  353.    If several `vpath' patterns match the dependency file's name, then
  354. `make' processes each matching `vpath' directive one by one, searching
  355. all the directories mentioned in each directive.  `make' handles
  356. multiple `vpath' directives in the order in which they appear in the
  357. makefile; multiple directives with the same pattern are independent of
  358. each other.
  359.  
  360.    Thus,
  361.  
  362.      vpath %.c foo
  363.      vpath %   blish
  364.      vpath %.c bar
  365.  
  366. will look for a file ending in `.c' in `foo', then `blish', then `bar',
  367. while
  368.  
  369.      vpath %.c foo:bar
  370.      vpath %   blish
  371.  
  372. will look for a file ending in `.c' in `foo', then `bar', then `blish'.
  373.  
  374. 
  375. File: make.info,  Node: Commands/Search,  Next: Implicit/Search,  Prev: Selective Search,  Up: Directory Search
  376.  
  377. Writing Shell Commands with Directory Search
  378. --------------------------------------------
  379.  
  380.    When a dependency is found in another directory through directory
  381. search, this cannot change the commands of the rule; they will execute
  382. as written.  Therefore, you must write the commands with care so that
  383. they will look for the dependency in the directory where `make' finds
  384. it.
  385.  
  386.    This is done with the "automatic variables" such as `$^' (*note
  387. Automatic Variables: Automatic.).  For instance, the value of `$^' is a
  388. list of all the dependencies of the rule, including the names of the
  389. directories in which they were found, and the value of `$@' is the
  390. target.  Thus:
  391.  
  392.      foo.o : foo.c
  393.              cc -c $(CFLAGS) $^ -o $@
  394.  
  395. (The variable `CFLAGS' exists so you can specify flags for C
  396. compilation by implicit rules; we use it here for consistency so it will
  397. affect all C compilations uniformly; *note Variables Used by Implicit
  398. Rules: Implicit Variables..)
  399.  
  400.    Often the dependencies include header files as well, which you do not
  401. want to mention in the commands.  The automatic variable `$<' is just
  402. the first dependency:
  403.  
  404.      VPATH = src:../headers
  405.      foo.o : foo.c defs.h hack.h
  406.              cc -c $(CFLAGS) $< -o $@
  407.  
  408. 
  409. File: make.info,  Node: Implicit/Search,  Next: Libraries/Search,  Prev: Commands/Search,  Up: Directory Search
  410.  
  411. Directory Search and Implicit Rules
  412. -----------------------------------
  413.  
  414.    The search through the directories specified in `VPATH' or with
  415. `vpath' also happens during consideration of implicit rules (*note
  416. Using Implicit Rules: Implicit Rules.).
  417.  
  418.    For example, when a file `foo.o' has no explicit rule, `make'
  419. considers implicit rules, such as the built-in rule to compile `foo.c'
  420. if that file exists.  If such a file is lacking in the current
  421. directory, the appropriate directories are searched for it.  If `foo.c'
  422. exists (or is mentioned in the makefile) in any of the directories, the
  423. implicit rule for C compilation is applied.
  424.  
  425.    The commands of implicit rules normally use automatic variables as a
  426. matter of necessity; consequently they will use the file names found by
  427. directory search with no extra effort.
  428.  
  429. 
  430. File: make.info,  Node: Libraries/Search,  Prev: Implicit/Search,  Up: Directory Search
  431.  
  432. Directory Search for Link Libraries
  433. -----------------------------------
  434.  
  435.    Directory search applies in a special way to libraries used with the
  436. linker.  This special feature comes into play when you write a
  437. dependency whose name is of the form `-lNAME'.  (You can tell something
  438. strange is going on here because the dependency is normally the name of
  439. a file, and the *file name* of the library looks like `libNAME.a', not
  440. like `-lNAME'.)
  441.  
  442.    When a dependency's name has the form `-lNAME', `make' handles it
  443. specially by searching for the file `libNAME.a' in the current
  444. directory, in directories specified by matching `vpath' search paths
  445. and the `VPATH' search path, and then in the directories `/lib',
  446. `/usr/lib', and `PREFIX/lib' (normally `/usr/local/lib').
  447.  
  448.    For example,
  449.  
  450.      foo : foo.c -lcurses
  451.              cc $^ -o $@
  452.  
  453. would cause the command `cc foo.c /usr/lib/libcurses.a -o foo' to be
  454. executed when `foo' is older than `foo.c' or than
  455. `/usr/lib/libcurses.a'.
  456.  
  457. 
  458. File: make.info,  Node: Phony Targets,  Next: Force Targets,  Prev: Directory Search,  Up: Rules
  459.  
  460. Phony Targets
  461. =============
  462.  
  463.    A phony target is one that is not really the name of a file.  It is
  464. just a name for some commands to be executed when you make an explicit
  465. request.  There are two reasons to use a phony target: to avoid a
  466. conflict with a file of the same name, and to improve performance.
  467.  
  468.    If you write a rule whose commands will not create the target file,
  469. the commands will be executed every time the target comes up for
  470. remaking.  Here is an example:
  471.  
  472.      clean:
  473.              rm *.o temp
  474.  
  475. Because the `rm' command does not create a file named `clean', probably
  476. no such file will ever exist.  Therefore, the `rm' command will be
  477. executed every time you say `make clean'.
  478.  
  479.    The phony target will cease to work if anything ever does create a
  480. file named `clean' in this directory.  Since it has no dependencies, the
  481. file `clean' would inevitably be considered up to date, and its
  482. commands would not be executed.  To avoid this problem, you can
  483. explicitly declare the target to be phony, using the special target
  484. `.PHONY' (*note Special Built-in Target Names: Special Targets.) as
  485. follows:
  486.  
  487.      .PHONY : clean
  488.  
  489. Once this is done, `make clean' will run the commands regardless of
  490. whether there is a file named `clean'.
  491.  
  492.    Since it knows that phony targets do not name actual files that
  493. could be remade from other files, `make' skips the implicit rule search
  494. for phony targets (*note Implicit Rules::.).  This is why declaring a
  495. target phony is good for performance, even if you are not worried about
  496. the actual file existing.
  497.  
  498.    Thus, you first write the line that states that `clean' is a phony
  499. target, then you write the rule, like this:
  500.  
  501.      .PHONY: clean
  502.      clean:
  503.              rm *.o temp
  504.  
  505.    A phony target should not be a dependency of a real target file; if
  506. it is, its commands are run every time `make' goes to update that file.
  507. As long as a phony target is never a dependency of a real target, the
  508. phony target commands will be executed only when the phony target is a
  509. specified goal (*note Arguments to Specify the Goals: Goals.).
  510.  
  511.    Phony targets can have dependencies.  When one directory contains
  512. multiple programs, it is most convenient to describe all of the
  513. programs in one makefile `./Makefile'.  Since the target remade by
  514. default will be the first one in the makefile, it is common to make
  515. this a phony target named `all' and give it, as dependencies, all the
  516. individual programs.  For example:
  517.  
  518.      all : prog1 prog2 prog3
  519.      .PHONY : all
  520.      
  521.      prog1 : prog1.o utils.o
  522.              cc -o prog1 prog1.o utils.o
  523.      
  524.      prog2 : prog2.o
  525.              cc -o prog2 prog2.o
  526.      
  527.      prog3 : prog3.o sort.o utils.o
  528.              cc -o prog3 prog3.o sort.o utils.o
  529.  
  530. Now you can say just `make' to remake all three programs, or specify as
  531. arguments the ones to remake (as in `make prog1 prog3').
  532.  
  533.    When one phony target is a dependency of another, it serves as a
  534. subroutine of the other.  For example, here `make cleanall' will delete
  535. the object files, the difference files, and the file `program':
  536.  
  537.      .PHONY: cleanall cleanobj cleandiff
  538.      
  539.      cleanall : cleanobj cleandiff
  540.              rm program
  541.      
  542.      cleanobj :
  543.              rm *.o
  544.      
  545.      cleandiff :
  546.              rm *.diff
  547.  
  548. 
  549. File: make.info,  Node: Force Targets,  Next: Empty Targets,  Prev: Phony Targets,  Up: Rules
  550.  
  551. Rules without Commands or Dependencies
  552. ======================================
  553.  
  554.    If a rule has no dependencies or commands, and the target of the rule
  555. is a nonexistent file, then `make' imagines this target to have been
  556. updated whenever its rule is run.  This implies that all targets
  557. depending on this one will always have their commands run.
  558.  
  559.    An example will illustrate this:
  560.  
  561.      clean: FORCE
  562.              rm $(objects)
  563.      FORCE:
  564.  
  565.    Here the target `FORCE' satisfies the special conditions, so the
  566. target `clean' that depends on it is forced to run its commands.  There
  567. is nothing special about the name `FORCE', but that is one name
  568. commonly used this way.
  569.  
  570.    As you can see, using `FORCE' this way has the same results as using
  571. `.PHONY: clean'.
  572.  
  573.    Using `.PHONY' is more explicit and more efficient.  However, other
  574. versions of `make' do not support `.PHONY'; thus `FORCE' appears in
  575. many makefiles.  *Note Phony Targets::.
  576.  
  577. 
  578. File: make.info,  Node: Empty Targets,  Next: Special Targets,  Prev: Force Targets,  Up: Rules
  579.  
  580. Empty Target Files to Record Events
  581. ===================================
  582.  
  583.    The "empty target" is a variant of the phony target; it is used to
  584. hold commands for an action that you request explicitly from time to
  585. time.  Unlike a phony target, this target file can really exist; but
  586. the file's contents do not matter, and usually are empty.
  587.  
  588.    The purpose of the empty target file is to record, with its
  589. last-modification time, when the rule's commands were last executed.  It
  590. does so because one of the commands is a `touch' command to update the
  591. target file.
  592.  
  593.    The empty target file must have some dependencies.  When you ask to
  594. remake the empty target, the commands are executed if any dependency is
  595. more recent than the target; in other words, if a dependency has
  596. changed since the last time you remade the target.  Here is an example:
  597.  
  598.      print: foo.c bar.c
  599.              lpr -p $?
  600.              touch print
  601.  
  602. With this rule, `make print' will execute the `lpr' command if either
  603. source file has changed since the last `make print'.  The automatic
  604. variable `$?' is used to print only those files that have changed
  605. (*note Automatic Variables: Automatic.).
  606.  
  607. 
  608. File: make.info,  Node: Special Targets,  Next: Multiple Targets,  Prev: Empty Targets,  Up: Rules
  609.  
  610. Special Built-in Target Names
  611. =============================
  612.  
  613.    Certain names have special meanings if they appear as targets.
  614.  
  615. `.PHONY'
  616.      The dependencies of the special target `.PHONY' are considered to
  617.      be phony targets.  When it is time to consider such a target,
  618.      `make' will run its commands unconditionally, regardless of
  619.      whether a file with that name exists or what its last-modification
  620.      time is.  *Note Phony Targets: Phony Targets.
  621.  
  622. `.SUFFIXES'
  623.      The dependencies of the special target `.SUFFIXES' are the list of
  624.      suffixes to be used in checking for suffix rules.  *Note
  625.      Old-Fashioned Suffix Rules: Suffix Rules.
  626.  
  627. `.DEFAULT'
  628.      The commands specified for `.DEFAULT' are used for any target for
  629.      which no rules are found (either explicit rules or implicit rules).
  630.      *Note Last Resort::.  If `.DEFAULT' commands are specified, every
  631.      file mentioned as a dependency, but not as a target in a rule,
  632.      will have these commands executed on its behalf.  *Note Implicit
  633.      Rule Search Algorithm: Search Algorithm.
  634.  
  635. `.PRECIOUS'
  636.      The targets which `.PRECIOUS' depends on are given the following
  637.      special treatment: if `make' is killed or interrupted during the
  638.      execution of their commands, the target is not deleted.  *Note
  639.      Interrupting or Killing `make': Interrupts.  Also, if the target
  640.      is an intermediate file, it will not be deleted after it is no
  641.      longer needed, as is normally done.  *Note Chains of Implicit
  642.      Rules: Chained Rules.
  643.  
  644.      You can also list the target pattern of an implicit rule (such as
  645.      `%.o') as a dependency file of the special target `.PRECIOUS' to
  646.      preserve intermediate files created by rules whose target patterns
  647.      match that file's name.
  648.  
  649. `.IGNORE'
  650.      Simply by being mentioned as a target, `.IGNORE' says to ignore
  651.      errors in execution of commands.  The dependencies and commands for
  652.      `.IGNORE' are not meaningful.
  653.  
  654.      `.IGNORE' exists for historical compatibility.  Since `.IGNORE'
  655.      affects every command in the makefile, it is not very useful; we
  656.      recommend you use the more selective ways to ignore errors in
  657.      specific commands.  *Note Errors in Commands: Errors.
  658.  
  659. `.SILENT'
  660.      Simply by being mentioned as a target, `.SILENT' says not to print
  661.      commands before executing them.  The dependencies and commands for
  662.      `.SILENT' are not meaningful.
  663.  
  664.      `.SILENT' exists for historical compatibility.  We recommend you
  665.      use the more selective ways to silence specific commands.  *Note
  666.      Command Echoing: Echoing.  If you want to silence all commands for
  667.      a particular run of `make', use the `-s' or `--silent' option
  668.      (*note Options Summary::.).
  669.  
  670. `.EXPORT_ALL_VARIABLES'
  671.      Simply by being mentioned as a target, this tells `make' to export
  672.      all variables to child processes by default.  *Note Communicating
  673.      Variables to a Sub-`make': Variables/Recursion.
  674.  
  675.    Any defined implicit rule suffix also counts as a special target if
  676. it appears as a target, and so does the concatenation of two suffixes,
  677. such as `.c.o'.  These targets are suffix rules, an obsolete way of
  678. defining implicit rules (but a way still widely used).  In principle,
  679. any target name could be special in this way if you break it in two and
  680. add both pieces to the suffix list.  In practice, suffixes normally
  681. begin with `.', so these special target names also begin with `.'.
  682. *Note Old-Fashioned Suffix Rules: Suffix Rules.
  683.  
  684. 
  685. File: make.info,  Node: Multiple Targets,  Next: Multiple Rules,  Prev: Special Targets,  Up: Rules
  686.  
  687. Multiple Targets in a Rule
  688. ==========================
  689.  
  690.    A rule with multiple targets is equivalent to writing many rules,
  691. each with one target, and all identical aside from that.  The same
  692. commands apply to all the targets, but their effects may vary because
  693. you can substitute the actual target name into the command using `$@'.
  694. The rule contributes the same dependencies to all the targets also.
  695.  
  696.    This is useful in two cases.
  697.  
  698.    * You want just dependencies, no commands.  For example:
  699.  
  700.           kbd.o command.o files.o: command.h
  701.  
  702.      gives an additional dependency to each of the three object files
  703.      mentioned.
  704.  
  705.    * Similar commands work for all the targets.  The commands do not
  706.      need to be absolutely identical, since the automatic variable `$@'
  707.      can be used to substitute the particular target to be remade into
  708.      the commands (*note Automatic Variables: Automatic.).  For example:
  709.  
  710.           bigoutput littleoutput : text.g
  711.                   generate text.g -$(subst output,,$@) > $@
  712.  
  713.      is equivalent to
  714.  
  715.           bigoutput : text.g
  716.                   generate text.g -big > bigoutput
  717.           littleoutput : text.g
  718.                   generate text.g -little > littleoutput
  719.  
  720.      Here we assume the hypothetical program `generate' makes two types
  721.      of output, one if given `-big' and one if given `-little'.  *Note
  722.      Functions for String Substitution and Analysis: Text Functions,
  723.      for an explanation of the `subst' function.
  724.  
  725.    Suppose you would like to vary the dependencies according to the
  726. target, much as the variable `$@' allows you to vary the commands.  You
  727. cannot do this with multiple targets in an ordinary rule, but you can
  728. do it with a "static pattern rule".  *Note Static Pattern Rules: Static
  729. Pattern.
  730.  
  731. 
  732. File: make.info,  Node: Multiple Rules,  Next: Static Pattern,  Prev: Multiple Targets,  Up: Rules
  733.  
  734. Multiple Rules for One Target
  735. =============================
  736.  
  737.    One file can be the target of several rules.  All the dependencies
  738. mentioned in all the rules are merged into one list of dependencies for
  739. the target.  If the target is older than any dependency from any rule,
  740. the commands are executed.
  741.  
  742.    There can only be one set of commands to be executed for a file.  If
  743. more than one rule gives commands for the same file, `make' uses the
  744. last set given and prints an error message.  (As a special case, if the
  745. file's name begins with a dot, no error message is printed.  This odd
  746. behavior is only for compatibility with other implementations of
  747. `make'.) There is no reason to write your makefiles this way; that is
  748. why `make' gives you an error message.
  749.  
  750.    An extra rule with just dependencies can be used to give a few extra
  751. dependencies to many files at once.  For example, one usually has a
  752. variable named `objects' containing a list of all the compiler output
  753. files in the system being made.  An easy way to say that all of them
  754. must be recompiled if `config.h' changes is to write the following:
  755.  
  756.      objects = foo.o bar.o
  757.      foo.o : defs.h
  758.      bar.o : defs.h test.h
  759.      $(objects) : config.h
  760.  
  761.    This could be inserted or taken out without changing the rules that
  762. really specify how to make the object files, making it a convenient
  763. form to use if you wish to add the additional dependency intermittently.
  764.  
  765.    Another wrinkle is that the additional dependencies could be
  766. specified with a variable that you set with a command argument to `make'
  767. (*note Overriding Variables: Overriding.).  For example,
  768.  
  769.      extradeps=
  770.      $(objects) : $(extradeps)
  771.  
  772. means that the command `make extradeps=foo.h' will consider `foo.h' as
  773. a dependency of each object file, but plain `make' will not.
  774.  
  775.    If none of the explicit rules for a target has commands, then `make'
  776. searches for an applicable implicit rule to find some commands *note
  777. Using Implicit Rules: Implicit Rules.).
  778.  
  779. 
  780. File: make.info,  Node: Static Pattern,  Next: Double-Colon,  Prev: Multiple Rules,  Up: Rules
  781.  
  782. Static Pattern Rules
  783. ====================
  784.  
  785.    "Static pattern rules" are rules which specify multiple targets and
  786. construct the dependency names for each target based on the target name.
  787. They are more general than ordinary rules with multiple targets because
  788. the targets do not have to have identical dependencies.  Their
  789. dependencies must be *analogous*, but not necessarily *identical*.
  790.  
  791. * Menu:
  792.  
  793. * Static Usage::                The syntax of static pattern rules.
  794. * Static versus Implicit::      When are they better than implicit rules?
  795.  
  796. 
  797. File: make.info,  Node: Static Usage,  Next: Static versus Implicit,  Up: Static Pattern
  798.  
  799. Syntax of Static Pattern Rules
  800. ------------------------------
  801.  
  802.    Here is the syntax of a static pattern rule:
  803.  
  804.      TARGETS ...: TARGET-PATTERN: DEP-PATTERNS ...
  805.              COMMANDS
  806.              ...
  807.  
  808. The TARGETS list specifies the targets that the rule applies to.  The
  809. targets can contain wildcard characters, just like the targets of
  810. ordinary rules (*note Using Wildcard Characters in File Names:
  811. Wildcards.).
  812.  
  813.    The TARGET-PATTERN and DEP-PATTERNS say how to compute the
  814. dependencies of each target.  Each target is matched against the
  815. TARGET-PATTERN to extract a part of the target name, called the "stem".
  816. This stem is substituted into each of the DEP-PATTERNS to make the
  817. dependency names (one from each DEP-PATTERN).
  818.  
  819.    Each pattern normally contains the character `%' just once.  When the
  820. TARGET-PATTERN matches a target, the `%' can match any part of the
  821. target name; this part is called the "stem".  The rest of the pattern
  822. must match exactly.  For example, the target `foo.o' matches the
  823. pattern `%.o', with `foo' as the stem.  The targets `foo.c' and
  824. `foo.out' do not match that pattern.
  825.  
  826.    The dependency names for each target are made by substituting the
  827. stem for the `%' in each dependency pattern.  For example, if one
  828. dependency pattern is `%.c', then substitution of the stem `foo' gives
  829. the dependency name `foo.c'.  It is legitimate to write a dependency
  830. pattern that does not contain `%'; then this dependency is the same for
  831. all targets.
  832.  
  833.    `%' characters in pattern rules can be quoted with preceding
  834. backslashes (`\').  Backslashes that would otherwise quote `%'
  835. characters can be quoted with more backslashes.  Backslashes that quote
  836. `%' characters or other backslashes are removed from the pattern before
  837. it is compared to file names or has a stem substituted into it.
  838. Backslashes that are not in danger of quoting `%' characters go
  839. unmolested.  For example, the pattern `the\%weird\\%pattern\\' has
  840. `the%weird\' preceding the operative `%' character, and `pattern\\'
  841. following it.  The final two backslashes are left alone because they
  842. cannot affect any `%' character.
  843.  
  844.    Here is an example, which compiles each of `foo.o' and `bar.o' from
  845. the corresponding `.c' file:
  846.  
  847.      objects = foo.o bar.o
  848.      
  849.      $(objects): %.o: %.c
  850.              $(CC) -c $(CFLAGS) $< -o $@
  851.  
  852. Here `$<' is the automatic variable that holds the name of the
  853. dependency and `$@' is the automatic variable that holds the name of
  854. the target; see *Note Automatic Variables: Automatic.
  855.  
  856.    Each target specified must match the target pattern; a warning is
  857. issued for each target that does not.  If you have a list of files,
  858. only some of which will match the pattern, you can use the `filter'
  859. function to remove nonmatching file names (*note Functions for String
  860. Substitution and Analysis: Text Functions.):
  861.  
  862.      files = foo.elc bar.o lose.o
  863.      
  864.      $(filter %.o,$(files)): %.o: %.c
  865.              $(CC) -c $(CFLAGS) $< -o $@
  866.      $(filter %.elc,$(files)): %.elc: %.el
  867.              emacs -f batch-byte-compile $<
  868.  
  869. In this example the result of `$(filter %.o,$(files))' is `bar.o
  870. lose.o', and the first static pattern rule causes each of these object
  871. files to be updated by compiling the corresponding C source file.  The
  872. result of `$(filter %.elc,$(files))' is `foo.elc', so that file is made
  873. from `foo.el'.
  874.  
  875.    Another example shows how to use `$*' in static pattern rules:
  876.  
  877.      bigoutput littleoutput : %output : text.g
  878.              generate text.g -$* > $@
  879.  
  880. When the `generate' command is run, `$*' will expand to the stem,
  881. either `big' or `little'.
  882.  
  883. 
  884. File: make.info,  Node: Static versus Implicit,  Prev: Static Usage,  Up: Static Pattern
  885.  
  886. Static Pattern Rules versus Implicit Rules
  887. ------------------------------------------
  888.  
  889.    A static pattern rule has much in common with an implicit rule
  890. defined as a pattern rule (*note Defining and Redefining Pattern Rules:
  891. Pattern Rules.).  Both have a pattern for the target and patterns for
  892. constructing the names of dependencies.  The difference is in how
  893. `make' decides *when* the rule applies.
  894.  
  895.    An implicit rule *can* apply to any target that matches its pattern,
  896. but it *does* apply only when the target has no commands otherwise
  897. specified, and only when the dependencies can be found.  If more than
  898. one implicit rule appears applicable, only one applies; the choice
  899. depends on the order of rules.
  900.  
  901.    By contrast, a static pattern rule applies to the precise list of
  902. targets that you specify in the rule.  It cannot apply to any other
  903. target and it invariably does apply to each of the targets specified.
  904. If two conflicting rules apply, and both have commands, that's an error.
  905.  
  906.    The static pattern rule can be better than an implicit rule for these
  907. reasons:
  908.  
  909.    * You may wish to override the usual implicit rule for a few files
  910.      whose names cannot be categorized syntactically but can be given
  911.      in an explicit list.
  912.  
  913.    * If you cannot be sure of the precise contents of the directories
  914.      you are using, you may not be sure which other irrelevant files
  915.      might lead `make' to use the wrong implicit rule.  The choice
  916.      might depend on the order in which the implicit rule search is
  917.      done.  With static pattern rules, there is no uncertainty: each
  918.      rule applies to precisely the targets specified.
  919.  
  920. 
  921. File: make.info,  Node: Double-Colon,  Next: Automatic Dependencies,  Prev: Static Pattern,  Up: Rules
  922.  
  923. Double-Colon Rules
  924. ==================
  925.  
  926.    "Double-colon" rules are rules written with `::' instead of `:'
  927. after the target names.  They are handled differently from ordinary
  928. rules when the same target appears in more than one rule.
  929.  
  930.    When a target appears in multiple rules, all the rules must be the
  931. same type: all ordinary, or all double-colon.  If they are
  932. double-colon, each of them is independent of the others.  Each
  933. double-colon rule's commands are executed if the target is older than
  934. any dependencies of that rule.  This can result in executing none, any,
  935. or all of the double-colon rules.
  936.  
  937.    Double-colon rules with the same target are in fact completely
  938. separate from one another.  Each double-colon rule is processed
  939. individually, just as rules with different targets are processed.
  940.  
  941.    The double-colon rules for a target are executed in the order they
  942. appear in the makefile.  However, the cases where double-colon rules
  943. really make sense are those where the order of executing the commands
  944. would not matter.
  945.  
  946.    Double-colon rules are somewhat obscure and not often very useful;
  947. they provide a mechanism for cases in which the method used to update a
  948. target differs depending on which dependency files caused the update,
  949. and such cases are rare.
  950.  
  951.    Each double-colon rule should specify commands; if it does not, an
  952. implicit rule will be used if one applies.  *Note Using Implicit Rules:
  953. Implicit Rules.
  954.  
  955. 
  956. File: make.info,  Node: Automatic Dependencies,  Prev: Double-Colon,  Up: Rules
  957.  
  958. Generating Dependencies Automatically
  959. =====================================
  960.  
  961.    In the makefile for a program, many of the rules you need to write
  962. often say only that some object file depends on some header file.  For
  963. example, if `main.c' uses `defs.h' via an `#include', you would write:
  964.  
  965.      main.o: defs.h
  966.  
  967. You need this rule so that `make' knows that it must remake `main.o'
  968. whenever `defs.h' changes.  You can see that for a large program you
  969. would have to write dozens of such rules in your makefile.  And, you
  970. must always be very careful to update the makefile every time you add
  971. or remove an `#include'.
  972.  
  973.    To avoid this hassle, most modern C compilers can write these rules
  974. for you, by looking at the `#include' lines in the source files.
  975. Usually this is done with the `-M' option to the compiler.  For
  976. example, the command:
  977.  
  978.      cc -M main.c
  979.  
  980. generates the output:
  981.  
  982.      main.o : main.c defs.h
  983.  
  984. Thus you no longer have to write all those rules yourself.  The
  985. compiler will do it for you.
  986.  
  987.    With old `make' programs, it was traditional practice to use this
  988. compiler feature to generate dependencies on demand with a command like
  989. `make depend'.  That command would create a file `depend' containing
  990. all the automatically-generated dependencies; then the makefile could
  991. use `include' to read them in (*note Include::.).
  992.  
  993.    In GNU `make', the feature of remaking makefiles makes this practice
  994. obsolete--you need never tell `make' explicitly to regenerate the
  995. dependencies, because it always regenerates any makefile that is out of
  996. date.  *Note Remaking Makefiles::.
  997.  
  998.    The practice we recommend for automatic dependency generation is to
  999. have one makefile corresponding to each source file.  For each source
  1000. file `NAME.c' there is a makefile `NAME.d' which lists what files the
  1001. object file `NAME.o' depends on.  That way only the source files that
  1002. have changed need to be rescanned to produce the new dependencies.
  1003.  
  1004.    Here is the pattern rule to generate a file of dependencies (i.e., a
  1005. makefile) called `NAME.d' from a C source file called `NAME.c':
  1006.  
  1007.      %.d: %.c
  1008.          $(CC) -M $(CPPFLAGS) $< | sed 's/$*.o/& $@/g' > $@
  1009.  
  1010. *Note Pattern Rules::, for information on defining pattern rules.  The
  1011. purpose of the `sed' command is to translate (for example):
  1012.  
  1013.      main.o : main.c defs.h
  1014.  
  1015. into:
  1016.  
  1017.      main.o main.d : main.c defs.h
  1018.  
  1019. This makes each `.d' file depend on all the source and header files
  1020. that the corresponding `.o' file depends on.  `make' then knows it must
  1021. regenerate the dependencies whenever any of the source or header files
  1022. changes.
  1023.  
  1024.    Once you've defined the rule to remake the `.d' files, you then use
  1025. the `include' directive to read them all in.  *Note Include::.  For
  1026. example:
  1027.  
  1028.      sources = foo.c bar.c
  1029.      
  1030.      include $(sources:.c=.d)
  1031.  
  1032. (This example uses a substitution variable reference to translate the
  1033. list of source files `foo.c bar.c' into a list of dependency makefiles,
  1034. `foo.d bar.d'.  *Note Substitution Refs::, for full information on
  1035. substitution references.)  Since the `.d' files are makefiles like any
  1036. others, `make' will remake them as necessary with no further work from
  1037. you.  *Note Remaking Makefiles::.
  1038.  
  1039. 
  1040. File: make.info,  Node: Commands,  Next: Using Variables,  Prev: Rules,  Up: Top
  1041.  
  1042. Writing the Commands in Rules
  1043. *****************************
  1044.  
  1045.    The commands of a rule consist of shell command lines to be executed
  1046. one by one.  Each command line must start with a tab, except that the
  1047. first command line may be attached to the target-and-dependencies line
  1048. with a semicolon in between.  Blank lines and lines of just comments
  1049. may appear among the command lines; they are ignored.
  1050.  
  1051.    Users use many different shell programs, but commands in makefiles
  1052. are always interpreted by `/bin/sh' unless the makefile specifies
  1053. otherwise.  *Note Command Execution: Execution.
  1054.  
  1055.    The shell that is in use determines whether comments can be written
  1056. on command lines, and what syntax they use.  When the shell is
  1057. `/bin/sh', a `#' starts a comment that extends to the end of the line.
  1058. The `#' does not have to be at the beginning of a line.  Text on a line
  1059. before a `#' is not part of the comment.
  1060.  
  1061. * Menu:
  1062.  
  1063. * Echoing::                     How to control when commands are echoed.
  1064. * Execution::                   How commands are executed.
  1065. * Parallel::                    How commands can be executed in parallel.
  1066. * Errors::                      What happens after a command execution error.
  1067. * Interrupts::                  What happens when a command is interrupted.
  1068. * Recursion::                   Invoking `make' from makefiles.
  1069. * Sequences::                   Defining canned sequences of commands.
  1070. * Empty Commands::              Defining useful, do-nothing commands.
  1071.  
  1072. 
  1073. File: make.info,  Node: Echoing,  Next: Execution,  Up: Commands
  1074.  
  1075. Command Echoing
  1076. ===============
  1077.  
  1078.    Normally `make' prints each command line before it is executed.  We
  1079. call this "echoing" because it gives the appearance that you are typing
  1080. the commands yourself.
  1081.  
  1082.    When a line starts with `@', the echoing of that line is suppressed.
  1083. The `@' is discarded before the command is passed to the shell.
  1084. Typically you would use this for a command whose only effect is to print
  1085. something, such as an `echo' command to indicate progress through the
  1086. makefile:
  1087.  
  1088.      @echo About to make distribution files
  1089.  
  1090.    When `make' is given the flag `-n' or `--just-print', echoing is all
  1091. that happens, no execution.  *Note Summary of Options: Options Summary.
  1092. In this case and only this case, even the commands starting with `@'
  1093. are printed.  This flag is useful for finding out which commands `make'
  1094. thinks are necessary without actually doing them.
  1095.  
  1096.    The `-s' or `--silent' flag to `make' prevents all echoing, as if
  1097. all commands started with `@'.  A rule in the makefile for the special
  1098. target `.SILENT' has the same effect (*note Special Built-in Target
  1099. Names: Special Targets.).  `.SILENT' is essentially obsolete since `@'
  1100. is more flexible.
  1101.  
  1102. 
  1103. File: make.info,  Node: Execution,  Next: Parallel,  Prev: Echoing,  Up: Commands
  1104.  
  1105. Command Execution
  1106. =================
  1107.  
  1108.    When it is time to execute commands to update a target, they are
  1109. executed by making a new subshell for each line.  (In practice, `make'
  1110. may take shortcuts that do not affect the results.)
  1111.  
  1112.    *Please note:* this implies that shell commands such as `cd' that
  1113. set variables local to each process will not affect the following
  1114. command lines.  If you want to use `cd' to affect the next command, put
  1115. the two on a single line with a semicolon between them.  Then `make'
  1116. will consider them a single command and pass them, together, to a shell
  1117. which will execute them in sequence.  For example:
  1118.  
  1119.      foo : bar/lose
  1120.              cd bar; gobble lose > ../foo
  1121.  
  1122.    If you would like to split a single shell command into multiple
  1123. lines of text, you must use a backslash at the end of all but the last
  1124. subline.  Such a sequence of lines is combined into a single line, by
  1125. deleting the backslash-newline sequences, before passing it to the
  1126. shell.  Thus, the following is equivalent to the preceding example:
  1127.  
  1128.      foo : bar/lose
  1129.              cd bar;  \
  1130.              gobble lose > ../foo
  1131.  
  1132.    The program used as the shell is taken from the variable `SHELL'.
  1133. By default, the program `/bin/sh' is used.
  1134.  
  1135.    Unlike most variables, the variable `SHELL' is never set from the
  1136. environment.  This is because the `SHELL' environment variable is used
  1137. to specify your personal choice of shell program for interactive use.
  1138. It would be very bad for personal choices like this to affect the
  1139. functioning of makefiles.  *Note Variables from the Environment:
  1140. Environment.
  1141.  
  1142. 
  1143. File: make.info,  Node: Parallel,  Next: Errors,  Prev: Execution,  Up: Commands
  1144.  
  1145. Parallel Execution
  1146. ==================
  1147.  
  1148.    GNU `make' knows how to execute several commands at once.  Normally,
  1149. `make' will execute only one command at a time, waiting for it to
  1150. finish before executing the next.  However, the `-j' or `--jobs' option
  1151. tells `make' to execute many commands simultaneously.
  1152.  
  1153.    If the `-j' option is followed by an integer, this is the number of
  1154. commands to execute at once; this is called the number of "job slots".
  1155. If there is nothing looking like an integer after the `-j' option,
  1156. there is no limit on the number of job slots.  The default number of job
  1157. slots is one, which means serial execution (one thing at a time).
  1158.  
  1159.    One unpleasant consequence of running several commands
  1160. simultaneously is that output from all of the commands comes when the
  1161. commands send it, so messages from different commands may be
  1162. interspersed.
  1163.  
  1164.    Another problem is that two processes cannot both take input from the
  1165. same device; so to make sure that only one command tries to take input
  1166. from the terminal at once, `make' will invalidate the standard input
  1167. streams of all but one running command.  This means that attempting to
  1168. read from standard input will usually be a fatal error (a `Broken pipe'
  1169. signal) for most child processes if there are several.
  1170.  
  1171.    It is unpredictable which command will have a valid standard input
  1172. stream (which will come from the terminal, or wherever you redirect the
  1173. standard input of `make').  The first command run will always get it
  1174. first, and the first command started after that one finishes will get
  1175. it next, and so on.
  1176.  
  1177.    We will change how this aspect of `make' works if we find a better
  1178. alternative.  In the mean time, you should not rely on any command using
  1179. standard input at all if you are using the parallel execution feature;
  1180. but if you are not using this feature, then standard input works
  1181. normally in all commands.
  1182.  
  1183.    If a command fails (is killed by a signal or exits with a nonzero
  1184. status), and errors are not ignored for that command (*note Errors in
  1185. Commands: Errors.), the remaining command lines to remake the same
  1186. target will not be run.  If a command fails and the `-k' or
  1187. `--keep-going' option was not given (*note Summary of Options: Options
  1188. Summary.), `make' aborts execution.  If make terminates for any reason
  1189. (including a signal) with child processes running, it waits for them to
  1190. finish before actually exiting.
  1191.  
  1192.    When the system is heavily loaded, you will probably want to run
  1193. fewer jobs than when it is lightly loaded.  You can use the `-l' option
  1194. to tell `make' to limit the number of jobs to run at once, based on the
  1195. load average.  The `-l' or `--max-load' option is followed by a
  1196. floating-point number.  For example,
  1197.  
  1198.      -l 2.5
  1199.  
  1200. will not let `make' start more than one job if the load average is
  1201. above 2.5.  The `-l' option with no following number removes the load
  1202. limit, if one was given with a previous `-l' option.
  1203.  
  1204.    More precisely, when `make' goes to start up a job, and it already
  1205. has at least one job running, it checks the current load average; if it
  1206. is not lower than the limit given with `-l', `make' waits until the load
  1207. average goes below that limit, or until all the other jobs finish.
  1208.  
  1209.    By default, there is no load limit.
  1210.  
  1211.