home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / make-3.70-bin.lha / info / make.info-1 next >
Encoding:
GNU Info File  |  1994-02-21  |  49.7 KB  |  1,147 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.45, last updated 14 December 1993, of `The GNU
  9. Make Manual', for `make', Version 3.70 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: 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.45 of the `GNU Make Manual', last updated 14
  39. December 1993 for `make' Version 3.70 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.    Non-bug suggestions are always welcome as well.  If you have
  357. questions about things that are unclear in the documentation or are
  358. just obscure features, contact Roland McGrath; he will try to help you
  359. out, although he may not have time to fix the problem.
  360.  
  361.    You can send electronic mail to Roland McGrath either through the
  362. Internet or via UUCP:
  363.  
  364.      Internet address:
  365.          roland@prep.ai.mit.edu
  366.      
  367.      UUCP path:
  368.          mit-eddie!prep.ai.mit.edu!roland
  369.  
  370. 
  371. File: make.info,  Node: Introduction,  Next: Makefiles,  Prev: Overview,  Up: Top
  372.  
  373. An Introduction to Makefiles
  374. ****************************
  375.  
  376.    You need a file called a "makefile" to tell `make' what to do.  Most
  377. often, the makefile tells `make' how to compile and link a program.
  378.  
  379.    In this chapter, we will discuss a simple makefile that describes
  380. how to compile and link a text editor which consists of eight C source
  381. files and three header files.  The makefile can also tell `make' how to
  382. run miscellaneous commands when explicitly asked (for example, to remove
  383. certain files as a clean-up operation).  To see a more complex example
  384. of a makefile, see *Note Complex Makefile::.
  385.  
  386.    When `make' recompiles the editor, each changed C source file must
  387. be recompiled.  If a header file has changed, each C source file that
  388. includes the header file must be recompiled to be safe.  Each
  389. compilation produces an object file corresponding to the source file.
  390. Finally, if any source file has been recompiled, all the object files,
  391. whether newly made or saved from previous compilations, must be linked
  392. together to produce the new executable editor.
  393.  
  394. * Menu:
  395.  
  396. * Rule Introduction::           What a rule looks like.
  397. * Simple Makefile::             A Simple Makefile
  398. * How Make Works::              How `make' Processes This Makefile
  399. * Variables Simplify::          Variables Make Makefiles Simpler
  400. * make Deduces::                Letting `make' Deduce the Commands
  401. * Combine By Dependency::       Another Style of Makefile
  402. * Cleanup::                     Rules for Cleaning the Directory
  403.  
  404. 
  405. File: make.info,  Node: Rule Introduction,  Next: Simple Makefile,  Up: Introduction
  406.  
  407. What a Rule Looks Like
  408. ======================
  409.  
  410.    A simple makefile consists of "rules" with the following shape:
  411.  
  412.      TARGET ... : DEPENDENCIES ...
  413.              COMMAND
  414.              ...
  415.              ...
  416.  
  417.    A "target" is usually the name of a file that is generated by a
  418. program; examples of targets are executable or object files.  A target
  419. can also be the name of an action to carry out, such as `clean' (*note
  420. Phony Targets::.).
  421.  
  422.    A "dependency" is a file that is used as input to create the target.
  423. A target often depends on several files.
  424.  
  425.    A "command" is an action that `make' carries out.  A rule may have
  426. more than one command, each on its own line.  *Please note:* you need
  427. to put a tab character at the beginning of every command line!  This is
  428. an obscurity that catches the unwary.
  429.  
  430.    Usually a command is in a rule with dependencies and serves to
  431. create a target file if any of the dependencies change.  However, the
  432. rule that specifies commands for the target need not have dependencies.
  433. For example, the rule containing the delete command associated with the
  434. target `clean' does not have dependencies.
  435.  
  436.    A "rule", then, explains how and when to remake certain files which
  437. are the targets of the particular rule.  `make' carries out the
  438. commands on the dependencies to create or update the target.  A rule
  439. can also explain how and when to carry out an action.  *Note Writing
  440. Rules: Rules.
  441.  
  442.    A makefile may contain other text besides rules, but a simple
  443. makefile need only contain rules.  Rules may look somewhat more
  444. complicated than shown in this template, but all fit the pattern more
  445. or less.
  446.  
  447. 
  448. File: make.info,  Node: Simple Makefile,  Next: How Make Works,  Prev: Rule Introduction,  Up: Introduction
  449.  
  450. A Simple Makefile
  451. =================
  452.  
  453.    Here is a straightforward makefile that describes the way an
  454. executable file called `edit' depends on eight object files which, in
  455. turn, depend on eight C source and three header files.
  456.  
  457.    In this example, all the C files include `defs.h', but only those
  458. defining editing commands include `command.h', and only low level files
  459. that change the editor buffer include `buffer.h'.
  460.  
  461.      edit : main.o kbd.o command.o display.o \
  462.             insert.o search.o files.o utils.o
  463.              cc -o edit main.o kbd.o command.o display.o \
  464.                         insert.o search.o files.o utils.o
  465.      
  466.      main.o : main.c defs.h
  467.              cc -c main.c
  468.      kbd.o : kbd.c defs.h command.h
  469.              cc -c kbd.c
  470.      command.o : command.c defs.h command.h
  471.              cc -c command.c
  472.      display.o : display.c defs.h buffer.h
  473.              cc -c display.c
  474.      insert.o : insert.c defs.h buffer.h
  475.              cc -c insert.c
  476.      search.o : search.c defs.h buffer.h
  477.              cc -c search.c
  478.      files.o : files.c defs.h buffer.h command.h
  479.              cc -c files.c
  480.      utils.o : utils.c defs.h
  481.              cc -c utils.c
  482.      clean :
  483.              rm edit main.o kbd.o command.o display.o \
  484.                 insert.o search.o files.o utils.o
  485.  
  486. We split each long line into two lines using backslash-newline; this is
  487. like using one long line, but is easier to read.
  488.  
  489.    To use this makefile to create the executable file called `edit',
  490. type:
  491.  
  492.      make
  493.  
  494.    To use this makefile to delete the executable file and all the object
  495. files from the directory, type:
  496.  
  497.      make clean
  498.  
  499.    In the example makefile, the targets include the executable file
  500. `edit', and the object files `main.o' and `kbd.o'.  The dependencies
  501. are files such as `main.c' and `defs.h'.  In fact, each `.o' file is
  502. both a target and a dependency.  Commands include `cc -c main.c' and
  503. `cc -c kbd.c'.
  504.  
  505.    When a target is a file, it needs to be recompiled or relinked if any
  506. of its dependencies change.  In addition, any dependencies that are
  507. themselves automatically generated should be updated first.  In this
  508. example, `edit' depends on each of the eight object files; the object
  509. file `main.o' depends on the source file `main.c' and on the header
  510. file `defs.h'.
  511.  
  512.    A shell command follows each line that contains a target and
  513. dependencies.  These shell commands say how to update the target file.
  514. A tab character must come at the beginning of every command line to
  515. distinguish commands lines from other lines in the makefile.  (Bear in
  516. mind that `make' does not know anything about how the commands work.
  517. It is up to you to supply commands that will update the target file
  518. properly.  All `make' does is execute the commands in the rule you have
  519. specified when the target file needs to be updated.)
  520.  
  521.    The target `clean' is not a file, but merely the name of an action.
  522. Since you normally do not want to carry out the actions in this rule,
  523. `clean' is not a dependency of any other rule.  Consequently, `make'
  524. never does anything with it unless you tell it specifically.  Note that
  525. this rule not only is not a dependency, it also does not have any
  526. dependencies, so the only purpose of the rule is to run the specified
  527. commands.  Targets that do not refer to files but are just actions are
  528. called "phony targets".  *Note Phony Targets::, for information about
  529. this kind of target.  *Note Errors in Commands: Errors, to see how to
  530. cause `make' to ignore errors from `rm' or any other command.
  531.  
  532. 
  533. File: make.info,  Node: How Make Works,  Next: Variables Simplify,  Prev: Simple Makefile,  Up: Introduction
  534.  
  535. How `make' Processes a Makefile
  536. ===============================
  537.  
  538.    By default, `make' starts with the first rule (not counting rules
  539. whose target names start with `.').  This is called the "default goal".
  540. ("Goals" are the targets that `make' strives ultimately to update.
  541. *Note Arguments to Specify the Goals: Goals.)
  542.  
  543.    In the simple example of the previous section, the default goal is to
  544. update the executable program `edit'; therefore, we put that rule first.
  545.  
  546.    Thus, when you give the command:
  547.  
  548.      make
  549.  
  550. `make' reads the makefile in the current directory and begins by
  551. processing the first rule.  In the example, this rule is for relinking
  552. `edit'; but before `make' can fully process this rule, it must process
  553. the rules for the files that `edit' depends on, which in this case are
  554. the object files.  Each of these files is processed according to its
  555. own rule.  These rules say to update each `.o' file by compiling its
  556. source file.  The recompilation must be done if the source file, or any
  557. of the header files named as dependencies, is more recent than the
  558. object file, or if the object file does not exist.
  559.  
  560.    The other rules are processed because their targets appear as
  561. dependencies of the goal.  If some other rule is not depended on by the
  562. goal (or anything it depends on, etc.), that rule is not processed,
  563. unless you tell `make' to do so (with a command such as `make clean').
  564.  
  565.    Before recompiling an object file, `make' considers updating its
  566. dependencies, the source file and header files.  This makefile does not
  567. specify anything to be done for them--the `.c' and `.h' files are not
  568. the targets of any rules--so `make' does nothing for these files.  But
  569. `make' would update automatically generated C programs, such as those
  570. made by Bison or Yacc, by their own rules at this time.
  571.  
  572.    After recompiling whichever object files need it, `make' decides
  573. whether to relink `edit'.  This must be done if the file `edit' does
  574. not exist, or if any of the object files are newer than it.  If an
  575. object file was just recompiled, it is now newer than `edit', so `edit'
  576. is relinked.
  577.  
  578.    Thus, if we change the file `insert.c' and run `make', `make' will
  579. compile that file to update `insert.o', and then link `edit'.  If we
  580. change the file `command.h' and run `make', `make' will recompile the
  581. object files `kbd.o', `command.o' and `files.o' and then link the file
  582. `edit'.
  583.  
  584. 
  585. File: make.info,  Node: Variables Simplify,  Next: make Deduces,  Prev: How Make Works,  Up: Introduction
  586.  
  587. Variables Make Makefiles Simpler
  588. ================================
  589.  
  590.    In our example, we had to list all the object files twice in the
  591. rule for `edit' (repeated here):
  592.  
  593.      edit : main.o kbd.o command.o display.o \
  594.                    insert.o search.o files.o utils.o
  595.              cc -o edit main.o kbd.o command.o display.o \
  596.                         insert.o search.o files.o utils.o
  597.  
  598.    Such duplication is error-prone; if a new object file is added to the
  599. system, we might add it to one list and forget the other.  We can
  600. eliminate the risk and simplify the makefile by using a variable.
  601. "Variables" allow a text string to be defined once and substituted in
  602. multiple places later (*note How to Use Variables: Using Variables.).
  603.  
  604.    It is standard practice for every makefile to have a variable named
  605. `objects', `OBJECTS', `objs', `OBJS', `obj', or `OBJ' which is a list
  606. of all object file names.  We would define such a variable `objects'
  607. with a line like this in the makefile:
  608.  
  609.      objects = main.o kbd.o command.o display.o \
  610.                insert.o search.o files.o utils.o
  611.  
  612. Then, each place we want to put a list of the object file names, we can
  613. substitute the variable's value by writing `$(objects)' (*note How to
  614. Use Variables: Using Variables.).
  615.  
  616.    Here is how the complete simple makefile looks when you use a
  617. variable for the object files:
  618.  
  619.      objects = main.o kbd.o command.o display.o \
  620.                insert.o search.o files.o utils.o
  621.      
  622.      edit : $(objects)
  623.              cc -o edit $(objects)
  624.      main.o : main.c defs.h
  625.              cc -c main.c
  626.      kbd.o : kbd.c defs.h command.h
  627.              cc -c kbd.c
  628.      command.o : command.c defs.h command.h
  629.              cc -c command.c
  630.      display.o : display.c defs.h buffer.h
  631.              cc -c display.c
  632.      insert.o : insert.c defs.h buffer.h
  633.              cc -c insert.c
  634.      search.o : search.c defs.h buffer.h
  635.              cc -c search.c
  636.      files.o : files.c defs.h buffer.h command.h
  637.              cc -c files.c
  638.      utils.o : utils.c defs.h
  639.              cc -c utils.c
  640.      clean :
  641.              rm edit $(objects)
  642.  
  643. 
  644. File: make.info,  Node: make Deduces,  Next: Combine By Dependency,  Prev: Variables Simplify,  Up: Introduction
  645.  
  646. Letting `make' Deduce the Commands
  647. ==================================
  648.  
  649.    It is not necessary to spell out the commands for compiling the
  650. individual C source files, because `make' can figure them out: it has an
  651. "implicit rule" for updating a `.o' file from a correspondingly named
  652. `.c' file using a `cc -c' command.  For example, it will use the
  653. command `cc -c main.c -o main.o' to compile `main.c' into `main.o'.  We
  654. can therefore omit the commands from the rules for the object files.
  655. *Note Using Implicit Rules: Implicit Rules.
  656.  
  657.    When a `.c' file is used automatically in this way, it is also
  658. automatically added to the list of dependencies.  We can therefore omit
  659. the `.c' files from the dependencies, provided we omit the commands.
  660.  
  661.    Here is the entire example, with both of these changes, and a
  662. variable `objects' as suggested above:
  663.  
  664.      objects = main.o kbd.o command.o display.o \
  665.                insert.o search.o files.o utils.o
  666.      
  667.      edit : $(objects)
  668.              cc -o edit $(objects)
  669.      
  670.      main.o : defs.h
  671.      kbd.o : defs.h command.h
  672.      command.o : defs.h command.h
  673.      display.o : defs.h buffer.h
  674.      insert.o : defs.h buffer.h
  675.      search.o : defs.h buffer.h
  676.      files.o : defs.h buffer.h command.h
  677.      utils.o : defs.h
  678.      
  679.      .PHONY : clean
  680.      clean :
  681.              -rm edit $(objects)
  682.  
  683. This is how we would write the makefile in actual practice.  (The
  684. complications associated with `clean' are described elsewhere.  See
  685. *Note Phony Targets::, and *Note Errors in Commands: Errors.)
  686.  
  687.    Because implicit rules are so convenient, they are important.  You
  688. will see them used frequently.
  689.  
  690. 
  691. File: make.info,  Node: Combine By Dependency,  Next: Cleanup,  Prev: make Deduces,  Up: Introduction
  692.  
  693. Another Style of Makefile
  694. =========================
  695.  
  696.    When the objects of a makefile are created only by implicit rules, an
  697. alternative style of makefile is possible.  In this style of makefile,
  698. you group entries by their dependencies instead of by their targets.
  699. Here is what one looks like:
  700.  
  701.      objects = main.o kbd.o command.o display.o \
  702.                insert.o search.o files.o utils.o
  703.      
  704.      edit : $(objects)
  705.              cc -o edit $(objects)
  706.      
  707.      $(objects) : defs.h
  708.      kbd.o command.o files.o : command.h
  709.      display.o insert.o search.o files.o : buffer.h
  710.  
  711. Here `defs.h' is given as a dependency of all the object files;
  712. `command.h' and `buffer.h' are dependencies of the specific object
  713. files listed for them.
  714.  
  715.    Whether this is better is a matter of taste: it is more compact, but
  716. some people dislike it because they find it clearer to put all the
  717. information about each target in one place.
  718.  
  719. 
  720. File: make.info,  Node: Cleanup,  Prev: Combine By Dependency,  Up: Introduction
  721.  
  722. Rules for Cleaning the Directory
  723. ================================
  724.  
  725.    Compiling a program is not the only thing you might want to write
  726. rules for.  Makefiles commonly tell how to do a few other things besides
  727. compiling a program: for example, how to delete all the object files
  728. and executables so that the directory is `clean'.
  729.  
  730.    Here is how we could write a `make' rule for cleaning our example
  731. editor:
  732.  
  733.      clean:
  734.              rm edit $(objects)
  735.  
  736.    In practice, we might want to write the rule in a somewhat more
  737. complicated manner to handle unanticipated situations.  We would do
  738. this:
  739.  
  740.      .PHONY : clean
  741.      clean :
  742.              -rm edit $(objects)
  743.  
  744. This prevents `make' from getting confused by an actual file called
  745. `clean' and causes it to continue in spite of errors from `rm'.  (See
  746. *Note Phony Targets::, and *Note Errors in Commands: Errors.)
  747.  
  748. A rule such as this should not be placed at the beginning of the
  749. makefile, because we do not want it to run by default!  Thus, in the
  750. example makefile, we want the rule for `edit', which recompiles the
  751. editor, to remain the default goal.
  752.  
  753.    Since `clean' is not a dependency of `edit', this rule will not run
  754. at all if we give the command `make' with no arguments.  In order to
  755. make the rule run, we have to type `make clean'.  *Note How to Run
  756. `make': Running.
  757.  
  758. 
  759. File: make.info,  Node: Makefiles,  Next: Rules,  Prev: Introduction,  Up: Top
  760.  
  761. Writing Makefiles
  762. *****************
  763.  
  764.    The information that tells `make' how to recompile a system comes
  765. from reading a data base called the "makefile".
  766.  
  767. * Menu:
  768.  
  769. * Makefile Contents::           What makefiles contain.
  770. * Makefile Names::              How to name your makefile.
  771. * Include::                     How one makefile can use another makefile.
  772. * MAKEFILES Variable::          The environment can specify extra makefiles.
  773. * Remaking Makefiles::          How makefiles get remade.
  774. * Overriding Makefiles::        How to override part of one makefile
  775.                                  with another makefile.
  776.  
  777. 
  778. File: make.info,  Node: Makefile Contents,  Next: Makefile Names,  Up: Makefiles
  779.  
  780. What Makefiles Contain
  781. ======================
  782.  
  783.    Makefiles contain five kinds of things: "explicit rules", "implicit
  784. rules", "variable definitions", "directives", and "comments".  Rules,
  785. variables, and directives are described at length in later chapters.
  786.  
  787.    * An "explicit rule" says when and how to remake one or more files,
  788.      called the rule's targets.  It lists the other files that the
  789.      targets "depend on", and may also give commands to use to create
  790.      or update the targets.  *Note Writing Rules: Rules.
  791.  
  792.    * An "implicit rule" says when and how to remake a class of files
  793.      based on their names.  It describes how a target may depend on a
  794.      file with a name similar to the target and gives commands to
  795.      create or update such a target.  *Note Using Implicit Rules:
  796.      Implicit Rules.
  797.  
  798.    * A "variable definition" is a line that specifies a text string
  799.      value for a variable that can be substituted into the text later.
  800.      The simple makefile example shows a variable definition for
  801.      `objects' as a list of all object files (*note Variables Make
  802.      Makefiles Simpler: Variables Simplify.).
  803.  
  804.    * A "directive" is a command for `make' to do something special while
  805.      reading the makefile.  These include:
  806.  
  807.         * Reading another makefile (*note Including Other Makefiles:
  808.           Include.).
  809.  
  810.         * Deciding (based on the values of variables) whether to use or
  811.           ignore a part of the makefile (*note Conditional Parts of
  812.           Makefiles: Conditionals.).
  813.  
  814.         * Defining a variable from a verbatim string containing
  815.           multiple lines (*note Defining Variables Verbatim: Defining.).
  816.  
  817.    * `#' in a line of a makefile starts a "comment".  It and the rest of
  818.      the line are ignored, except that a trailing backslash not escaped
  819.      by another backslash will continue the comment across multiple
  820.      lines.  Comments may appear on any of the lines in the makefile,
  821.      except within a `define' directive, and perhaps within commands
  822.      (where the shell decides what is a comment).  A line containing
  823.      just a comment (with perhaps spaces before it) is effectively
  824.      blank, and is ignored.
  825.  
  826. 
  827. File: make.info,  Node: Makefile Names,  Next: Include,  Prev: Makefile Contents,  Up: Makefiles
  828.  
  829. What Name to Give Your Makefile
  830. ===============================
  831.  
  832.    By default, when `make' looks for the makefile, it tries the
  833. following names, in order: `GNUmakefile', `makefile' and `Makefile'.
  834.  
  835.    Normally you should call your makefile either `makefile' or
  836. `Makefile'.  (We recommend `Makefile' because it appears prominently
  837. near the beginning of a directory listing, right near other important
  838. files such as `README'.)  The first name checked, `GNUmakefile', is not
  839. recommended for most makefiles.  You should use this name if you have a
  840. makefile that is specific to GNU `make', and will not be understood by
  841. other versions of `make'.  Other `make' programs look for `makefile' and
  842. `Makefile', but not `GNUmakefile'.
  843.  
  844.    If `make' finds none of these names, it does not use any makefile.
  845. Then you must specify a goal with a command argument, and `make' will
  846. attempt to figure out how to remake it using only its built-in implicit
  847. rules.  *Note Using Implicit Rules: Implicit Rules.
  848.  
  849.    If you want to use a nonstandard name for your makefile, you can
  850. specify the makefile name with the `-f' or `--file' option.  The
  851. arguments `-f NAME' or `--file=NAME' tell `make' to read the file NAME
  852. as the makefile.  If you use more than one `-f' or `--file' option, you
  853. can specify several makefiles.  All the makefiles are effectively
  854. concatenated in the order specified.  The default makefile names
  855. `GNUmakefile', `makefile' and `Makefile' are not checked automatically
  856. if you specify `-f' or `--file'.
  857.  
  858. 
  859. File: make.info,  Node: Include,  Next: MAKEFILES Variable,  Prev: Makefile Names,  Up: Makefiles
  860.  
  861. Including Other Makefiles
  862. =========================
  863.  
  864.    The `include' directive tells `make' to suspend reading the current
  865. makefile and read one or more other makefiles before continuing.  The
  866. directive is a line in the makefile that looks like this:
  867.  
  868.      include FILENAMES...
  869.  
  870. FILENAMES can contain shell file name patterns.
  871.  
  872.    Extra spaces are allowed and ignored at the beginning of the line,
  873. but a tab is not allowed.  (If the line begins with a tab, it will be
  874. considered a command line.)  Whitespace is required between `include'
  875. and the file names, and between file names; extra whitespace is ignored
  876. there and at the end of the directive.  A comment starting with `#' is
  877. allowed at the end of the line.  If the file names contain any variable
  878. or function references, they are expanded.  *Note How to Use Variables:
  879. Using Variables.
  880.  
  881.    For example, if you have three `.mk' files, `a.mk', `b.mk', and
  882. `c.mk', and `$(bar)' expands to `bish bash', then the following
  883. expression
  884.  
  885.      include foo *.mk $(bar)
  886.  
  887.    is equivalent to
  888.  
  889.      include foo a.mk b.mk c.mk bish bash
  890.  
  891.    When `make' processes an `include' directive, it suspends reading of
  892. the containing makefile and reads from each listed file in turn.  When
  893. that is finished, `make' resumes reading the makefile in which the
  894. directive appears.
  895.  
  896.    One occasion for using `include' directives is when several programs,
  897. handled by individual makefiles in various directories, need to use a
  898. common set of variable definitions (*note Setting Variables: Setting.)
  899. or pattern rules (*note Defining and Redefining Pattern Rules: Pattern
  900. Rules.).
  901.  
  902.    Another such occasion is when you want to generate dependencies from
  903. source files automatically; the dependencies can be put in a file that
  904. is included by the main makefile.  This practice is generally cleaner
  905. than that of somehow appending the dependencies to the end of the main
  906. makefile as has been traditionally done with other versions of `make'.
  907. *Note Automatic Dependencies::.
  908.  
  909.    If the specified name does not start with a slash, and the file is
  910. not found in the current directory, several other directories are
  911. searched.  First, any directories you have specified with the `-I' or
  912. `--include-dir' option are searched (*note Summary of Options: Options
  913. Summary.).  Then the following directories (if they exist) are
  914. searched, in this order: `PREFIX/include' (normally
  915. `/usr/local/include') `/usr/gnu/include', `/usr/local/include',
  916. `/usr/include'.
  917.  
  918.    If an included makefile cannot be found in any of these directories,
  919. a warning message is generated, but it is not an immediately fatal
  920. error; processing of the makefile containing the `include' continues.
  921. Once it has finished reading makefiles, `make' will try to remake any
  922. that are out of date or don't exist.  *Note How Makefiles Are Remade:
  923. Remaking Makefiles.  Only after it has tried to find a way to remake a
  924. makefile and failed, will `make' diagnose the missing makefile as a
  925. fatal error.
  926.  
  927.    If you want `make' to simply ignore a makefile which does not exist
  928. and cannot be remade, with no error message, use the `-include'
  929. directive instead of `include', like this:
  930.  
  931.      -include FILENAMES...
  932.  
  933.    This is acts like `include' in every way except that there is no
  934. error (not even a warning) if any of the FILENAMES do not exist.
  935.  
  936. 
  937. File: make.info,  Node: MAKEFILES Variable,  Next: Remaking Makefiles,  Prev: Include,  Up: Makefiles
  938.  
  939. The Variable `MAKEFILES'
  940. ========================
  941.  
  942.    If the environment variable `MAKEFILES' is defined, `make' considers
  943. its value as a list of names (separated by whitespace) of additional
  944. makefiles to be read before the others.  This works much like the
  945. `include' directive: various directories are searched for those files
  946. (*note Including Other Makefiles: Include.).  In addition, the default
  947. goal is never taken from one of these makefiles and it is not an error
  948. if the files listed in `MAKEFILES' are not found.
  949.  
  950.    The main use of `MAKEFILES' is in communication between recursive
  951. invocations of `make' (*note Recursive Use of `make': Recursion.).  It
  952. usually is not desirable to set the environment variable before a
  953. top-level invocation of `make', because it is usually better not to
  954. mess with a makefile from outside.  However, if you are running `make'
  955. without a specific makefile, a makefile in `MAKEFILES' can do useful
  956. things to help the built-in implicit rules work better, such as
  957. defining search paths (*note Directory Search::.).
  958.  
  959.    Some users are tempted to set `MAKEFILES' in the environment
  960. automatically on login, and program makefiles to expect this to be done.
  961. This is a very bad idea, because such makefiles will fail to work if
  962. run by anyone else.  It is much better to write explicit `include'
  963. directives in the makefiles.  *Note Including Other Makefiles: Include.
  964.  
  965. 
  966. File: make.info,  Node: Remaking Makefiles,  Next: Overriding Makefiles,  Prev: MAKEFILES Variable,  Up: Makefiles
  967.  
  968. How Makefiles Are Remade
  969. ========================
  970.  
  971.    Sometimes makefiles can be remade from other files, such as RCS or
  972. SCCS files.  If a makefile can be remade from other files, you probably
  973. want `make' to get an up-to-date version of the makefile to read in.
  974.  
  975.    To this end, after reading in all makefiles, `make' will consider
  976. each as a goal target and attempt to update it.  If a makefile has a
  977. rule which says how to update it (found either in that very makefile or
  978. in another one) or if an implicit rule applies to it (*note Using
  979. Implicit Rules: Implicit Rules.), it will be updated if necessary.
  980. After all makefiles have been checked, if any have actually been
  981. changed, `make' starts with a clean slate and reads all the makefiles
  982. over again.  (It will also attempt to update each of them over again,
  983. but normally this will not change them again, since they are already up
  984. to date.)
  985.  
  986.    If the makefiles specify a double-colon rule to remake a file with
  987. commands but no dependencies, that file will always be remade (*note
  988. Double-Colon::.).  In the case of makefiles, a makefile that has a
  989. double-colon rule with commands but no dependencies will be remade every
  990. time `make' is run, and then again after `make' starts over and reads
  991. the makefiles in again.  This would cause an infinite loop: `make'
  992. would constantly remake the makefile, and never do anything else.  So,
  993. to avoid this, `make' will *not* attempt to remake makefiles which are
  994. specified as double-colon targets but have no dependencies.
  995.  
  996.    If you do not specify any makefiles to be read with `-f' or `--file'
  997. options, `make' will try the default makefile names; *note What Name to
  998. Give Your Makefile: Makefile Names..  Unlike makefiles explicitly
  999. requested with `-f' or `--file' options, `make' is not certain that
  1000. these makefiles should exist.  However, if a default makefile does not
  1001. exist but can be created by running `make' rules, you probably want the
  1002. rules to be run so that the makefile can be used.
  1003.  
  1004.    Therefore, if none of the default makefiles exists, `make' will try
  1005. to make each of them in the same order in which they are searched for
  1006. (*note What Name to Give Your Makefile: Makefile Names.) until it
  1007. succeeds in making one, or it runs out of names to try.  Note that it
  1008. is not an error if `make' cannot find or make any makefile; a makefile
  1009. is not always necessary.
  1010.  
  1011.    When you use the `-t' or `--touch' option (*note Instead of
  1012. Executing the Commands: Instead of Execution.), you would not want to
  1013. use an out-of-date makefile to decide which targets to touch.  So the
  1014. `-t' option has no effect on updating makefiles; they are really
  1015. updated even if `-t' is specified.  Likewise, `-q' (or `--question')
  1016. and `-n' (or `--just-print') do not prevent updating of makefiles,
  1017. because an out-of-date makefile would result in the wrong output for
  1018. other targets.  Thus, `make -f mfile -n foo' will update `mfile', read
  1019. it in, and then print the commands to update `foo' and its dependencies
  1020. without running them.  The commands printed for `foo' will be those
  1021. specified in the updated contents of `mfile'.
  1022.  
  1023.    However, on occasion you might actually wish to prevent updating of
  1024. even the makefiles.  You can do this by specifying the makefiles as
  1025. goals in the command line as well as specifying them as makefiles.
  1026. When the makefile name is specified explicitly as a goal, the options
  1027. `-t' and so on do apply to them.
  1028.  
  1029.    Thus, `make -f mfile -n mfile foo' would read the makefile `mfile',
  1030. print the commands needed to update it without actually running them,
  1031. and then print the commands needed to update `foo' without running
  1032. them.  The commands for `foo' will be those specified by the existing
  1033. contents of `mfile'.
  1034.  
  1035. 
  1036. File: make.info,  Node: Overriding Makefiles,  Prev: Remaking Makefiles,  Up: Makefiles
  1037.  
  1038. Overriding Part of Another Makefile
  1039. ===================================
  1040.  
  1041.    Sometimes it is useful to have a makefile that is mostly just like
  1042. another makefile.  You can often use the `include' directive to include
  1043. one in the other, and add more targets or variable definitions.
  1044. However, if the two makefiles give different commands for the same
  1045. target, `make' will not let you just do this.  But there is another way.
  1046.  
  1047.    In the containing makefile (the one that wants to include the other),
  1048. you can use the `.DEFAULT' special target to say that to remake any
  1049. target that cannot be made from the information in the containing
  1050. makefile, `make' should look in another makefile.  *Note Defining
  1051. Last-Resort Default Rules: Last Resort, for more information on
  1052. `.DEFAULT'.
  1053.  
  1054.    For example, if you have a makefile called `Makefile' that says how
  1055. to make the target `foo' (and other targets), you can write a makefile
  1056. called `GNUmakefile' that contains:
  1057.  
  1058.      foo:
  1059.              frobnicate > foo
  1060.      
  1061.      .DEFAULT:
  1062.              @$(MAKE) -f Makefile $@
  1063.  
  1064.    If you say `make foo', `make' will find `GNUmakefile', read it, and
  1065. see that to make `foo', it needs to run the command `frobnicate > foo'.
  1066. If you say `make bar', `make' will find no way to make `bar' in
  1067. `GNUmakefile', so it will use the commands from `.DEFAULT': `make -f
  1068. Makefile bar'.  If `Makefile' provides a rule for updating `bar', `make'
  1069. will apply the rule.  And likewise for any other target that
  1070. `GNUmakefile' does not say how to make.
  1071.  
  1072. 
  1073. File: make.info,  Node: Rules,  Next: Commands,  Prev: Makefiles,  Up: Top
  1074.  
  1075. Writing Rules
  1076. *************
  1077.  
  1078.    A "rule" appears in the makefile and says when and how to remake
  1079. certain files, called the rule's "targets" (most often only one per
  1080. rule).  It lists the other files that are the "dependencies" of the
  1081. target, and "commands" to use to create or update the target.
  1082.  
  1083.    The order of rules is not significant, except for determining the
  1084. "default goal": the target for `make' to consider, if you do not
  1085. otherwise specify one.  The default goal is the target of the first
  1086. rule in the first makefile.  If the first rule has multiple targets,
  1087. only the first target is taken as the default.  There are two
  1088. exceptions: a target starting with a period is not a default unless it
  1089. contains one or more slashes, `/', as well; and, a target that defines
  1090. a pattern rule has no effect on the default goal.  (*Note Defining and
  1091. Redefining Pattern Rules: Pattern Rules.)
  1092.  
  1093.    Therefore, we usually write the makefile so that the first rule is
  1094. the one for compiling the entire program or all the programs described
  1095. by the makefile (often with a target called `all').  *Note Arguments to
  1096. Specify the Goals: Goals.
  1097.  
  1098. * Menu:
  1099.  
  1100. * Rule Example::                An example explained.
  1101. * Rule Syntax::                 General syntax explained.
  1102. * Wildcards::                   Using wildcard characters such as `*'.
  1103. * Directory Search::            Searching other directories for source files.
  1104. * Phony Targets::               Using a target that is not a real file's name.
  1105. * Force Targets::               You can use a target without commands
  1106.                                   or dependencies to mark other
  1107.                                   targets as phony.
  1108. * Empty Targets::               When only the date matters and the
  1109.                                   files are empty.
  1110. * Special Targets::             Targets with special built-in meanings.
  1111. * Multiple Targets::            When to make use of several targets in a rule.
  1112. * Multiple Rules::              How to use several rules with the same target.
  1113. * Static Pattern::              Static pattern rules apply to multiple targets
  1114.                                   and can vary the dependencies according to
  1115.                                   the target name.
  1116. * Double-Colon::                How to use a special kind of rule to allow
  1117.                                   several independent rules for one target.
  1118. * Automatic Dependencies::      How to automatically generate rules giving
  1119.                                  dependencies from the source files themselves.
  1120.  
  1121. 
  1122. File: make.info,  Node: Rule Example,  Next: Rule Syntax,  Up: Rules
  1123.  
  1124. Rule Example
  1125. ============
  1126.  
  1127.    Here is an example of a rule:
  1128.  
  1129.      foo.o : foo.c defs.h       # module for twiddling the frobs
  1130.              cc -c -g foo.c
  1131.  
  1132.    Its target is `foo.o' and its dependencies are `foo.c' and `defs.h'.
  1133. It has one command, which is `cc -c -g foo.c'.  The command line
  1134. starts with a tab to identify it as a command.
  1135.  
  1136.    This rule says two things:
  1137.  
  1138.    * How to decide whether `foo.o' is out of date: it is out of date if
  1139.      it does not exist, or if either `foo.c' or `defs.h' is more recent
  1140.      than it.
  1141.  
  1142.    * How to update the file `foo.o': by running `cc' as stated.  The
  1143.      command does not explicitly mention `defs.h', but we presume that
  1144.      `foo.c' includes it, and that that is why `defs.h' was added to
  1145.      the dependencies.
  1146.  
  1147.