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