home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / make.info-3 (.txt) < prev    next >
GNU Info File  |  1994-11-12  |  51KB  |  928 lines

  1. This is Info file make.info, produced by Makeinfo-1.55 from the input
  2. file ./make.texinfo.
  3.    This file documents the GNU Make utility, which determines
  4. automatically which pieces of a large program need to be recompiled,
  5. and issues the commands to recompile them.
  6.    This is Edition 0.47, last updated 1 November 1994, of `The GNU Make
  7. Manual', for `make', Version 3.72 Beta.
  8.    Copyright (C) 1988, '89, '90, '91, '92, '93, '94 Free Software
  9. Foundation, Inc.
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided that
  15. the entire resulting derived work is distributed under the terms of a
  16. permission notice identical to this one.
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that this permission notice may be stated in a
  20. translation approved by the Free Software Foundation.
  21. File: make.info,  Node: Parallel,  Next: Errors,  Prev: Execution,  Up: Commands
  22. Parallel Execution
  23. ==================
  24.    GNU `make' knows how to execute several commands at once.  Normally,
  25. `make' will execute only one command at a time, waiting for it to
  26. finish before executing the next.  However, the `-j' or `--jobs' option
  27. tells `make' to execute many commands simultaneously.
  28.    If the `-j' option is followed by an integer, this is the number of
  29. commands to execute at once; this is called the number of "job slots".
  30. If there is nothing looking like an integer after the `-j' option,
  31. there is no limit on the number of job slots.  The default number of job
  32. slots is one, which means serial execution (one thing at a time).
  33.    One unpleasant consequence of running several commands
  34. simultaneously is that output from all of the commands comes when the
  35. commands send it, so messages from different commands may be
  36. interspersed.
  37.    Another problem is that two processes cannot both take input from the
  38. same device; so to make sure that only one command tries to take input
  39. from the terminal at once, `make' will invalidate the standard input
  40. streams of all but one running command.  This means that attempting to
  41. read from standard input will usually be a fatal error (a `Broken pipe'
  42. signal) for most child processes if there are several.
  43.    It is unpredictable which command will have a valid standard input
  44. stream (which will come from the terminal, or wherever you redirect the
  45. standard input of `make').  The first command run will always get it
  46. first, and the first command started after that one finishes will get
  47. it next, and so on.
  48.    We will change how this aspect of `make' works if we find a better
  49. alternative.  In the mean time, you should not rely on any command using
  50. standard input at all if you are using the parallel execution feature;
  51. but if you are not using this feature, then standard input works
  52. normally in all commands.
  53.    If a command fails (is killed by a signal or exits with a nonzero
  54. status), and errors are not ignored for that command (*note Errors in
  55. Commands: Errors.), the remaining command lines to remake the same
  56. target will not be run.  If a command fails and the `-k' or
  57. `--keep-going' option was not given (*note Summary of Options: Options
  58. Summary.), `make' aborts execution.  If make terminates for any reason
  59. (including a signal) with child processes running, it waits for them to
  60. finish before actually exiting.
  61.    When the system is heavily loaded, you will probably want to run
  62. fewer jobs than when it is lightly loaded.  You can use the `-l' option
  63. to tell `make' to limit the number of jobs to run at once, based on the
  64. load average.  The `-l' or `--max-load' option is followed by a
  65. floating-point number.  For example,
  66.      -l 2.5
  67. will not let `make' start more than one job if the load average is
  68. above 2.5.  The `-l' option with no following number removes the load
  69. limit, if one was given with a previous `-l' option.
  70.    More precisely, when `make' goes to start up a job, and it already
  71. has at least one job running, it checks the current load average; if it
  72. is not lower than the limit given with `-l', `make' waits until the load
  73. average goes below that limit, or until all the other jobs finish.
  74.    By default, there is no load limit.
  75. File: make.info,  Node: Errors,  Next: Interrupts,  Prev: Parallel,  Up: Commands
  76. Errors in Commands
  77. ==================
  78.    After each shell command returns, `make' looks at its exit status.
  79. If the command completed successfully, the next command line is executed
  80. in a new shell; after the last command line is finished, the rule is
  81. finished.
  82.    If there is an error (the exit status is nonzero), `make' gives up on
  83. the current rule, and perhaps on all rules.
  84.    Sometimes the failure of a certain command does not indicate a
  85. problem.  For example, you may use the `mkdir' command to ensure that a
  86. directory exists.  If the directory already exists, `mkdir' will report
  87. an error, but you probably want `make' to continue regardless.
  88.    To ignore errors in a command line, write a `-' at the beginning of
  89. the line's text (after the initial tab).  The `-' is discarded before
  90. the command is passed to the shell for execution.
  91.    For example,
  92.      clean:
  93.              -rm -f *.o
  94. This causes `rm' to continue even if it is unable to remove a file.
  95.    When you run `make' with the `-i' or `--ignore-errors' flag, errors
  96. are ignored in all commands of all rules.  A rule in the makefile for
  97. the special target `.IGNORE' has the same effect, if there are no
  98. dependencies.  These ways of ignoring errors are obsolete because `-'
  99. is more flexible.
  100.    When errors are to be ignored, because of either a `-' or the `-i'
  101. flag, `make' treats an error return just like success, except that it
  102. prints out a message that tells you the status code the command exited
  103. with, and says that the error has been ignored.
  104.    When an error happens that `make' has not been told to ignore, it
  105. implies that the current target cannot be correctly remade, and neither
  106. can any other that depends on it either directly or indirectly.  No
  107. further commands will be executed for these targets, since their
  108. preconditions have not been achieved.
  109.    Normally `make' gives up immediately in this circumstance, returning
  110. a nonzero status.  However, if the `-k' or `--keep-going' flag is
  111. specified, `make' continues to consider the other dependencies of the
  112. pending targets, remaking them if necessary, before it gives up and
  113. returns nonzero status.  For example, after an error in compiling one
  114. object file, `make -k' will continue compiling other object files even
  115. though it already knows that linking them will be impossible.  *Note
  116. Summary of Options: Options Summary.
  117.    The usual behavior assumes that your purpose is to get the specified
  118. targets up to date; once `make' learns that this is impossible, it
  119. might as well report the failure immediately.  The `-k' option says
  120. that the real purpose is to test as many of the changes made in the
  121. program as possible, perhaps to find several independent problems so
  122. that you can correct them all before the next attempt to compile.  This
  123. is why Emacs' `compile' command passes the `-k' flag by default.
  124.    Usually when a command fails, if it has changed the target file at
  125. all, the file is corrupted and cannot be used--or at least it is not
  126. completely updated.  Yet the file's timestamp says that it is now up to
  127. date, so the next time `make' runs, it will not try to update that
  128. file.  The situation is just the same as when the command is killed by a
  129. signal; *note Interrupts::..  So generally the right thing to do is to
  130. delete the target file if the command fails after beginning to change
  131. the file.  `make' will do this if `.DELETE_ON_ERROR' appears as a
  132. target.  This is almost always what you want `make' to do, but it is
  133. not historical practice; so for compatibility, you must explicitly
  134. request it.
  135. File: make.info,  Node: Interrupts,  Next: Recursion,  Prev: Errors,  Up: Commands
  136. Interrupting or Killing `make'
  137. =============================