home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / info / make.info-1 < prev    next >
Encoding:
GNU Info File  |  1996-10-12  |  49.7 KB  |  1,143 lines

  1. This is Info file make.info, produced by Makeinfo-1.64 from the input
  2. file /ade-src/fsf/make/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.51, last updated 9 May 1996, of `The GNU Make
  9. Manual', for `make', Version 3.75 Beta.
  10.  
  11.    Copyright (C) 1988, '89, '90, '91, '92, '93, '94, '95, '96
  12. Free Software 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: Top,  Next: Overview,  Prev: (dir),  Up: (dir)
  30.  
  31. Make
  32. ****
  33.  
  34.    The GNU `make' utility automatically determines which pieces of a
  35. large program need to be recompiled, and issues the commands to
  36. recompile them.
  37.  
  38.    This is Edition 0.51 of the `GNU Make Manual', last updated 9 May
  39. 1996 for `make' Version 3.75 Beta.
  40.  
  41.    This manual describes `make' and contains the following chapters:
  42.  
  43. * Menu:
  44.  
  45. * Overview::                    Overview of `make'.
  46. * Introduction::                An introduction to `make'.
  47. * Makefiles::                   Makefiles tell `make' what to do.
  48. * Rules::                       Rules describe when a file must be remade.
  49. * Commands::                    Commands say how to remake a file.
  50. * Using Variables::             You can use variables to avoid repetition.
  51. * Conditionals::                Use or ignore parts of the makefile based
  52.                                  on the values of variables.
  53. * Functions::                   Many powerful ways to manipulate text.
  54. * make Invocation: Running.     How to invoke `make' on the command line.
  55. * Implicit Rules::              Use implicit rules to treat many files alike,
  56.                                  based on their file names.
  57. * Archives::                    How `make' can update library archives.
  58. * Features::                    Features GNU `make' has over other `make's.
  59. * Missing::                     What GNU `make' lacks from other `make's.
  60. * Makefile Conventions::        Conventions for makefiles in GNU programs.
  61. * Quick Reference::             A quick reference for experienced users.
  62. * Complex Makefile::            A real example of a straightforward,
  63.                                  but nontrivial, makefile.
  64. * Concept Index::               Index of Concepts
  65. * Name Index::                  Index of Functions, Variables, & Directives
  66.  
  67.  -- The Detailed Node Listing --
  68.  
  69. Overview of `make'
  70.  
  71. * Preparing::                   Preparing and Running Make
  72. * Reading::                     On Reading this Text
  73. * Bugs::                        Problems and Bugs
  74.  
  75. An Introduction to Makefiles
  76.  
  77. * Rule Introduction::           What a rule looks like.
  78. * Simple Makefile::             A Simple Makefile
  79. * How Make Works::              How `make' Processes This Makefile
  80. * Variables Simplify::          Variables Make Makefiles Simpler
  81. * make Deduces::                Letting `make' Deduce the Commands
  82. * Combine By Dependency::       Another Style of Makefile
  83. * Cleanup::                     Rules for Cleaning the Directory
  84.  
  85. Writing Makefiles
  86.  
  87. * Makefile Contents::           What makefiles contain.
  88. * Makefile Names::              How to name your makefile.
  89. * Include::                     How one makefile can use another makefile.
  90. * MAKEFILES Variable::          The environment can specify extra makefiles.
  91. * Remaking Makefiles::          How makefiles get remade.
  92. * Overriding Makefiles::        How to override part of one makefile
  93.                                  with another makefile.
  94.  
  95. Writing Rules
  96.  
  97. * Rule Example::                An example explained.
  98. * Rule Syntax::                 General syntax explained.
  99. * Wildcards::                   Using wildcard characters such as `*'.
  100. * Directory Search::            Searching other directories for source files.
  101. * Phony Targets::               Using a target that is not a real file's name.
  102. * Force Targets::               You can use a target without commands
  103.                                   or dependencies to mark other
  104.                                   targets as phony.
  105. * Empty Targets::               When only the date matters and the
  106.                                   files are empty.
  107. * Special Targets::             Targets with special built-in meanings.
  108. * Multiple Targets::            When to make use of several targets in a rule.
  109. * Multiple Rules::              How to use several rules with the same target.
  110. * Static Pattern::              Static pattern rules apply to multiple targets
  111.                                   and can vary the dependencies according to
  112.                                   the target name.
  113. * Double-Colon::                How to use a special kind of rule to allow
  114.                                   several independent rules for one target.
  115. * Automatic Dependencies::      How to automatically generate rules giving
  116.                                  dependencies from the source files themselves.
  117.  
  118. Using Wildcard Characters in File Names
  119.  
  120. * Wildcard Examples::           Several examples
  121. * Wildcard Pitfall::            Problems to avoid.
  122. * Wildcard Function::           How to cause wildcard expansion where
  123.                                   it does not normally take place.
  124.  
  125. Searching Directories for Dependencies
  126.  
  127. * General Search::              Specifying a search path that applies
  128.                                   to every dependency.
  129. * Selective Search::            Specifying a search path
  130.                                   for a specified class of names.
  131. * Commands/Search::             How to write shell commands that work together
  132.                                   with search paths.
  133. * Implicit/Search::             How search paths affect implicit rules.
  134. * Libraries/Search::            Directory search for link libraries.
  135.  
  136. Static Pattern Rules
  137.  
  138. * Static Usage::                The syntax of static pattern rules.
  139. * Static versus Implicit::      When are they better than implicit rules?
  140.  
  141. Writing the Commands in Rules
  142.  
  143. * Echoing::                     How to control when commands are echoed.
  144. * Execution::                   How commands are executed.
  145. * Parallel::                    How commands can be executed in parallel.
  146. * Errors::                      What happens after a command execution error.
  147. * Interrupts::                  What happens when a command is interrupted.
  148. * Recursion::                   Invoking `make' from makefiles.
  149. * Sequences::                   Defining canned sequences of commands.
  150. * Empty Commands::              Defining useful, do-nothing commands.
  151.  
  152. Recursive Use of `make'
  153.  
  154. * MAKE Variable::               The special effects of using `$(MAKE)'.
  155. * Variables/Recursion::         How to communicate variables to a sub-`make'.
  156. * Options/Recursion::           How to communicate options to a sub-`make'.
  157. * -w Option::                   How the `-w' or `--print-directory' option
  158.                                  helps debug use of recursive `make' commands.
  159.  
  160. How to Use Variables
  161.  
  162. * Reference::                   How to use the value of a variable.
  163. * Flavors::                     Variables come in two flavors.
  164. * Advanced::                    Advanced features for referencing a variable.
  165. * Values::                      All the ways variables get their values.
  166. * Setting::                     How to set a variable in the makefile.
  167. * Appending::                   How to append more text to the old value
  168.                                   of a variable.
  169. * Override Directive::          How to set a variable in the makefile even if
  170.                                   the user has set it with a command argument.
  171. * Defining::                    An alternate way to set a variable
  172.                                   to a verbatim string.
  173. * Environment::                 Variable values can come from the environment.
  174.  
  175. Advanced Features for Reference to Variables
  176.  
  177. * Substitution Refs::           Referencing a variable with
  178.                                   substitutions on the value.
  179. * Computed Names::              Computing the name of the variable to refer to.
  180.  
  181. Conditional Parts of Makefiles
  182.  
  183. * Conditional Example::         Example of a conditional
  184. * Conditional Syntax::          The syntax of conditionals.
  185. * Testing Flags::               Conditionals that test flags.
  186.  
  187. Functions for Transforming Text
  188.  
  189. * Syntax of Functions::         How to write a function call.
  190. * Text Functions::              General-purpose text manipulation functions.
  191. * Filename Functions::          Functions for manipulating file names.
  192. * Foreach Function::            Repeat some text with controlled variation.
  193. * Origin Function::             Find where a variable got its value.
  194. * Shell Function::              Substitute the output of a shell command.
  195.  
  196. How to Run `make'
  197.  
  198. * Makefile Arguments::          How to specify which makefile to use.
  199. * Goals::                       How to use goal arguments to specify which
  200.                                   parts of the makefile to use.
  201. * Instead of Execution::        How to use mode flags to specify what
  202.                                   kind of thing to do with the commands
  203.                                   in the makefile other than simply
  204.                                   execute them.
  205. * Avoiding Compilation::        How to avoid recompiling certain files.
  206. * Overriding::                  How to override a variable to specify
  207.                                   an alternate compiler and other things.
  208. * Testing::                     How to proceed past some errors, to
  209.                                   test compilation.
  210. * Options Summary::             Summary of Options
  211.  
  212. Using Implicit Rules
  213.  
  214. * Using Implicit::              How to use an existing implicit rule
  215.                                   to get the commands for updating a file.
  216. * Catalogue of Rules::          A list of built-in implicit rules.
  217. * Implicit Variables::          How to change what predefined rules do.
  218. * Chained Rules::               How to use a chain of implicit rules.
  219. * Pattern Rules::               How to define new implicit rules.
  220. * Last Resort::                 How to defining commands for rules
  221.                                   which cannot find any.
  222. * Suffix Rules::                The old-fashioned style of implicit rule.
  223. * Search Algorithm::            The precise algorithm for applying
  224.                                   implicit rules.
  225.  
  226. Defining and Redefining Pattern Rules
  227.  
  228. * Pattern Intro::               An introduction to pattern rules.
  229. * Pattern Examples::            Examples of pattern rules.
  230. * Automatic::                   How to use automatic variables in the
  231.                                   commands of implicit rules.
  232. * Pattern Match::               How patterns match.
  233. * Match-Anything Rules::        Precautions you should take prior to
  234.                                   defining rules that can match any
  235.                                   target file whatever.
  236. * Canceling Rules::             How to override or cancel built-in rules.
  237.  
  238. Using `make' to Update Archive Files
  239.  
  240. * Archive Members::             Archive members as targets.
  241. * Archive Update::              The implicit rule for archive member targets.
  242. * Archive Suffix Rules::        You can write a special kind of suffix rule
  243.                                   for updating archives.
  244.  
  245. Implicit Rule for Archive Member Targets
  246.  
  247. * Archive Symbols::             How to update archive symbol directories.
  248.  
  249. 
  250. File: make.info,  Node: Overview,  Next: Introduction,  Prev: Top,  Up: Top
  251.  
  252. Overview of `make'
  253. ******************
  254.  
  255.    The `make' utility automatically determines which pieces of a large
  256. program need to be recompiled, and issues commands to recompile them.
  257. This manual describes GNU `make', which was implemented by Richard
  258. Stallman and Roland McGrath.  GNU `make' conforms to section 6.2 of
  259. `IEEE Standard 1003.2-1992' (POSIX.2).
  260.  
  261.    Our examples show C programs, since they are most common, but you
  262. can use `make' with any programming language whose compiler can be run
  263. with a shell command.  Indeed, `make' is not limited to programs.  You
  264. can use it to describe any task where some files must be updated
  265. automatically from others whenever the others change.
  266.  
  267. * Menu:
  268.  
  269. * Preparing::                   Preparing and Running Make
  270. * Reading::                     On Reading this Text
  271. * Bugs::                        Problems and Bugs
  272.  
  273. 
  274. File: make.info,  Node: Preparing,  Next: Reading,  Up: Overview
  275.  
  276. Preparing and Running Make
  277. ==========================
  278.  
  279.    To prepare to use `make', you must write a file called the
  280. "makefile" that describes the relationships among files in your program
  281. and provides commands for updating each file.  In a program, typically,
  282. the executable file is updated from object files, which are in turn
  283. made by compiling source files.
  284.  
  285.    Once a suitable makefile exists, each time you change some source
  286. files, this simple shell command:
  287.  
  288.      make
  289.  
  290. suffices to perform all necessary recompilations.  The `make' program
  291. uses the makefile data base and the last-modification times of the
  292. files to decide which of the files need to be updated.  For each of
  293. those files, it issues the commands recorded in the data base.
  294.  
  295.    You can provide command line arguments to `make' to control which
  296. files should be recompiled, or how.  *Note How to Run `make': Running.
  297.  
  298. 
  299. File: make.info,  Node: Reading,  Next: Bugs,  Prev: Preparing,  Up: Overview
  300.  
  301. How to Read This Manual
  302. =======================
  303.  
  304.    If you are new to `make', or are looking for a general introduction,
  305. read the first few sections of each chapter, skipping the later
  306. sections.  In each chapter, the first few sections contain introductory
  307. or general information and the later sections contain specialized or
  308. technical information.  The exception is the second chapter, *Note An
  309. Introduction to Makefiles: Introduction, all of which is introductory.
  310.  
  311.    If you are familiar with other `make' programs, see *Note Features
  312. of GNU `make': Features, which lists the enhancements GNU `make' has,
  313. and *Note Incompatibilities and Missing Features: Missing, which
  314. explains the few things GNU `make' lacks that others have.
  315.  
  316.    For a quick summary, see *Note Options Summary::, *Note Quick
  317. Reference::, and *Note Special Targets::.
  318.  
  319. 
  320. File: make.info,  Node: Bugs,  Prev: Reading,  Up: Overview
  321.  
  322. Problems and Bugs
  323. =================
  324.  
  325.    If you have problems with GNU `make' or think you've found a bug,
  326. please report it to the developers; we cannot promise to do anything but
  327. we might well want to fix it.
  328.  
  329.    Before reporting a bug, make sure you've actually found a real bug.
  330. Carefully reread the documentation and see if it really says you can do
  331. what you're trying to do.  If it's not clear whether you should be able
  332. to do something or not, report that too; it's a bug in the
  333. documentation!
  334.  
  335.    Before reporting a bug or trying to fix it yourself, try to isolate
  336. it to the smallest possible makefile that reproduces the problem.  Then
  337. send us the makefile and the exact results `make' gave you.  Also say
  338. what you expected to occur; this will help us decide whether the
  339. problem was really in the documentation.
  340.  
  341.    Once you've got a precise problem, please send electronic mail either
  342. through the Internet or via UUCP:
  343.  
  344.      Internet address:
  345.          bug-gnu-utils@prep.ai.mit.edu
  346.      
  347.      UUCP path:
  348.          mit-eddie!prep.ai.mit.edu!bug-gnu-utils
  349.  
  350. Please include the version number of `make' you are using.  You can get
  351. this information with the command `make --version'.  Be sure also to
  352. include the type of machine and operating system you are using.  If
  353. possible, include the contents of the file `config.h' that is generated
  354. by the configuration process.
  355.  
  356. 
  357. File: make.info,  Node: Introduction,  Next: Makefiles,  Prev: Overview,  Up: Top
  358.  
  359. An Introduction to Makefiles
  360. ****************************
  361.  
  362.    You need a file called a "makefile" to tell `make' what to do.  Most
  363. often, the makefile tells `make' how to compile and link a program.
  364.  
  365.    In this chapter, we will discuss a simple makefile that describes
  366. how to compile and link a text editor which consists of eight C source
  367. files and three header files.  The makefile can also tell `make' how to
  368. run miscellaneous commands when explicitly asked (for example, to remove
  369. certain files as a clean-up operation).  To see a more complex example
  370. of a makefile, see *Note Complex Makefile::.
  371.  
  372.    When `make' recompiles the editor, each changed C source file must
  373. be recompiled.  If a header file has changed, each C source file that
  374. includes the header file must be recompiled to be safe.  Each
  375. compilation produces an object file corresponding to the source file.
  376. Finally, if any source file has been recompiled, all the object files,
  377. whether newly made or saved from previous compilations, must be linked
  378. together to produce the new executable editor.
  379.  
  380. * Menu:
  381.  
  382. * Rule Introduction::           What a rule looks like.
  383. * Simple Makefile::             A Simple Makefile
  384. * How Make Works::              How `make' Processes This Makefile
  385. * Variables Simplify::          Variables Make Makefiles Simpler
  386. * make Deduces::                Letting `make' Deduce the Commands
  387. * Combine By Dependency::       Another Style of Makefile
  388. * Cleanup::                     Rules for Cleaning the Directory
  389.  
  390. 
  391. File: make.info,  Node: Rule Introduction,  Next: Simple Makefile,  Up: Introduction
  392.  
  393. What a Rule Looks Like
  394. ======================
  395.  
  396.    A simple makefile consists of "rules" with the following shape:
  397.  
  398.      TARGET ... : DEPENDENCIES ...
  399.              COMMAND
  400.              ...
  401.              ...
  402.  
  403.    A "target" is usually the name of a file that is generated by a
  404. program; examples of targets are executable or object files.  A target
  405. can also be the name of an action to carry out, such as `clean' (*note
  406. Phony Targets::.).
  407.  
  408.    A "dependency" is a file that is used as input to create the target.
  409. A target often depends on several files.
  410.  
  411.    A "command" is an action that `make' carries out.  A rule may have
  412. more than one command, each on its own line.  *Please note:* you need
  413. to put a tab character at the beginning of every command line!  This is
  414. an obscurity that catches the unwary.
  415.  
  416.    Usually a command is in a rule with dependencies and serves to
  417. create a target file if any of the dependencies change.  However, the
  418. rule that specifies commands for the target need not have dependencies.
  419. For example, the rule containing the delete command associated with the
  420. target `clean' does not have dependencies.
  421.  
  422.    A "rule", then, explains how and when to remake certain files which
  423. are the targets of the particular rule.  `make' carries out the
  424. commands on the dependencies to create or update the target.  A rule
  425. can also explain how and when to carry out an action.  *Note Writing
  426. Rules: Rules.
  427.  
  428.    A makefile may contain other text besides rules, but a simple
  429. makefile need only contain rules.  Rules may look somewhat more
  430. complicated than shown in this template, but all fit the pattern more
  431. or less.
  432.  
  433. 
  434. File: make.info,  Node: Simple Makefile,  Next: How Make Works,  Prev: Rule Introduction,  Up: Introduction
  435.  
  436. A Simple Makefile
  437. =================
  438.  
  439.    Here is a straightforward makefile that describes the way an
  440. executable file called `edit' depends on eight object files which, in
  441. turn, depend on eight C source and three header files.
  442.  
  443.    In this example, all the C files include `defs.h', but only those
  444. defining editing commands include `command.h', and only low level files
  445. that change the editor buffer include `buffer.h'.
  446.  
  447.      edit : main.o kbd.o command.o display.o \
  448.             insert.o search.o files.o utils.o
  449.              cc -o edit main.o kbd.o command.o display.o \
  450.                         insert.o search.o files.o utils.o
  451.      
  452.      main.o : main.c defs.h
  453.              cc -c main.c
  454.      kbd.o : kbd.c defs.h command.h
  455.              cc -c kbd.c
  456.      command.o : command.c defs.h command.h
  457.              cc -c command.c
  458.      display.o : display.c defs.h buffer.h
  459.              cc -c display.c
  460.      insert.o : insert.c defs.h buffer.h
  461.              cc -c insert.c
  462.      search.o : search.c defs.h buffer.h
  463.              cc -c search.c
  464.      files.o : files.c defs.h buffer.h command.h
  465.              cc -c files.c
  466.      utils.o : utils.c defs.h
  467.              cc -c utils.c
  468.      clean :
  469.              rm edit main.o kbd.o command.o display.o \
  470.                 insert.o search.o files.o utils.o
  471.  
  472. We split each long line into two lines using backslash-newline; this is
  473. like using one long line, but is easier to read.
  474.  
  475.    To use this makefile to create the executable file called `edit',
  476. type:
  477.  
  478.      make
  479.  
  480.    To use this makefile to delete the executable file and all the object
  481. files from the directory, type:
  482.  
  483.      make clean
  484.  
  485.    In the example makefile, the targets include the executable file
  486. `edit', and the object files `main.o' and `kbd.o'.  The dependencies
  487. are files such as `main.c' and `defs.h'.  In fact, each `.o' file is
  488. both a target and a dependency.  Commands include `cc -c main.c' and
  489. `cc -c kbd.c'.
  490.  
  491.    When a target is a file, it needs to be recompiled or relinked if any
  492. of its dependencies change.  In addition, any dependencies that are
  493. themselves automatically generated should be updated first.  In this
  494. example, `edit' depends on each of the eight object files; the object
  495. file `main.o' depends on the source file `main.c' and on the header
  496. file `defs.h'.
  497.  
  498.    A shell command follows each line that contains a target and
  499. dependencies.  These shell commands say how to update the target file.
  500. A tab character must come at the beginning of every command line to
  501. distinguish commands lines from other lines in the makefile.  (Bear in
  502. mind that `make' does not know anything about how the commands work.
  503. It is up to you to supply commands that will update the target file
  504. properly.  All `make' does is execute the commands in the rule you have
  505. specified when the target file needs to be updated.)
  506.  
  507.    The target `clean' is not a file, but merely the name of an action.
  508. Since you normally do not want to carry out the actions in this rule,
  509. `clean' is not a dependency of any other rule.  Consequently, `make'
  510. never does anything with it unless you tell it specifically.  Note that
  511. this rule not only is not a dependency, it also does not have any
  512. dependencies, so the only purpose of the rule is to run the specified
  513. commands.  Targets that do not refer to files but are just actions are
  514. called "phony targets".  *Note Phony Targets::, for information about
  515. this kind of target.  *Note Errors in Commands: Errors, to see how to
  516. cause `make' to ignore errors from `rm' or any other command.
  517.  
  518. 
  519. File: make.info,  Node: How Make Works,  Next: Variables Simplify,  Prev: Simple Makefile,  Up: Introduction
  520.  
  521. How `make' Processes a Makefile
  522. ===============================
  523.  
  524.    By default, `make' starts with the first target (not targets whose
  525. names start with `.').  This is called the "default goal".  ("Goals"
  526. are the targets that `make' strives ultimately to update.  *Note
  527. Arguments to Specify the Goals: Goals.)
  528.  
  529.    In the simple example of the previous section, the default goal is to
  530. update the executable program `edit'; therefore, we put that rule first.
  531.  
  532.    Thus, when you give the command:
  533.  
  534.      make
  535.  
  536. `make' reads the makefile in the current directory and begins by
  537. processing the first rule.  In the example, this rule is for relinking
  538. `edit'; but before `make' can fully process this rule, it must process
  539. the rules for the files that `edit' depends on, which in this case are
  540. the object files.  Each of these files is processed according to its
  541. own rule.  These rules say to update each `.o' file by compiling its
  542. source file.  The recompilation must be done if the source file, or any
  543. of the header files named as dependencies, is more recent than the
  544. object file, or if the object file does not exist.
  545.  
  546.    The other rules are processed because their targets appear as
  547. dependencies of the goal.  If some other rule is not depended on by the
  548. goal (or anything it depends on, etc.), that rule is not processed,
  549. unless you tell `make' to do so (with a command such as `make clean').
  550.  
  551.    Before recompiling an object file, `make' considers updating its
  552. dependencies, the source file and header files.  This makefile does not
  553. specify anything to be done for them--the `.c' and `.h' files are not
  554. the targets of any rules--so `make' does nothing for these files.  But
  555. `make' would update automatically generated C programs, such as those
  556. made by Bison or Yacc, by their own rules at this time.
  557.  
  558.    After recompiling whichever object files need it, `make' decides
  559. whether to relink `edit'.  This must be done if the file `edit' does
  560. not exist, or if any of the object files are newer than it.  If an
  561. object file was just recompiled, it is now newer than `edit', so `edit'
  562. is relinked.
  563.  
  564.    Thus, if we change the file `insert.c' and run `make', `make' will
  565. compile that file to update `insert.o', and then link `edit'.  If we
  566. change the file `command.h' and run `make', `make' will recompile the
  567. object files `kbd.o', `command.o' and `files.o' and then link the file
  568. `edit'.
  569.  
  570. 
  571. File: make.info,  Node: Variables Simplify,  Next: make Deduces,  Prev: How Make Works,  Up: Introduction
  572.  
  573. Variables Make Makefiles Simpler
  574. ================================
  575.  
  576.    In our example, we had to list all the object files twice in the
  577. rule for `edit' (repeated here):
  578.  
  579.      edit : main.o kbd.o command.o display.o \
  580.                    insert.o search.o files.o utils.o
  581.              cc -o edit main.o kbd.o command.o display.o \
  582.                         insert.o search.o files.o utils.o
  583.  
  584.    Such duplication is error-prone; if a new object file is added to the
  585. system, we might add it to one list and forget the other.  We can
  586. eliminate the risk and simplify the makefile by using a variable.
  587. "Variables" allow a text string to be defined once and substituted in
  588. multiple places later (*note How to Use Variables: Using Variables.).
  589.  
  590.    It is standard practice for every makefile to have a variable named
  591. `objects', `OBJECTS', `objs', `OBJS', `obj', or `OBJ' which is a list
  592. of all object file names.  We would define such a variable `objects'
  593. with a line like this in the makefile:
  594.  
  595.      objects = main.o kbd.o command.o display.o \
  596.                insert.o search.o files.o utils.o
  597.  
  598. Then, each place we want to put a list of the object file names, we can
  599. substitute the variable's value by writing `$(objects)' (*note How to
  600. Use Variables: Using Variables.).
  601.  
  602.    Here is how the complete simple makefile looks when you use a
  603. variable for the object files:
  604.  
  605.      objects = main.o kbd.o command.o display.o \
  606.                insert.o search.o files.o utils.o
  607.      
  608.      edit : $(objects)
  609.              cc -o edit $(objects)
  610.      main.o : main.c defs.h
  611.              cc -c main.c
  612.      kbd.o : kbd.c defs.h command.h
  613.              cc -c kbd.c
  614.      command.o : command.c defs.h command.h
  615.              cc -c command.c
  616.      display.o : display.c defs.h buffer.h
  617.              cc -c display.c
  618.      insert.o : insert.c defs.h buffer.h
  619.              cc -c insert.c
  620.      search.o : search.c defs.h buffer.h
  621.              cc -c search.c
  622.      files.o : files.c defs.h buffer.h command.h
  623.              cc -c files.c
  624.      utils.o : utils.c defs.h
  625.              cc -c utils.c
  626.      clean :
  627.              rm edit $(objects)
  628.  
  629. 
  630. File: make.info,  Node: make Deduces,  Next: Combine By Dependency,  Prev: Variables Simplify,  Up: Introduction
  631.  
  632. Letting `make' Deduce the Commands
  633. ==================================
  634.  
  635.    It is not necessary to spell out the commands for compiling the
  636. individual C source files, because `make' can figure them out: it has an
  637. "implicit rule" for updating a `.o' file from a correspondingly named
  638. `.c' file using a `cc -c' command.  For example, it will use the
  639. command `cc -c main.c -o main.o' to compile `main.c' into `main.o'.  We
  640. can therefore omit the commands from the rules for the object files.
  641. *Note Using Implicit Rules: Implicit Rules.
  642.  
  643.    When a `.c' file is used automatically in this way, it is also
  644. automatically added to the list of dependencies.  We can therefore omit
  645. the `.c' files from the dependencies, provided we omit the commands.
  646.  
  647.    Here is the entire example, with both of these changes, and a
  648. variable `objects' as suggested above:
  649.  
  650.      objects = main.o kbd.o command.o display.o \
  651.                insert.o search.o files.o utils.o
  652.      
  653.      edit : $(objects)
  654.              cc -o edit $(objects)
  655.      
  656.      main.o : defs.h
  657.      kbd.o : defs.h command.h
  658.      command.o : defs.h command.h
  659.      display.o : defs.h buffer.h
  660.      insert.o : defs.h buffer.h
  661.      search.o : defs.h buffer.h
  662.      files.o : defs.h buffer.h command.h
  663.      utils.o : defs.h
  664.      
  665.      .PHONY : clean
  666.      clean :
  667.              -rm edit $(objects)
  668.  
  669. This is how we would write the makefile in actual practice.  (The
  670. complications associated with `clean' are described elsewhere.  See
  671. *Note Phony Targets::, and *Note Errors in Commands: Errors.)
  672.  
  673.    Because implicit rules are so convenient, they are important.  You
  674. will see them used frequently.
  675.  
  676. 
  677. File: make.info,  Node: Combine By Dependency,  Next: Cleanup,  Prev: make Deduces,  Up: Introduction
  678.  
  679. Another Style of Makefile
  680. =========================
  681.  
  682.    When the objects of a makefile are created only by implicit rules, an
  683. alternative style of makefile is possible.  In this style of makefile,
  684. you group entries by their dependencies instead of by their targets.
  685. Here is what one looks like:
  686.  
  687.      objects = main.o kbd.o command.o display.o \
  688.                insert.o search.o files.o utils.o
  689.      
  690.      edit : $(objects)
  691.              cc -o edit $(objects)
  692.      
  693.      $(objects) : defs.h
  694.      kbd.o command.o files.o : command.h
  695.      display.o insert.o search.o files.o : buffer.h
  696.  
  697. Here `defs.h' is given as a dependency of all the object files;
  698. `command.h' and `buffer.h' are dependencies of the specific object
  699. files listed for them.
  700.  
  701.    Whether this is better is a matter of taste: it is more compact, but
  702. some people dislike it because they find it clearer to put all the
  703. information about each target in one place.
  704.  
  705. 
  706. File: make.info,  Node: Cleanup,  Prev: Combine By Dependency,  Up: Introduction
  707.  
  708. Rules for Cleaning the Directory
  709. ================================
  710.  
  711.    Compiling a program is not the only thing you might want to write
  712. rules for.  Makefiles commonly tell how to do a few other things besides
  713. compiling a program: for example, how to delete all the object files
  714. and executables so that the directory is `clean'.
  715.  
  716.    Here is how we could write a `make' rule for cleaning our example
  717. editor:
  718.  
  719.      clean:
  720.              rm edit $(objects)
  721.  
  722.    In practice, we might want to write the rule in a somewhat more
  723. complicated manner to handle unanticipated situations.  We would do
  724. this:
  725.  
  726.      .PHONY : clean
  727.      clean :
  728.              -rm edit $(objects)
  729.  
  730. This prevents `make' from getting confused by an actual file called
  731. `clean' and causes it to continue in spite of errors from `rm'.  (See
  732. *Note Phony Targets::, and *Note Errors in Commands: Errors.)
  733.  
  734. A rule such as this should not be placed at the beginning of the
  735. makefile, because we do not want it to run by default!  Thus, in the
  736. example makefile, we want the rule for `edit', which recompiles the
  737. editor, to remain the default goal.
  738.  
  739.    Since `clean' is not a dependency of `edit', this rule will not run
  740. at all if we give the command `make' with no arguments.  In order to
  741. make the rule run, we have to type `make clean'.  *Note How to Run
  742. `make': Running.
  743.  
  744. 
  745. File: make.info,  Node: Makefiles,  Next: Rules,  Prev: Introduction,  Up: Top
  746.  
  747. Writing Makefiles
  748. *****************
  749.  
  750.    The information that tells `make' how to recompile a system comes
  751. from reading a data base called the "makefile".
  752.  
  753. * Menu:
  754.  
  755. * Makefile Contents::           What makefiles contain.
  756. * Makefile Names::              How to name your makefile.
  757. * Include::                     How one makefile can use another makefile.
  758. * MAKEFILES Variable::          The environment can specify extra makefiles.
  759. * Remaking Makefiles::          How makefiles get remade.
  760. * Overriding Makefiles::        How to override part of one makefile
  761.                                  with another makefile.
  762.  
  763. 
  764. File: make.info,  Node: Makefile Contents,  Next: Makefile Names,  Up: Makefiles
  765.  
  766. What Makefiles Contain
  767. ======================
  768.  
  769.    Makefiles contain five kinds of things: "explicit rules", "implicit
  770. rules", "variable definitions", "directives", and "comments".  Rules,
  771. variables, and directives are described at length in later chapters.
  772.  
  773.    * An "explicit rule" says when and how to remake one or more files,
  774.      called the rule's targets.  It lists the other files that the
  775.      targets "depend on", and may also give commands to use to create
  776.      or update the targets.  *Note Writing Rules: Rules.
  777.  
  778.    * An "implicit rule" says when and how to remake a class of files
  779.      based on their names.  It describes how a target may depend on a
  780.      file with a name similar to the target and gives commands to
  781.      create or update such a target.  *Note Using Implicit Rules:
  782.      Implicit Rules.
  783.  
  784.    * A "variable definition" is a line that specifies a text string
  785.      value for a variable that can be substituted into the text later.
  786.      The simple makefile example shows a variable definition for
  787.      `objects' as a list of all object files (*note Variables Make
  788.      Makefiles Simpler: Variables Simplify.).
  789.  
  790.    * A "directive" is a command for `make' to do something special while
  791.      reading the makefile.  These include:
  792.  
  793.         * Reading another makefile (*note Including Other Makefiles:
  794.           Include.).
  795.  
  796.         * Deciding (based on the values of variables) whether to use or
  797.           ignore a part of the makefile (*note Conditional Parts of
  798.           Makefiles: Conditionals.).
  799.  
  800.         * Defining a variable from a verbatim string containing
  801.           multiple lines (*note Defining Variables Verbatim: Defining.).
  802.  
  803.    * `#' in a line of a makefile starts a "comment".  It and the rest of
  804.      the line are ignored, except that a trailing backslash not escaped
  805.      by another backslash will continue the comment across multiple
  806.      lines.  Comments may appear on any of the lines in the makefile,
  807.      except within a `define' directive, and perhaps within commands
  808.      (where the shell decides what is a comment).  A line containing
  809.      just a comment (with perhaps spaces before it) is effectively
  810.      blank, and is ignored.
  811.  
  812. 
  813. File: make.info,  Node: Makefile Names,  Next: Include,  Prev: Makefile Contents,  Up: Makefiles
  814.  
  815. What Name to Give Your Makefile
  816. ===============================
  817.  
  818.    By default, when `make' looks for the makefile, it tries the
  819. following names, in order: `GNUmakefile', `makefile' and `Makefile'.
  820.  
  821.    Normally you should call your makefile either `makefile' or
  822. `Makefile'.  (We recommend `Makefile' because it appears prominently
  823. near the beginning of a directory listing, right near other important
  824. files such as `README'.)  The first name checked, `GNUmakefile', is not
  825. recommended for most makefiles.  You should use this name if you have a
  826. makefile that is specific to GNU `make', and will not be understood by
  827. other versions of `make'.  Other `make' programs look for `makefile' and
  828. `Makefile', but not `GNUmakefile'.
  829.  
  830.    If `make' finds none of these names, it does not use any makefile.
  831. Then you must specify a goal with a command argument, and `make' will
  832. attempt to figure out how to remake it using only its built-in implicit
  833. rules.  *Note Using Implicit Rules: Implicit Rules.
  834.  
  835.    If you want to use a nonstandard name for your makefile, you can
  836. specify the makefile name with the `-f' or `--file' option.  The
  837. arguments `-f NAME' or `--file=NAME' tell `make' to read the file NAME
  838. as the makefile.  If you use more than one `-f' or `--file' option, you
  839. can specify several makefiles.  All the makefiles are effectively
  840. concatenated in the order specified.  The default makefile names
  841. `GNUmakefile', `makefile' and `Makefile' are not checked automatically
  842. if you specify `-f' or `--file'.
  843.  
  844. 
  845. File: make.info,  Node: Include,  Next: MAKEFILES Variable,  Prev: Makefile Names,  Up: Makefiles
  846.  
  847. Including Other Makefiles
  848. =========================
  849.  
  850.    The `include' directive tells `make' to suspend reading the current
  851. makefile and read one or more other makefiles before continuing.  The
  852. directive is a line in the makefile that looks like this:
  853.  
  854.      include FILENAMES...
  855.  
  856. FILENAMES can contain shell file name patterns.
  857.  
  858.    Extra spaces are allowed and ignored at the beginning of the line,
  859. but a tab is not allowed.  (If the line begins with a tab, it will be
  860. considered a command line.)  Whitespace is required between `include'
  861. and the file names, and between file names; extra whitespace is ignored
  862. there and at the end of the directive.  A comment starting with `#' is
  863. allowed at the end of the line.  If the file names contain any variable
  864. or function references, they are expanded.  *Note How to Use Variables:
  865. Using Variables.
  866.  
  867.    For example, if you have three `.mk' files, `a.mk', `b.mk', and
  868. `c.mk', and `$(bar)' expands to `bish bash', then the following
  869. expression
  870.  
  871.      include foo *.mk $(bar)
  872.  
  873.    is equivalent to
  874.  
  875.      include foo a.mk b.mk c.mk bish bash
  876.  
  877.    When `make' processes an `include' directive, it suspends reading of
  878. the containing makefile and reads from each listed file in turn.  When
  879. that is finished, `make' resumes reading the makefile in which the
  880. directive appears.
  881.  
  882.    One occasion for using `include' directives is when several programs,
  883. handled by individual makefiles in various directories, need to use a
  884. common set of variable definitions (*note Setting Variables: Setting.)
  885. or pattern rules (*note Defining and Redefining Pattern Rules: Pattern
  886. Rules.).
  887.  
  888.    Another such occasion is when you want to generate dependencies from
  889. source files automatically; the dependencies can be put in a file that
  890. is included by the main makefile.  This practice is generally cleaner
  891. than that of somehow appending the dependencies to the end of the main
  892. makefile as has been traditionally done with other versions of `make'.
  893. *Note Automatic Dependencies::.
  894.  
  895.    If the specified name does not start with a slash, and the file is
  896. not found in the current directory, several other directories are
  897. searched.  First, any directories you have specified with the `-I' or
  898. `--include-dir' option are searched (*note Summary of Options: Options
  899. Summary.).  Then the following directories (if they exist) are
  900. searched, in this order: `PREFIX/include' (normally
  901. `/usr/local/include') `/usr/gnu/include', `/usr/local/include',
  902. `/usr/include'.
  903.  
  904.    If an included makefile cannot be found in any of these directories,
  905. a warning message is generated, but it is not an immediately fatal
  906. error; processing of the makefile containing the `include' continues.
  907. Once it has finished reading makefiles, `make' will try to remake any
  908. that are out of date or don't exist.  *Note How Makefiles Are Remade:
  909. Remaking Makefiles.  Only after it has tried to find a way to remake a
  910. makefile and failed, will `make' diagnose the missing makefile as a
  911. fatal error.
  912.  
  913.    If you want `make' to simply ignore a makefile which does not exist
  914. and cannot be remade, with no error message, use the `-include'
  915. directive instead of `include', like this:
  916.  
  917.      -include FILENAMES...
  918.  
  919.    This is acts like `include' in every way except that there is no
  920. error (not even a warning) if any of the FILENAMES do not exist.  For
  921. compatibility with some other `make' implementations, `sinclude' is
  922. another name for `-include'.
  923.  
  924. 
  925. File: make.info,  Node: MAKEFILES Variable,  Next: Remaking Makefiles,  Prev: Include,  Up: Makefiles
  926.  
  927. The Variable `MAKEFILES'
  928. ========================
  929.  
  930.    If the environment variable `MAKEFILES' is defined, `make' considers
  931. its value as a list of names (separated by whitespace) of additional
  932. makefiles to be read before the others.  This works much like the
  933. `include' directive: various directories are searched for those files
  934. (*note Including Other Makefiles: Include.).  In addition, the default
  935. goal is never taken from one of these makefiles and it is not an error
  936. if the files listed in `MAKEFILES' are not found.
  937.  
  938.    The main use of `MAKEFILES' is in communication between recursive
  939. invocations of `make' (*note Recursive Use of `make': Recursion.).  It
  940. usually is not desirable to set the environment variable before a
  941. top-level invocation of `make', because it is usually better not to
  942. mess with a makefile from outside.  However, if you are running `make'
  943. without a specific makefile, a makefile in `MAKEFILES' can do useful
  944. things to help the built-in implicit rules work better, such as
  945. defining search paths (*note Directory Search::.).
  946.  
  947.    Some users are tempted to set `MAKEFILES' in the environment
  948. automatically on login, and program makefiles to expect this to be done.
  949. This is a very bad idea, because such makefiles will fail to work if
  950. run by anyone else.  It is much better to write explicit `include'
  951. directives in the makefiles.  *Note Including Other Makefiles: Include.
  952.  
  953. 
  954. File: make.info,  Node: Remaking Makefiles,  Next: Overriding Makefiles,  Prev: MAKEFILES Variable,  Up: Makefiles
  955.  
  956. How Makefiles Are Remade
  957. ========================
  958.  
  959.    Sometimes makefiles can be remade from other files, such as RCS or
  960. SCCS files.  If a makefile can be remade from other files, you probably
  961. want `make' to get an up-to-date version of the makefile to read in.
  962.  
  963.    To this end, after reading in all makefiles, `make' will consider
  964. each as a goal target and attempt to update it.  If a makefile has a
  965. rule which says how to update it (found either in that very makefile or
  966. in another one) or if an implicit rule applies to it (*note Using
  967. Implicit Rules: Implicit Rules.), it will be updated if necessary.
  968. After all makefiles have been checked, if any have actually been
  969. changed, `make' starts with a clean slate and reads all the makefiles
  970. over again.  (It will also attempt to update each of them over again,
  971. but normally this will not change them again, since they are already up
  972. to date.)
  973.  
  974.    If the makefiles specify a double-colon rule to remake a file with
  975. commands but no dependencies, that file will always be remade (*note
  976. Double-Colon::.).  In the case of makefiles, a makefile that has a
  977. double-colon rule with commands but no dependencies will be remade every
  978. time `make' is run, and then again after `make' starts over and reads
  979. the makefiles in again.  This would cause an infinite loop: `make'
  980. would constantly remake the makefile, and never do anything else.  So,
  981. to avoid this, `make' will *not* attempt to remake makefiles which are
  982. specified as double-colon targets but have no dependencies.
  983.  
  984.    If you do not specify any makefiles to be read with `-f' or `--file'
  985. options, `make' will try the default makefile names; *note What Name to
  986. Give Your Makefile: Makefile Names..  Unlike makefiles explicitly
  987. requested with `-f' or `--file' options, `make' is not certain that
  988. these makefiles should exist.  However, if a default makefile does not
  989. exist but can be created by running `make' rules, you probably want the
  990. rules to be run so that the makefile can be used.
  991.  
  992.    Therefore, if none of the default makefiles exists, `make' will try
  993. to make each of them in the same order in which they are searched for
  994. (*note What Name to Give Your Makefile: Makefile Names.) until it
  995. succeeds in making one, or it runs out of names to try.  Note that it
  996. is not an error if `make' cannot find or make any makefile; a makefile
  997. is not always necessary.
  998.  
  999.    When you use the `-t' or `--touch' option (*note Instead of
  1000. Executing the Commands: Instead of Execution.), you would not want to
  1001. use an out-of-date makefile to decide which targets to touch.  So the
  1002. `-t' option has no effect on updating makefiles; they are really
  1003. updated even if `-t' is specified.  Likewise, `-q' (or `--question')
  1004. and `-n' (or `--just-print') do not prevent updating of makefiles,
  1005. because an out-of-date makefile would result in the wrong output for
  1006. other targets.  Thus, `make -f mfile -n foo' will update `mfile', read
  1007. it in, and then print the commands to update `foo' and its dependencies
  1008. without running them.  The commands printed for `foo' will be those
  1009. specified in the updated contents of `mfile'.
  1010.  
  1011.    However, on occasion you might actually wish to prevent updating of
  1012. even the makefiles.  You can do this by specifying the makefiles as
  1013. goals in the command line as well as specifying them as makefiles.
  1014. When the makefile name is specified explicitly as a goal, the options
  1015. `-t' and so on do apply to them.
  1016.  
  1017.    Thus, `make -f mfile -n mfile foo' would read the makefile `mfile',
  1018. print the commands needed to update it without actually running them,
  1019. and then print the commands needed to update `foo' without running
  1020. them.  The commands for `foo' will be those specified by the existing
  1021. contents of `mfile'.
  1022.  
  1023. 
  1024. File: make.info,  Node: Overriding Makefiles,  Prev: Remaking Makefiles,  Up: Makefiles
  1025.  
  1026. Overriding Part of Another Makefile
  1027. ===================================
  1028.  
  1029.    Sometimes it is useful to have a makefile that is mostly just like
  1030. another makefile.  You can often use the `include' directive to include
  1031. one in the other, and add more targets or variable definitions.
  1032. However, if the two makefiles give different commands for the same
  1033. target, `make' will not let you just do this.  But there is another way.
  1034.  
  1035.    In the containing makefile (the one that wants to include the other),
  1036. you can use a match-anything pattern rule to say that to remake any
  1037. target that cannot be made from the information in the containing
  1038. makefile, `make' should look in another makefile.  *Note Pattern
  1039. Rules::, for more information on pattern rules.
  1040.  
  1041.    For example, if you have a makefile called `Makefile' that says how
  1042. to make the target `foo' (and other targets), you can write a makefile
  1043. called `GNUmakefile' that contains:
  1044.  
  1045.      foo:
  1046.              frobnicate > foo
  1047.      
  1048.      %: force
  1049.              @$(MAKE) -f Makefile $@
  1050.      force: ;
  1051.  
  1052.    If you say `make foo', `make' will find `GNUmakefile', read it, and
  1053. see that to make `foo', it needs to run the command `frobnicate > foo'.
  1054. If you say `make bar', `make' will find no way to make `bar' in
  1055. `GNUmakefile', so it will use the commands from the pattern rule: `make
  1056. -f Makefile bar'.  If `Makefile' provides a rule for updating `bar',
  1057. `make' will apply the rule.  And likewise for any other target that
  1058. `GNUmakefile' does not say how to make.
  1059.  
  1060.    The way this works is that the pattern rule has a pattern of just
  1061. `%', so it matches any target whatever.  The rule specifies a
  1062. dependency `force', to guarantee that the commands will be run even if
  1063. the target file already exists.  We give `force' target empty commands
  1064. to prevent `make' from searching for an implicit rule to build
  1065. it--otherwise it would apply the same match-anything rule to `force'
  1066. itself and create a dependency loop!
  1067.  
  1068. 
  1069. File: make.info,  Node: Rules,  Next: Commands,  Prev: Makefiles,  Up: Top
  1070.  
  1071. Writing Rules
  1072. *************
  1073.  
  1074.    A "rule" appears in the makefile and says when and how to remake
  1075. certain files, called the rule's "targets" (most often only one per
  1076. rule).  It lists the other files that are the "dependencies" of the
  1077. target, and "commands" to use to create or update the target.
  1078.  
  1079.    The order of rules is not significant, except for determining the
  1080. "default goal": the target for `make' to consider, if you do not
  1081. otherwise specify one.  The default goal is the target of the first
  1082. rule in the first makefile.  If the first rule has multiple targets,
  1083. only the first target is taken as the default.  There are two
  1084. exceptions: a target starting with a period is not a default unless it
  1085. contains one or more slashes, `/', as well; and, a target that defines
  1086. a pattern rule has no effect on the default goal.  (*Note Defining and
  1087. Redefining Pattern Rules: Pattern Rules.)
  1088.  
  1089.    Therefore, we usually write the makefile so that the first rule is
  1090. the one for compiling the entire program or all the programs described
  1091. by the makefile (often with a target called `all').  *Note Arguments to
  1092. Specify the Goals: Goals.
  1093.  
  1094. * Menu:
  1095.  
  1096. * Rule Example::                An example explained.
  1097. * Rule Syntax::                 General syntax explained.
  1098. * Wildcards::                   Using wildcard characters such as `*'.
  1099. * Directory Search::            Searching other directories for source files.
  1100. * Phony Targets::               Using a target that is not a real file's name.
  1101. * Force Targets::               You can use a target without commands
  1102.                                   or dependencies to mark other
  1103.                                   targets as phony.
  1104. * Empty Targets::               When only the date matters and the
  1105.                                   files are empty.
  1106. * Special Targets::             Targets with special built-in meanings.
  1107. * Multiple Targets::            When to make use of several targets in a rule.
  1108. * Multiple Rules::              How to use several rules with the same target.
  1109. * Static Pattern::              Static pattern rules apply to multiple targets
  1110.                                   and can vary the dependencies according to
  1111.                                   the target name.
  1112. * Double-Colon::                How to use a special kind of rule to allow
  1113.                                   several independent rules for one target.
  1114. * Automatic Dependencies::      How to automatically generate rules giving
  1115.                                  dependencies from the source files themselves.
  1116.  
  1117. 
  1118. File: make.info,  Node: Rule Example,  Next: Rule Syntax,  Up: Rules
  1119.  
  1120. Rule Example
  1121. ============
  1122.  
  1123.    Here is an example of a rule:
  1124.  
  1125.      foo.o : foo.c defs.h       # module for twiddling the frobs
  1126.              cc -c -g foo.c
  1127.  
  1128.    Its target is `foo.o' and its dependencies are `foo.c' and `defs.h'.
  1129. It has one command, which is `cc -c -g foo.c'.  The command line
  1130. starts with a tab to identify it as a command.
  1131.  
  1132.    This rule says two things:
  1133.  
  1134.    * How to decide whether `foo.o' is out of date: it is out of date if
  1135.      it does not exist, or if either `foo.c' or `defs.h' is more recent
  1136.      than it.
  1137.  
  1138.    * How to update the file `foo.o': by running `cc' as stated.  The
  1139.      command does not explicitly mention `defs.h', but we presume that
  1140.      `foo.c' includes it, and that that is why `defs.h' was added to
  1141.      the dependencies.
  1142.  
  1143.