home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / make.info-5 (.txt) < prev    next >
GNU Info File  |  1994-11-12  |  48KB  |  861 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: Overriding,  Next: Testing,  Prev: Avoiding Compilation,  Up: Running
  22. Overriding Variables
  23. ====================
  24.    An argument that contains `=' specifies the value of a variable:
  25. `V=X' sets the value of the variable V to X.  If you specify a value in
  26. this way, all ordinary assignments of the same variable in the makefile
  27. are ignored; we say they have been "overridden" by the command line
  28. argument.
  29.    The most common way to use this facility is to pass extra flags to
  30. compilers.  For example, in a properly written makefile, the variable
  31. `CFLAGS' is included in each command that runs the C compiler, so a
  32. file `foo.c' would be compiled something like this:
  33.      cc -c $(CFLAGS) foo.c
  34.    Thus, whatever value you set for `CFLAGS' affects each compilation
  35. that occurs.  The makefile probably specifies the usual value for
  36. `CFLAGS', like this:
  37.      CFLAGS=-g
  38.    Each time you run `make', you can override this value if you wish.
  39. For example, if you say `make CFLAGS='-g -O'', each C compilation will
  40. be done with `cc -c -g -O'.  (This illustrates how you can use quoting
  41. in the shell to enclose spaces and other special characters in the
  42. value of a variable when you override it.)
  43.    The variable `CFLAGS' is only one of many standard variables that
  44. exist just so that you can change them this way.  *Note Variables Used
  45. by Implicit Rules: Implicit Variables, for a complete list.
  46.    You can also program the makefile to look at additional variables of
  47. your own, giving the user the ability to control other aspects of how
  48. the makefile works by changing the variables.
  49.    When you override a variable with a command argument, you can define
  50. either a recursively-expanded variable or a simply-expanded variable.
  51. The examples shown above make a recursively-expanded variable; to make a
  52. simply-expanded variable, write `:=' instead of `='.  But, unless you
  53. want to include a variable reference or function call in the *value*
  54. that you specify, it makes no difference which kind of variable you
  55. create.
  56.    There is one way that the makefile can change a variable that you
  57. have overridden.  This is to use the `override' directive, which is a
  58. line that looks like this: `override VARIABLE = VALUE' (*note The
  59. `override' Directive: Override Directive.).
  60. File: make.info,  Node: Testing,  Next: Options Summary,  Prev: Overriding,  Up: Running
  61. Testing the Compilation of a Program
  62. ====================================
  63.    Normally, when an error happens in executing a shell command, `make'
  64. gives up immediately, returning a nonzero status.  No further commands
  65. are executed for any target.  The error implies that the goal cannot be
  66. correctly remade, and `make' reports this as soon as it knows.
  67.    When you are compiling a program that you have just changed, this is
  68. not what you want.  Instead, you would rather that `make' try compiling
  69. every file that can be tried, to show you as many compilation errors as
  70. possible.
  71.    On these occasions, you should use the `-k' or `--keep-going' flag.
  72. This tells `make' to continue to consider the other dependencies of the
  73. pending targets, remaking them if necessary, before it gives up and
  74. returns nonzero status.  For example, after an error in compiling one
  75. object file, `make -k' will continue compiling other object files even
  76. though it already knows that linking them will be impossible.  In
  77. addition to continuing after failed shell commands, `make -k' will
  78. continue as much as possible after discovering that it does not know
  79. how to make a target or dependency file.  This will always cause an
  80. error message, but without `-k', it is a fatal error (*note Summary of
  81. Options: Options Summary.).
  82.    The usual behavior of `make' assumes that your purpose is to get the
  83. goals up to date; once `make' learns that this is impossible, it might
  84. as well report the failure immediately.  The `-k' flag says that the
  85. real purpose is to test as much as possible of the changes made in the
  86. program, perhaps to find several independent problems so that you can
  87. correct them all before the next attempt to compile.  This is why Emacs'
  88. `M-x compile' command passes the `-k' flag by default.
  89. File: make.info,  Node: Options Summary,  Prev: Testing,  Up: Running
  90. Summary of Options
  91. ==================
  92.    Here is a table of all the options `make' understands:
  93.      These options are ignored for compatibility with other versions of
  94.      `make'.
  95. `-C DIR'
  96. `--directory=DIR'
  97.      Change to directory DIR before reading the makefiles.  If multiple
  98.      `-C' options are specified, each is interpreted relative to the
  99.      previous one: `-C / -C etc' is equivalent to `-C /etc'.  This is
  100.      typically used with recursive invocations of `make' (*note
  101.      Recursive Use of `make': Recursion.).
  102. `--debug'
  103.      Print debugging information in addition to normal processing.  The
  104.      debugging information says which files are being considered for
  105.      remaking, which file-times are being compared and with what
  106.      results, which files actually need to be remade, which implicit
  107.      rules are considered and which are applied--everything interesting
  108.      about how `make' decides what to do.
  109. `--environment-overrides'
  110.      Give variables taken from the environment precedence over
  111.      variables from makefiles.  *Note Variables from the Environment:
  112.      Environment.
  113. `-f FILE'
  114. `--file=FILE'
  115. `--makefile=FILE'
  116.      Read the file named FILE as a makefile.  *Note Writing Makefiles:
  117.      Makefiles.
  118. `--help'
  119.      Remind you of the options that `make' understands and then exit.
  120. `--ignore-errors'
  121.      Ignore all errors in commands executed to remake files.  *Note
  122.      Errors in Commands: Errors.
  123. `-I DIR'
  124. `--include-dir=DIR'
  125.      Specifies a directory DIR to search for included makefiles.  *Note
  126.      Including Other Makefiles: Include.  If several `-I' options are
  127.      used to specify several directories, the directories are searched
  128.      in the order specified.
  129. `-j [JOBS]'
  130. `--jobs=[JOBS]'
  131.      Specifies the number of jobs (commands) to run simultaneously.
  132.      With no argument, `make' runs as many jobs simultaneously as
  133.      possible.  If there is more than one `-j' option, the last one is
  134.      effective.  *Note Parallel Execution: Parallel, for more
  135.      information on how commands are run.
  136. `--keep-going'
  137.      Continue as much as possible after an error.  While the target that
  138.      failed, and those that depend on it, cannot be remade, the other
  139.      dependencies of these targets can be processed all the same.
  140.      *Note Testing the Compilation of a Program: Testing.
  141. `-l [LOAD]'
  142. `--load-average[=LOAD]'
  143. `--max-load[=LOAD]'
  144.      Specifies that no new jobs (commands) should be started if there
  145.      are other jobs running and the load average is at least LOAD (a
  146.      floating-point number).  With no argument, removes a previous load
  147.      limit.  *Note Parallel Execution: Parallel.
  148. `--just-print'
  149. `--dry-run'
  150. `--recon'
  151.      Print the commands that would be executed, but do not execute them.
  152.      *Note Instead of Executing the Commands: Instead of Execution.
  153. `-o FILE'
  154. `--old-file=FILE'
  155. `--assu