1 This is make.info, produced by makeinfo version 6.7 from make.texi.
3 This file documents the GNU 'make' utility, which determines
4 automatically which pieces of a large program need to be recompiled, and
5 issues the commands to recompile them.
7 This is Edition 0.76, last updated 31 October 2022, of 'The GNU Make
8 Manual', for GNU 'make' version 4.4.
10 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
11 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
12 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
13 2022 Free Software Foundation, Inc.
15 Permission is granted to copy, distribute and/or modify this
16 document under the terms of the GNU Free Documentation License,
17 Version 1.3 or any later version published by the Free Software
18 Foundation; with no Invariant Sections, with the Front-Cover Texts
19 being "A GNU Manual," and with the Back-Cover Texts as in (a)
20 below. A copy of the license is included in the section entitled
21 "GNU Free Documentation License."
23 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
24 modify this GNU manual. Buying copies from the FSF supports it in
25 developing GNU and promoting software freedom."
26 INFO-DIR-SECTION Software development
28 * Make: (make). Remake files automatically.
32 File: make.info, Node: Shell Function, Next: Guile Function, Prev: Make Control Functions, Up: Functions
34 8.14 The 'shell' Function
35 =========================
37 The 'shell' function is unlike any other function other than the
38 'wildcard' function (*note The Function 'wildcard': Wildcard Function.)
39 in that it communicates with the world outside of 'make'.
41 The 'shell' function provides for 'make' the same facility that
42 backquotes ('`') provide in most shells: it does "command expansion".
43 This means that it takes as an argument a shell command and expands to
44 the output of the command. The only processing 'make' does on the
45 result is to convert each newline (or carriage-return / newline pair) to
46 a single space. If there is a trailing (carriage-return and) newline it
47 will simply be removed.
49 The commands run by calls to the 'shell' function are run when the
50 function calls are expanded (*note How 'make' Reads a Makefile: Reading
51 Makefiles.). Because this function involves spawning a new shell, you
52 should carefully consider the performance implications of using the
53 'shell' function within recursively expanded variables vs. simply
54 expanded variables (*note The Two Flavors of Variables: Flavors.).
56 An alternative to the 'shell' function is the '!=' assignment
57 operator; it provides a similar behavior but has subtle differences
58 (*note Setting Variables: Setting.). The '!=' assignment operator is
59 included in newer POSIX standards.
61 After the 'shell' function or '!=' assignment operator is used, its
62 exit status is placed in the '.SHELLSTATUS' variable.
64 Here are some examples of the use of the 'shell' function:
66 contents := $(shell cat foo)
68 sets 'contents' to the contents of the file 'foo', with a space (rather
69 than a newline) separating each line.
71 files := $(shell echo *.c)
73 sets 'files' to the expansion of '*.c'. Unless 'make' is using a very
74 strange shell, this has the same result as '$(wildcard *.c)' (as long as
75 at least one '.c' file exists).
77 All variables that are marked as 'export' will also be passed to the
78 shell started by the 'shell' function. It is possible to create a
79 variable expansion loop: consider this 'makefile':
81 export HI = $(shell echo hi)
84 When 'make' wants to run the recipe it must add the variable HI to
85 the environment; to do so it must be expanded. The value of this
86 variable requires an invocation of the 'shell' function, and to invoke
87 it we must create its environment. Since HI is exported, we need to
88 expand it to create its environment. And so on. In this obscure case
89 'make' will use the value of the variable from the environment provided
90 to 'make', or else the empty string if there was none, rather than
91 looping or issuing an error. This is often what you want; for example:
93 export PATH = $(shell echo /usr/local/bin:$$PATH)
95 However, it would be simpler and more efficient to use a
96 simply-expanded variable here (':=') in the first place.
99 File: make.info, Node: Guile Function, Prev: Shell Function, Up: Functions
101 8.15 The 'guile' Function
102 =========================
104 If GNU 'make' is built with support for GNU Guile as an embedded
105 extension language then the 'guile' function will be available. The
106 'guile' function takes one argument which is first expanded by 'make' in
107 the normal fashion, then passed to the GNU Guile evaluator. The result
108 of the evaluator is converted into a string and used as the expansion of
109 the 'guile' function in the makefile. See *note GNU Guile Integration:
110 Guile Integration. for details on writing extensions to 'make' in Guile.
112 You can determine whether GNU Guile support is available by checking
113 the '.FEATURES' variable for the word GUILE.
116 File: make.info, Node: Running, Next: Implicit Rules, Prev: Functions, Up: Top
121 A makefile that says how to recompile a program can be used in more than
122 one way. The simplest use is to recompile every file that is out of
123 date. Usually, makefiles are written so that if you run 'make' with no
124 arguments, it does just that.
126 But you might want to update only some of the files; you might want
127 to use a different compiler or different compiler options; you might
128 want just to find out which files are out of date without changing them.
130 By giving arguments when you run 'make', you can do any of these
131 things and many others.
133 The exit status of 'make' is always one of three values:
135 The exit status is zero if 'make' is successful.
137 The exit status is two if 'make' encounters any errors. It will
138 print messages describing the particular errors.
140 The exit status is one if you use the '-q' flag and 'make'
141 determines that some target is not already up to date. *Note
142 Instead of Executing Recipes: Instead of Execution.
146 * Makefile Arguments:: How to specify which makefile to use.
147 * Goals:: How to use goal arguments to specify which
148 parts of the makefile to use.
149 * Instead of Execution:: How to use mode flags to specify what
150 kind of thing to do with the recipes
151 in the makefile other than simply
153 * Avoiding Compilation:: How to avoid recompiling certain files.
154 * Overriding:: How to override a variable to specify
155 an alternate compiler and other things.
156 * Testing:: How to proceed past some errors, to
158 * Temporary Files:: Where 'make' keeps its temporary files.
159 * Options Summary:: Summary of Options
162 File: make.info, Node: Makefile Arguments, Next: Goals, Prev: Running, Up: Running
164 9.1 Arguments to Specify the Makefile
165 =====================================
167 The way to specify the name of the makefile is with the '-f' or '--file'
168 option ('--makefile' also works). For example, '-f altmake' says to use
169 the file 'altmake' as the makefile.
171 If you use the '-f' flag several times and follow each '-f' with an
172 argument, all the specified files are used jointly as makefiles.
174 If you do not use the '-f' or '--file' flag, the default is to try
175 'GNUmakefile', 'makefile', and 'Makefile', in that order, and use the
176 first of these three which exists or can be made (*note Writing
177 Makefiles: Makefiles.).
180 File: make.info, Node: Goals, Next: Instead of Execution, Prev: Makefile Arguments, Up: Running
182 9.2 Arguments to Specify the Goals
183 ==================================
185 The "goals" are the targets that 'make' should strive ultimately to
186 update. Other targets are updated as well if they appear as
187 prerequisites of goals, or prerequisites of prerequisites of goals, etc.
189 By default, the goal is the first target in the makefile (not
190 counting targets that start with a period). Therefore, makefiles are
191 usually written so that the first target is for compiling the entire
192 program or programs they describe. If the first rule in the makefile
193 has several targets, only the first target in the rule becomes the
194 default goal, not the whole list. You can manage the selection of the
195 default goal from within your makefile using the '.DEFAULT_GOAL'
196 variable (*note Other Special Variables: Special Variables.).
198 You can also specify a different goal or goals with command line
199 arguments to 'make'. Use the name of the goal as an argument. If you
200 specify several goals, 'make' processes each of them in turn, in the
203 Any target in the makefile may be specified as a goal (unless it
204 starts with '-' or contains an '=', in which case it will be parsed as a
205 switch or variable definition, respectively). Even targets not in the
206 makefile may be specified, if 'make' can find implicit rules that say
209 'Make' will set the special variable 'MAKECMDGOALS' to the list of
210 goals you specified on the command line. If no goals were given on the
211 command line, this variable is empty. Note that this variable should be
212 used only in special circumstances.
214 An example of appropriate use is to avoid including '.d' files during
215 'clean' rules (*note Automatic Prerequisites::), so 'make' won't create
216 them only to immediately remove them again:
218 sources = foo.c bar.c
220 ifeq (,$(filter clean,$(MAKECMDGOALS))
221 include $(sources:.c=.d)
224 One use of specifying a goal is if you want to compile only a part of
225 the program, or only one of several programs. Specify as a goal each
226 file that you wish to remake. For example, consider a directory
227 containing several programs, with a makefile that starts like this:
230 all: size nm ld ar as
232 If you are working on the program 'size', you might want to say
233 'make size' so that only the files of that program are recompiled.
235 Another use of specifying a goal is to make files that are not
236 normally made. For example, there may be a file of debugging output, or
237 a version of the program that is compiled specially for testing, which
238 has a rule in the makefile but is not a prerequisite of the default
241 Another use of specifying a goal is to run the recipe associated with
242 a phony target (*note Phony Targets::) or empty target (*note Empty
243 Target Files to Record Events: Empty Targets.). Many makefiles contain
244 a phony target named 'clean' which deletes everything except source
245 files. Naturally, this is done only if you request it explicitly with
246 'make clean'. Following is a list of typical phony and empty target
247 names. *Note Standard Targets::, for a detailed list of all the
248 standard target names which GNU software packages use.
251 Make all the top-level targets the makefile knows about.
254 Delete all files that are normally created by running 'make'.
257 Like 'clean', but may refrain from deleting a few files that people
258 normally don't want to recompile. For example, the 'mostlyclean'
259 target for GCC does not delete 'libgcc.a', because recompiling it
260 is rarely necessary and takes a lot of time.
265 Any of these targets might be defined to delete _more_ files than
266 'clean' does. For example, this would delete configuration files
267 or links that you would normally create as preparation for
268 compilation, even if the makefile itself cannot create these files.
271 Copy the executable file into a directory that users typically
272 search for commands; copy any auxiliary files that the executable
273 uses into the directories where it will look for them.
276 Print listings of the source files that have changed.
279 Create a tar file of the source files.
282 Create a shell archive (shar file) of the source files.
285 Create a distribution file of the source files. This might be a
286 tar file, or a shar file, or a compressed version of one of the
287 above, or even more than one of the above.
290 Update a tags table for this program.
294 Perform self tests on the program this makefile builds.
297 File: make.info, Node: Instead of Execution, Next: Avoiding Compilation, Prev: Goals, Up: Running
299 9.3 Instead of Executing Recipes
300 ================================
302 The makefile tells 'make' how to tell whether a target is up to date,
303 and how to update each target. But updating the targets is not always
304 what you want. Certain options specify other activities for 'make'.
311 "No-op". Causes 'make' to print the recipes that are needed to
312 make the targets up to date, but not actually execute them. Note
313 that some recipes are still executed, even with this flag (*note
314 How the 'MAKE' Variable Works: MAKE Variable.). Also any recipes
315 needed to update included makefiles are still executed (*note How
316 Makefiles Are Remade: Remaking Makefiles.).
321 "Touch". Marks targets as up to date without actually changing
322 them. In other words, 'make' pretends to update the targets but
323 does not really change their contents; instead only their modified
329 "Question". Silently check whether the targets are up to date, but
330 do not execute recipes; the exit code shows whether any updates are
338 "What if". Each '-W' flag is followed by a file name. The given
339 files' modification times are recorded by 'make' as being the
340 present time, although the actual modification times remain the
341 same. You can use the '-W' flag in conjunction with the '-n' flag
342 to see what would happen if you were to modify specific files.
344 With the '-n' flag, 'make' prints the recipe that it would normally
345 execute but usually does not execute it.
347 With the '-t' flag, 'make' ignores the recipes in the rules and uses
348 (in effect) the command 'touch' for each target that needs to be remade.
349 The 'touch' command is also printed, unless '-s' or '.SILENT' is used.
350 For speed, 'make' does not actually invoke the program 'touch'. It does
353 With the '-q' flag, 'make' prints nothing and executes no recipes,
354 but the exit status code it returns is zero if and only if the targets
355 to be considered are already up to date. If the exit status is one,
356 then some updating needs to be done. If 'make' encounters an error, the
357 exit status is two, so you can distinguish an error from a target that
360 It is an error to use more than one of these three flags in the same
361 invocation of 'make'.
363 The '-n', '-t', and '-q' options do not affect recipe lines that
364 begin with '+' characters or contain the strings '$(MAKE)' or '${MAKE}'.
365 Note that only the line containing the '+' character or the strings
366 '$(MAKE)' or '${MAKE}' is run regardless of these options. Other lines
367 in the same rule are not run unless they too begin with '+' or contain
368 '$(MAKE)' or '${MAKE}' (*Note How the 'MAKE' Variable Works: MAKE
371 The '-t' flag prevents phony targets (*note Phony Targets::) from
372 being updated, unless there are recipe lines beginning with '+' or
373 containing '$(MAKE)' or '${MAKE}'.
375 The '-W' flag provides two features:
377 * If you also use the '-n' or '-q' flag, you can see what 'make'
378 would do if you were to modify some files.
380 * Without the '-n' or '-q' flag, when 'make' is actually executing
381 recipes, the '-W' flag can direct 'make' to act as if some files
382 had been modified, without actually running the recipes for those
385 Note that the options '-p' and '-v' allow you to obtain other
386 information about 'make' or about the makefiles in use (*note Summary of
387 Options: Options Summary.).
390 File: make.info, Node: Avoiding Compilation, Next: Overriding, Prev: Instead of Execution, Up: Running
392 9.4 Avoiding Recompilation of Some Files
393 ========================================
395 Sometimes you may have changed a source file but you do not want to
396 recompile all the files that depend on it. For example, suppose you add
397 a macro or a declaration to a header file that many other files depend
398 on. Being conservative, 'make' assumes that any change in the header
399 file requires recompilation of all dependent files, but you know that
400 they do not need to be recompiled and you would rather not waste the
401 time waiting for them to compile.
403 If you anticipate the problem before changing the header file, you
404 can use the '-t' flag. This flag tells 'make' not to run the recipes in
405 the rules, but rather to mark the target up to date by changing its
406 last-modification date. You would follow this procedure:
408 1. Use the command 'make' to recompile the source files that really
409 need recompilation, ensuring that the object files are up-to-date
412 2. Make the changes in the header files.
414 3. Use the command 'make -t' to mark all the object files as up to
415 date. The next time you run 'make', the changes in the header
416 files will not cause any recompilation.
418 If you have already changed the header file at a time when some files
419 do need recompilation, it is too late to do this. Instead, you can use
420 the '-o FILE' flag, which marks a specified file as "old" (*note Summary
421 of Options: Options Summary.). This means that the file itself will not
422 be remade, and nothing else will be remade on its account. Follow this
425 1. Recompile the source files that need compilation for reasons
426 independent of the particular header file, with 'make -o
427 HEADERFILE'. If several header files are involved, use a separate
428 '-o' option for each header file.
430 2. Touch all the object files with 'make -t'.
433 File: make.info, Node: Overriding, Next: Testing, Prev: Avoiding Compilation, Up: Running
435 9.5 Overriding Variables
436 ========================
438 An argument that contains '=' specifies the value of a variable: 'V=X'
439 sets the value of the variable V to X. If you specify a value in this
440 way, all ordinary assignments of the same variable in the makefile are
441 ignored; we say they have been "overridden" by the command line
444 The most common way to use this facility is to pass extra flags to
445 compilers. For example, in a properly written makefile, the variable
446 'CFLAGS' is included in each recipe that runs the C compiler, so a file
447 'foo.c' would be compiled something like this:
449 cc -c $(CFLAGS) foo.c
451 Thus, whatever value you set for 'CFLAGS' affects each compilation
452 that occurs. The makefile probably specifies the usual value for
457 Each time you run 'make', you can override this value if you wish.
458 For example, if you say 'make CFLAGS='-g -O'', each C compilation will
459 be done with 'cc -c -g -O'. (This also illustrates how you can use
460 quoting in the shell to enclose spaces and other special characters in
461 the value of a variable when you override it.)
463 The variable 'CFLAGS' is only one of many standard variables that
464 exist just so that you can change them this way. *Note Variables Used
465 by Implicit Rules: Implicit Variables, for a complete list.
467 You can also program the makefile to look at additional variables of
468 your own, giving the user the ability to control other aspects of how
469 the makefile works by changing the variables.
471 When you override a variable with a command line argument, you can
472 define either a recursively-expanded variable or a simply-expanded
473 variable. The examples shown above make a recursively-expanded
474 variable; to make a simply-expanded variable, write ':=' or '::='
475 instead of '='. But, unless you want to include a variable reference or
476 function call in the _value_ that you specify, it makes no difference
477 which kind of variable you create.
479 There is one way that the makefile can change a variable that you
480 have overridden. This is to use the 'override' directive, which is a
481 line that looks like this: 'override VARIABLE = VALUE' (*note The
482 'override' Directive: Override Directive.).
485 File: make.info, Node: Testing, Next: Temporary Files, Prev: Overriding, Up: Running
487 9.6 Testing the Compilation of a Program
488 ========================================
490 Normally, when an error happens in executing a shell command, 'make'
491 gives up immediately, returning a nonzero status. No further recipes
492 are executed for any target. The error implies that the goal cannot be
493 correctly remade, and 'make' reports this as soon as it knows.
495 When you are compiling a program that you have just changed, this is
496 not what you want. Instead, you would rather that 'make' try compiling
497 every file that can be tried, to show you as many compilation errors as
500 On these occasions, you should use the '-k' or '--keep-going' flag.
501 This tells 'make' to continue to consider the other prerequisites of the
502 pending targets, remaking them if necessary, before it gives up and
503 returns nonzero status. For example, after an error in compiling one
504 object file, 'make -k' will continue compiling other object files even
505 though it already knows that linking them will be impossible. In
506 addition to continuing after failed shell commands, 'make -k' will
507 continue as much as possible after discovering that it does not know how
508 to make a target or prerequisite file. This will always cause an error
509 message, but without '-k', it is a fatal error (*note Summary of
510 Options: Options Summary.).
512 The usual behavior of 'make' assumes that your purpose is to get the
513 goals up to date; once 'make' learns that this is impossible, it might
514 as well report the failure immediately. The '-k' flag says that the
515 real purpose is to test as much as possible of the changes made in the
516 program, perhaps to find several independent problems so that you can
517 correct them all before the next attempt to compile. This is why Emacs'
518 'M-x compile' command passes the '-k' flag by default.
521 File: make.info, Node: Temporary Files, Next: Options Summary, Prev: Testing, Up: Running
526 In some situations, 'make' will need to create its own temporary files.
527 These files must not be disturbed while 'make' is running, including all
528 recursively-invoked instances of 'make'.
530 If the environment variable 'MAKE_TMPDIR' is set then all temporary
531 files created by 'make' will be placed there.
533 If 'MAKE_TMPDIR' is not set, then the standard location for temporary
534 files for the current operating system will be used. For POSIX systems
535 this will be the location set in the 'TMPDIR' environment variable, or
536 else the system's default location (e.g., '/tmp') is used. On Windows,
537 first 'TMP' then 'TEMP' will be checked, then 'TMPDIR', and finally the
538 system default temporary file location will be used.
540 Note that this directory must already exist or 'make' will fail:
541 'make' will not attempt to create it.
543 These variables _cannot_ be set from within a makefile: GNU 'make'
544 must have access to this location before it begins reading the
548 File: make.info, Node: Options Summary, Prev: Temporary Files, Up: Running
550 9.8 Summary of Options
551 ======================
553 Here is a table of all the options 'make' understands:
557 These options are ignored for compatibility with other versions of
562 Consider all targets out-of-date. GNU 'make' proceeds to consider
563 targets and their prerequisites using the normal algorithms;
564 however, all targets so considered are always remade regardless of
565 the status of their prerequisites. To avoid infinite recursion, if
566 'MAKE_RESTARTS' (*note Other Special Variables: Special Variables.)
567 is set to a number greater than 0 this option is disabled when
568 considering whether to remake makefiles (*note How Makefiles Are
569 Remade: Remaking Makefiles.).
573 Change to directory DIR before reading the makefiles. If multiple
574 '-C' options are specified, each is interpreted relative to the
575 previous one: '-C / -C etc' is equivalent to '-C /etc'. This is
576 typically used with recursive invocations of 'make' (*note
577 Recursive Use of 'make': Recursion.).
581 Print debugging information in addition to normal processing. The
582 debugging information says which files are being considered for
583 remaking, which file-times are being compared and with what
584 results, which files actually need to be remade, which implicit
585 rules are considered and which are applied--everything interesting
586 about how 'make' decides what to do. The '-d' option is equivalent
587 to '--debug=a' (see below).
591 Print debugging information in addition to normal processing.
592 Various levels and types of output can be chosen. With no
593 arguments, print the "basic" level of debugging. Possible
594 arguments are below; only the first character is considered, and
595 values must be comma- or space-separated.
598 All types of debugging output are enabled. This is equivalent
602 Basic debugging prints each target that was found to be
603 out-of-date, and whether the build was successful or not.
606 A level above 'basic'; includes messages about which makefiles
607 were parsed, prerequisites that did not need to be rebuilt,
608 etc. This option also enables 'basic' messages.
611 Prints messages describing the implicit rule searches for each
612 target. This option also enables 'basic' messages.
615 Prints messages giving details on the invocation of specific
619 By default, the above messages are not enabled while trying to
620 remake the makefiles. This option enables messages while
621 rebuilding makefiles, too. Note that the 'all' option does
622 enable this option. This option also enables 'basic'
626 Prints the recipe to be executed, even when the recipe is
627 normally silent (due to '.SILENT' or '@'). Also prints the
628 makefile name and line number where the recipe was defined.
631 Explains why each target must be remade by showing which
632 prerequisites are more up to date than the target.
635 Disable all debugging currently enabled. If additional
636 debugging flags are encountered after this they will still
640 '--environment-overrides'
641 Give variables taken from the environment precedence over variables
642 from makefiles. *Note Variables from the Environment: Environment.
647 Evaluate STRING as makefile syntax. This is a command-line version
648 of the 'eval' function (*note Eval Function::). The evaluation is
649 performed after the default rules and variables have been defined,
650 but before any makefiles are read.
655 Read the file named FILE as a makefile. *Note Writing Makefiles:
661 Remind you of the options that 'make' understands and then exit.
665 Ignore all errors in recipes executed to remake files. *Note
666 Errors in Recipes: Errors.
670 Specifies a directory DIR to search for included makefiles. *Note
671 Including Other Makefiles: Include. If several '-I' options are
672 used to specify several directories, the directories are searched
673 in the order specified. If the directory DIR is a single dash
674 ('-') then any already-specified directories up to that point
675 (including the default directory paths) will be discarded. You can
676 examine the current list of directories to be searched via the
677 '.INCLUDE_DIRS' variable.
681 Specifies the number of recipes (jobs) to run simultaneously. With
682 no argument, 'make' runs as many recipes simultaneously as
683 possible. If there is more than one '-j' option, the last one is
684 effective. *Note Parallel Execution: Parallel, for more
685 information on how recipes are run. Note that this option is
688 '--jobserver-style=[STYLE]'
689 Chooses the style of jobserver to use. This option only has effect
690 if parallel builds are enabled (*note Parallel Execution:
691 Parallel.). On POSIX systems STYLE can be one of 'fifo' (the
692 default) or 'pipe'. On Windows the only acceptable STYLE is 'sem'
693 (the default). This option is useful if you need to use an older
694 versions of GNU 'make', or a different tool that requires a
695 specific jobserver style.
699 Continue as much as possible after an error. While the target that
700 failed, and those that depend on it, cannot be remade, the other
701 prerequisites of these targets can be processed all the same.
702 *Note Testing the Compilation of a Program: Testing.
705 '--load-average[=LOAD]'
707 Specifies that no new recipes should be started if there are other
708 recipes running and the load average is at least LOAD (a
709 floating-point number). With no argument, removes a previous load
710 limit. *Note Parallel Execution: Parallel.
713 '--check-symlink-times'
714 On systems that support symbolic links, this option causes 'make'
715 to consider the timestamps on any symbolic links in addition to the
716 timestamp on the file referenced by those links. When this option
717 is provided, the most recent timestamp among the file and the
718 symbolic links is taken as the modification time for this target
726 Print the recipe that would be executed, but do not execute it
727 (except in certain circumstances). *Note Instead of Executing
728 Recipes: Instead of Execution.
733 Do not remake the file FILE even if it is older than its
734 prerequisites, and do not remake anything on account of changes in
735 FILE. Essentially the file is treated as very old and its rules
736 are ignored. *Note Avoiding Recompilation of Some Files: Avoiding
740 '--output-sync[=TYPE]'
741 Ensure that the complete output from each recipe is printed in one
742 uninterrupted sequence. This option is only useful when using the
743 '--jobs' option to run multiple recipes simultaneously (*note
744 Parallel Execution: Parallel.) Without this option output will be
745 displayed as it is generated by the recipes.
747 With no type or the type 'target', output from the entire recipe of
748 each target is grouped together. With the type 'line', output from
749 each line in the recipe is grouped together. With the type
750 'recurse', the output from an entire recursive make is grouped
751 together. With the type 'none', no output synchronization is
752 performed. *Note Output During Parallel Execution: Parallel
757 Print the data base (rules and variable values) that results from
758 reading the makefiles; then execute as usual or as otherwise
759 specified. This also prints the version information given by the
760 '-v' switch (see below). To print the data base without trying to
761 remake any files, use 'make -qp'. To print the data base of
762 predefined rules and variables, use 'make -p -f /dev/null'. The
763 data base output contains file name and line number information for
764 recipe and variable definitions, so it can be a useful debugging
765 tool in complex environments.
769 "Question mode". Do not run any recipes, or print anything; just
770 return an exit status that is zero if the specified targets are
771 already up to date, one if any remaking is required, or two if an
772 error is encountered. *Note Instead of Executing Recipes: Instead
777 Eliminate use of the built-in implicit rules (*note Using Implicit
778 Rules: Implicit Rules.). You can still define your own by writing
779 pattern rules (*note Defining and Redefining Pattern Rules: Pattern
780 Rules.). The '-r' option also clears out the default list of
781 suffixes for suffix rules (*note Old-Fashioned Suffix Rules: Suffix
782 Rules.). But you can still define your own suffixes with a rule
783 for '.SUFFIXES', and then define your own suffix rules. Note that
784 only _rules_ are affected by the '-r' option; default variables
785 remain in effect (*note Variables Used by Implicit Rules: Implicit
786 Variables.); see the '-R' option below.
789 '--no-builtin-variables'
790 Eliminate use of the built-in rule-specific variables (*note
791 Variables Used by Implicit Rules: Implicit Variables.). You can
792 still define your own, of course. The '-R' option also
793 automatically enables the '-r' option (see above), since it doesn't
794 make sense to have implicit rules without any definitions for the
795 variables that they use.
801 Silent operation; do not print the recipes as they are executed.
802 *Note Recipe Echoing: Echoing.
808 Cancel the effect of the '-k' option. This is never necessary
809 except in a recursive 'make' where '-k' might be inherited from the
810 top-level 'make' via 'MAKEFLAGS' (*note Recursive Use of 'make':
811 Recursion.) or if you set '-k' in 'MAKEFLAGS' in your environment.
815 This option enables a form of fuzz-testing of prerequisite
816 relationships. When parallelism is enabled ('-j') the order in
817 which targets are built becomes less deterministic. If
818 prerequisites are not fully declared in the makefile this can lead
819 to intermittent and hard-to-track-down build failures.
821 The '--shuffle' option forces 'make' to purposefully reorder goals
822 and prerequisites so target/prerequisite relationships still hold,
823 but ordering of prerequisites of a given target are reordered as
826 The order in which prerequisites are listed in automatic variables
827 is not changed by this option.
829 The '.NOTPARALLEL' pseudo-target disables shuffling for that
830 makefile. Also any prerequisite list which contains '.WAIT' will
831 not be shuffled. *Note Disabling Parallel Execution: Parallel
834 The '--shuffle=' option accepts these values:
837 Choose a random seed for the shuffle. This is the default if
838 no mode is specified. The chosen seed is also provided to
839 sub-'make' commands. The seed is included in error messages
840 so that it can be re-used in future runs to reproduce the
841 problem or verify that it has been resolved.
844 Reverse the order of goals and prerequisites, rather than a
848 Use 'random' shuffle initialized with the specified seed
849 value. The SEED is an integer.
852 Disable shuffling. This negates any previous '--shuffle'
858 Touch files (mark them up to date without really changing them)
859 instead of running their recipes. This is used to pretend that the
860 recipes were done, in order to fool future invocations of 'make'.
861 *Note Instead of Executing Recipes: Instead of Execution.
864 Show tracing information for 'make' execution. Using '--trace' is
865 shorthand for '--debug=print,why'.
869 Print the version of the 'make' program plus a copyright, a list of
870 authors, and a notice that there is no warranty; then exit.
874 Print a message containing the working directory both before and
875 after executing the makefile. This may be useful for tracking down
876 errors from complicated nests of recursive 'make' commands. *Note
877 Recursive Use of 'make': Recursion. (In practice, you rarely need
878 to specify this option since 'make' does it for you; see *note The
879 '--print-directory' Option: -w Option.)
881 '--no-print-directory'
882 Disable printing of the working directory under '-w'. This option
883 is useful when '-w' is turned on automatically, but you do not want
884 to see the extra messages. *Note The '--print-directory' Option:
891 Pretend that the target FILE has just been modified. When used
892 with the '-n' flag, this shows you what would happen if you were to
893 modify that file. Without '-n', it is almost the same as running a
894 'touch' command on the given file before running 'make', except
895 that the modification time is changed only in the imagination of
896 'make'. *Note Instead of Executing Recipes: Instead of Execution.
898 '--warn-undefined-variables'
899 Issue a warning message whenever 'make' sees a reference to an
900 undefined variable. This can be helpful when you are trying to
901 debug makefiles which use variables in complex ways.
904 File: make.info, Node: Implicit Rules, Next: Archives, Prev: Running, Up: Top
906 10 Using Implicit Rules
907 ***********************
909 Certain standard ways of remaking target files are used very often. For
910 example, one customary way to make an object file is from a C source
911 file using the C compiler, 'cc'.
913 "Implicit rules" tell 'make' how to use customary techniques so that
914 you do not have to specify them in detail when you want to use them.
915 For example, there is an implicit rule for C compilation. File names
916 determine which implicit rules are run. For example, C compilation
917 typically takes a '.c' file and makes a '.o' file. So 'make' applies
918 the implicit rule for C compilation when it sees this combination of
921 A chain of implicit rules can apply in sequence; for example, 'make'
922 will remake a '.o' file from a '.y' file by way of a '.c' file.
924 The built-in implicit rules use several variables in their recipes so
925 that, by changing the values of the variables, you can change the way
926 the implicit rule works. For example, the variable 'CFLAGS' controls
927 the flags given to the C compiler by the implicit rule for C
930 You can define your own implicit rules by writing "pattern rules".
932 "Suffix rules" are a more limited way to define implicit rules.
933 Pattern rules are more general and clearer, but suffix rules are
934 retained for compatibility.
938 * Using Implicit:: How to use an existing implicit rule
939 to get the recipes for updating a file.
940 * Catalogue of Rules:: A list of built-in rules.
941 * Implicit Variables:: How to change what predefined rules do.
942 * Chained Rules:: How to use a chain of implicit rules.
943 * Pattern Rules:: How to define new implicit rules.
944 * Last Resort:: How to define a recipe for rules which
946 * Suffix Rules:: The old-fashioned style of implicit rule.
947 * Implicit Rule Search:: The precise algorithm for applying
951 File: make.info, Node: Using Implicit, Next: Catalogue of Rules, Prev: Implicit Rules, Up: Implicit Rules
953 10.1 Using Implicit Rules
954 =========================
956 To allow 'make' to find a customary method for updating a target file,
957 all you have to do is refrain from specifying recipes yourself. Either
958 write a rule with no recipe, or don't write a rule at all. Then 'make'
959 will figure out which implicit rule to use based on which kind of source
960 file exists or can be made.
962 For example, suppose the makefile looks like this:
965 cc -o foo foo.o bar.o $(CFLAGS) $(LDFLAGS)
967 Because you mention 'foo.o' but do not give a rule for it, 'make' will
968 automatically look for an implicit rule that tells how to update it.
969 This happens whether or not the file 'foo.o' currently exists.
971 If an implicit rule is found, it can supply both a recipe and one or
972 more prerequisites (the source files). You would want to write a rule
973 for 'foo.o' with no recipe if you need to specify additional
974 prerequisites, such as header files, that the implicit rule cannot
977 Each implicit rule has a target pattern and prerequisite patterns.
978 There may be many implicit rules with the same target pattern. For
979 example, numerous rules make '.o' files: one, from a '.c' file with the
980 C compiler; another, from a '.p' file with the Pascal compiler; and so
981 on. The rule that actually applies is the one whose prerequisites exist
982 or can be made. So, if you have a file 'foo.c', 'make' will run the C
983 compiler; otherwise, if you have a file 'foo.p', 'make' will run the
984 Pascal compiler; and so on.
986 Of course, when you write the makefile, you know which implicit rule
987 you want 'make' to use, and you know it will choose that one because you
988 know which possible prerequisite files are supposed to exist. *Note
989 Catalogue of Built-In Rules: Catalogue of Rules, for a catalogue of all
990 the predefined implicit rules.
992 Above, we said an implicit rule applies if the required prerequisites
993 "exist or can be made". A file "can be made" if it is mentioned
994 explicitly in the makefile as a target or a prerequisite, or if an
995 implicit rule can be recursively found for how to make it. When an
996 implicit prerequisite is the result of another implicit rule, we say
997 that "chaining" is occurring. *Note Chains of Implicit Rules: Chained
1000 In general, 'make' searches for an implicit rule for each target, and
1001 for each double-colon rule, that has no recipe. A file that is
1002 mentioned only as a prerequisite is considered a target whose rule
1003 specifies nothing, so implicit rule search happens for it. *Note
1004 Implicit Rule Search Algorithm: Implicit Rule Search, for the details of
1005 how the search is done.
1007 Note that explicit prerequisites do not influence implicit rule
1008 search. For example, consider this explicit rule:
1012 The prerequisite on 'foo.p' does not necessarily mean that 'make' will
1013 remake 'foo.o' according to the implicit rule to make an object file, a
1014 '.o' file, from a Pascal source file, a '.p' file. For example, if
1015 'foo.c' also exists, the implicit rule to make an object file from a C
1016 source file is used instead, because it appears before the Pascal rule
1017 in the list of predefined implicit rules (*note Catalogue of Built-In
1018 Rules: Catalogue of Rules.).
1020 If you do not want an implicit rule to be used for a target that has
1021 no recipe, you can give that target an empty recipe by writing a
1022 semicolon (*note Defining Empty Recipes: Empty Recipes.).
1025 File: make.info, Node: Catalogue of Rules, Next: Implicit Variables, Prev: Using Implicit, Up: Implicit Rules
1027 10.2 Catalogue of Built-In Rules
1028 ================================
1030 Here is a catalogue of predefined implicit rules which are always
1031 available unless the makefile explicitly overrides or cancels them.
1032 *Note Canceling Implicit Rules: Canceling Rules, for information on
1033 canceling or overriding an implicit rule. The '-r' or
1034 '--no-builtin-rules' option cancels all predefined rules.
1036 This manual only documents the default rules available on POSIX-based
1037 operating systems. Other operating systems, such as VMS, Windows, OS/2,
1038 etc. may have different sets of default rules. To see the full list of
1039 default rules and variables available in your version of GNU 'make', run
1040 'make -p' in a directory with no makefile.
1042 Not all of these rules will always be defined, even when the '-r'
1043 option is not given. Many of the predefined implicit rules are
1044 implemented in 'make' as suffix rules, so which ones will be defined
1045 depends on the "suffix list" (the list of prerequisites of the special
1046 target '.SUFFIXES'). The default suffix list is: '.out', '.a', '.ln',
1047 '.o', '.c', '.cc', '.C', '.cpp', '.p', '.f', '.F', '.m', '.r', '.y',
1048 '.l', '.ym', '.lm', '.s', '.S', '.mod', '.sym', '.def', '.h', '.info',
1049 '.dvi', '.tex', '.texinfo', '.texi', '.txinfo', '.w', '.ch' '.web',
1050 '.sh', '.elc', '.el'. All of the implicit rules described below whose
1051 prerequisites have one of these suffixes are actually suffix rules. If
1052 you modify the suffix list, the only predefined suffix rules in effect
1053 will be those named by one or two of the suffixes that are on the list
1054 you specify; rules whose suffixes fail to be on the list are disabled.
1055 *Note Old-Fashioned Suffix Rules: Suffix Rules, for full details on
1058 Compiling C programs
1059 'N.o' is made automatically from 'N.c' with a recipe of the form
1060 '$(CC) $(CPPFLAGS) $(CFLAGS) -c'.
1062 Compiling C++ programs
1063 'N.o' is made automatically from 'N.cc', 'N.cpp', or 'N.C' with a
1064 recipe of the form '$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c'. We
1065 encourage you to use the suffix '.cc' or '.cpp' for C++ source
1066 files instead of '.C' to better support case-insensitive file
1069 Compiling Pascal programs
1070 'N.o' is made automatically from 'N.p' with the recipe '$(PC)
1073 Compiling Fortran and Ratfor programs
1074 'N.o' is made automatically from 'N.r', 'N.F' or 'N.f' by running
1075 the Fortran compiler. The precise recipe used is as follows:
1078 '$(FC) $(FFLAGS) -c'.
1080 '$(FC) $(FFLAGS) $(CPPFLAGS) -c'.
1082 '$(FC) $(FFLAGS) $(RFLAGS) -c'.
1084 Preprocessing Fortran and Ratfor programs
1085 'N.f' is made automatically from 'N.r' or 'N.F'. This rule runs
1086 just the preprocessor to convert a Ratfor or preprocessable Fortran
1087 program into a strict Fortran program. The precise recipe used is
1091 '$(FC) $(CPPFLAGS) $(FFLAGS) -F'.
1093 '$(FC) $(FFLAGS) $(RFLAGS) -F'.
1095 Compiling Modula-2 programs
1096 'N.sym' is made from 'N.def' with a recipe of the form
1097 '$(M2C) $(M2FLAGS) $(DEFFLAGS)'. 'N.o' is made from 'N.mod'; the
1098 form is: '$(M2C) $(M2FLAGS) $(MODFLAGS)'.
1100 Assembling and preprocessing assembler programs
1101 'N.o' is made automatically from 'N.s' by running the assembler,
1102 'as'. The precise recipe is '$(AS) $(ASFLAGS)'.
1104 'N.s' is made automatically from 'N.S' by running the C
1105 preprocessor, 'cpp'. The precise recipe is '$(CPP) $(CPPFLAGS)'.
1107 Linking a single object file
1108 'N' is made automatically from 'N.o' by running the C compiler to
1109 link the program. The precise recipe used is
1110 '$(CC) $(LDFLAGS) N.o $(LOADLIBES) $(LDLIBS)'.
1112 This rule does the right thing for a simple program with only one
1113 source file. It will also do the right thing if there are multiple
1114 object files (presumably coming from various other source files),
1115 one of which has a name matching that of the executable file.
1120 when 'x.c', 'y.c' and 'z.c' all exist will execute:
1130 In more complicated cases, such as when there is no object file
1131 whose name derives from the executable file name, you must write an
1132 explicit recipe for linking.
1134 Each kind of file automatically made into '.o' object files will be
1135 automatically linked by using the compiler ('$(CC)', '$(FC)' or
1136 '$(PC)'; the C compiler '$(CC)' is used to assemble '.s' files)
1137 without the '-c' option. This could be done by using the '.o'
1138 object files as intermediates, but it is faster to do the compiling
1139 and linking in one step, so that's how it's done.
1142 'N.c' is made automatically from 'N.y' by running Yacc with the
1143 recipe '$(YACC) $(YFLAGS)'.
1146 'N.c' is made automatically from 'N.l' by running Lex. The actual
1147 recipe is '$(LEX) $(LFLAGS)'.
1149 Lex for Ratfor programs
1150 'N.r' is made automatically from 'N.l' by running Lex. The actual
1151 recipe is '$(LEX) $(LFLAGS)'.
1153 The convention of using the same suffix '.l' for all Lex files
1154 regardless of whether they produce C code or Ratfor code makes it
1155 impossible for 'make' to determine automatically which of the two
1156 languages you are using in any particular case. If 'make' is
1157 called upon to remake an object file from a '.l' file, it must
1158 guess which compiler to use. It will guess the C compiler, because
1159 that is more common. If you are using Ratfor, make sure 'make'
1160 knows this by mentioning 'N.r' in the makefile. Or, if you are
1161 using Ratfor exclusively, with no C files, remove '.c' from the
1162 list of implicit rule suffixes with:
1165 .SUFFIXES: .o .r .f .l ...
1167 Making Lint Libraries from C, Yacc, or Lex programs
1168 'N.ln' is made from 'N.c' by running 'lint'. The precise recipe is
1169 '$(LINT) $(LINTFLAGS) $(CPPFLAGS) -i'. The same recipe is used on
1170 the C code produced from 'N.y' or 'N.l'.
1173 'N.dvi' is made from 'N.tex' with the recipe '$(TEX)'. 'N.tex' is
1174 made from 'N.web' with '$(WEAVE)', or from 'N.w' (and from 'N.ch'
1175 if it exists or can be made) with '$(CWEAVE)'. 'N.p' is made from
1176 'N.web' with '$(TANGLE)' and 'N.c' is made from 'N.w' (and from
1177 'N.ch' if it exists or can be made) with '$(CTANGLE)'.
1180 'N.dvi' is made from 'N.texinfo', 'N.texi', or 'N.txinfo', with the
1181 recipe '$(TEXI2DVI) $(TEXI2DVI_FLAGS)'. 'N.info' is made from
1182 'N.texinfo', 'N.texi', or 'N.txinfo', with the recipe
1183 '$(MAKEINFO) $(MAKEINFO_FLAGS)'.
1186 Any file 'N' is extracted if necessary from an RCS file named
1187 either 'N,v' or 'RCS/N,v'. The precise recipe used is
1188 '$(CO) $(COFLAGS)'. 'N' will not be extracted from RCS if it
1189 already exists, even if the RCS file is newer. The rules for RCS
1190 are terminal (*note Match-Anything Pattern Rules: Match-Anything
1191 Rules.), so RCS files cannot be generated from another source; they
1192 must actually exist.
1195 Any file 'N' is extracted if necessary from an SCCS file named
1196 either 's.N' or 'SCCS/s.N'. The precise recipe used is
1197 '$(GET) $(GFLAGS)'. The rules for SCCS are terminal (*note
1198 Match-Anything Pattern Rules: Match-Anything Rules.), so SCCS files
1199 cannot be generated from another source; they must actually exist.
1201 For the benefit of SCCS, a file 'N' is copied from 'N.sh' and made
1202 executable (by everyone). This is for shell scripts that are
1203 checked into SCCS. Since RCS preserves the execution permission of
1204 a file, you do not need to use this feature with RCS.
1206 We recommend that you avoid using of SCCS. RCS is widely held to be
1207 superior, and is also free. By choosing free software in place of
1208 comparable (or inferior) proprietary software, you support the free
1211 Usually, you want to change only the variables listed in the table
1212 above, which are documented in the following section.
1214 However, the recipes in built-in implicit rules actually use
1215 variables such as 'COMPILE.c', 'LINK.p', and 'PREPROCESS.S', whose
1216 values contain the recipes listed above.
1218 'make' follows the convention that the rule to compile a '.X' source
1219 file uses the variable 'COMPILE.X'. Similarly, the rule to produce an
1220 executable from a '.X' file uses 'LINK.X'; and the rule to preprocess a
1221 '.X' file uses 'PREPROCESS.X'.
1223 Every rule that produces an object file uses the variable
1224 'OUTPUT_OPTION'. 'make' defines this variable either to contain '-o
1225 $@', or to be empty, depending on a compile-time option. You need the
1226 '-o' option to ensure that the output goes into the right file when the
1227 source file is in a different directory, as when using 'VPATH' (*note
1228 Directory Search::). However, compilers on some systems do not accept a
1229 '-o' switch for object files. If you use such a system, and use
1230 'VPATH', some compilations will put their output in the wrong place. A
1231 possible workaround for this problem is to give 'OUTPUT_OPTION' the
1232 value '; mv $*.o $@'.
1235 File: make.info, Node: Implicit Variables, Next: Chained Rules, Prev: Catalogue of Rules, Up: Implicit Rules
1237 10.3 Variables Used by Implicit Rules
1238 =====================================
1240 The recipes in built-in implicit rules make liberal use of certain
1241 predefined variables. You can alter the values of these variables in
1242 the makefile, with arguments to 'make', or in the environment to alter
1243 how the implicit rules work without redefining the rules themselves.
1244 You can cancel all variables used by implicit rules with the '-R' or
1245 '--no-builtin-variables' option.
1247 For example, the recipe used to compile a C source file actually says
1248 '$(CC) -c $(CFLAGS) $(CPPFLAGS)'. The default values of the variables
1249 used are 'cc' and nothing, resulting in the command 'cc -c'. By
1250 redefining 'CC' to 'ncc', you could cause 'ncc' to be used for all C
1251 compilations performed by the implicit rule. By redefining 'CFLAGS' to
1252 be '-g', you could pass the '-g' option to each compilation. _All_
1253 implicit rules that do C compilation use '$(CC)' to get the program name
1254 for the compiler and _all_ include '$(CFLAGS)' among the arguments given
1257 The variables used in implicit rules fall into two classes: those
1258 that are names of programs (like 'CC') and those that contain arguments
1259 for the programs (like 'CFLAGS'). (The "name of a program" may also
1260 contain some command arguments, but it must start with an actual
1261 executable program name.) If a variable value contains more than one
1262 argument, separate them with spaces.
1264 The following tables describe of some of the more commonly-used
1265 predefined variables. This list is not exhaustive, and the default
1266 values shown here may not be what 'make' selects for your environment.
1267 To see the complete list of predefined variables for your instance of
1268 GNU 'make' you can run 'make -p' in a directory with no makefiles.
1270 Here is a table of some of the more common variables used as names of
1271 programs in built-in rules:
1274 Archive-maintaining program; default 'ar'.
1277 Program for compiling assembly files; default 'as'.
1280 Program for compiling C programs; default 'cc'.
1283 Program for compiling C++ programs; default 'g++'.
1286 Program for running the C preprocessor, with results to standard
1287 output; default '$(CC) -E'.
1290 Program for compiling or preprocessing Fortran and Ratfor programs;
1294 Program to use to compile Modula-2 source code; default 'm2c'.
1297 Program for compiling Pascal programs; default 'pc'.
1300 Program for extracting a file from RCS; default 'co'.
1303 Program for extracting a file from SCCS; default 'get'.
1306 Program to use to turn Lex grammars into source code; default
1310 Program to use to turn Yacc grammars into source code; default
1314 Program to use to run lint on source code; default 'lint'.
1317 Program to convert a Texinfo source file into an Info file; default
1321 Program to make TeX DVI files from TeX source; default 'tex'.
1324 Program to make TeX DVI files from Texinfo source; default
1328 Program to translate Web into TeX; default 'weave'.
1331 Program to translate C Web into TeX; default 'cweave'.
1334 Program to translate Web into Pascal; default 'tangle'.
1337 Program to translate C Web into C; default 'ctangle'.
1340 Command to remove a file; default 'rm -f'.
1342 Here is a table of variables whose values are additional arguments
1343 for the programs above. The default values for all of these is the
1344 empty string, unless otherwise noted.
1347 Flags to give the archive-maintaining program; default 'rv'.
1350 Extra flags to give to the assembler (when explicitly invoked on a
1354 Extra flags to give to the C compiler.
1357 Extra flags to give to the C++ compiler.
1360 Extra flags to give to the RCS 'co' program.
1363 Extra flags to give to the C preprocessor and programs that use it
1364 (the C and Fortran compilers).
1367 Extra flags to give to the Fortran compiler.
1370 Extra flags to give to the SCCS 'get' program.
1373 Extra flags to give to compilers when they are supposed to invoke
1374 the linker, 'ld', such as '-L'. Libraries ('-lfoo') should be
1375 added to the 'LDLIBS' variable instead.
1378 Library flags or names given to compilers when they are supposed to
1379 invoke the linker, 'ld'. 'LOADLIBES' is a deprecated (but still
1380 supported) alternative to 'LDLIBS'. Non-library linker flags, such
1381 as '-L', should go in the 'LDFLAGS' variable.
1384 Extra flags to give to Lex.
1387 Extra flags to give to Yacc.
1390 Extra flags to give to the Pascal compiler.
1393 Extra flags to give to the Fortran compiler for Ratfor programs.
1396 Extra flags to give to lint.
1399 File: make.info, Node: Chained Rules, Next: Pattern Rules, Prev: Implicit Variables, Up: Implicit Rules
1401 10.4 Chains of Implicit Rules
1402 =============================
1404 Sometimes a file can be made by a sequence of implicit rules. For
1405 example, a file 'N.o' could be made from 'N.y' by running first Yacc and
1406 then 'cc'. Such a sequence is called a "chain".
1408 If the file 'N.c' exists, or is mentioned in the makefile, no special
1409 searching is required: 'make' finds that the object file can be made by
1410 C compilation from 'N.c'; later on, when considering how to make 'N.c',
1411 the rule for running Yacc is used. Ultimately both 'N.c' and 'N.o' are
1414 However, even if 'N.c' does not exist and is not mentioned, 'make'
1415 knows how to envision it as the missing link between 'N.o' and 'N.y'!
1416 In this case, 'N.c' is called an "intermediate file". Once 'make' has
1417 decided to use the intermediate file, it is entered in the data base as
1418 if it had been mentioned in the makefile, along with the implicit rule
1419 that says how to create it.
1421 Intermediate files are remade using their rules just like all other
1422 files. But intermediate files are treated differently in two ways.
1424 The first difference is what happens if the intermediate file does
1425 not exist. If an ordinary file B does not exist, and 'make' considers a
1426 target that depends on B, it invariably creates B and then updates the
1427 target from B. But if B is an intermediate file, then 'make' can leave
1428 well enough alone: it won't create B unless one of its prerequisites is
1429 out of date. This means the target depending on B won't be rebuilt
1430 either, unless there is some other reason to update that target: for
1431 example the target doesn't exist or a different prerequisite is newer
1434 The second difference is that if 'make' _does_ create B in order to
1435 update something else, it deletes B later on after it is no longer
1436 needed. Therefore, an intermediate file which did not exist before
1437 'make' also does not exist after 'make'. 'make' reports the deletion to
1438 you by printing a 'rm' command showing which file it is deleting.
1440 You can explicitly mark a file as intermediate by listing it as a
1441 prerequisite of the special target '.INTERMEDIATE'. This takes effect
1442 even if the file is mentioned explicitly in some other way.
1444 A file cannot be intermediate if it is mentioned in the makefile as a
1445 target or prerequisite, so one way to avoid the deletion of intermediate
1446 files is by adding it as a prerequisite to some target. However, doing
1447 so can cause make to do extra work when searching pattern rules (*note
1448 Implicit Rule Search Algorithm: Implicit Rule Search.).
1450 As an alternative, listing a file as a prerequisite of the special
1451 target '.NOTINTERMEDIATE' forces it to not be considered intermediate
1452 (just as any other mention of the file will do). Also, listing the
1453 target pattern of a pattern rule as a prerequisite of '.NOTINTERMEDIATE'
1454 ensures that no targets generated using that pattern rule are considered
1457 You can disable intermediate files completely in your makefile by
1458 providing '.NOTINTERMEDIATE' as a target with no prerequisites: in that
1459 case it applies to every file in the makefile.
1461 If you do not want 'make' to create a file merely because it does not
1462 already exist, but you also do not want 'make' to automatically delete
1463 the file, you can mark it as a "secondary" file. To do this, list it as
1464 a prerequisite of the special target '.SECONDARY'. Marking a file as
1465 secondary also marks it as intermediate.
1467 A chain can involve more than two implicit rules. For example, it is
1468 possible to make a file 'foo' from 'RCS/foo.y,v' by running RCS, Yacc
1469 and 'cc'. Then both 'foo.y' and 'foo.c' are intermediate files that are
1472 No single implicit rule can appear more than once in a chain. This
1473 means that 'make' will not even consider such a ridiculous thing as
1474 making 'foo' from 'foo.o.o' by running the linker twice. This
1475 constraint has the added benefit of preventing any infinite loop in the
1476 search for an implicit rule chain.
1478 There are some special implicit rules to optimize certain cases that
1479 would otherwise be handled by rule chains. For example, making 'foo'
1480 from 'foo.c' could be handled by compiling and linking with separate
1481 chained rules, using 'foo.o' as an intermediate file. But what actually
1482 happens is that a special rule for this case does the compilation and
1483 linking with a single 'cc' command. The optimized rule is used in
1484 preference to the step-by-step chain because it comes earlier in the
1487 Finally, for performance reasons 'make' will not consider
1488 non-terminal match-anything rules (i.e., '%:') when searching for a rule
1489 to build a prerequisite of an implicit rule (*note Match-Anything
1493 File: make.info, Node: Pattern Rules, Next: Last Resort, Prev: Chained Rules, Up: Implicit Rules
1495 10.5 Defining and Redefining Pattern Rules
1496 ==========================================
1498 You define an implicit rule by writing a "pattern rule". A pattern rule
1499 looks like an ordinary rule, except that its target contains the
1500 character '%' (exactly one of them). The target is considered a pattern
1501 for matching file names; the '%' can match any nonempty substring, while
1502 other characters match only themselves. The prerequisites likewise use
1503 '%' to show how their names relate to the target name.
1505 Thus, a pattern rule '%.o : %.c' says how to make any file 'STEM.o'
1506 from another file 'STEM.c'.
1508 Note that expansion using '%' in pattern rules occurs *after* any
1509 variable or function expansions, which take place when the makefile is
1510 read. *Note How to Use Variables: Using Variables, and *note Functions
1511 for Transforming Text: Functions.
1515 * Pattern Intro:: An introduction to pattern rules.
1516 * Pattern Examples:: Examples of pattern rules.
1517 * Automatic Variables:: How to use automatic variables in the
1518 recipe of implicit rules.
1519 * Pattern Match:: How patterns match.
1520 * Match-Anything Rules:: Precautions you should take prior to
1521 defining rules that can match any
1522 target file whatever.
1523 * Canceling Rules:: How to override or cancel built-in rules.
1526 File: make.info, Node: Pattern Intro, Next: Pattern Examples, Prev: Pattern Rules, Up: Pattern Rules
1528 10.5.1 Introduction to Pattern Rules
1529 ------------------------------------
1531 A pattern rule contains the character '%' (exactly one of them) in the
1532 target; otherwise, it looks exactly like an ordinary rule. The target
1533 is a pattern for matching file names; the '%' matches any nonempty
1534 substring, while other characters match only themselves.
1536 For example, '%.c' as a pattern matches any file name that ends in
1537 '.c'. 's.%.c' as a pattern matches any file name that starts with 's.',
1538 ends in '.c' and is at least five characters long. (There must be at
1539 least one character to match the '%'.) The substring that the '%'
1540 matches is called the "stem".
1542 '%' in a prerequisite of a pattern rule stands for the same stem that
1543 was matched by the '%' in the target. In order for the pattern rule to
1544 apply, its target pattern must match the file name under consideration
1545 and all of its prerequisites (after pattern substitution) must name
1546 files that exist or can be made. These files become prerequisites of
1549 Thus, a rule of the form
1551 %.o : %.c ; RECIPE...
1553 specifies how to make a file 'N.o', with another file 'N.c' as its
1554 prerequisite, provided that 'N.c' exists or can be made.
1556 There may also be prerequisites that do not use '%'; such a
1557 prerequisite attaches to every file made by this pattern rule. These
1558 unvarying prerequisites are useful occasionally.
1560 A pattern rule need not have any prerequisites that contain '%', or
1561 in fact any prerequisites at all. Such a rule is effectively a general
1562 wildcard. It provides a way to make any file that matches the target
1563 pattern. *Note Last Resort::.
1565 More than one pattern rule may match a target. In this case 'make'
1566 will choose the "best fit" rule. *Note How Patterns Match: Pattern
1569 Pattern rules may have more than one target; however, every target
1570 must contain a '%' character. Multiple target patterns in pattern rules
1571 are always treated as grouped targets (*note Multiple Targets in a Rule:
1572 Multiple Targets.) regardless of whether they use the ':' or '&:'
1575 There is one exception: if a pattern target is out of date or does
1576 not exist and the makefile does not need to build it, then it will not
1577 cause the other targets to be considered out of date. Note that this
1578 historical exception will be removed in future versions of GNU 'make'
1579 and should not be relied on. If this situation is detected 'make' will
1580 generate a warning _pattern recipe did not update peer target_; however,
1581 'make' cannot detect all such situations. Please be sure that your
1582 recipe updates _all_ the target patterns when it runs.
1585 File: make.info, Node: Pattern Examples, Next: Automatic Variables, Prev: Pattern Intro, Up: Pattern Rules
1587 10.5.2 Pattern Rule Examples
1588 ----------------------------
1590 Here are some examples of pattern rules actually predefined in 'make'.
1591 First, the rule that compiles '.c' files into '.o' files:
1594 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
1596 defines a rule that can make any file 'X.o' from 'X.c'. The recipe uses
1597 the automatic variables '$@' and '$<' to substitute the names of the
1598 target file and the source file in each case where the rule applies
1599 (*note Automatic Variables::).
1601 Here is a second built-in rule:
1606 defines a rule that can make any file 'X' whatsoever from a
1607 corresponding file 'X,v' in the sub-directory 'RCS'. Since the target
1608 is '%', this rule will apply to any file whatever, provided the
1609 appropriate prerequisite file exists. The double colon makes the rule
1610 "terminal", which means that its prerequisite may not be an intermediate
1611 file (*note Match-Anything Pattern Rules: Match-Anything Rules.).
1613 This pattern rule has two targets:
1615 %.tab.c %.tab.h: %.y
1618 This tells 'make' that the recipe 'bison -d X.y' will make both
1619 'X.tab.c' and 'X.tab.h'. If the file 'foo' depends on the files
1620 'parse.tab.o' and 'scan.o' and the file 'scan.o' depends on the file
1621 'parse.tab.h', when 'parse.y' is changed, the recipe 'bison -d parse.y'
1622 will be executed only once, and the prerequisites of both 'parse.tab.o'
1623 and 'scan.o' will be satisfied. (Presumably the file 'parse.tab.o' will
1624 be recompiled from 'parse.tab.c' and the file 'scan.o' from 'scan.c',
1625 while 'foo' is linked from 'parse.tab.o', 'scan.o', and its other
1626 prerequisites, and it will execute happily ever after.)
1629 File: make.info, Node: Automatic Variables, Next: Pattern Match, Prev: Pattern Examples, Up: Pattern Rules
1631 10.5.3 Automatic Variables
1632 --------------------------
1634 Suppose you are writing a pattern rule to compile a '.c' file into a
1635 '.o' file: how do you write the 'cc' command so that it operates on the
1636 right source file name? You cannot write the name in the recipe,
1637 because the name is different each time the implicit rule is applied.
1639 What you do is use a special feature of 'make', the "automatic
1640 variables". These variables have values computed afresh for each rule
1641 that is executed, based on the target and prerequisites of the rule. In
1642 this example, you would use '$@' for the object file name and '$<' for
1643 the source file name.
1645 It's very important that you recognize the limited scope in which
1646 automatic variable values are available: they only have values within
1647 the recipe. In particular, you cannot use them anywhere within the
1648 target list of a rule; they have no value there and will expand to the
1649 empty string. Also, they cannot be accessed directly within the
1650 prerequisite list of a rule. A common mistake is attempting to use '$@'
1651 within the prerequisites list; this will not work. However, there is a
1652 special feature of GNU 'make', secondary expansion (*note Secondary
1653 Expansion::), which will allow automatic variable values to be used in
1656 Here is a table of automatic variables:
1659 The file name of the target of the rule. If the target is an
1660 archive member, then '$@' is the name of the archive file. In a
1661 pattern rule that has multiple targets (*note Introduction to
1662 Pattern Rules: Pattern Intro.), '$@' is the name of whichever
1663 target caused the rule's recipe to be run.
1666 The target member name, when the target is an archive member.
1667 *Note Archives::. For example, if the target is 'foo.a(bar.o)'
1668 then '$%' is 'bar.o' and '$@' is 'foo.a'. '$%' is empty when the
1669 target is not an archive member.
1672 The name of the first prerequisite. If the target got its recipe
1673 from an implicit rule, this will be the first prerequisite added by
1674 the implicit rule (*note Implicit Rules::).
1677 The names of all the prerequisites that are newer than the target,
1678 with spaces between them. If the target does not exist, all
1679 prerequisites will be included. For prerequisites which are
1680 archive members, only the named member is used (*note Archives::).
1682 '$?' is useful even in explicit rules when you wish to operate on
1683 only the prerequisites that have changed. For example, suppose
1684 that an archive named 'lib' is supposed to contain copies of
1685 several object files. This rule copies just the changed object
1686 files into the archive:
1688 lib: foo.o bar.o lose.o win.o
1692 The names of all the prerequisites, with spaces between them. For
1693 prerequisites which are archive members, only the named member is
1694 used (*note Archives::). A target has only one prerequisite on
1695 each other file it depends on, no matter how many times each file
1696 is listed as a prerequisite. So if you list a prerequisite more
1697 than once for a target, the value of '$^' contains just one copy of
1698 the name. This list does *not* contain any of the order-only
1699 prerequisites; for those see the '$|' variable, below.
1702 This is like '$^', but prerequisites listed more than once are
1703 duplicated in the order they were listed in the makefile. This is
1704 primarily useful for use in linking commands where it is meaningful
1705 to repeat library file names in a particular order.
1708 The names of all the order-only prerequisites, with spaces between
1712 The stem with which an implicit rule matches (*note How Patterns
1713 Match: Pattern Match.). If the target is 'dir/a.foo.b' and the
1714 target pattern is 'a.%.b' then the stem is 'dir/foo'. The stem is
1715 useful for constructing names of related files.
1717 In a static pattern rule, the stem is part of the file name that
1718 matched the '%' in the target pattern.
1720 In an explicit rule, there is no stem; so '$*' cannot be determined
1721 in that way. Instead, if the target name ends with a recognized
1722 suffix (*note Old-Fashioned Suffix Rules: Suffix Rules.), '$*' is
1723 set to the target name minus the suffix. For example, if the
1724 target name is 'foo.c', then '$*' is set to 'foo', since '.c' is a
1725 suffix. GNU 'make' does this bizarre thing only for compatibility
1726 with other implementations of 'make'. You should generally avoid
1727 using '$*' except in implicit rules or static pattern rules.
1729 If the target name in an explicit rule does not end with a
1730 recognized suffix, '$*' is set to the empty string for that rule.
1732 Of the variables listed above, four have values that are single file
1733 names, and three have values that are lists of file names. These seven
1734 have variants that get just the file's directory name or just the file
1735 name within the directory. The variant variables' names are formed by
1736 appending 'D' or 'F', respectively. The functions 'dir' and 'notdir'
1737 can be used to obtain a similar effect (*note Functions for File Names:
1738 File Name Functions.). Note, however, that the 'D' variants all omit
1739 the trailing slash which always appears in the output of the 'dir'
1740 function. Here is a table of the variants:
1743 The directory part of the file name of the target, with the
1744 trailing slash removed. If the value of '$@' is 'dir/foo.o' then
1745 '$(@D)' is 'dir'. This value is '.' if '$@' does not contain a
1749 The file-within-directory part of the file name of the target. If
1750 the value of '$@' is 'dir/foo.o' then '$(@F)' is 'foo.o'. '$(@F)'
1751 is equivalent to '$(notdir $@)'.
1755 The directory part and the file-within-directory part of the stem;
1756 'dir' and 'foo' in this example.
1760 The directory part and the file-within-directory part of the target
1761 archive member name. This makes sense only for archive member
1762 targets of the form 'ARCHIVE(MEMBER)' and is useful only when
1763 MEMBER may contain a directory name. (*Note Archive Members as
1764 Targets: Archive Members.)
1768 The directory part and the file-within-directory part of the first
1773 Lists of the directory parts and the file-within-directory parts of
1778 Lists of the directory parts and the file-within-directory parts of
1779 all prerequisites, including multiple instances of duplicated
1784 Lists of the directory parts and the file-within-directory parts of
1785 all prerequisites that are newer than the target.
1787 Note that we use a special stylistic convention when we talk about
1788 these automatic variables; we write "the value of '$<'", rather than
1789 "the variable '<'" as we would write for ordinary variables such as
1790 'objects' and 'CFLAGS'. We think this convention looks more natural in
1791 this special case. Please do not assume it has a deep significance;
1792 '$<' refers to the variable named '<' just as '$(CFLAGS)' refers to the
1793 variable named 'CFLAGS'. You could just as well use '$(<)' in place of
1797 File: make.info, Node: Pattern Match, Next: Match-Anything Rules, Prev: Automatic Variables, Up: Pattern Rules
1799 10.5.4 How Patterns Match
1800 -------------------------
1802 A target pattern is composed of a '%' between a prefix and a suffix,
1803 either or both of which may be empty. The pattern matches a file name
1804 only if the file name starts with the prefix and ends with the suffix,
1805 without overlap. The text between the prefix and the suffix is called
1806 the "stem". Thus, when the pattern '%.o' matches the file name
1807 'test.o', the stem is 'test'. The pattern rule prerequisites are turned
1808 into actual file names by substituting the stem for the character '%'.
1809 Thus, if in the same example one of the prerequisites is written as
1810 '%.c', it expands to 'test.c'.
1812 When the target pattern does not contain a slash (and it usually does
1813 not), directory names in the file names are removed from the file name
1814 before it is compared with the target prefix and suffix. After the
1815 comparison of the file name to the target pattern, the directory names,
1816 along with the slash that ends them, are added on to the prerequisite
1817 file names generated from the pattern rule's prerequisite patterns and
1818 the file name. The directories are ignored only for the purpose of
1819 finding an implicit rule to use, not in the application of that rule.
1820 Thus, 'e%t' matches the file name 'src/eat', with 'src/a' as the stem.
1821 When prerequisites are turned into file names, the directories from the
1822 stem are added at the front, while the rest of the stem is substituted
1823 for the '%'. The stem 'src/a' with a prerequisite pattern 'c%r' gives
1824 the file name 'src/car'.
1826 A pattern rule can be used to build a given file only if there is a
1827 target pattern that matches the file name, _and_ all prerequisites in
1828 that rule either exist or can be built. The rules you write take
1829 precedence over those that are built in. Note however, that a rule
1830 which can be satisfied without chaining other implicit rules (for
1831 example, one which has no prerequisites or its prerequisites already
1832 exist or are mentioned) always takes priority over a rule with
1833 prerequisites that must be made by chaining other implicit rules.
1835 It is possible that more than one pattern rule will meet these
1836 criteria. In that case, 'make' will choose the rule with the shortest
1837 stem (that is, the pattern that matches most specifically). If more
1838 than one pattern rule has the shortest stem, 'make' will choose the
1839 first one found in the makefile.
1841 This algorithm results in more specific rules being preferred over
1842 more generic ones; for example:
1845 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
1848 $(COMPILE.F) $(OUTPUT_OPTION) $<
1851 $(CC) -fPIC -c $(CFLAGS) $(CPPFLAGS) $< -o $@
1853 Given these rules and asked to build 'bar.o' where both 'bar.c' and
1854 'bar.f' exist, 'make' will choose the first rule and compile 'bar.c'
1855 into 'bar.o'. In the same situation where 'bar.c' does not exist, then
1856 'make' will choose the second rule and compile 'bar.f' into 'bar.o'.
1858 If 'make' is asked to build 'lib/bar.o' and both 'lib/bar.c' and
1859 'lib/bar.f' exist, then the third rule will be chosen since the stem for
1860 this rule ('bar') is shorter than the stem for the first rule
1861 ('lib/bar'). If 'lib/bar.c' does not exist then the third rule is not
1862 eligible and the second rule will be used, even though the stem is
1866 File: make.info, Node: Match-Anything Rules, Next: Canceling Rules, Prev: Pattern Match, Up: Pattern Rules
1868 10.5.5 Match-Anything Pattern Rules
1869 -----------------------------------
1871 When a pattern rule's target is just '%', it matches any file name
1872 whatever. We call these rules "match-anything" rules. They are very
1873 useful, but it can take a lot of time for 'make' to think about them,
1874 because it must consider every such rule for each file name listed
1875 either as a target or as a prerequisite.
1877 Suppose the makefile mentions 'foo.c'. For this target, 'make' would
1878 have to consider making it by linking an object file 'foo.c.o', or by C
1879 compilation-and-linking in one step from 'foo.c.c', or by Pascal
1880 compilation-and-linking from 'foo.c.p', and many other possibilities.
1882 We know these possibilities are ridiculous since 'foo.c' is a C
1883 source file, not an executable. If 'make' did consider these
1884 possibilities, it would ultimately reject them, because files such as
1885 'foo.c.o' and 'foo.c.p' would not exist. But these possibilities are so
1886 numerous that 'make' would run very slowly if it had to consider them.
1888 To gain speed, we have put various constraints on the way 'make'
1889 considers match-anything rules. There are two different constraints
1890 that can be applied, and each time you define a match-anything rule you
1891 must choose one or the other for that rule.
1893 One choice is to mark the match-anything rule as "terminal" by
1894 defining it with a double colon. When a rule is terminal, it does not
1895 apply unless its prerequisites actually exist. Prerequisites that could
1896 be made with other implicit rules are not good enough. In other words,
1897 no further chaining is allowed beyond a terminal rule.
1899 For example, the built-in implicit rules for extracting sources from
1900 RCS and SCCS files are terminal; as a result, if the file 'foo.c,v' does
1901 not exist, 'make' will not even consider trying to make it as an
1902 intermediate file from 'foo.c,v.o' or from 'RCS/SCCS/s.foo.c,v'. RCS
1903 and SCCS files are generally ultimate source files, which should not be
1904 remade from any other files; therefore, 'make' can save time by not
1905 looking for ways to remake them.
1907 If you do not mark the match-anything rule as terminal, then it is
1908 non-terminal. A non-terminal match-anything rule cannot apply to a
1909 prerequisite of an implicit rule, or to a file name that indicates a
1910 specific type of data. A file name indicates a specific type of data if
1911 some non-match-anything implicit rule target matches it.
1913 For example, the file name 'foo.c' matches the target for the pattern
1914 rule '%.c : %.y' (the rule to run Yacc). Regardless of whether this
1915 rule is actually applicable (which happens only if there is a file
1916 'foo.y'), the fact that its target matches is enough to prevent
1917 consideration of any non-terminal match-anything rules for the file
1918 'foo.c'. Thus, 'make' will not even consider trying to make 'foo.c' as
1919 an executable file from 'foo.c.o', 'foo.c.c', 'foo.c.p', etc.
1921 The motivation for this constraint is that non-terminal
1922 match-anything rules are used for making files containing specific types
1923 of data (such as executable files) and a file name with a recognized
1924 suffix indicates some other specific type of data (such as a C source
1927 Special built-in dummy pattern rules are provided solely to recognize
1928 certain file names so that non-terminal match-anything rules will not be
1929 considered. These dummy rules have no prerequisites and no recipes, and
1930 they are ignored for all other purposes. For example, the built-in
1935 exists to make sure that Pascal source files such as 'foo.p' match a
1936 specific target pattern and thereby prevent time from being wasted
1937 looking for 'foo.p.o' or 'foo.p.c'.
1939 Dummy pattern rules such as the one for '%.p' are made for every
1940 suffix listed as valid for use in suffix rules (*note Old-Fashioned
1941 Suffix Rules: Suffix Rules.).
1944 File: make.info, Node: Canceling Rules, Prev: Match-Anything Rules, Up: Pattern Rules
1946 10.5.6 Canceling Implicit Rules
1947 -------------------------------
1949 You can override a built-in implicit rule (or one you have defined
1950 yourself) by defining a new pattern rule with the same target and
1951 prerequisites, but a different recipe. When the new rule is defined,
1952 the built-in one is replaced. The new rule's position in the sequence
1953 of implicit rules is determined by where you write the new rule.
1955 You can cancel a built-in implicit rule by defining a pattern rule
1956 with the same target and prerequisites, but no recipe. For example, the
1957 following would cancel the rule that runs the assembler:
1962 File: make.info, Node: Last Resort, Next: Suffix Rules, Prev: Pattern Rules, Up: Implicit Rules
1964 10.6 Defining Last-Resort Default Rules
1965 =======================================
1967 You can define a last-resort implicit rule by writing a terminal
1968 match-anything pattern rule with no prerequisites (*note Match-Anything
1969 Rules::). This is just like any other pattern rule; the only thing
1970 special about it is that it will match any target. So such a rule's
1971 recipe is used for all targets and prerequisites that have no recipe of
1972 their own and for which no other implicit rule applies.
1974 For example, when testing a makefile, you might not care if the
1975 source files contain real data, only that they exist. Then you might do
1981 to cause all the source files needed (as prerequisites) to be created
1984 You can instead define a recipe to be used for targets for which
1985 there are no rules at all, even ones which don't specify recipes. You
1986 do this by writing a rule for the target '.DEFAULT'. Such a rule's
1987 recipe is used for all prerequisites which do not appear as targets in
1988 any explicit rule, and for which no implicit rule applies. Naturally,
1989 there is no '.DEFAULT' rule unless you write one.
1991 If you use '.DEFAULT' with no recipe or prerequisites:
1995 the recipe previously stored for '.DEFAULT' is cleared. Then 'make'
1996 acts as if you had never defined '.DEFAULT' at all.
1998 If you do not want a target to get the recipe from a match-anything
1999 pattern rule or '.DEFAULT', but you also do not want any recipe to be
2000 run for the target, you can give it an empty recipe (*note Defining
2001 Empty Recipes: Empty Recipes.).
2003 You can use a last-resort rule to override part of another makefile.
2004 *Note Overriding Part of Another Makefile: Overriding Makefiles.
2007 File: make.info, Node: Suffix Rules, Next: Implicit Rule Search, Prev: Last Resort, Up: Implicit Rules
2009 10.7 Old-Fashioned Suffix Rules
2010 ===============================
2012 "Suffix rules" are the old-fashioned way of defining implicit rules for
2013 'make'. Suffix rules are obsolete because pattern rules are more
2014 general and clearer. They are supported in GNU 'make' for compatibility
2015 with old makefiles. They come in two kinds: "double-suffix" and
2018 A double-suffix rule is defined by a pair of suffixes: the target
2019 suffix and the source suffix. It matches any file whose name ends with
2020 the target suffix. The corresponding implicit prerequisite is made by
2021 replacing the target suffix with the source suffix in the file name. A
2022 two-suffix rule '.c.o' (whose target and source suffixes are '.o' and
2023 '.c') is equivalent to the pattern rule '%.o : %.c'.
2025 A single-suffix rule is defined by a single suffix, which is the
2026 source suffix. It matches any file name, and the corresponding implicit
2027 prerequisite name is made by appending the source suffix. A
2028 single-suffix rule whose source suffix is '.c' is equivalent to the
2029 pattern rule '% : %.c'.
2031 Suffix rule definitions are recognized by comparing each rule's
2032 target against a defined list of known suffixes. When 'make' sees a
2033 rule whose target is a known suffix, this rule is considered a
2034 single-suffix rule. When 'make' sees a rule whose target is two known
2035 suffixes concatenated, this rule is taken as a double-suffix rule.
2037 For example, '.c' and '.o' are both on the default list of known
2038 suffixes. Therefore, if you define a rule whose target is '.c.o',
2039 'make' takes it to be a double-suffix rule with source suffix '.c' and
2040 target suffix '.o'. Here is the old-fashioned way to define the rule
2041 for compiling a C source file:
2044 $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
2046 Suffix rules cannot have any prerequisites of their own. If they
2047 have any, they are treated as normal files with funny names, not as
2048 suffix rules. Thus, the rule:
2051 $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
2053 tells how to make the file '.c.o' from the prerequisite file 'foo.h',
2054 and is not at all like the pattern rule:
2057 $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
2059 which tells how to make '.o' files from '.c' files, and makes all '.o'
2060 files using this pattern rule also depend on 'foo.h'.
2062 Suffix rules with no recipe are also meaningless. They do not remove
2063 previous rules as do pattern rules with no recipe (*note Canceling
2064 Implicit Rules: Canceling Rules.). They simply enter the suffix or pair
2065 of suffixes concatenated as a target in the data base.
2067 The known suffixes are simply the names of the prerequisites of the
2068 special target '.SUFFIXES'. You can add your own suffixes by writing a
2069 rule for '.SUFFIXES' that adds more prerequisites, as in:
2071 .SUFFIXES: .hack .win
2073 which adds '.hack' and '.win' to the end of the list of suffixes.
2075 If you wish to eliminate the default known suffixes instead of just
2076 adding to them, write a rule for '.SUFFIXES' with no prerequisites. By
2077 special dispensation, this eliminates all existing prerequisites of
2078 '.SUFFIXES'. You can then write another rule to add the suffixes you
2081 .SUFFIXES: # Delete the default suffixes
2082 .SUFFIXES: .c .o .h # Define our suffix list
2084 The '-r' or '--no-builtin-rules' flag causes the default list of
2085 suffixes to be empty.
2087 The variable 'SUFFIXES' is defined to the default list of suffixes
2088 before 'make' reads any makefiles. You can change the list of suffixes
2089 with a rule for the special target '.SUFFIXES', but that does not alter
2093 File: make.info, Node: Implicit Rule Search, Prev: Suffix Rules, Up: Implicit Rules
2095 10.8 Implicit Rule Search Algorithm
2096 ===================================
2098 Here is the procedure 'make' uses for searching for an implicit rule for
2099 a target T. This procedure is followed for each double-colon rule with
2100 no recipe, for each target of ordinary rules none of which have a
2101 recipe, and for each prerequisite that is not the target of any rule.
2102 It is also followed recursively for prerequisites that come from
2103 implicit rules, in the search for a chain of rules.
2105 Suffix rules are not mentioned in this algorithm because suffix rules
2106 are converted to equivalent pattern rules once the makefiles have been
2109 For an archive member target of the form 'ARCHIVE(MEMBER)', the
2110 following algorithm is run twice, first using the entire target name T,
2111 and second using '(MEMBER)' as the target T if the first run found no
2114 1. Split T into a directory part, called D, and the rest, called N.
2115 For example, if T is 'src/foo.o', then D is 'src/' and N is
2118 2. Make a list of all the pattern rules one of whose targets matches T
2119 or N. If the target pattern contains a slash, it is matched
2120 against T; otherwise, against N.
2122 3. If any rule in that list is _not_ a match-anything rule, or if T is
2123 a prerequisite of an implicit rule, then remove all non-terminal
2124 match-anything rules from the list.
2126 4. Remove from the list all rules with no recipe.
2128 5. For each pattern rule in the list:
2130 a. Find the stem S, which is the nonempty part of T or N matched
2131 by the '%' in the target pattern.
2133 b. Compute the prerequisite names by substituting S for '%'; if
2134 the target pattern does not contain a slash, append D to the
2135 front of each prerequisite name.
2137 c. Test whether all the prerequisites exist or ought to exist.
2138 (If a file name is mentioned in the makefile as a target or as
2139 an explicit prerequisite of target T, then we say it ought to
2142 If all prerequisites exist or ought to exist, or there are no
2143 prerequisites, then this rule applies.
2145 6. If no pattern rule has been found so far, try harder. For each
2146 pattern rule in the list:
2148 a. If the rule is terminal, ignore it and go on to the next rule.
2150 b. Compute the prerequisite names as before.
2152 c. Test whether all the prerequisites exist or ought to exist.
2154 d. For each prerequisite that does not exist, follow this
2155 algorithm recursively to see if the prerequisite can be made
2156 by an implicit rule.
2158 e. If all prerequisites exist, ought to exist, or can be made by
2159 implicit rules, then this rule applies.
2161 7. If no pattern rule has been found then try step 5 and step 6 again
2162 with a modified definition of "ought to exist": if a filename is
2163 mentioned as a target or as an explicit prerequisite of _any_
2164 target, then it ought to exist. This check is only present for
2165 backward-compatibility with older versions of GNU make: we don't
2166 recommend relying on it.
2168 8. If no implicit rule applies, the rule for '.DEFAULT', if any,
2169 applies. In that case, give T the same recipe that '.DEFAULT' has.
2170 Otherwise, there is no recipe for T.
2172 Once a rule that applies has been found, for each target pattern of
2173 the rule other than the one that matched T or N, the '%' in the pattern
2174 is replaced with S and the resultant file name is stored until the
2175 recipe to remake the target file T is executed. After the recipe is
2176 executed, each of these stored file names are entered into the data base
2177 and marked as having been updated and having the same update status as
2180 When the recipe of a pattern rule is executed for T, the automatic
2181 variables are set corresponding to the target and prerequisites. *Note
2182 Automatic Variables::.
2185 File: make.info, Node: Archives, Next: Extending make, Prev: Implicit Rules, Up: Top
2187 11 Using 'make' to Update Archive Files
2188 ***************************************
2190 "Archive files" are files containing named sub-files called "members";
2191 they are maintained with the program 'ar' and their main use is as
2192 subroutine libraries for linking.
2196 * Archive Members:: Archive members as targets.
2197 * Archive Update:: The implicit rule for archive member targets.
2198 * Archive Pitfalls:: Dangers to watch out for when using archives.
2199 * Archive Suffix Rules:: You can write a special kind of suffix rule
2200 for updating archives.
2203 File: make.info, Node: Archive Members, Next: Archive Update, Prev: Archives, Up: Archives
2205 11.1 Archive Members as Targets
2206 ===============================
2208 An individual member of an archive file can be used as a target or
2209 prerequisite in 'make'. You specify the member named MEMBER in archive
2210 file ARCHIVE as follows:
2214 This construct is available only in targets and prerequisites, not in
2215 recipes! Most programs that you might use in recipes do not support
2216 this syntax and cannot act directly on archive members. Only 'ar' and
2217 other programs specifically designed to operate on archives can do so.
2218 Therefore, valid recipes to update an archive member target probably
2219 must use 'ar'. For example, this rule says to create a member 'hack.o'
2220 in archive 'foolib' by copying the file 'hack.o':
2222 foolib(hack.o) : hack.o
2225 In fact, nearly all archive member targets are updated in just this
2226 way and there is an implicit rule to do it for you. *Please note:* The
2227 'c' flag to 'ar' is required if the archive file does not already exist.
2229 To specify several members in the same archive, you can write all the
2230 member names together between the parentheses. For example:
2232 foolib(hack.o kludge.o)
2236 foolib(hack.o) foolib(kludge.o)
2238 You can also use shell-style wildcards in an archive member
2239 reference. *Note Using Wildcard Characters in File Names: Wildcards.
2240 For example, 'foolib(*.o)' expands to all existing members of the
2241 'foolib' archive whose names end in '.o'; perhaps 'foolib(hack.o)
2245 File: make.info, Node: Archive Update, Next: Archive Pitfalls, Prev: Archive Members, Up: Archives
2247 11.2 Implicit Rule for Archive Member Targets
2248 =============================================
2250 Recall that a target that looks like 'A(M)' stands for the member named
2251 M in the archive file A.
2253 When 'make' looks for an implicit rule for such a target, as a
2254 special feature it considers implicit rules that match '(M)', as well as
2255 those that match the actual target 'A(M)'.
2257 This causes one special rule whose target is '(%)' to match. This
2258 rule updates the target 'A(M)' by copying the file M into the archive.
2259 For example, it will update the archive member target 'foo.a(bar.o)' by
2260 copying the _file_ 'bar.o' into the archive 'foo.a' as a _member_ named
2263 When this rule is chained with others, the result is very powerful.
2264 Thus, 'make "foo.a(bar.o)"' (the quotes are needed to protect the '('
2265 and ')' from being interpreted specially by the shell) in the presence
2266 of a file 'bar.c' is enough to cause the following recipe to be run,
2267 even without a makefile:
2269 cc -c bar.c -o bar.o
2273 Here 'make' has envisioned the file 'bar.o' as an intermediate file.
2274 *Note Chains of Implicit Rules: Chained Rules.
2276 Implicit rules such as this one are written using the automatic
2277 variable '$%'. *Note Automatic Variables::.
2279 An archive member name in an archive cannot contain a directory name,
2280 but it may be useful in a makefile to pretend that it does. If you
2281 write an archive member target 'foo.a(dir/file.o)', 'make' will perform
2282 automatic updating with this recipe:
2284 ar r foo.a dir/file.o
2286 which has the effect of copying the file 'dir/file.o' into a member
2287 named 'file.o'. In connection with such usage, the automatic variables
2288 '%D' and '%F' may be useful.
2292 * Archive Symbols:: How to update archive symbol directories.
2295 File: make.info, Node: Archive Symbols, Prev: Archive Update, Up: Archive Update
2297 11.2.1 Updating Archive Symbol Directories
2298 ------------------------------------------
2300 An archive file that is used as a library usually contains a special
2301 member named '__.SYMDEF' that contains a directory of the external
2302 symbol names defined by all the other members. After you update any
2303 other members, you need to update '__.SYMDEF' so that it will summarize
2304 the other members properly. This is done by running the 'ranlib'
2309 Normally you would put this command in the rule for the archive file,
2310 and make all the members of the archive file prerequisites of that rule.
2313 libfoo.a: libfoo.a(x.o) libfoo.a(y.o) ...
2316 The effect of this is to update archive members 'x.o', 'y.o', etc., and
2317 then update the symbol directory member '__.SYMDEF' by running 'ranlib'.
2318 The rules for updating the members are not shown here; most likely you
2319 can omit them and use the implicit rule which copies files into the
2320 archive, as described in the preceding section.
2322 This is not necessary when using the GNU 'ar' program, which updates
2323 the '__.SYMDEF' member automatically.
2326 File: make.info, Node: Archive Pitfalls, Next: Archive Suffix Rules, Prev: Archive Update, Up: Archives
2328 11.3 Dangers When Using Archives
2329 ================================
2331 It is important to be careful when using parallel execution (the '-j'
2332 switch; *note Parallel Execution: Parallel.) and archives. If multiple
2333 'ar' commands run at the same time on the same archive file, they will
2334 not know about each other and can corrupt the file.
2336 Possibly a future version of 'make' will provide a mechanism to
2337 circumvent this problem by serializing all recipes that operate on the
2338 same archive file. But for the time being, you must either write your
2339 makefiles to avoid this problem in some other way, or not use '-j'.
2342 File: make.info, Node: Archive Suffix Rules, Prev: Archive Pitfalls, Up: Archives
2344 11.4 Suffix Rules for Archive Files
2345 ===================================
2347 You can write a special kind of suffix rule for dealing with archive
2348 files. *Note Suffix Rules::, for a full explanation of suffix rules.
2349 Archive suffix rules are obsolete in GNU 'make', because pattern rules
2350 for archives are a more general mechanism (*note Archive Update::). But
2351 they are retained for compatibility with other 'make's.
2353 To write a suffix rule for archives, you simply write a suffix rule
2354 using the target suffix '.a' (the usual suffix for archive files). For
2355 example, here is the old-fashioned suffix rule to update a library
2356 archive from C source files:
2359 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $*.o
2363 This works just as if you had written the pattern rule:
2366 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $*.o
2370 In fact, this is just what 'make' does when it sees a suffix rule
2371 with '.a' as the target suffix. Any double-suffix rule '.X.a' is
2372 converted to a pattern rule with the target pattern '(%.o)' and a
2373 prerequisite pattern of '%.X'.
2375 Since you might want to use '.a' as the suffix for some other kind of
2376 file, 'make' also converts archive suffix rules to pattern rules in the
2377 normal way (*note Suffix Rules::). Thus a double-suffix rule '.X.a'
2378 produces two pattern rules: '(%.o): %.X' and '%.a: %.X'.
2381 File: make.info, Node: Extending make, Next: Integrating make, Prev: Archives, Up: Top
2383 12 Extending GNU 'make'
2384 ***********************
2386 GNU 'make' provides many advanced capabilities, including many useful
2387 functions. However, it does not contain a complete programming language
2388 and so it has limitations. Sometimes these limitations can be overcome
2389 through use of the 'shell' function to invoke a separate program,
2390 although this can be inefficient.
2392 In cases where the built-in capabilities of GNU 'make' are
2393 insufficient to your requirements there are two options for extending
2394 'make'. On systems where it's provided, you can utilize GNU Guile as an
2395 embedded scripting language (*note GNU Guile Integration: Guile
2396 Integration.). On systems which support dynamically loadable objects,
2397 you can write your own extension in any language (which can be compiled
2398 into such an object) and load it to provide extended capabilities (*note
2399 The 'load' Directive: load Directive.).
2403 * Guile Integration:: Using Guile as an embedded scripting language.
2404 * Loading Objects:: Loading dynamic objects as extensions.
2407 File: make.info, Node: Guile Integration, Next: Loading Objects, Prev: Extending make, Up: Extending make
2409 12.1 GNU Guile Integration
2410 ==========================
2412 GNU 'make' may be built with support for GNU Guile as an embedded
2413 extension language. Guile implements the Scheme language. A review of
2414 GNU Guile and the Scheme language and its features is beyond the scope
2415 of this manual: see the documentation for GNU Guile and Scheme.
2417 You can determine if 'make' contains support for Guile by examining
2418 the '.FEATURES' variable; it will contain the word GUILE if Guile
2419 support is available.
2421 The Guile integration provides one new 'make' function: 'guile'. The
2422 'guile' function takes one argument which is first expanded by 'make' in
2423 the normal fashion, then passed to the GNU Guile evaluator. The result
2424 of the evaluator is converted into a string and used as the expansion of
2425 the 'guile' function in the makefile.
2427 In addition, GNU 'make' exposes Guile procedures for use in Guile
2432 * Guile Types:: Converting Guile types to 'make' strings.
2433 * Guile Interface:: Invoking 'make' functions from Guile.
2434 * Guile Example:: Example using Guile in 'make'.
2437 File: make.info, Node: Guile Types, Next: Guile Interface, Prev: Guile Integration, Up: Guile Integration
2439 12.1.1 Conversion of Guile Types
2440 --------------------------------
2442 There is only one "data type" in 'make': a string. GNU Guile, on the
2443 other hand, provides a rich variety of different data types. An
2444 important aspect of the interface between 'make' and GNU Guile is the
2445 conversion of Guile data types into 'make' strings.
2447 This conversion is relevant in two places: when a makefile invokes
2448 the 'guile' function to evaluate a Guile expression, the result of that
2449 evaluation must be converted into a make string so it can be further
2450 evaluated by 'make'. And secondly, when a Guile script invokes one of
2451 the procedures exported by 'make' the argument provided to the procedure
2452 must be converted into a string.
2454 The conversion of Guile types into 'make' strings is as below:
2457 False is converted into the empty string: in 'make' conditionals
2458 the empty string is considered false.
2461 True is converted to the string '#t': in 'make' conditionals any
2462 non-empty string is considered true.
2466 A symbol or number is converted into the string representation of
2467 that symbol or number.
2470 A printable character is converted to the same character.
2473 A string containing only printable characters is converted to the
2477 A list is converted recursively according to the above rules. This
2478 implies that any structured list will be flattened (that is, a
2479 result of ''(a b (c d) e)' will be converted to the 'make' string
2483 Any other Guile type results in an error. In future versions of
2484 'make', other Guile types may be converted.
2486 The translation of '#f' (to the empty string) and '#t' (to the
2487 non-empty string '#t') is designed to allow you to use Guile boolean
2488 results directly as 'make' boolean conditions. For example:
2490 $(if $(guile (access? "myfile" R_OK)),$(info myfile exists))
2492 As a consequence of these conversion rules you must consider the
2493 result of your Guile script, as that result will be converted into a
2494 string and parsed by 'make'. If there is no natural result for the
2495 script (that is, the script exists solely for its side-effects), you
2496 should add '#f' as the final expression in order to avoid syntax errors
2500 File: make.info, Node: Guile Interface, Next: Guile Example, Prev: Guile Types, Up: Guile Integration
2502 12.1.2 Interfaces from Guile to 'make'
2503 --------------------------------------
2505 In addition to the 'guile' function available in makefiles, 'make'
2506 exposes some procedures for use in your Guile scripts. At startup
2507 'make' creates a new Guile module, 'gnu make', and exports these
2508 procedures as public interfaces from that module:
2511 This procedure takes a single argument which is converted into a
2512 string. The string is expanded by 'make' using normal 'make'
2513 expansion rules. The result of the expansion is converted into a
2514 Guile string and provided as the result of the procedure.
2517 This procedure takes a single argument which is converted into a
2518 string. The string is evaluated by 'make' as if it were a
2519 makefile. This is the same capability available via the 'eval'
2520 function (*note Eval Function::). The result of the 'gmk-eval'
2521 procedure is always the empty string.
2523 Note that 'gmk-eval' is not quite the same as using 'gmk-expand'
2524 with the 'eval' function: in the latter case the evaluated string
2525 will be expanded _twice_; first by 'gmk-expand', then again by the
2529 File: make.info, Node: Guile Example, Prev: Guile Interface, Up: Guile Integration
2531 12.1.3 Example Using Guile in 'make'
2532 ------------------------------------
2534 Here is a very simple example using GNU Guile to manage writing to a
2535 file. These Guile procedures simply open a file, allow writing to the
2536 file (one string per line), and close the file. Note that because we
2537 cannot store complex values such as Guile ports in 'make' variables,
2538 we'll keep the port as a global variable in the Guile interpreter.
2540 You can create Guile functions easily using 'define'/'endef' to
2541 create a Guile script, then use the 'guile' function to internalize it:
2544 ;; A simple Guile IO library for GNU make
2548 (define (mkopen name mode)
2549 (set! MKPORT (open-file name mode))
2564 # Internalize the Guile IO functions
2567 If you have a significant amount of Guile support code, you might
2568 consider keeping it in a different file (e.g., 'guileio.scm') and then
2569 loading it in your makefile using the 'guile' function:
2571 $(guile (load "guileio.scm"))
2573 An advantage to this method is that when editing 'guileio.scm', your
2574 editor will understand that this file contains Scheme syntax rather than
2577 Now you can use these Guile functions to create files. Suppose you
2578 need to operate on a very large list, which cannot fit on the command
2579 line, but the utility you're using accepts the list as input as well:
2582 @$(guile (mkopen "tmp.out" "w")) \
2583 $(foreach X,$^,$(guile (mkwrite "$(X)"))) \
2587 A more comprehensive suite of file manipulation procedures is
2588 possible of course. You could, for example, maintain multiple output
2589 files at the same time by choosing a symbol for each one and using it as
2590 the key to a hash table, where the value is a port, then returning the
2591 symbol to be stored in a 'make' variable.
2594 File: make.info, Node: Loading Objects, Prev: Guile Integration, Up: Extending make
2596 12.2 Loading Dynamic Objects
2597 ============================
2599 Warning: The 'load' directive and extension capability is
2600 considered a "technology preview" in this release of GNU make. We
2601 encourage you to experiment with this feature and we appreciate any
2602 feedback on it. However we cannot guarantee to maintain
2603 backward-compatibility in the next release. Consider using GNU
2604 Guile instead for extending GNU make (*note The 'guile' Function:
2607 Many operating systems provide a facility for dynamically loading
2608 compiled objects. If your system provides this facility, GNU 'make' can
2609 make use of it to load dynamic objects at runtime, providing new
2610 capabilities which may then be invoked by your makefile.
2612 The 'load' directive is used to load a dynamic object. Once the
2613 object is loaded, a "setup" function will be invoked to allow the object
2614 to initialize itself and register new facilities with GNU 'make'. A
2615 dynamic object might include new 'make' functions, for example, and the
2616 "setup" function would register them with GNU 'make''s function handling
2621 * load Directive:: Loading dynamic objects as extensions.
2622 * Remaking Loaded Objects:: How loaded objects get remade.
2623 * Loaded Object API:: Programmatic interface for loaded objects.
2624 * Loaded Object Example:: Example of a loaded object
2627 File: make.info, Node: load Directive, Next: Remaking Loaded Objects, Prev: Loading Objects, Up: Loading Objects
2629 12.2.1 The 'load' Directive
2630 ---------------------------
2632 Objects are loaded into GNU 'make' by placing the 'load' directive into
2633 your makefile. The syntax of the 'load' directive is as follows:
2635 load OBJECT-FILE ...
2639 load OBJECT-FILE(SYMBOL-NAME) ...
2641 The file OBJECT-FILE is dynamically loaded by GNU 'make'. If
2642 OBJECT-FILE does not include a directory path then it is first looked
2643 for in the current directory. If it is not found there, or a directory
2644 path is included, then system-specific paths will be searched. If the
2645 load fails for any reason, 'make' will print a message and exit.
2647 If the load succeeds 'make' will invoke an initializing function.
2649 If SYMBOL-NAME is provided, it will be used as the name of the
2650 initializing function.
2652 If no SYMBOL-NAME is provided, the initializing function name is
2653 created by taking the base file name of OBJECT-FILE, up to the first
2654 character which is not a valid symbol name character (alphanumerics and
2655 underscores are valid symbol name characters). To this prefix will be
2656 appended the suffix '_gmk_setup'.
2658 More than one object file may be loaded with a single 'load'
2659 directive, and both forms of 'load' arguments may be used in the same
2662 The initializing function will be provided the file name and line
2663 number of the invocation of the 'load' operation. It should return a
2664 value of type 'int', which must be '0' on failure and non-'0' on
2665 success. If the return value is '-1', then GNU make will _not_ attempt
2666 to rebuild the object file (*note How Loaded Objects Are Remade:
2667 Remaking Loaded Objects.).
2673 will load the dynamic object '../mk_funcs.so'. After the object is
2674 loaded, 'make' will invoke the function (assumed to be defined by the
2675 shared object) 'mk_funcs_gmk_setup'.
2679 load ../mk_funcs.so(init_mk_func)
2681 will load the dynamic object '../mk_funcs.so'. After the object is
2682 loaded, 'make' will invoke the function 'init_mk_func'.
2684 Regardless of how many times an object file appears in a 'load'
2685 directive, it will only be loaded (and its setup function will only be
2688 After an object has been successfully loaded, its file name is
2689 appended to the '.LOADED' variable.
2691 If you would prefer that failure to load a dynamic object not be
2692 reported as an error, you can use the '-load' directive instead of
2693 'load'. GNU 'make' will not fail and no message will be generated if an
2694 object fails to load. The failed object is not added to the '.LOADED'
2695 variable, which can then be consulted to determine if the load was
2699 File: make.info, Node: Remaking Loaded Objects, Next: Loaded Object API, Prev: load Directive, Up: Loading Objects
2701 12.2.2 How Loaded Objects Are Remade
2702 ------------------------------------
2704 Loaded objects undergo the same re-make procedure as makefiles (*note
2705 How Makefiles Are Remade: Remaking Makefiles.). If any loaded object is
2706 recreated, then 'make' will start from scratch and re-read all the
2707 makefiles, and reload the object files again. It is not necessary for
2708 the loaded object to do anything special to support this.
2710 It's up to the makefile author to provide the rules needed for
2711 rebuilding the loaded object.
2714 File: make.info, Node: Loaded Object API, Next: Loaded Object Example, Prev: Remaking Loaded Objects, Up: Loading Objects
2716 12.2.3 Loaded Object Interface
2717 ------------------------------
2719 Warning: For this feature to be useful your extensions will need to
2720 invoke various functions internal to GNU 'make'. The programming
2721 interfaces provided in this release should not be considered
2722 stable: functions may be added, removed, or change calling
2723 signatures or implementations in future versions of GNU 'make'.
2725 To be useful, loaded objects must be able to interact with GNU
2726 'make'. This interaction includes both interfaces the loaded object
2727 provides to makefiles and also interfaces 'make' provides to the loaded
2728 object to manipulate 'make''s operation.
2730 The interface between loaded objects and 'make' is defined by the
2731 'gnumake.h' C header file. All loaded objects written in C should
2732 include this header file. Any loaded object not written in C will need
2733 to implement the interface defined in this header file.
2735 Typically, a loaded object will register one or more new GNU 'make'
2736 functions using the 'gmk_add_function' routine from within its setup
2737 function. The implementations of these 'make' functions may make use of
2738 the 'gmk_expand' and 'gmk_eval' routines to perform their tasks, then
2739 optionally return a string as the result of the function expansion.
2741 Loaded Object Licensing
2742 .......................
2744 Every dynamic extension should define the global symbol
2745 'plugin_is_GPL_compatible' to assert that it has been licensed under a
2746 GPL-compatible license. If this symbol does not exist, 'make' emits a
2747 fatal error and exits when it tries to load your extension.
2749 The declared type of the symbol should be 'int'. It does not need to
2750 be in any allocated section, though. The code merely asserts that the
2751 symbol exists in the global scope. Something like this is enough:
2753 int plugin_is_GPL_compatible;
2759 This structure represents a filename/location pair. It is provided
2760 when defining items, so GNU 'make' can inform the user later where
2761 the definition occurred if necessary.
2763 Registering Functions
2764 .....................
2766 There is currently one way for makefiles to invoke operations provided
2767 by the loaded object: through the 'make' function call interface. A
2768 loaded object can register one or more new functions which may then be
2769 invoked from within the makefile in the same way as any other function.
2771 Use 'gmk_add_function' to create a new 'make' function. Its
2772 arguments are as follows:
2775 The function name. This is what the makefile should use to invoke
2776 the function. The name must be between 1 and 255 characters long
2777 and it may only contain alphanumeric, period ('.'), dash ('-'), and
2778 underscore ('_') characters. It may not begin with a period.
2781 A pointer to a function that 'make' will invoke when it expands the
2782 function in a makefile. This function must be defined by the
2786 The minimum number of arguments the function will accept. Must be
2787 between 0 and 255. GNU 'make' will check this and fail before
2788 invoking 'func_ptr' if the function was invoked with too few
2792 The maximum number of arguments the function will accept. Must be
2793 between 0 and 255. GNU 'make' will check this and fail before
2794 invoking 'func_ptr' if the function was invoked with too many
2795 arguments. If the value is 0, then any number of arguments is
2796 accepted. If the value is greater than 0, then it must be greater
2797 than or equal to 'min_args'.
2800 Flags that specify how this function will operate; the desired
2801 flags should be OR'd together. If the 'GMK_FUNC_NOEXPAND' flag is
2802 given then the function arguments will not be expanded before the
2803 function is called; otherwise they will be expanded first.
2805 Registered Function Interface
2806 .............................
2808 A function registered with 'make' must match the 'gmk_func_ptr' type.
2809 It will be invoked with three parameters: 'name' (the name of the
2810 function), 'argc' (the number of arguments to the function), and 'argv'
2811 (an array of pointers to arguments to the function). The last pointer
2812 (that is, 'argv[argc]') will be null ('0').
2814 The return value of the function is the result of expanding the
2815 function. If the function expands to nothing the return value may be
2816 null. Otherwise, it must be a pointer to a string created with
2817 'gmk_alloc'. Once the function returns, 'make' owns this string and
2818 will free it when appropriate; it cannot be accessed by the loaded
2821 GNU 'make' Facilities
2822 .....................
2824 There are some facilities exported by GNU 'make' for use by loaded
2825 objects. Typically these would be run from within the setup function
2826 and/or the functions registered via 'gmk_add_function', to retrieve or
2827 modify the data 'make' works with.
2830 This function takes a string and expands it using 'make' expansion
2831 rules. The result of the expansion is returned in a nil-terminated
2832 string buffer. The caller is responsible for calling 'gmk_free'
2833 with a pointer to the returned buffer when done.
2836 This function takes a buffer and evaluates it as a segment of
2837 makefile syntax. This function can be used to define new
2838 variables, new rules, etc. It is equivalent to using the 'eval'
2841 Note that there is a difference between 'gmk_eval' and calling
2842 'gmk_expand' with a string using the 'eval' function: in the latter case
2843 the string will be expanded _twice_; once by 'gmk_expand' and then again
2844 by the 'eval' function. Using 'gmk_eval' the buffer is only expanded
2845 once, at most (as it's read by the 'make' parser).
2850 Some systems allow for different memory management schemes. Thus you
2851 should never pass memory that you've allocated directly to any 'make'
2852 function, nor should you attempt to directly free any memory returned to
2853 you by any 'make' function. Instead, use the 'gmk_alloc' and 'gmk_free'
2856 In particular, the string returned to 'make' by a function registered
2857 using 'gmk_add_function' _must_ be allocated using 'gmk_alloc', and the
2858 string returned from the 'make' 'gmk_expand' function _must_ be freed
2859 (when no longer needed) using 'gmk_free'.
2862 Return a pointer to a newly-allocated buffer. This function will
2863 always return a valid pointer; if not enough memory is available
2864 'make' will exit. 'gmk_alloc' does not initialize allocated
2868 Free a buffer returned to you by 'make'. Once the 'gmk_free'
2869 function returns the string will no longer be valid. If NULL is
2870 passed to 'gmk_free', no operation is performed.
2873 File: make.info, Node: Loaded Object Example, Prev: Loaded Object API, Up: Loading Objects
2875 12.2.4 Example Loaded Object
2876 ----------------------------
2878 Let's suppose we wanted to write a new GNU 'make' function that would
2879 create a temporary file and return its name. We would like our function
2880 to take a prefix as an argument. First we can write the function in a
2889 #include <gnumake.h>
2891 int plugin_is_GPL_compatible;
2894 gen_tmpfile(const char *nm, int argc, char **argv)
2898 /* Compute the size of the filename and allocate space for it. */
2899 int len = strlen (argv[0]) + 6 + 1;
2900 char *buf = gmk_alloc (len);
2902 strcpy (buf, argv[0]);
2903 strcat (buf, "XXXXXX");
2908 /* Don't leak the file descriptor. */
2914 fprintf (stderr, "mkstemp(%s) failed: %s\n", buf, strerror (errno));
2920 mk_temp_gmk_setup (const gmk_floc *floc)
2922 printf ("mk_temp plugin loaded from %s:%lu\n", floc->filenm, floc->lineno);
2923 /* Register the function with make name "mk-temp". */
2924 gmk_add_function ("mk-temp", gen_tmpfile, 1, 1, 1);
2928 Next, we will write a 'Makefile' that can build this shared object,
2929 load it, and use it:
2932 @echo Temporary file: $(mk-temp tmpfile.)
2936 mk_temp.so: mk_temp.c
2937 $(CC) -shared -fPIC -o $@ $<
2939 On MS-Windows, due to peculiarities of how shared objects are
2940 produced, the compiler needs to scan the "import library" produced when
2941 building 'make', typically called 'libgnumake-VERSION.dll.a', where
2942 VERSION is the version of the load object API. So the recipe to produce
2943 a shared object will look on Windows like this (assuming the API version
2946 mk_temp.dll: mk_temp.c
2947 $(CC) -shared -o $@ $< -lgnumake-1
2949 Now when you run 'make' you'll see something like:
2952 mk_temp plugin loaded from Makefile:4
2953 cc -shared -fPIC -o mk_temp.so mk_temp.c
2954 Temporary filename: tmpfile.A7JEwd
2957 File: make.info, Node: Integrating make, Next: Features, Prev: Extending make, Up: Top
2959 13 Integrating GNU 'make'
2960 *************************
2962 GNU 'make' is often one component in a larger system of tools, including
2963 integrated development environments, compiler toolchains, and others.
2964 The role of 'make' is to start commands and determine whether they
2965 succeeded or not: no special integration is needed to accomplish that.
2966 However, sometimes it is convenient to bind 'make' more tightly with
2967 other parts of the system, both higher-level (tools that invoke 'make')
2968 and lower-level (tools that 'make' invokes).
2972 * Job Slots:: Share job slots with GNU 'make'.
2973 * Terminal Output:: Control output to terminals.
2976 File: make.info, Node: Job Slots, Next: Terminal Output, Prev: Integrating make, Up: Integrating make
2978 13.1 Sharing Job Slots with GNU 'make'
2979 ======================================
2981 GNU 'make' has the ability to run multiple recipes in parallel (*note
2982 Parallel Execution: Parallel.) and to cap the total number of parallel
2983 jobs even across recursive invocations of 'make' (*note Communicating
2984 Options to a Sub-'make': Options/Recursion.). Tools that 'make' invokes
2985 which are also able to run multiple operations in parallel, either using
2986 multiple threads or multiple processes, can be enhanced to participate
2987 in GNU 'make''s job management facility to ensure that the total number
2988 of active threads/processes running on the system does not exceed the
2989 maximum number of slots provided to GNU 'make'.
2991 GNU 'make' uses a method called the "jobserver" to control the number
2992 of active jobs across recursive invocations. The actual implementation
2993 of the jobserver varies across different operating systems, but some
2994 fundamental aspects are always true.
2996 First, 'make' will provide information necessary for accessing the
2997 jobserver through the environment to its children, in the 'MAKEFLAGS'
2998 environment variable. Tools which want to participate in the jobserver
2999 protocol will need to parse this environment variable and find the word
3000 starting with '--jobserver-auth='. The value of this option will
3001 describe how to communicate with the jobserver. The interpretation of
3002 this value is described in the sections below.
3004 Be aware that the 'MAKEFLAGS' variable may contain multiple instances
3005 of the '--jobserver-auth=' option. Only the _last_ instance is
3008 Second, every command 'make' starts has one implicit job slot
3009 reserved for it before it starts. Any tool which wants to participate
3010 in the jobserver protocol should assume it can always run one job
3011 without having to contact the jobserver at all.
3013 Finally, it's critical that tools that participate in the jobserver
3014 protocol return the exact number of slots they obtained from the
3015 jobserver back to the jobserver before they exit, even under error
3016 conditions. Remember that the implicit job slot should *not* be
3017 returned to the jobserver! Returning too few slots means that those
3018 slots will be lost for the rest of the build process; returning too many
3019 slots means that extra slots will be available. The top-level 'make'
3020 command will print an error message at the end of the build if it
3021 detects an incorrect number of slots available in the jobserver.
3023 As an example, suppose you are implementing a linker which provides
3024 for multithreaded operation. You would like to enhance the linker so
3025 that if it is invoked by GNU 'make' it can participate in the jobserver
3026 protocol to control how many threads are used during link. First you
3027 will need to modify the linker to determine if the 'MAKEFLAGS'
3028 environment variable is set. Next you will need to parse the value of
3029 that variable to determine if the jobserver is available, and how to
3030 access it. If it is available then you can access it to obtain job
3031 slots controlling how much parallelism your tool can use. Once done
3032 your tool must return those job slots back to the jobserver.
3036 * POSIX Jobserver:: Using the jobserver on POSIX systems.
3037 * Windows Jobserver:: Using the jobserver on Windows systems.
3040 File: make.info, Node: POSIX Jobserver, Next: Windows Jobserver, Prev: Job Slots, Up: Job Slots
3042 13.1.1 POSIX Jobserver Interaction
3043 ----------------------------------
3045 On POSIX systems the jobserver is implemented in one of two ways: on
3046 systems that support it, GNU 'make' will create a named pipe and use
3047 that for the jobserver. In this case the auth option will have the form
3048 '--jobserver-auth=fifo:PATH' where 'PATH' is the pathname of the named
3049 pipe. To access the jobserver you should open the named pipe path and
3050 read/write to it as described below.
3052 If the system doesn't support named pipes, or if the user provided
3053 the '--jobserver-style' option and specified 'pipe', then the jobserver
3054 will be implemented as a simple UNIX pipe. In this case the auth option
3055 will have the form '--jobserver-auth=R,W' where 'R' and 'W' are
3056 non-negative integers representing file descriptors: 'R' is the read
3057 file descriptor and 'W' is the write file descriptor. If either or both
3058 of these file descriptors are negative, it means the jobserver is
3059 disabled for this process.
3061 When using a simple pipe, only command lines that 'make' understands
3062 to be recursive invocations of 'make' (*note How the 'MAKE' Variable
3063 Works: MAKE Variable.) will have access to the jobserver. When writing
3064 makefiles you must be sure to mark the command as recursive (most
3065 commonly by prefixing the command line with the '+' indicator (*note
3066 Recursive Use of 'make': Recursion.). Note that the read side of the
3067 jobserver pipe is set to "blocking" mode. This should not be changed.
3069 In both implementations of the jobserver, the pipe will be pre-loaded
3070 with one single-character token for each available job. To obtain an
3071 extra slot you must read a single character from the jobserver; to
3072 release a slot you must write a single character back into the
3075 It's important that when you release the job slot, you write back the
3076 same character you read. Don't assume that all tokens are the same
3077 character; different characters may have different meanings to GNU
3078 'make'. The order is not important, since 'make' has no idea in what
3079 order jobs will complete anyway.
3081 There are various error conditions you must consider to ensure your
3082 implementation is robust:
3084 * If you have a command-line argument controlling the parallel
3085 operation of your tool, consider whether your tool should detect
3086 situations where both the jobserver and the command-line argument
3087 are specified, and how it should react.
3089 * If your tool does not recognize the format of the
3090 '--jobserver-auth' string, it should assume the jobserver is using
3091 a different style and it cannot connect.
3093 * If your tool determines that the '--jobserver-auth' option
3094 references a simple pipe but that the file descriptors specified
3095 are closed, this means that the calling 'make' process did not
3096 think that your tool was a recursive 'make' invocation (e.g., the
3097 command line was not prefixed with a '+' character). You should
3098 notify your users of this situation.
3100 * Your tool should be sure to write back the tokens it read, even
3101 under error conditions. This includes not only errors in your tool
3102 but also outside influences such as interrupts ('SIGINT'), etc.
3103 You may want to install signal handlers to manage this write-back.
3105 * Your tool may also examine the first word of the 'MAKEFLAGS'
3106 variable and look for the character 'n'. If this character is
3107 present then 'make' was invoked with the '-n' option and your tool
3108 may want to stop without performing any operations.
3111 File: make.info, Node: Windows Jobserver, Prev: POSIX Jobserver, Up: Job Slots
3113 13.1.2 Windows Jobserver Interaction
3114 ------------------------------------
3116 On Windows systems the jobserver is implemented as a named semaphore.
3117 The semaphore will be set with an initial count equal to the number of
3118 available slots; to obtain a slot you must wait on the semaphore (with
3119 or without a timeout). To release a slot, release the semaphore.
3121 To access the semaphore you must parse the 'MAKEFLAGS' variable and
3122 look for the argument string '--jobserver-auth=NAME' where 'NAME' is the
3123 name of the named semaphore. Use this name with 'OpenSemaphore' to
3124 create a handle to the semaphore.
3126 The only valid style for '--jobserver-style' is 'sem'.
3128 There are various error conditions you must consider to ensure your
3129 implementation is robust:
3131 * Usually you will have a command-line argument controlling the
3132 parallel operation of your tool. Consider whether your tool should
3133 detect situations where both the jobserver and the command-line
3134 argument are specified, and how it should react.
3136 * Your tool should be sure to release the semaphore for the tokens it
3137 read, even under error conditions. This includes not only errors
3138 in your tool but also outside influences such as interrupts
3139 ('SIGINT'), etc. You may want to install signal handlers to manage
3143 File: make.info, Node: Terminal Output, Prev: Job Slots, Up: Integrating make
3145 13.2 Synchronized Terminal Output
3146 =================================
3148 Normally GNU 'make' will invoke all commands with access to the same
3149 standard and error outputs that 'make' itself was started with. A
3150 number of tools will detect whether the output is a terminal or
3151 not-a-terminal, and use this information to change the output style.
3152 For example if the output goes to a terminal the tool may add control
3153 characters that set color, or even change the location of the cursor.
3154 If the output is not going to a terminal then these special control
3155 characters are not emitted so that they don't corrupt log files, etc.
3157 The '--output-sync' (*note Output During Parallel Execution: Parallel
3158 Output.) option will defeat the terminal detection. When output
3159 synchronization is enabled GNU 'make' arranges for all command output to
3160 be written to a file, so that its output can be written as a block
3161 without interference from other commands. This means that all tools
3162 invoked by 'make' will believe that their output is not going to be
3163 displayed on a terminal, even when it will be (because 'make' will
3164 display it there after the command is completed).
3166 In order to facilitate tools which would like to determine whether or
3167 not their output will be displayed on a terminal, GNU 'make' will set
3168 the 'MAKE_TERMOUT' and 'MAKE_TERMERR' environment variables before
3169 invoking any commands. Tools which would like to determine whether
3170 standard or error output (respectively) will be displayed on a terminal
3171 can check these environment variables to determine if they exist and
3172 contain a non-empty value. If so the tool can assume that the output
3173 will (eventually) be displayed on a terminal. If the variables are not
3174 set or have an empty value, then the tool should fall back to its normal
3175 methods of detecting whether output is going to a terminal or not.
3177 The content of the variables can be parsed to determine the type of
3178 terminal which will be used to display the output.
3180 Similarly, environments which invoke 'make' and would like to capture
3181 the output and eventually display it on a terminal (or some display
3182 which can interpret terminal control characters) can set these variables
3183 before invoking 'make'. GNU 'make' will not modify these environment
3184 variables if they already exist when it starts.
3187 File: make.info, Node: Features, Next: Missing, Prev: Integrating make, Up: Top
3189 14 Features of GNU 'make'
3190 *************************
3192 Here is a summary of the features of GNU 'make', for comparison with and
3193 credit to other versions of 'make'. We consider the features of 'make'
3194 in 4.2 BSD systems as a baseline. If you are concerned with writing
3195 portable makefiles, you should not use the features of 'make' listed
3196 here, nor the ones in *note Missing::.
3198 Many features come from the version of 'make' in System V.
3200 * The 'VPATH' variable and its special meaning. *Note Searching
3201 Directories for Prerequisites: Directory Search. This feature
3202 exists in System V 'make', but is undocumented. It is documented
3203 in 4.3 BSD 'make' (which says it mimics System V's 'VPATH'
3206 * Included makefiles. *Note Including Other Makefiles: Include.
3207 Allowing multiple files to be included with a single directive is a
3210 * Variables are read from and communicated via the environment.
3211 *Note Variables from the Environment: Environment.
3213 * Options passed through the variable 'MAKEFLAGS' to recursive
3214 invocations of 'make'. *Note Communicating Options to a
3215 Sub-'make': Options/Recursion.
3217 * The automatic variable '$%' is set to the member name in an archive
3218 reference. *Note Automatic Variables::.
3220 * The automatic variables '$@', '$*', '$<', '$%', and '$?' have
3221 corresponding forms like '$(@F)' and '$(@D)'. We have generalized
3222 this to '$^' as an obvious extension. *Note Automatic Variables::.
3224 * Substitution variable references. *Note Basics of Variable
3225 References: Reference.
3227 * The command line options '-b' and '-m', accepted and ignored. In
3228 System V 'make', these options actually do something.
3230 * Execution of recursive commands to run 'make' via the variable
3231 'MAKE' even if '-n', '-q' or '-t' is specified. *Note Recursive
3232 Use of 'make': Recursion.
3234 * Support for suffix '.a' in suffix rules. *Note Archive Suffix
3235 Rules::. This feature is obsolete in GNU 'make', because the
3236 general feature of rule chaining (*note Chains of Implicit Rules:
3237 Chained Rules.) allows one pattern rule for installing members in
3238 an archive (*note Archive Update::) to be sufficient.
3240 * The arrangement of lines and backslash/newline combinations in
3241 recipes is retained when the recipes are printed, so they appear as
3242 they do in the makefile, except for the stripping of initial
3245 The following features were inspired by various other versions of
3246 'make'. In some cases it is unclear exactly which versions inspired
3249 * Pattern rules using '%'. This has been implemented in several
3250 versions of 'make'. We're not sure who invented it first, but it's
3251 been spread around a bit. *Note Defining and Redefining Pattern
3252 Rules: Pattern Rules.
3254 * Rule chaining and implicit intermediate files. This was
3255 implemented by Stu Feldman in his version of 'make' for AT&T Eighth
3256 Edition Research Unix, and later by Andrew Hume of AT&T Bell Labs
3257 in his 'mk' program (where he terms it "transitive closure"). We
3258 do not really know if we got this from either of them or thought it
3259 up ourselves at the same time. *Note Chains of Implicit Rules:
3262 * The automatic variable '$^' containing a list of all prerequisites
3263 of the current target. We did not invent this, but we have no idea
3264 who did. *Note Automatic Variables::. The automatic variable '$+'
3265 is a simple extension of '$^'.
3267 * The "what if" flag ('-W' in GNU 'make') was (as far as we know)
3268 invented by Andrew Hume in 'mk'. *Note Instead of Executing
3269 Recipes: Instead of Execution.
3271 * The concept of doing several things at once (parallelism) exists in
3272 many incarnations of 'make' and similar programs, though not in the
3273 System V or BSD implementations. *Note Recipe Execution:
3276 * A number of different build tools that support parallelism also
3277 support collecting output and displaying as a single block. *Note
3278 Output During Parallel Execution: Parallel Output.
3280 * Modified variable references using pattern substitution come from
3281 SunOS 4. *Note Basics of Variable References: Reference. This
3282 functionality was provided in GNU 'make' by the 'patsubst' function
3283 before the alternate syntax was implemented for compatibility with
3284 SunOS 4. It is not altogether clear who inspired whom, since GNU
3285 'make' had 'patsubst' before SunOS 4 was released.
3287 * The special significance of '+' characters preceding recipe lines
3288 (*note Instead of Executing Recipes: Instead of Execution.) is
3289 mandated by 'IEEE Standard 1003.2-1992' (POSIX.2).
3291 * The '+=' syntax to append to the value of a variable comes from
3292 SunOS 4 'make'. *Note Appending More Text to Variables: Appending.
3294 * The syntax 'ARCHIVE(MEM1 MEM2...)' to list multiple members in a
3295 single archive file comes from SunOS 4 'make'. *Note Archive
3298 * The '-include' directive to include makefiles with no error for a
3299 nonexistent file comes from SunOS 4 'make'. (But note that SunOS 4
3300 'make' does not allow multiple makefiles to be specified in one
3301 '-include' directive.) The same feature appears with the name
3302 'sinclude' in SGI 'make' and perhaps others.
3304 * The '!=' shell assignment operator exists in many BSD of 'make' and
3305 is purposefully implemented here to behave identically to those
3308 * Various build management tools are implemented using scripting
3309 languages such as Perl or Python and thus provide a natural
3310 embedded scripting language, similar to GNU 'make''s integration of
3313 The remaining features are inventions new in GNU 'make':
3315 * Use the '-v' or '--version' option to print version and copyright
3318 * Use the '-h' or '--help' option to summarize the options to 'make'.
3320 * Simply-expanded variables. *Note The Two Flavors of Variables:
3323 * Pass command line variable assignments automatically through the
3324 variable 'MAKE' to recursive 'make' invocations. *Note Recursive
3325 Use of 'make': Recursion.
3327 * Use the '-C' or '--directory' command option to change directory.
3328 *Note Summary of Options: Options Summary.
3330 * Make verbatim variable definitions with 'define'. *Note Defining
3331 Multi-Line Variables: Multi-Line.
3333 * Declare phony targets with the special target '.PHONY'.
3335 Andrew Hume of AT&T Bell Labs implemented a similar feature with a
3336 different syntax in his 'mk' program. This seems to be a case of
3337 parallel discovery. *Note Phony Targets: Phony Targets.
3339 * Manipulate text by calling functions. *Note Functions for
3340 Transforming Text: Functions.
3342 * Use the '-o' or '--old-file' option to pretend a file's
3343 modification-time is old. *Note Avoiding Recompilation of Some
3344 Files: Avoiding Compilation.
3346 * Conditional execution.
3348 This feature has been implemented numerous times in various
3349 versions of 'make'; it seems a natural extension derived from the
3350 features of the C preprocessor and similar macro languages and is
3351 not a revolutionary concept. *Note Conditional Parts of Makefiles:
3354 * Specify a search path for included makefiles. *Note Including
3355 Other Makefiles: Include.
3357 * Specify extra makefiles to read with an environment variable.
3358 *Note The Variable 'MAKEFILES': MAKEFILES Variable.
3360 * Strip leading sequences of './' from file names, so that './FILE'
3361 and 'FILE' are considered to be the same file.
3363 * Use a special search method for library prerequisites written in
3364 the form '-lNAME'. *Note Directory Search for Link Libraries:
3367 * Allow suffixes for suffix rules (*note Old-Fashioned Suffix Rules:
3368 Suffix Rules.) to contain any characters. In other versions of
3369 'make', they must begin with '.' and not contain any '/'
3372 * Keep track of the current level of 'make' recursion using the
3373 variable 'MAKELEVEL'. *Note Recursive Use of 'make': Recursion.
3375 * Provide any goals given on the command line in the variable
3376 'MAKECMDGOALS'. *Note Arguments to Specify the Goals: Goals.
3378 * Specify static pattern rules. *Note Static Pattern Rules: Static
3381 * Provide selective 'vpath' search. *Note Searching Directories for
3382 Prerequisites: Directory Search.
3384 * Provide computed variable references. *Note Basics of Variable
3385 References: Reference.
3387 * Update makefiles. *Note How Makefiles Are Remade: Remaking
3388 Makefiles. System V 'make' has a very, very limited form of this
3389 functionality in that it will check out SCCS files for makefiles.
3391 * Various new built-in implicit rules. *Note Catalogue of Built-In
3392 Rules: Catalogue of Rules.
3394 * Load dynamic objects which can modify the behavior of 'make'.
3395 *Note Loading Dynamic Objects: Loading Objects.
3398 File: make.info, Node: Missing, Next: Makefile Conventions, Prev: Features, Up: Top
3400 15 Incompatibilities and Missing Features
3401 *****************************************
3403 The 'make' programs in various other systems support a few features that
3404 are not implemented in GNU 'make'. The POSIX.2 standard ('IEEE Standard
3405 1003.2-1992') which specifies 'make' does not require any of these
3408 * A target of the form 'FILE((ENTRY))' stands for a member of archive
3409 file FILE. The member is chosen, not by name, but by being an
3410 object file which defines the linker symbol ENTRY.
3412 This feature was not put into GNU 'make' because of the
3413 non-modularity of putting knowledge into 'make' of the internal
3414 format of archive file symbol tables. *Note Updating Archive
3415 Symbol Directories: Archive Symbols.
3417 * Suffixes (used in suffix rules) that end with the character '~'
3418 have a special meaning to System V 'make'; they refer to the SCCS
3419 file that corresponds to the file one would get without the '~'.
3420 For example, the suffix rule '.c~.o' would make the file 'N.o' from
3421 the SCCS file 's.N.c'. For complete coverage, a whole series of
3422 such suffix rules is required. *Note Old-Fashioned Suffix Rules:
3425 In GNU 'make', this entire series of cases is handled by two
3426 pattern rules for extraction from SCCS, in combination with the
3427 general feature of rule chaining. *Note Chains of Implicit Rules:
3430 * In System V and 4.3 BSD 'make', files found by 'VPATH' search
3431 (*note Searching Directories for Prerequisites: Directory Search.)
3432 have their names changed inside recipes. We feel it is much
3433 cleaner to always use automatic variables and thus make this
3434 feature unnecessary.
3436 * In some Unix 'make's, the automatic variable '$*' appearing in the
3437 prerequisites of a rule has the amazingly strange "feature" of
3438 expanding to the full name of the _target of that rule_. We cannot
3439 imagine what went on in the minds of Unix 'make' developers to do
3440 this; it is utterly inconsistent with the normal definition of
3443 * In some Unix 'make's, implicit rule search (*note Using Implicit
3444 Rules: Implicit Rules.) is apparently done for _all_ targets, not
3445 just those without recipes. This means you can do:
3450 and Unix 'make' will intuit that 'foo.o' depends on 'foo.c'.
3452 We feel that such usage is broken. The prerequisite properties of
3453 'make' are well-defined (for GNU 'make', at least), and doing such
3454 a thing simply does not fit the model.
3456 * GNU 'make' does not include any built-in implicit rules for
3457 compiling or preprocessing EFL programs. If we hear of anyone who
3458 is using EFL, we will gladly add them.
3460 * It appears that in SVR4 'make', a suffix rule can be specified with
3461 no recipe, and it is treated as if it had an empty recipe (*note
3462 Empty Recipes::). For example:
3466 will override the built-in '.c.a' suffix rule.
3468 We feel that it is cleaner for a rule without a recipe to always
3469 simply add to the prerequisite list for the target. The above
3470 example can be easily rewritten to get the desired behavior in GNU
3475 * Some versions of 'make' invoke the shell with the '-e' flag, except
3476 under '-k' (*note Testing the Compilation of a Program: Testing.).
3477 The '-e' flag tells the shell to exit as soon as any program it
3478 runs returns a nonzero status. We feel it is cleaner to write each
3479 line of the recipe to stand on its own and not require this special
3483 File: make.info, Node: Makefile Conventions, Next: Quick Reference, Prev: Missing, Up: Top
3485 16 Makefile Conventions
3486 ***********************
3488 This node describes conventions for writing the Makefiles for GNU
3489 programs. Using Automake will help you write a Makefile that follows
3490 these conventions. For more information on portable Makefiles, see
3491 POSIX and *note Portable Make Programming: (autoconf)Portable Make.
3495 * Makefile Basics:: General conventions for Makefiles.
3496 * Utilities in Makefiles:: Utilities to be used in Makefiles.
3497 * Command Variables:: Variables for specifying commands.
3498 * DESTDIR:: Supporting staged installs.
3499 * Directory Variables:: Variables for installation directories.
3500 * Standard Targets:: Standard targets for users.
3501 * Install Command Categories:: Three categories of commands in the 'install'
3502 rule: normal, pre-install and post-install.
3505 File: make.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions
3507 16.1 General Conventions for Makefiles
3508 ======================================
3510 Every Makefile should contain this line:
3514 to avoid trouble on systems where the 'SHELL' variable might be
3515 inherited from the environment. (This is never a problem with GNU
3518 Different 'make' programs have incompatible suffix lists and implicit
3519 rules, and this sometimes creates confusion or misbehavior. So it is a
3520 good idea to set the suffix list explicitly using only the suffixes you
3521 need in the particular Makefile, like this:
3526 The first line clears out the suffix list, the second introduces all
3527 suffixes which may be subject to implicit rules in this Makefile.
3529 Don't assume that '.' is in the path for command execution. When you
3530 need to run programs that are a part of your package during the make,
3531 please make sure that it uses './' if the program is built as part of
3532 the make or '$(srcdir)/' if the file is an unchanging part of the source
3533 code. Without one of these prefixes, the current search path is used.
3535 The distinction between './' (the "build directory") and '$(srcdir)/'
3536 (the "source directory") is important because users can build in a
3537 separate directory using the '--srcdir' option to 'configure'. A rule
3540 foo.1 : foo.man sedscript
3541 sed -f sedscript foo.man > foo.1
3543 will fail when the build directory is not the source directory, because
3544 'foo.man' and 'sedscript' are in the source directory.
3546 When using GNU 'make', relying on 'VPATH' to find the source file
3547 will work in the case where there is a single dependency file, since the
3548 'make' automatic variable '$<' will represent the source file wherever
3549 it is. (Many versions of 'make' set '$<' only in implicit rules.) A
3550 Makefile target like
3553 $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
3555 should instead be written as
3558 $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@
3560 in order to allow 'VPATH' to work correctly. When the target has
3561 multiple dependencies, using an explicit '$(srcdir)' is the easiest way
3562 to make the rule work well. For example, the target above for 'foo.1'
3565 foo.1 : foo.man sedscript
3566 sed -f $(srcdir)/sedscript $(srcdir)/foo.man > $@
3568 GNU distributions usually contain some files which are not source
3569 files--for example, Info files, and the output from Autoconf, Automake,
3570 Bison or Flex. Since these files normally appear in the source
3571 directory, they should always appear in the source directory, not in the
3572 build directory. So Makefile rules to update them should put the
3573 updated files in the source directory.
3575 However, if a file does not appear in the distribution, then the
3576 Makefile should not put it in the source directory, because building a
3577 program in ordinary circumstances should not modify the source directory
3580 Try to make the build and installation targets, at least (and all
3581 their subtargets) work correctly with a parallel 'make'.
3584 File: make.info, Node: Utilities in Makefiles, Next: Command Variables, Prev: Makefile Basics, Up: Makefile Conventions
3586 16.2 Utilities in Makefiles
3587 ===========================
3589 Write the Makefile commands (and any shell scripts, such as 'configure')
3590 to run under 'sh' (both the traditional Bourne shell and the POSIX
3591 shell), not 'csh'. Don't use any special features of 'ksh' or 'bash',
3592 or POSIX features not widely supported in traditional Bourne 'sh'.
3594 The 'configure' script and the Makefile rules for building and
3595 installation should not use any utilities directly except these:
3597 awk cat cmp cp diff echo egrep expr false grep install-info ln ls
3598 mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
3600 Compression programs such as 'gzip' can be used in the 'dist' rule.
3602 Generally, stick to the widely-supported (usually POSIX-specified)
3603 options and features of these programs. For example, don't use 'mkdir
3604 -p', convenient as it may be, because a few systems don't support it at
3605 all and with others, it is not safe for parallel execution. For a list
3606 of known incompatibilities, see *note Portable Shell Programming:
3607 (autoconf)Portable Shell.
3609 It is a good idea to avoid creating symbolic links in makefiles,
3610 since a few file systems don't support them.
3612 The Makefile rules for building and installation can also use
3613 compilers and related programs, but should do so via 'make' variables so
3614 that the user can substitute alternatives. Here are some of the
3617 ar bison cc flex install ld ldconfig lex
3618 make makeinfo ranlib texi2dvi yacc
3620 Use the following 'make' variables to run those programs:
3622 $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
3623 $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
3625 When you use 'ranlib' or 'ldconfig', you should make sure nothing bad
3626 happens if the system does not have the program in question. Arrange to
3627 ignore an error from that command, and print a message before the
3628 command to tell the user that failure of this command does not mean a
3629 problem. (The Autoconf 'AC_PROG_RANLIB' macro can help with this.)
3631 If you use symbolic links, you should implement a fallback for
3632 systems that don't have symbolic links.
3634 Additional utilities that can be used via Make variables are:
3636 chgrp chmod chown mknod
3638 It is ok to use other utilities in Makefile portions (or scripts)
3639 intended only for particular systems where you know those utilities
3643 File: make.info, Node: Command Variables, Next: DESTDIR, Prev: Utilities in Makefiles, Up: Makefile Conventions
3645 16.3 Variables for Specifying Commands
3646 ======================================
3648 Makefiles should provide variables for overriding certain commands,
3651 In particular, you should run most utility programs via variables.
3652 Thus, if you use Bison, have a variable named 'BISON' whose default
3653 value is set with 'BISON = bison', and refer to it with '$(BISON)'
3654 whenever you need to use Bison.
3656 File management utilities such as 'ln', 'rm', 'mv', and so on, need
3657 not be referred to through variables in this way, since users don't need
3658 to replace them with other programs.
3660 Each program-name variable should come with an options variable that
3661 is used to supply options to the program. Append 'FLAGS' to the
3662 program-name variable name to get the options variable name--for
3663 example, 'BISONFLAGS'. (The names 'CFLAGS' for the C compiler, 'YFLAGS'
3664 for yacc, and 'LFLAGS' for lex, are exceptions to this rule, but we keep
3665 them because they are standard.) Use 'CPPFLAGS' in any compilation
3666 command that runs the preprocessor, and use 'LDFLAGS' in any compilation
3667 command that does linking as well as in any direct use of 'ld'.
3669 If there are C compiler options that _must_ be used for proper
3670 compilation of certain files, do not include them in 'CFLAGS'. Users
3671 expect to be able to specify 'CFLAGS' freely themselves. Instead,
3672 arrange to pass the necessary options to the C compiler independently of
3673 'CFLAGS', by writing them explicitly in the compilation commands or by
3674 defining an implicit rule, like this:
3677 ALL_CFLAGS = -I. $(CFLAGS)
3679 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
3681 Do include the '-g' option in 'CFLAGS', because that is not
3682 _required_ for proper compilation. You can consider it a default that
3683 is only recommended. If the package is set up so that it is compiled
3684 with GCC by default, then you might as well include '-O' in the default
3685 value of 'CFLAGS' as well.
3687 Put 'CFLAGS' last in the compilation command, after other variables
3688 containing compiler options, so the user can use 'CFLAGS' to override
3691 'CFLAGS' should be used in every invocation of the C compiler, both
3692 those which do compilation and those which do linking.
3694 Every Makefile should define the variable 'INSTALL', which is the
3695 basic command for installing a file into the system.
3697 Every Makefile should also define the variables 'INSTALL_PROGRAM' and
3698 'INSTALL_DATA'. (The default for 'INSTALL_PROGRAM' should be
3699 '$(INSTALL)'; the default for 'INSTALL_DATA' should be '${INSTALL} -m
3700 644'.) Then it should use those variables as the commands for actual
3701 installation, for executables and non-executables respectively. Minimal
3702 use of these variables is as follows:
3704 $(INSTALL_PROGRAM) foo $(bindir)/foo
3705 $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
3707 However, it is preferable to support a 'DESTDIR' prefix on the target
3708 files, as explained in the next section.
3710 It is acceptable, but not required, to install multiple files in one
3711 command, with the final argument being a directory, as in:
3713 $(INSTALL_PROGRAM) foo bar baz $(bindir)
3716 File: make.info, Node: DESTDIR, Next: Directory Variables, Prev: Command Variables, Up: Makefile Conventions
3718 16.4 'DESTDIR': Support for Staged Installs
3719 ===========================================
3721 'DESTDIR' is a variable prepended to each installed target file, like
3724 $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo
3725 $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a
3727 The 'DESTDIR' variable is specified by the user on the 'make' command
3728 line as an absolute file name. For example:
3730 make DESTDIR=/tmp/stage install
3732 'DESTDIR' should be supported only in the 'install*' and 'uninstall*'
3733 targets, as those are the only targets where it is useful.
3735 If your installation step would normally install '/usr/local/bin/foo'
3736 and '/usr/local/lib/libfoo.a', then an installation invoked as in the
3737 example above would install '/tmp/stage/usr/local/bin/foo' and
3738 '/tmp/stage/usr/local/lib/libfoo.a' instead.
3740 Prepending the variable 'DESTDIR' to each target in this way provides
3741 for "staged installs", where the installed files are not placed directly
3742 into their expected location but are instead copied into a temporary
3743 location ('DESTDIR'). However, installed files maintain their relative
3744 directory structure and any embedded file names will not be modified.
3746 You should not set the value of 'DESTDIR' in your 'Makefile' at all;
3747 then the files are installed into their expected locations by default.
3748 Also, specifying 'DESTDIR' should not change the operation of the
3749 software in any way, so its value should not be included in any file
3752 'DESTDIR' support is commonly used in package creation. It is also
3753 helpful to users who want to understand what a given package will
3754 install where, and to allow users who don't normally have permissions to
3755 install into protected areas to build and install before gaining those
3756 permissions. Finally, it can be useful with tools such as 'stow', where
3757 code is installed in one place but made to appear to be installed
3758 somewhere else using symbolic links or special mount operations. So, we
3759 strongly recommend GNU packages support 'DESTDIR', though it is not an
3760 absolute requirement.
3763 File: make.info, Node: Directory Variables, Next: Standard Targets, Prev: DESTDIR, Up: Makefile Conventions
3765 16.5 Variables for Installation Directories
3766 ===========================================
3768 Installation directories should always be named by variables, so it is
3769 easy to install in a nonstandard place. The standard names for these
3770 variables and the values they should have in GNU packages are described
3771 below. They are based on a standard file system layout; variants of it
3772 are used in GNU/Linux and other modern operating systems.
3774 Installers are expected to override these values when calling 'make'
3775 (e.g., 'make prefix=/usr install') or 'configure' (e.g., 'configure
3776 --prefix=/usr'). GNU packages should not try to guess which value
3777 should be appropriate for these variables on the system they are being
3778 installed onto: use the default settings specified here so that all GNU
3779 packages behave identically, allowing the installer to achieve any
3782 All installation directories, and their parent directories, should be
3783 created (if necessary) before they are installed into.
3785 These first two variables set the root for the installation. All the
3786 other installation directories should be subdirectories of one of these
3787 two, and nothing should be directly installed into these two
3791 A prefix used in constructing the default values of the variables
3792 listed below. The default value of 'prefix' should be
3793 '/usr/local'. When building the complete GNU system, the prefix
3794 will be empty and '/usr' will be a symbolic link to '/'. (If you
3795 are using Autoconf, write it as '@prefix@'.)
3797 Running 'make install' with a different value of 'prefix' from the
3798 one used to build the program should _not_ recompile the program.
3801 A prefix used in constructing the default values of some of the
3802 variables listed below. The default value of 'exec_prefix' should
3803 be '$(prefix)'. (If you are using Autoconf, write it as
3806 Generally, '$(exec_prefix)' is used for directories that contain
3807 machine-specific files (such as executables and subroutine
3808 libraries), while '$(prefix)' is used directly for other
3811 Running 'make install' with a different value of 'exec_prefix' from
3812 the one used to build the program should _not_ recompile the
3815 Executable programs are installed in one of the following
3819 The directory for installing executable programs that users can
3820 run. This should normally be '/usr/local/bin', but write it as
3821 '$(exec_prefix)/bin'. (If you are using Autoconf, write it as
3825 The directory for installing executable programs that can be run
3826 from the shell, but are only generally useful to system
3827 administrators. This should normally be '/usr/local/sbin', but
3828 write it as '$(exec_prefix)/sbin'. (If you are using Autoconf,
3829 write it as '@sbindir@'.)
3832 The directory for installing executable programs to be run by other
3833 programs rather than by users. This directory should normally be
3834 '/usr/local/libexec', but write it as '$(exec_prefix)/libexec'.
3835 (If you are using Autoconf, write it as '@libexecdir@'.)
3837 The definition of 'libexecdir' is the same for all packages, so you
3838 should install your data in a subdirectory thereof. Most packages
3839 install their data under '$(libexecdir)/PACKAGE-NAME/', possibly
3840 within additional subdirectories thereof, such as
3841 '$(libexecdir)/PACKAGE-NAME/MACHINE/VERSION'.
3843 Data files used by the program during its execution are divided into
3844 categories in two ways.
3846 * Some files are normally modified by programs; others are never
3847 normally modified (though users may edit some of these).
3849 * Some files are architecture-independent and can be shared by all
3850 machines at a site; some are architecture-dependent and can be
3851 shared only by machines of the same kind and operating system;
3852 others may never be shared between two machines.
3854 This makes for six different possibilities. However, we want to
3855 discourage the use of architecture-dependent files, aside from object
3856 files and libraries. It is much cleaner to make other data files
3857 architecture-independent, and it is generally not hard.
3859 Here are the variables Makefiles should use to specify directories to
3860 put these various kinds of files in:
3863 The root of the directory tree for read-only
3864 architecture-independent data files. This should normally be
3865 '/usr/local/share', but write it as '$(prefix)/share'. (If you are
3866 using Autoconf, write it as '@datarootdir@'.) 'datadir''s default
3867 value is based on this variable; so are 'infodir', 'mandir', and
3871 The directory for installing idiosyncratic read-only
3872 architecture-independent data files for this program. This is
3873 usually the same place as 'datarootdir', but we use the two
3874 separate variables so that you can move these program-specific
3875 files without altering the location for Info files, man pages, etc.
3877 This should normally be '/usr/local/share', but write it as
3878 '$(datarootdir)'. (If you are using Autoconf, write it as
3881 The definition of 'datadir' is the same for all packages, so you
3882 should install your data in a subdirectory thereof. Most packages
3883 install their data under '$(datadir)/PACKAGE-NAME/'.
3886 The directory for installing read-only data files that pertain to a
3887 single machine-that is to say, files for configuring a host.
3888 Mailer and network configuration files, '/etc/passwd', and so forth
3889 belong here. All the files in this directory should be ordinary
3890 ASCII text files. This directory should normally be
3891 '/usr/local/etc', but write it as '$(prefix)/etc'. (If you are
3892 using Autoconf, write it as '@sysconfdir@'.)
3894 Do not install executables here in this directory (they probably
3895 belong in '$(libexecdir)' or '$(sbindir)'). Also do not install
3896 files that are modified in the normal course of their use (programs
3897 whose purpose is to change the configuration of the system
3898 excluded). Those probably belong in '$(localstatedir)'.
3901 The directory for installing architecture-independent data files
3902 which the programs modify while they run. This should normally be
3903 '/usr/local/com', but write it as '$(prefix)/com'. (If you are
3904 using Autoconf, write it as '@sharedstatedir@'.)
3907 The directory for installing data files which the programs modify
3908 while they run, and that pertain to one specific machine. Users
3909 should never need to modify files in this directory to configure
3910 the package's operation; put such configuration information in
3911 separate files that go in '$(datadir)' or '$(sysconfdir)'.
3912 '$(localstatedir)' should normally be '/usr/local/var', but write
3913 it as '$(prefix)/var'. (If you are using Autoconf, write it as
3917 The directory for installing data files which the programs modify
3918 while they run, that pertain to one specific machine, and which
3919 need not persist longer than the execution of the program--which is
3920 generally long-lived, for example, until the next reboot. PID
3921 files for system daemons are a typical use. In addition, this
3922 directory should not be cleaned except perhaps at reboot, while the
3923 general '/tmp' ('TMPDIR') may be cleaned arbitrarily. This should
3924 normally be '/var/run', but write it as '$(localstatedir)/run'.
3925 Having it as a separate variable allows the use of '/run' if
3926 desired, for example. (If you are using Autoconf 2.70 or later,
3927 write it as '@runstatedir@'.)
3929 These variables specify the directory for installing certain specific
3930 types of files, if your program has them. Every GNU package should have
3931 Info files, so every program needs 'infodir', but not all need 'libdir'
3935 The directory for installing header files to be included by user
3936 programs with the C '#include' preprocessor directive. This should
3937 normally be '/usr/local/include', but write it as
3938 '$(prefix)/include'. (If you are using Autoconf, write it as
3941 Most compilers other than GCC do not look for header files in
3942 directory '/usr/local/include'. So installing the header files
3943 this way is only useful with GCC. Sometimes this is not a problem
3944 because some libraries are only really intended to work with GCC.
3945 But some libraries are intended to work with other compilers. They
3946 should install their header files in two places, one specified by
3947 'includedir' and one specified by 'oldincludedir'.
3950 The directory for installing '#include' header files for use with
3951 compilers other than GCC. This should normally be '/usr/include'.
3952 (If you are using Autoconf, you can write it as '@oldincludedir@'.)
3954 The Makefile commands should check whether the value of
3955 'oldincludedir' is empty. If it is, they should not try to use it;
3956 they should cancel the second installation of the header files.
3958 A package should not replace an existing header in this directory
3959 unless the header came from the same package. Thus, if your Foo
3960 package provides a header file 'foo.h', then it should install the
3961 header file in the 'oldincludedir' directory if either (1) there is
3962 no 'foo.h' there or (2) the 'foo.h' that exists came from the Foo
3965 To tell whether 'foo.h' came from the Foo package, put a magic
3966 string in the file--part of a comment--and 'grep' for that string.
3969 The directory for installing documentation files (other than Info)
3970 for this package. By default, it should be
3971 '/usr/local/share/doc/YOURPKG', but it should be written as
3972 '$(datarootdir)/doc/YOURPKG'. (If you are using Autoconf, write it
3973 as '@docdir@'.) The YOURPKG subdirectory, which may include a
3974 version number, prevents collisions among files with common names,
3978 The directory for installing the Info files for this package. By
3979 default, it should be '/usr/local/share/info', but it should be
3980 written as '$(datarootdir)/info'. (If you are using Autoconf,
3981 write it as '@infodir@'.) 'infodir' is separate from 'docdir' for
3982 compatibility with existing practice.
3988 Directories for installing documentation files in the particular
3989 format. They should all be set to '$(docdir)' by default. (If you
3990 are using Autoconf, write them as '@htmldir@', '@dvidir@', etc.)
3991 Packages which supply several translations of their documentation
3992 should install them in '$(htmldir)/'LL, '$(pdfdir)/'LL, etc. where
3993 LL is a locale abbreviation such as 'en' or 'pt_BR'.
3996 The directory for object files and libraries of object code. Do
3997 not install executables here, they probably ought to go in
3998 '$(libexecdir)' instead. The value of 'libdir' should normally be
3999 '/usr/local/lib', but write it as '$(exec_prefix)/lib'. (If you
4000 are using Autoconf, write it as '@libdir@'.)
4003 The directory for installing any Emacs Lisp files in this package.
4004 By default, it should be '/usr/local/share/emacs/site-lisp', but it
4005 should be written as '$(datarootdir)/emacs/site-lisp'.
4007 If you are using Autoconf, write the default as '@lispdir@'. In
4008 order to make '@lispdir@' work, you need the following lines in
4009 your 'configure.ac' file:
4011 lispdir='${datarootdir}/emacs/site-lisp'
4015 The directory for installing locale-specific message catalogs for
4016 this package. By default, it should be '/usr/local/share/locale',
4017 but it should be written as '$(datarootdir)/locale'. (If you are
4018 using Autoconf, write it as '@localedir@'.) This directory usually
4019 has a subdirectory per locale.
4021 Unix-style man pages are installed in one of the following:
4024 The top-level directory for installing the man pages (if any) for
4025 this package. It will normally be '/usr/local/share/man', but you
4026 should write it as '$(datarootdir)/man'. (If you are using
4027 Autoconf, write it as '@mandir@'.)
4030 The directory for installing section 1 man pages. Write it as
4033 The directory for installing section 2 man pages. Write it as
4037 *Don't make the primary documentation for any GNU software be a man
4038 page. Write a manual in Texinfo instead. Man pages are just for
4039 the sake of people running GNU software on Unix, which is a
4040 secondary application only.*
4043 The file name extension for the installed man page. This should
4044 contain a period followed by the appropriate digit; it should
4048 The file name extension for installed section 1 man pages.
4050 The file name extension for installed section 2 man pages.
4052 Use these names instead of 'manext' if the package needs to install
4053 man pages in more than one section of the manual.
4055 And finally, you should set the following variable:
4058 The directory for the sources being compiled. The value of this
4059 variable is normally inserted by the 'configure' shell script. (If
4060 you are using Autoconf, use 'srcdir = @srcdir@'.)
4064 # Common prefix for installation directories.
4065 # NOTE: This directory must exist when you start the install.
4067 datarootdir = $(prefix)/share
4068 datadir = $(datarootdir)
4069 exec_prefix = $(prefix)
4070 # Where to put the executable for the command 'gcc'.
4071 bindir = $(exec_prefix)/bin
4072 # Where to put the directories used by the compiler.
4073 libexecdir = $(exec_prefix)/libexec
4074 # Where to put the Info files.
4075 infodir = $(datarootdir)/info
4077 If your program installs a large number of files into one of the
4078 standard user-specified directories, it might be useful to group them
4079 into a subdirectory particular to that program. If you do this, you
4080 should write the 'install' rule to create these subdirectories.
4082 Do not expect the user to include the subdirectory name in the value
4083 of any of the variables listed above. The idea of having a uniform set
4084 of variable names for installation directories is to enable the user to
4085 specify the exact same values for several different GNU packages. In
4086 order for this to be useful, all the packages must be designed so that
4087 they will work sensibly when the user does so.
4089 At times, not all of these variables may be implemented in the
4090 current release of Autoconf and/or Automake; but as of Autoconf 2.60, we
4091 believe all of them are. When any are missing, the descriptions here
4092 serve as specifications for what Autoconf will implement. As a
4093 programmer, you can either use a development version of Autoconf or
4094 avoid using these variables until a stable release is made which
4098 File: make.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions
4100 16.6 Standard Targets for Users
4101 ===============================
4103 All GNU programs should have the following targets in their Makefiles:
4106 Compile the entire program. This should be the default target.
4107 This target need not rebuild any documentation files; Info files
4108 should normally be included in the distribution, and DVI (and other
4109 documentation format) files should be made only when explicitly
4112 By default, the Make rules should compile and link with '-g', so
4113 that executable programs have debugging symbols. Otherwise, you
4114 are essentially helpless in the face of a crash, and it is often
4115 far from easy to reproduce with a fresh build.
4118 Compile the program and copy the executables, libraries, and so on
4119 to the file names where they should reside for actual use. If
4120 there is a simple test to verify that a program is properly
4121 installed, this target should run that test.
4123 Do not strip executables when installing them. This helps eventual
4124 debugging that may be needed later, and nowadays disk space is
4125 cheap and dynamic loaders typically ensure debug sections are not
4126 loaded during normal execution. Users that need stripped binaries
4127 may invoke the 'install-strip' target to do that.
4129 If possible, write the 'install' target rule so that it does not
4130 modify anything in the directory where the program was built,
4131 provided 'make all' has just been done. This is convenient for
4132 building the program under one user name and installing it under
4135 The commands should create all the directories in which files are
4136 to be installed, if they don't already exist. This includes the
4137 directories specified as the values of the variables 'prefix' and
4138 'exec_prefix', as well as all subdirectories that are needed. One
4139 way to do this is by means of an 'installdirs' target as described
4142 Use '-' before any command for installing a man page, so that
4143 'make' will ignore any errors. This is in case there are systems
4144 that don't have the Unix man page documentation system installed.
4146 The way to install Info files is to copy them into '$(infodir)'
4147 with '$(INSTALL_DATA)' (*note Command Variables::), and then run
4148 the 'install-info' program if it is present. 'install-info' is a
4149 program that edits the Info 'dir' file to add or update the menu
4150 entry for the given Info file; it is part of the Texinfo package.
4152 Here is a sample rule to install an Info file that also tries to
4153 handle some additional situations, such as 'install-info' not being
4156 do-install-info: foo.info installdirs
4158 # Prefer an info file in . to one in srcdir.
4159 if test -f foo.info; then d=.; \
4160 else d="$(srcdir)"; fi; \
4161 $(INSTALL_DATA) $$d/foo.info \
4162 "$(DESTDIR)$(infodir)/foo.info"
4163 # Run install-info only if it exists.
4164 # Use 'if' instead of just prepending '-' to the
4165 # line so we notice real errors from install-info.
4166 # Use '$(SHELL) -c' because some shells do not
4167 # fail gracefully when there is an unknown command.
4169 if $(SHELL) -c 'install-info --version' \
4170 >/dev/null 2>&1; then \
4171 install-info --dir-file="$(DESTDIR)$(infodir)/dir" \
4172 "$(DESTDIR)$(infodir)/foo.info"; \
4175 When writing the 'install' target, you must classify all the
4176 commands into three categories: normal ones, "pre-installation"
4177 commands and "post-installation" commands. *Note Install Command
4184 These targets install documentation in formats other than Info;
4185 they're intended to be called explicitly by the person installing
4186 the package, if that format is desired. GNU prefers Info files, so
4187 these must be installed by the 'install' target.
4189 When you have many documentation files to install, we recommend
4190 that you avoid collisions and clutter by arranging for these
4191 targets to install in subdirectories of the appropriate
4192 installation directory, such as 'htmldir'. As one example, if your
4193 package has multiple manuals, and you wish to install HTML
4194 documentation with many files (such as the "split" mode output by
4195 'makeinfo --html'), you'll certainly want to use subdirectories, or
4196 two nodes with the same name in different manuals will overwrite
4199 Please make these 'install-FORMAT' targets invoke the commands for
4200 the FORMAT target, for example, by making FORMAT a dependency.
4203 Delete all the installed files--the copies that the 'install' and
4204 'install-*' targets create.
4206 This rule should not modify the directories where compilation is
4207 done, only the directories where files are installed.
4209 The uninstallation commands are divided into three categories, just
4210 like the installation commands. *Note Install Command
4214 Like 'install', but strip the executable files while installing
4215 them. In simple cases, this target can use the 'install' target in
4219 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
4222 But if the package installs scripts as well as real executables,
4223 the 'install-strip' target can't just refer to the 'install'
4224 target; it has to strip the executables but not the scripts.
4226 'install-strip' should not strip the executables in the build
4227 directory which are being copied for installation. It should only
4228 strip the copies that are installed.
4230 Normally we do not recommend stripping an executable unless you are
4231 sure the program has no bugs. However, it can be reasonable to
4232 install a stripped executable for actual execution while saving the
4233 unstripped executable elsewhere in case there is a bug.
4236 Delete all files in the current directory that are normally created
4237 by building the program. Also delete files in other directories if
4238 they are created by this makefile. However, don't delete the files
4239 that record the configuration. Also preserve files that could be
4240 made by building, but normally aren't because the distribution
4241 comes with them. There is no need to delete parent directories
4242 that were created with 'mkdir -p', since they could have existed
4245 Delete '.dvi' files here if they are not part of the distribution.
4248 Delete all files in the current directory (or created by this
4249 makefile) that are created by configuring or building the program.
4250 If you have unpacked the source and built the program without
4251 creating any other files, 'make distclean' should leave only the
4252 files that were in the distribution. However, there is no need to
4253 delete parent directories that were created with 'mkdir -p', since
4254 they could have existed anyway.
4257 Like 'clean', but may refrain from deleting a few files that people
4258 normally don't want to recompile. For example, the 'mostlyclean'
4259 target for GCC does not delete 'libgcc.a', because recompiling it
4260 is rarely necessary and takes a lot of time.
4263 Delete almost everything that can be reconstructed with this
4264 Makefile. This typically includes everything deleted by
4265 'distclean', plus more: C source files produced by Bison, tags
4266 tables, Info files, and so on.
4268 The reason we say "almost everything" is that running the command
4269 'make maintainer-clean' should not delete 'configure' even if
4270 'configure' can be remade using a rule in the Makefile. More
4271 generally, 'make maintainer-clean' should not delete anything that
4272 needs to exist in order to run 'configure' and then begin to build
4273 the program. Also, there is no need to delete parent directories
4274 that were created with 'mkdir -p', since they could have existed
4275 anyway. These are the only exceptions; 'maintainer-clean' should
4276 delete everything else that can be rebuilt.
4278 The 'maintainer-clean' target is intended to be used by a
4279 maintainer of the package, not by ordinary users. You may need
4280 special tools to reconstruct some of the files that 'make
4281 maintainer-clean' deletes. Since these files are normally included
4282 in the distribution, we don't take care to make them easy to
4283 reconstruct. If you find you need to unpack the full distribution
4284 again, don't blame us.
4286 To help make users aware of this, the commands for the special
4287 'maintainer-clean' target should start with these two:
4289 @echo 'This command is intended for maintainers to use; it'
4290 @echo 'deletes files that may need special tools to rebuild.'
4293 Update a tags table for this program.
4296 Generate any Info files needed. The best way to write the rules is
4301 foo.info: foo.texi chap1.texi chap2.texi
4302 $(MAKEINFO) $(srcdir)/foo.texi
4304 You must define the variable 'MAKEINFO' in the Makefile. It should
4305 run the 'makeinfo' program, which is part of the Texinfo
4308 Normally a GNU distribution comes with Info files, and that means
4309 the Info files are present in the source directory. Therefore, the
4310 Make rule for an info file should update it in the source
4311 directory. When users build the package, ordinarily Make will not
4312 update the Info files because they will already be up to date.
4318 Generate documentation files in the given format. These targets
4319 should always exist, but any or all can be a no-op if the given
4320 output format cannot be generated. These targets should not be
4321 dependencies of the 'all' target; the user must manually invoke
4324 Here's an example rule for generating DVI files from Texinfo:
4328 foo.dvi: foo.texi chap1.texi chap2.texi
4329 $(TEXI2DVI) $(srcdir)/foo.texi
4331 You must define the variable 'TEXI2DVI' in the Makefile. It should
4332 run the program 'texi2dvi', which is part of the Texinfo
4333 distribution. ('texi2dvi' uses TeX to do the real work of
4334 formatting. TeX is not distributed with Texinfo.) Alternatively,
4335 write only the dependencies, and allow GNU 'make' to provide the
4338 Here's another example, this one for generating HTML from Texinfo:
4342 foo.html: foo.texi chap1.texi chap2.texi
4343 $(TEXI2HTML) $(srcdir)/foo.texi
4345 Again, you would define the variable 'TEXI2HTML' in the Makefile;
4346 for example, it might run 'makeinfo --no-split --html' ('makeinfo'
4347 is part of the Texinfo distribution).
4350 Create a distribution tar file for this program. The tar file
4351 should be set up so that the file names in the tar file start with
4352 a subdirectory name which is the name of the package it is a
4353 distribution for. This name can include the version number.
4355 For example, the distribution tar file of GCC version 1.40 unpacks
4356 into a subdirectory named 'gcc-1.40'.
4358 The easiest way to do this is to create a subdirectory
4359 appropriately named, use 'ln' or 'cp' to install the proper files
4360 in it, and then 'tar' that subdirectory.
4362 Compress the tar file with 'gzip'. For example, the actual
4363 distribution file for GCC version 1.40 is called 'gcc-1.40.tar.gz'.
4364 It is ok to support other free compression formats as well.
4366 The 'dist' target should explicitly depend on all non-source files
4367 that are in the distribution, to make sure they are up to date in
4368 the distribution. *Note Making Releases: (standards)Releases.
4371 Perform self-tests (if any). The user must build the program
4372 before running the tests, but need not install the program; you
4373 should write the self-tests so that they work when the program is
4374 built but not installed.
4376 The following targets are suggested as conventional names, for
4377 programs in which they are useful.
4380 Perform installation tests (if any). The user must build and
4381 install the program before running the tests. You should not
4382 assume that '$(bindir)' is in the search path.
4385 It's useful to add a target named 'installdirs' to create the
4386 directories where files are installed, and their parent
4387 directories. There is a script called 'mkinstalldirs' which is
4388 convenient for this; you can find it in the Gnulib package. You
4389 can use a rule like this:
4391 # Make sure all installation directories (e.g. $(bindir))
4392 # actually exist by making them if necessary.
4393 installdirs: mkinstalldirs
4394 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
4395 $(libdir) $(infodir) \
4398 or, if you wish to support 'DESTDIR' (strongly encouraged),
4400 # Make sure all installation directories (e.g. $(bindir))
4401 # actually exist by making them if necessary.
4402 installdirs: mkinstalldirs
4403 $(srcdir)/mkinstalldirs \
4404 $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
4405 $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \
4408 This rule should not modify the directories where compilation is
4409 done. It should do nothing but create installation directories.
4412 File: make.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions
4414 16.7 Install Command Categories
4415 ===============================
4417 When writing the 'install' target, you must classify all the commands
4418 into three categories: normal ones, "pre-installation" commands and
4419 "post-installation" commands.
4421 Normal commands move files into their proper places, and set their
4422 modes. They may not alter any files except the ones that come entirely
4423 from the package they belong to.
4425 Pre-installation and post-installation commands may alter other
4426 files; in particular, they can edit global configuration files or data
4429 Pre-installation commands are typically executed before the normal
4430 commands, and post-installation commands are typically run after the
4433 The most common use for a post-installation command is to run
4434 'install-info'. This cannot be done with a normal command, since it
4435 alters a file (the Info directory) which does not come entirely and
4436 solely from the package being installed. It is a post-installation
4437 command because it needs to be done after the normal command which
4438 installs the package's Info files.
4440 Most programs don't need any pre-installation commands, but we have
4441 the feature just in case it is needed.
4443 To classify the commands in the 'install' rule into these three
4444 categories, insert "category lines" among them. A category line
4445 specifies the category for the commands that follow.
4447 A category line consists of a tab and a reference to a special Make
4448 variable, plus an optional comment at the end. There are three
4449 variables you can use, one for each category; the variable name
4450 specifies the category. Category lines are no-ops in ordinary execution
4451 because these three Make variables are normally undefined (and you
4452 _should not_ define them in the makefile).
4454 Here are the three possible category lines, each with a comment that
4455 explains what it means:
4457 $(PRE_INSTALL) # Pre-install commands follow.
4458 $(POST_INSTALL) # Post-install commands follow.
4459 $(NORMAL_INSTALL) # Normal commands follow.
4461 If you don't use a category line at the beginning of the 'install'
4462 rule, all the commands are classified as normal until the first category
4463 line. If you don't use any category lines, all the commands are
4464 classified as normal.
4466 These are the category lines for 'uninstall':
4468 $(PRE_UNINSTALL) # Pre-uninstall commands follow.
4469 $(POST_UNINSTALL) # Post-uninstall commands follow.
4470 $(NORMAL_UNINSTALL) # Normal commands follow.
4472 Typically, a pre-uninstall command would be used for deleting entries
4473 from the Info directory.
4475 If the 'install' or 'uninstall' target has any dependencies which act
4476 as subroutines of installation, then you should start _each_
4477 dependency's commands with a category line, and start the main target's
4478 commands with a category line also. This way, you can ensure that each
4479 command is placed in the right category regardless of which of the
4480 dependencies actually run.
4482 Pre-installation and post-installation commands should not run any
4483 programs except for these:
4485 [ basename bash cat chgrp chmod chown cmp cp dd diff echo
4486 egrep expand expr false fgrep find getopt grep gunzip gzip
4487 hostname install install-info kill ldconfig ln ls md5sum
4488 mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
4489 test touch true uname xargs yes
4491 The reason for distinguishing the commands in this way is for the
4492 sake of making binary packages. Typically a binary package contains all
4493 the executables and other files that need to be installed, and has its
4494 own method of installing them--so it does not need to run the normal
4495 installation commands. But installing the binary package does need to
4496 execute the pre-installation and post-installation commands.
4498 Programs to build binary packages work by extracting the
4499 pre-installation and post-installation commands. Here is one way of
4500 extracting the pre-installation commands (the '-s' option to 'make' is
4501 needed to silence messages about entering subdirectories):
4503 make -s -n install -o all \
4504 PRE_INSTALL=pre-install \
4505 POST_INSTALL=post-install \
4506 NORMAL_INSTALL=normal-install \
4507 | gawk -f pre-install.awk
4509 where the file 'pre-install.awk' could contain this:
4511 $0 ~ /^(normal-install|post-install)[ \t]*$/ {on = 0}
4513 $0 ~ /^pre-install[ \t]*$/ {on = 1}
4516 File: make.info, Node: Quick Reference, Next: Error Messages, Prev: Makefile Conventions, Up: Top
4518 Appendix A Quick Reference
4519 **************************
4521 This appendix summarizes the directives, text manipulation functions,
4522 and special variables which GNU 'make' understands. *Note Special
4523 Targets::, *note Catalogue of Built-In Rules: Catalogue of Rules, and
4524 *note Summary of Options: Options Summary, for other summaries.
4526 Here is a summary of the directives GNU 'make' recognizes:
4530 'define VARIABLE :='
4531 'define VARIABLE ::='
4532 'define VARIABLE :::='
4533 'define VARIABLE +='
4534 'define VARIABLE ?='
4536 Define multi-line variables.
4540 Undefining variables.
4541 *Note Undefine Directive::.
4553 Conditionally evaluate part of the makefile.
4554 *Note Conditionals::.
4559 Include another makefile.
4560 *Note Including Other Makefiles: Include.
4562 'override VARIABLE-ASSIGNMENT'
4563 Define a variable, overriding any previous definition, even one
4564 from the command line.
4565 *Note The 'override' Directive: Override Directive.
4568 Tell 'make' to export all variables to child processes by default.
4569 *Note Communicating Variables to a Sub-'make': Variables/Recursion.
4572 'export VARIABLE-ASSIGNMENT'
4574 Tell 'make' whether or not to export a particular variable to child
4576 *Note Communicating Variables to a Sub-'make': Variables/Recursion.
4578 'private VARIABLE-ASSIGNMENT'
4579 Do not allow this variable assignment to be inherited by
4581 *Note Suppressing Inheritance::.
4583 'vpath PATTERN PATH'
4584 Specify a search path for files matching a '%' pattern.
4585 *Note The 'vpath' Directive: Selective Search.
4588 Remove all search paths previously specified for PATTERN.
4591 Remove all search paths previously specified in any 'vpath'
4594 Here is a summary of the built-in functions (*note Functions::):
4596 '$(subst FROM,TO,TEXT)'
4597 Replace FROM with TO in TEXT.
4598 *Note Functions for String Substitution and Analysis: Text
4601 '$(patsubst PATTERN,REPLACEMENT,TEXT)'
4602 Replace words matching PATTERN with REPLACEMENT in TEXT.
4603 *Note Functions for String Substitution and Analysis: Text
4607 Remove excess whitespace characters from STRING.
4608 *Note Functions for String Substitution and Analysis: Text
4611 '$(findstring FIND,TEXT)'
4612 Locate FIND in TEXT.
4613 *Note Functions for String Substitution and Analysis: Text
4616 '$(filter PATTERN...,TEXT)'
4617 Select words in TEXT that match one of the PATTERN words.
4618 *Note Functions for String Substitution and Analysis: Text
4621 '$(filter-out PATTERN...,TEXT)'
4622 Select words in TEXT that _do not_ match any of the PATTERN words.
4623 *Note Functions for String Substitution and Analysis: Text
4627 Sort the words in LIST lexicographically, removing duplicates.
4628 *Note Functions for String Substitution and Analysis: Text
4632 Extract the Nth word (one-origin) of TEXT.
4633 *Note Functions for String Substitution and Analysis: Text
4637 Count the number of words in TEXT.
4638 *Note Functions for String Substitution and Analysis: Text
4641 '$(wordlist S,E,TEXT)'
4642 Returns the list of words in TEXT from S to E.
4643 *Note Functions for String Substitution and Analysis: Text
4646 '$(firstword NAMES...)'
4647 Extract the first word of NAMES.
4648 *Note Functions for String Substitution and Analysis: Text
4651 '$(lastword NAMES...)'
4652 Extract the last word of NAMES.
4653 *Note Functions for String Substitution and Analysis: Text
4657 Extract the directory part of each file name.
4658 *Note Functions for File Names: File Name Functions.
4660 '$(notdir NAMES...)'
4661 Extract the non-directory part of each file name.
4662 *Note Functions for File Names: File Name Functions.
4664 '$(suffix NAMES...)'
4665 Extract the suffix (the last '.' and following characters) of each
4667 *Note Functions for File Names: File Name Functions.
4669 '$(basename NAMES...)'
4670 Extract the base name (name without suffix) of each file name.
4671 *Note Functions for File Names: File Name Functions.
4673 '$(addsuffix SUFFIX,NAMES...)'
4674 Append SUFFIX to each word in NAMES.
4675 *Note Functions for File Names: File Name Functions.
4677 '$(addprefix PREFIX,NAMES...)'
4678 Prepend PREFIX to each word in NAMES.
4679 *Note Functions for File Names: File Name Functions.
4681 '$(join LIST1,LIST2)'
4682 Join two parallel lists of words.
4683 *Note Functions for File Names: File Name Functions.
4685 '$(wildcard PATTERN...)'
4686 Find file names matching a shell file name pattern (_not_ a '%'
4688 *Note The Function 'wildcard': Wildcard Function.
4690 '$(realpath NAMES...)'
4691 For each file name in NAMES, expand to an absolute name that does
4692 not contain any '.', '..', nor symlinks.
4693 *Note Functions for File Names: File Name Functions.
4695 '$(abspath NAMES...)'
4696 For each file name in NAMES, expand to an absolute name that does
4697 not contain any '.' or '..' components, but preserves symlinks.
4698 *Note Functions for File Names: File Name Functions.
4701 When this function is evaluated, 'make' generates a fatal error
4702 with the message TEXT.
4703 *Note Functions That Control Make: Make Control Functions.
4705 '$(warning TEXT...)'
4706 When this function is evaluated, 'make' generates a warning with
4708 *Note Functions That Control Make: Make Control Functions.
4711 Execute a shell command and return its output.
4712 *Note The 'shell' Function: Shell Function.
4714 '$(origin VARIABLE)'
4715 Return a string describing how the 'make' variable VARIABLE was
4717 *Note The 'origin' Function: Origin Function.
4719 '$(flavor VARIABLE)'
4720 Return a string describing the flavor of the 'make' variable
4722 *Note The 'flavor' Function: Flavor Function.
4724 '$(let VAR [VAR ...],WORDS,TEXT)'
4725 Evaluate TEXT with the VARs bound to the words in WORDS.
4726 *Note The 'let' Function: Let Function.
4728 '$(foreach VAR,WORDS,TEXT)'
4729 Evaluate TEXT with VAR bound to each word in WORDS, and concatenate
4731 *Note The 'foreach' Function: Foreach Function.
4733 '$(if CONDITION,THEN-PART[,ELSE-PART])'
4734 Evaluate the condition CONDITION; if it's non-empty substitute the
4735 expansion of the THEN-PART otherwise substitute the expansion of
4737 *Note Functions for Conditionals: Conditional Functions.
4739 '$(or CONDITION1[,CONDITION2[,CONDITION3...]])'
4740 Evaluate each condition CONDITIONN one at a time; substitute the
4741 first non-empty expansion. If all expansions are empty, substitute
4743 *Note Functions for Conditionals: Conditional Functions.
4745 '$(and CONDITION1[,CONDITION2[,CONDITION3...]])'
4746 Evaluate each condition CONDITIONN one at a time; if any expansion
4747 results in the empty string substitute the empty string. If all
4748 expansions result in a non-empty string, substitute the expansion
4749 of the last CONDITION.
4750 *Note Functions for Conditionals: Conditional Functions.
4752 '$(intcmp LHS,RHS[,LT-PART[,EQ-PART[,GT-PART]]])'
4753 Compare LHS and RHS numerically; substitute the expansion of
4754 LT-PART, EQ-PART, or GT-PART depending on whether the left-hand
4755 side is less-than, equal-to, or greater-than the right-hand side,
4757 *Note Functions for Conditionals: Conditional Functions.
4759 '$(call VAR,PARAM,...)'
4760 Evaluate the variable VAR replacing any references to '$(1)',
4761 '$(2)' with the first, second, etc. PARAM values.
4762 *Note The 'call' Function: Call Function.
4765 Evaluate TEXT then read the results as makefile commands. Expands
4766 to the empty string.
4767 *Note The 'eval' Function: Eval Function.
4769 '$(file OP FILENAME,TEXT)'
4770 Expand the arguments, then open the file FILENAME using mode OP and
4771 write TEXT to that file.
4772 *Note The 'file' Function: File Function.
4775 Evaluates to the contents of the variable VAR, with no expansion
4777 *Note The 'value' Function: Value Function.
4779 Here is a summary of the automatic variables. *Note Automatic
4780 Variables::, for full information.
4783 The file name of the target.
4786 The target member name, when the target is an archive member.
4789 The name of the first prerequisite.
4792 The names of all the prerequisites that are newer than the target,
4793 with spaces between them. For prerequisites which are archive
4794 members, only the named member is used (*note Archives::).
4798 The names of all the prerequisites, with spaces between them. For
4799 prerequisites which are archive members, only the named member is
4800 used (*note Archives::). The value of '$^' omits duplicate
4801 prerequisites, while '$+' retains them and preserves their order.
4804 The stem with which an implicit rule matches (*note How Patterns
4805 Match: Pattern Match.).
4809 The directory part and the file-within-directory part of '$@'.
4813 The directory part and the file-within-directory part of '$*'.
4817 The directory part and the file-within-directory part of '$%'.
4821 The directory part and the file-within-directory part of '$<'.
4825 The directory part and the file-within-directory part of '$^'.
4829 The directory part and the file-within-directory part of '$+'.
4833 The directory part and the file-within-directory part of '$?'.
4835 These variables are used specially by GNU 'make':
4839 Makefiles to be read on every invocation of 'make'.
4840 *Note The Variable 'MAKEFILES': MAKEFILES Variable.
4844 Directory search path for files not found in the current directory.
4845 *Note 'VPATH' Search Path for All Prerequisites: General Search.
4849 The name of the system default command interpreter, usually
4850 '/bin/sh'. You can set 'SHELL' in the makefile to change the shell
4851 used to run recipes. *Note Recipe Execution: Execution. The
4852 'SHELL' variable is handled specially when importing from and
4853 exporting to the environment. *Note Choosing the Shell::.
4857 On MS-DOS only, the name of the command interpreter that is to be
4858 used by 'make'. This value takes precedence over the value of
4859 'SHELL'. *Note MAKESHELL variable: Execution.
4863 The name with which 'make' was invoked. Using this variable in
4864 recipes has special meaning. *Note How the 'MAKE' Variable Works:
4869 The built-in variable 'MAKE_VERSION' expands to the version number
4870 of the GNU 'make' program.
4874 The built-in variable 'MAKE_HOST' expands to a string representing
4875 the host that GNU 'make' was built to run on.
4879 The number of levels of recursion (sub-'make's).
4880 *Note Variables/Recursion::.
4884 The flags given to 'make'. You can set this in the environment or
4885 a makefile to set flags.
4886 *Note Communicating Options to a Sub-'make': Options/Recursion.
4888 It is _never_ appropriate to use 'MAKEFLAGS' directly in a recipe
4889 line: its contents may not be quoted correctly for use in the
4890 shell. Always allow recursive 'make''s to obtain these values
4891 through the environment from its parent.
4895 Other flags parsed by 'make'. You can set this in the environment
4896 or a makefile to set 'make' command-line flags. GNU 'make' never
4897 sets this variable itself. This variable is only needed if you'd
4898 like to set GNU 'make'-specific flags in a POSIX-compliant
4899 makefile. This variable will be seen by GNU 'make' and ignored by
4900 other 'make' implementations. It's not needed if you only use GNU
4901 'make'; just use 'MAKEFLAGS' directly. *Note Communicating Options
4902 to a Sub-'make': Options/Recursion.
4906 The targets given to 'make' on the command line. Setting this
4907 variable has no effect on the operation of 'make'.
4908 *Note Arguments to Specify the Goals: Goals.
4912 Set to the absolute pathname of the current working directory
4913 (after all '-C' options are processed, if any). Setting this
4914 variable has no effect on the operation of 'make'.
4915 *Note Recursive Use of 'make': Recursion.
4919 The default list of suffixes before 'make' reads any makefiles.
4922 Defines the naming of the libraries 'make' searches for, and their
4924 *Note Directory Search for Link Libraries: Libraries/Search.
4927 File: make.info, Node: Error Messages, Next: Complex Makefile, Prev: Quick Reference, Up: Top
4929 Appendix B Errors Generated by Make
4930 ***********************************
4932 Here is a list of the more common errors you might see generated by
4933 'make', and some information about what they mean and how to fix them.
4935 Sometimes 'make' errors are not fatal, especially in the presence of
4936 a '-' prefix on a recipe line, or the '-k' command line option. Errors
4937 that are fatal are prefixed with the string '***'.
4939 Error messages are all either prefixed with the name of the program
4940 (usually 'make'), or, if the error is found in a makefile, the name of
4941 the file and line number containing the problem.
4943 In the table below, these common prefixes are left off.
4946 '[FOO] SIGNAL DESCRIPTION'
4947 These errors are not really 'make' errors at all. They mean that a
4948 program that 'make' invoked as part of a recipe returned a non-0
4949 error code ('Error NN'), which 'make' interprets as failure, or it
4950 exited in some other abnormal fashion (with a signal of some type).
4951 *Note Errors in Recipes: Errors.
4953 If no '***' is attached to the message, then the sub-process failed
4954 but the rule in the makefile was prefixed with the '-' special
4955 character, so 'make' ignored the error.
4957 'missing separator. Stop.'
4958 'missing separator (did you mean TAB instead of 8 spaces?). Stop.'
4959 This means that 'make' could not understand much of anything about
4960 the makefile line it just read. GNU 'make' looks for various
4961 separators (':', '=', recipe prefix characters, etc.) to indicate
4962 what kind of line it's parsing. This message means it couldn't
4965 One of the most common reasons for this message is that you (or
4966 perhaps your oh-so-helpful editor, as is the case with many
4967 MS-Windows editors) have attempted to indent your recipe lines with
4968 spaces instead of a tab character. In this case, 'make' will use
4969 the second form of the error above. Remember that every line in
4970 the recipe must begin with a tab character (unless you set
4971 '.RECIPEPREFIX'; *note Special Variables::). Eight spaces do not
4972 count. *Note Rule Syntax::.
4974 'recipe commences before first target. Stop.'
4975 'missing rule before recipe. Stop.'
4976 This means the first thing in the makefile seems to be part of a
4977 recipe: it begins with a recipe prefix character and doesn't appear
4978 to be a legal 'make' directive (such as a variable assignment).
4979 Recipes must always be associated with a target.
4981 The second form is generated if the line has a semicolon as the
4982 first non-whitespace character; 'make' interprets this to mean you
4983 left out the "target: prerequisite" section of a rule. *Note Rule
4986 'No rule to make target `XXX'.'
4987 'No rule to make target `XXX', needed by `YYY'.'
4988 This means that 'make' decided it needed to build a target, but
4989 then couldn't find any instructions in the makefile on how to do
4990 that, either explicit or implicit (including in the default rules
4993 If you want that file to be built, you will need to add a rule to
4994 your makefile describing how that target can be built. Other
4995 possible sources of this problem are typos in the makefile (if that
4996 file name is wrong) or a corrupted source tree (if that file is not
4997 supposed to be built, but rather only a prerequisite).
4999 'No targets specified and no makefile found. Stop.'
5001 The former means that you didn't provide any targets to be built on
5002 the command line, and 'make' couldn't find any makefiles to read
5003 in. The latter means that some makefile was found, but it didn't
5004 contain any default goal and none was given on the command line.
5005 GNU 'make' has nothing to do in these situations. *Note Arguments
5006 to Specify the Makefile: Makefile Arguments.
5008 'Makefile `XXX' was not found.'
5009 'Included makefile `XXX' was not found.'
5010 A makefile specified on the command line (first form) or included
5011 (second form) was not found.
5013 'warning: overriding recipe for target `XXX''
5014 'warning: ignoring old recipe for target `XXX''
5015 GNU 'make' allows only one recipe to be specified per target
5016 (except for double-colon rules). If you give a recipe for a target
5017 which already has been defined to have one, this warning is issued
5018 and the second recipe will overwrite the first. *Note Multiple
5019 Rules for One Target: Multiple Rules.
5021 'Circular XXX <- YYY dependency dropped.'
5022 This means that 'make' detected a loop in the dependency graph:
5023 after tracing the prerequisite YYY of target XXX, and its
5024 prerequisites, etc., one of them depended on XXX again.
5026 'Recursive variable `XXX' references itself (eventually). Stop.'
5027 This means you've defined a normal (recursive) 'make' variable XXX
5028 that, when it's expanded, will refer to itself (XXX). This is not
5029 allowed; either use simply-expanded variables (':=' or '::=') or
5030 use the append operator ('+='). *Note How to Use Variables: Using
5033 'Unterminated variable reference. Stop.'
5034 This means you forgot to provide the proper closing parenthesis or
5035 brace in your variable or function reference.
5037 'insufficient arguments to function `XXX'. Stop.'
5038 This means you haven't provided the requisite number of arguments
5039 for this function. See the documentation of the function for a
5040 description of its arguments. *Note Functions for Transforming
5043 'missing target pattern. Stop.'
5044 'multiple target patterns. Stop.'
5045 'target pattern contains no `%'. Stop.'
5046 'mixed implicit and static pattern rules. Stop.'
5047 These errors are generated for malformed static pattern rules
5048 (*note Syntax of Static Pattern Rules: Static Usage.). The first
5049 means the target-pattern part of the rule is empty; the second
5050 means there are multiple pattern characters ('%') in the
5051 target-pattern part; the third means there are no pattern
5052 characters in the target-pattern part; and the fourth means that
5053 all three parts of the static pattern rule contain pattern
5054 characters ('%')-the first part should not contain pattern
5057 If you see these errors and you aren't trying to create a static
5058 pattern rule, check the value of any variables in your target and
5059 prerequisite lists to be sure they do not contain colons.
5061 'warning: -jN forced in submake: disabling jobserver mode.'
5062 This warning and the next are generated if 'make' detects error
5063 conditions related to parallel processing on systems where
5064 sub-'make's can communicate (*note Communicating Options to a
5065 Sub-'make': Options/Recursion.). This warning is generated if a
5066 recursive invocation of a 'make' process is forced to have '-jN' in
5067 its argument list (where N is greater than one). This could
5068 happen, for example, if you set the 'MAKE' environment variable to
5069 'make -j2'. In this case, the sub-'make' doesn't communicate with
5070 other 'make' processes and will simply pretend it has two jobs of
5073 'warning: jobserver unavailable: using -j1. Add `+' to parent make rule.'
5074 In order for 'make' processes to communicate, the parent will pass
5075 information to the child. Since this could result in problems if
5076 the child process isn't actually a 'make', the parent will only do
5077 this if it thinks the child is a 'make'. The parent uses the
5078 normal algorithms to determine this (*note How the 'MAKE' Variable
5079 Works: MAKE Variable.). If the makefile is constructed such that
5080 the parent doesn't know the child is a 'make' process, then the
5081 child will receive only part of the information necessary. In this
5082 case, the child will generate this warning message and proceed with
5083 its build in a sequential manner.
5085 'warning: ignoring prerequisites on suffix rule definition'
5086 According to POSIX, a suffix rule cannot contain prerequisites. If
5087 a rule that could be a suffix rule has prerequisites it is
5088 interpreted as a simple explicit rule, with an odd target name.
5089 This requirement is obeyed when POSIX-conforming mode is enabled
5090 (the '.POSIX' target is defined). In versions of GNU 'make' prior
5091 to 4.3, no warning was emitted and a suffix rule was created,
5092 however all prerequisites were ignored and were not part of the
5093 suffix rule. Starting with GNU 'make' 4.3 the behavior is the
5094 same, and in addition this warning is generated. In a future
5095 version the POSIX-conforming behavior will be the only behavior: no
5096 rule with a prerequisite can be suffix rule and this warning will
5100 File: make.info, Node: Complex Makefile, Next: GNU Free Documentation License, Prev: Error Messages, Up: Top
5102 Appendix C Complex Makefile Example
5103 ***********************************
5105 Here is the makefile for the GNU 'tar' program. This is a moderately
5106 complex makefile. The first line uses a '#!' setting to allow the
5107 makefile to be executed directly.
5109 Because it is the first target, the default goal is 'all'. An
5110 interesting feature of this makefile is that 'testpad.h' is a source
5111 file automatically created by the 'testpad' program, itself compiled
5114 If you type 'make' or 'make all', then 'make' creates the 'tar'
5115 executable, the 'rmt' daemon that provides remote tape access, and the
5116 'tar.info' Info file.
5118 If you type 'make install', then 'make' not only creates 'tar',
5119 'rmt', and 'tar.info', but also installs them.
5121 If you type 'make clean', then 'make' removes the '.o' files, and the
5122 'tar', 'rmt', 'testpad', 'testpad.h', and 'core' files.
5124 If you type 'make distclean', then 'make' not only removes the same
5125 files as does 'make clean' but also the 'TAGS', 'Makefile', and
5126 'config.status' files. (Although it is not evident, this makefile (and
5127 'config.status') is generated by the user with the 'configure' program,
5128 which is provided in the 'tar' distribution, but is not shown here.)
5130 If you type 'make realclean', then 'make' removes the same files as
5131 does 'make distclean' and also removes the Info files generated from
5134 In addition, there are targets 'shar' and 'dist' that create
5138 # Generated automatically from Makefile.in by configure.
5139 # Un*x Makefile for GNU tar program.
5140 # Copyright (C) 1991 Free Software Foundation, Inc.
5142 # This program is free software; you can redistribute
5143 # it and/or modify it under the terms of the GNU
5144 # General Public License ...
5150 #### Start of system configuration section. ####
5154 # If you use gcc, you should either run the
5155 # fixincludes script that comes with it or else use
5156 # gcc with the -traditional option. Otherwise ioctl
5157 # calls will be compiled incorrectly on some systems.
5160 INSTALL = /usr/local/bin/install -c
5161 INSTALLDATA = /usr/local/bin/install -c -m 644
5163 # Things you might add to DEFS:
5164 # -DSTDC_HEADERS If you have ANSI C headers and
5166 # -DPOSIX If you have POSIX.1 headers and
5168 # -DBSD42 If you have sys/dir.h (unless
5169 # you use -DPOSIX), sys/file.h,
5170 # and st_blocks in `struct stat'.
5171 # -DUSG If you have System V/ANSI C
5172 # string and memory functions
5173 # and headers, sys/sysmacros.h,
5174 # fcntl.h, getcwd, no valloc,
5175 # and ndir.h (unless
5176 # you use -DDIRENT).
5177 # -DNO_MEMORY_H If USG or STDC_HEADERS but do not
5179 # -DDIRENT If USG and you have dirent.h
5180 # instead of ndir.h.
5181 # -DSIGTYPE=int If your signal handlers
5182 # return int, not void.
5183 # -DNO_MTIO If you lack sys/mtio.h
5185 # -DNO_REMOTE If you do not have a remote shell
5187 # -DUSE_REXEC To use rexec for remote tape
5188 # operations instead of
5189 # forking rsh or remsh.
5190 # -DVPRINTF_MISSING If you lack vprintf function
5191 # (but have _doprnt).
5192 # -DDOPRNT_MISSING If you lack _doprnt function.
5193 # Also need to define
5194 # -DVPRINTF_MISSING.
5195 # -DFTIME_MISSING If you lack ftime system call.
5196 # -DSTRSTR_MISSING If you lack strstr function.
5197 # -DVALLOC_MISSING If you lack valloc function.
5198 # -DMKDIR_MISSING If you lack mkdir and
5199 # rmdir system calls.
5200 # -DRENAME_MISSING If you lack rename system call.
5201 # -DFTRUNCATE_MISSING If you lack ftruncate
5203 # -DV7 On Version 7 Unix (not
5204 # tested in a long time).
5205 # -DEMUL_OPEN3 If you lack a 3-argument version
5206 # of open, and want to emulate it
5207 # with system calls you do have.
5208 # -DNO_OPEN3 If you lack the 3-argument open
5209 # and want to disable the tar -k
5210 # option instead of emulating open.
5211 # -DXENIX If you have sys/inode.h
5212 # and need it 94 to be included.
5214 DEFS = -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \
5215 -DVPRINTF_MISSING -DBSD42
5216 # Set this to rtapelib.o unless you defined NO_REMOTE,
5217 # in which case make it empty.
5218 RTAPELIB = rtapelib.o
5220 DEF_AR_FILE = /dev/rmt8
5224 CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \
5225 -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \
5226 -DDEFBLOCKING=$(DEFBLOCKING)
5230 # Prefix for each installed program,
5231 # normally empty or `g'.
5234 # The directory to install tar in.
5235 bindir = $(prefix)/bin
5237 # The directory to install the info files in.
5238 infodir = $(prefix)/info
5240 #### End of system configuration section. ####
5242 SRCS_C = tar.c create.c extract.c buffer.c \
5243 getoldopt.c update.c gnu.c mangle.c \
5244 version.c list.c names.c diffarch.c \
5245 port.c wildmat.c getopt.c getopt1.c \
5248 SRCS = $(SRCS_C) $(SRCS_Y)
5249 OBJS = $(SRCS_C:.c=.o) $(SRCS_Y:.y=.o) $(RTAPELIB)
5250 AUX = README COPYING ChangeLog Makefile.in \
5251 makefile.pc configure configure.in \
5252 tar.texinfo tar.info* texinfo.tex \
5253 tar.h port.h open3.h getopt.h regex.h \
5254 rmt.h rmt.c rtapelib.c alloca.c \
5255 msd_dir.h msd_dir.c tcexparg.c \
5256 level-0 level-1 backup-specs testpad.c
5259 all: tar rmt tar.info
5262 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
5265 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c
5267 tar.info: tar.texinfo
5268 makeinfo tar.texinfo
5272 $(INSTALL) tar $(bindir)/$(binprefix)tar
5273 -test ! -f rmt || $(INSTALL) rmt /etc/rmt
5274 $(INSTALLDATA) $(srcdir)/tar.info* $(infodir)
5276 $(OBJS): tar.h port.h testpad.h
5277 regex.o buffer.o tar.o: regex.h
5278 # getdate.y has 8 shift/reduce conflicts.
5284 $(CC) -o $@ testpad.o
5291 rm -f *.o tar rmt testpad testpad.h core
5295 rm -f TAGS Makefile config.status
5298 realclean: distclean
5302 shar: $(SRCS) $(AUX)
5303 shar $(SRCS) $(AUX) | compress \
5304 > tar-`sed -e '/version_string/!d' \
5305 -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
5310 dist: $(SRCS) $(AUX)
5312 -e '/version_string/!d' \
5313 -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
5316 -rm -rf `cat .fname`
5318 ln $(SRCS) $(AUX) `cat .fname`
5319 tar chZf `cat .fname`.tar.Z `cat .fname`
5320 -rm -rf `cat .fname` .fname
5322 tar.zoo: $(SRCS) $(AUX)
5326 for X in $(SRCS) $(AUX) ; do \
5328 sed 's/$$/^M/' $$X \
5329 > tmp.dir/$$X ; done
5330 cd tmp.dir ; zoo aM ../tar.zoo *
5334 File: make.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: Complex Makefile, Up: Top
5336 Appendix D GNU Free Documentation License
5337 *****************************************
5339 Version 1.3, 3 November 2008
5341 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
5344 Everyone is permitted to copy and distribute verbatim copies
5345 of this license document, but changing it is not allowed.
5349 The purpose of this License is to make a manual, textbook, or other
5350 functional and useful document "free" in the sense of freedom: to
5351 assure everyone the effective freedom to copy and redistribute it,
5352 with or without modifying it, either commercially or
5353 noncommercially. Secondarily, this License preserves for the
5354 author and publisher a way to get credit for their work, while not
5355 being considered responsible for modifications made by others.
5357 This License is a kind of "copyleft", which means that derivative
5358 works of the document must themselves be free in the same sense.
5359 It complements the GNU General Public License, which is a copyleft
5360 license designed for free software.
5362 We have designed this License in order to use it for manuals for
5363 free software, because free software needs free documentation: a
5364 free program should come with manuals providing the same freedoms
5365 that the software does. But this License is not limited to
5366 software manuals; it can be used for any textual work, regardless
5367 of subject matter or whether it is published as a printed book. We
5368 recommend this License principally for works whose purpose is
5369 instruction or reference.
5371 1. APPLICABILITY AND DEFINITIONS
5373 This License applies to any manual or other work, in any medium,
5374 that contains a notice placed by the copyright holder saying it can
5375 be distributed under the terms of this License. Such a notice
5376 grants a world-wide, royalty-free license, unlimited in duration,
5377 to use that work under the conditions stated herein. The
5378 "Document", below, refers to any such manual or work. Any member
5379 of the public is a licensee, and is addressed as "you". You accept
5380 the license if you copy, modify or distribute the work in a way
5381 requiring permission under copyright law.
5383 A "Modified Version" of the Document means any work containing the
5384 Document or a portion of it, either copied verbatim, or with
5385 modifications and/or translated into another language.
5387 A "Secondary Section" is a named appendix or a front-matter section
5388 of the Document that deals exclusively with the relationship of the
5389 publishers or authors of the Document to the Document's overall
5390 subject (or to related matters) and contains nothing that could
5391 fall directly within that overall subject. (Thus, if the Document
5392 is in part a textbook of mathematics, a Secondary Section may not
5393 explain any mathematics.) The relationship could be a matter of
5394 historical connection with the subject or with related matters, or
5395 of legal, commercial, philosophical, ethical or political position
5398 The "Invariant Sections" are certain Secondary Sections whose
5399 titles are designated, as being those of Invariant Sections, in the
5400 notice that says that the Document is released under this License.
5401 If a section does not fit the above definition of Secondary then it
5402 is not allowed to be designated as Invariant. The Document may
5403 contain zero Invariant Sections. If the Document does not identify
5404 any Invariant Sections then there are none.
5406 The "Cover Texts" are certain short passages of text that are
5407 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
5408 that says that the Document is released under this License. A
5409 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
5410 be at most 25 words.
5412 A "Transparent" copy of the Document means a machine-readable copy,
5413 represented in a format whose specification is available to the
5414 general public, that is suitable for revising the document
5415 straightforwardly with generic text editors or (for images composed
5416 of pixels) generic paint programs or (for drawings) some widely
5417 available drawing editor, and that is suitable for input to text
5418 formatters or for automatic translation to a variety of formats
5419 suitable for input to text formatters. A copy made in an otherwise
5420 Transparent file format whose markup, or absence of markup, has
5421 been arranged to thwart or discourage subsequent modification by
5422 readers is not Transparent. An image format is not Transparent if
5423 used for any substantial amount of text. A copy that is not
5424 "Transparent" is called "Opaque".
5426 Examples of suitable formats for Transparent copies include plain
5427 ASCII without markup, Texinfo input format, LaTeX input format,
5428 SGML or XML using a publicly available DTD, and standard-conforming
5429 simple HTML, PostScript or PDF designed for human modification.
5430 Examples of transparent image formats include PNG, XCF and JPG.
5431 Opaque formats include proprietary formats that can be read and
5432 edited only by proprietary word processors, SGML or XML for which
5433 the DTD and/or processing tools are not generally available, and
5434 the machine-generated HTML, PostScript or PDF produced by some word
5435 processors for output purposes only.
5437 The "Title Page" means, for a printed book, the title page itself,
5438 plus such following pages as are needed to hold, legibly, the
5439 material this License requires to appear in the title page. For
5440 works in formats which do not have any title page as such, "Title
5441 Page" means the text near the most prominent appearance of the
5442 work's title, preceding the beginning of the body of the text.
5444 The "publisher" means any person or entity that distributes copies
5445 of the Document to the public.
5447 A section "Entitled XYZ" means a named subunit of the Document
5448 whose title either is precisely XYZ or contains XYZ in parentheses
5449 following text that translates XYZ in another language. (Here XYZ
5450 stands for a specific section name mentioned below, such as
5451 "Acknowledgements", "Dedications", "Endorsements", or "History".)
5452 To "Preserve the Title" of such a section when you modify the
5453 Document means that it remains a section "Entitled XYZ" according
5456 The Document may include Warranty Disclaimers next to the notice
5457 which states that this License applies to the Document. These
5458 Warranty Disclaimers are considered to be included by reference in
5459 this License, but only as regards disclaiming warranties: any other
5460 implication that these Warranty Disclaimers may have is void and
5461 has no effect on the meaning of this License.
5465 You may copy and distribute the Document in any medium, either
5466 commercially or noncommercially, provided that this License, the
5467 copyright notices, and the license notice saying this License
5468 applies to the Document are reproduced in all copies, and that you
5469 add no other conditions whatsoever to those of this License. You
5470 may not use technical measures to obstruct or control the reading
5471 or further copying of the copies you make or distribute. However,
5472 you may accept compensation in exchange for copies. If you
5473 distribute a large enough number of copies you must also follow the
5474 conditions in section 3.
5476 You may also lend copies, under the same conditions stated above,
5477 and you may publicly display copies.
5479 3. COPYING IN QUANTITY
5481 If you publish printed copies (or copies in media that commonly
5482 have printed covers) of the Document, numbering more than 100, and
5483 the Document's license notice requires Cover Texts, you must
5484 enclose the copies in covers that carry, clearly and legibly, all
5485 these Cover Texts: Front-Cover Texts on the front cover, and
5486 Back-Cover Texts on the back cover. Both covers must also clearly
5487 and legibly identify you as the publisher of these copies. The
5488 front cover must present the full title with all words of the title
5489 equally prominent and visible. You may add other material on the
5490 covers in addition. Copying with changes limited to the covers, as
5491 long as they preserve the title of the Document and satisfy these
5492 conditions, can be treated as verbatim copying in other respects.
5494 If the required texts for either cover are too voluminous to fit
5495 legibly, you should put the first ones listed (as many as fit
5496 reasonably) on the actual cover, and continue the rest onto
5499 If you publish or distribute Opaque copies of the Document
5500 numbering more than 100, you must either include a machine-readable
5501 Transparent copy along with each Opaque copy, or state in or with
5502 each Opaque copy a computer-network location from which the general
5503 network-using public has access to download using public-standard
5504 network protocols a complete Transparent copy of the Document, free
5505 of added material. If you use the latter option, you must take
5506 reasonably prudent steps, when you begin distribution of Opaque
5507 copies in quantity, to ensure that this Transparent copy will
5508 remain thus accessible at the stated location until at least one
5509 year after the last time you distribute an Opaque copy (directly or
5510 through your agents or retailers) of that edition to the public.
5512 It is requested, but not required, that you contact the authors of
5513 the Document well before redistributing any large number of copies,
5514 to give them a chance to provide you with an updated version of the
5519 You may copy and distribute a Modified Version of the Document
5520 under the conditions of sections 2 and 3 above, provided that you
5521 release the Modified Version under precisely this License, with the
5522 Modified Version filling the role of the Document, thus licensing
5523 distribution and modification of the Modified Version to whoever
5524 possesses a copy of it. In addition, you must do these things in
5525 the Modified Version:
5527 A. Use in the Title Page (and on the covers, if any) a title
5528 distinct from that of the Document, and from those of previous
5529 versions (which should, if there were any, be listed in the
5530 History section of the Document). You may use the same title
5531 as a previous version if the original publisher of that
5532 version gives permission.
5534 B. List on the Title Page, as authors, one or more persons or
5535 entities responsible for authorship of the modifications in
5536 the Modified Version, together with at least five of the
5537 principal authors of the Document (all of its principal
5538 authors, if it has fewer than five), unless they release you
5539 from this requirement.
5541 C. State on the Title page the name of the publisher of the
5542 Modified Version, as the publisher.
5544 D. Preserve all the copyright notices of the Document.
5546 E. Add an appropriate copyright notice for your modifications
5547 adjacent to the other copyright notices.
5549 F. Include, immediately after the copyright notices, a license
5550 notice giving the public permission to use the Modified
5551 Version under the terms of this License, in the form shown in
5554 G. Preserve in that license notice the full lists of Invariant
5555 Sections and required Cover Texts given in the Document's
5558 H. Include an unaltered copy of this License.
5560 I. Preserve the section Entitled "History", Preserve its Title,
5561 and add to it an item stating at least the title, year, new
5562 authors, and publisher of the Modified Version as given on the
5563 Title Page. If there is no section Entitled "History" in the
5564 Document, create one stating the title, year, authors, and
5565 publisher of the Document as given on its Title Page, then add
5566 an item describing the Modified Version as stated in the
5569 J. Preserve the network location, if any, given in the Document
5570 for public access to a Transparent copy of the Document, and
5571 likewise the network locations given in the Document for
5572 previous versions it was based on. These may be placed in the
5573 "History" section. You may omit a network location for a work
5574 that was published at least four years before the Document
5575 itself, or if the original publisher of the version it refers
5576 to gives permission.
5578 K. For any section Entitled "Acknowledgements" or "Dedications",
5579 Preserve the Title of the section, and preserve in the section
5580 all the substance and tone of each of the contributor
5581 acknowledgements and/or dedications given therein.
5583 L. Preserve all the Invariant Sections of the Document, unaltered
5584 in their text and in their titles. Section numbers or the
5585 equivalent are not considered part of the section titles.
5587 M. Delete any section Entitled "Endorsements". Such a section
5588 may not be included in the Modified Version.
5590 N. Do not retitle any existing section to be Entitled
5591 "Endorsements" or to conflict in title with any Invariant
5594 O. Preserve any Warranty Disclaimers.
5596 If the Modified Version includes new front-matter sections or
5597 appendices that qualify as Secondary Sections and contain no
5598 material copied from the Document, you may at your option designate
5599 some or all of these sections as invariant. To do this, add their
5600 titles to the list of Invariant Sections in the Modified Version's
5601 license notice. These titles must be distinct from any other
5604 You may add a section Entitled "Endorsements", provided it contains
5605 nothing but endorsements of your Modified Version by various
5606 parties--for example, statements of peer review or that the text
5607 has been approved by an organization as the authoritative
5608 definition of a standard.
5610 You may add a passage of up to five words as a Front-Cover Text,
5611 and a passage of up to 25 words as a Back-Cover Text, to the end of
5612 the list of Cover Texts in the Modified Version. Only one passage
5613 of Front-Cover Text and one of Back-Cover Text may be added by (or
5614 through arrangements made by) any one entity. If the Document
5615 already includes a cover text for the same cover, previously added
5616 by you or by arrangement made by the same entity you are acting on
5617 behalf of, you may not add another; but you may replace the old
5618 one, on explicit permission from the previous publisher that added
5621 The author(s) and publisher(s) of the Document do not by this
5622 License give permission to use their names for publicity for or to
5623 assert or imply endorsement of any Modified Version.
5625 5. COMBINING DOCUMENTS
5627 You may combine the Document with other documents released under
5628 this License, under the terms defined in section 4 above for
5629 modified versions, provided that you include in the combination all
5630 of the Invariant Sections of all of the original documents,
5631 unmodified, and list them all as Invariant Sections of your
5632 combined work in its license notice, and that you preserve all
5633 their Warranty Disclaimers.
5635 The combined work need only contain one copy of this License, and
5636 multiple identical Invariant Sections may be replaced with a single
5637 copy. If there are multiple Invariant Sections with the same name
5638 but different contents, make the title of each such section unique
5639 by adding at the end of it, in parentheses, the name of the
5640 original author or publisher of that section if known, or else a
5641 unique number. Make the same adjustment to the section titles in
5642 the list of Invariant Sections in the license notice of the
5645 In the combination, you must combine any sections Entitled
5646 "History" in the various original documents, forming one section
5647 Entitled "History"; likewise combine any sections Entitled
5648 "Acknowledgements", and any sections Entitled "Dedications". You
5649 must delete all sections Entitled "Endorsements."
5651 6. COLLECTIONS OF DOCUMENTS
5653 You may make a collection consisting of the Document and other
5654 documents released under this License, and replace the individual
5655 copies of this License in the various documents with a single copy
5656 that is included in the collection, provided that you follow the
5657 rules of this License for verbatim copying of each of the documents
5658 in all other respects.
5660 You may extract a single document from such a collection, and
5661 distribute it individually under this License, provided you insert
5662 a copy of this License into the extracted document, and follow this
5663 License in all other respects regarding verbatim copying of that
5666 7. AGGREGATION WITH INDEPENDENT WORKS
5668 A compilation of the Document or its derivatives with other
5669 separate and independent documents or works, in or on a volume of a
5670 storage or distribution medium, is called an "aggregate" if the
5671 copyright resulting from the compilation is not used to limit the
5672 legal rights of the compilation's users beyond what the individual
5673 works permit. When the Document is included in an aggregate, this
5674 License does not apply to the other works in the aggregate which
5675 are not themselves derivative works of the Document.
5677 If the Cover Text requirement of section 3 is applicable to these
5678 copies of the Document, then if the Document is less than one half
5679 of the entire aggregate, the Document's Cover Texts may be placed
5680 on covers that bracket the Document within the aggregate, or the
5681 electronic equivalent of covers if the Document is in electronic
5682 form. Otherwise they must appear on printed covers that bracket
5683 the whole aggregate.
5687 Translation is considered a kind of modification, so you may
5688 distribute translations of the Document under the terms of section
5689 4. Replacing Invariant Sections with translations requires special
5690 permission from their copyright holders, but you may include
5691 translations of some or all Invariant Sections in addition to the
5692 original versions of these Invariant Sections. You may include a
5693 translation of this License, and all the license notices in the
5694 Document, and any Warranty Disclaimers, provided that you also
5695 include the original English version of this License and the
5696 original versions of those notices and disclaimers. In case of a
5697 disagreement between the translation and the original version of
5698 this License or a notice or disclaimer, the original version will
5701 If a section in the Document is Entitled "Acknowledgements",
5702 "Dedications", or "History", the requirement (section 4) to
5703 Preserve its Title (section 1) will typically require changing the
5708 You may not copy, modify, sublicense, or distribute the Document
5709 except as expressly provided under this License. Any attempt
5710 otherwise to copy, modify, sublicense, or distribute it is void,
5711 and will automatically terminate your rights under this License.
5713 However, if you cease all violation of this License, then your
5714 license from a particular copyright holder is reinstated (a)
5715 provisionally, unless and until the copyright holder explicitly and
5716 finally terminates your license, and (b) permanently, if the
5717 copyright holder fails to notify you of the violation by some
5718 reasonable means prior to 60 days after the cessation.
5720 Moreover, your license from a particular copyright holder is
5721 reinstated permanently if the copyright holder notifies you of the
5722 violation by some reasonable means, this is the first time you have
5723 received notice of violation of this License (for any work) from
5724 that copyright holder, and you cure the violation prior to 30 days
5725 after your receipt of the notice.
5727 Termination of your rights under this section does not terminate
5728 the licenses of parties who have received copies or rights from you
5729 under this License. If your rights have been terminated and not
5730 permanently reinstated, receipt of a copy of some or all of the
5731 same material does not give you any rights to use it.
5733 10. FUTURE REVISIONS OF THIS LICENSE
5735 The Free Software Foundation may publish new, revised versions of
5736 the GNU Free Documentation License from time to time. Such new
5737 versions will be similar in spirit to the present version, but may
5738 differ in detail to address new problems or concerns. See
5739 <https://www.gnu.org/licenses/>.
5741 Each version of the License is given a distinguishing version
5742 number. If the Document specifies that a particular numbered
5743 version of this License "or any later version" applies to it, you
5744 have the option of following the terms and conditions either of
5745 that specified version or of any later version that has been
5746 published (not as a draft) by the Free Software Foundation. If the
5747 Document does not specify a version number of this License, you may
5748 choose any version ever published (not as a draft) by the Free
5749 Software Foundation. If the Document specifies that a proxy can
5750 decide which future versions of this License can be used, that
5751 proxy's public statement of acceptance of a version permanently
5752 authorizes you to choose that version for the Document.
5756 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
5757 World Wide Web server that publishes copyrightable works and also
5758 provides prominent facilities for anybody to edit those works. A
5759 public wiki that anybody can edit is an example of such a server.
5760 A "Massive Multiauthor Collaboration" (or "MMC") contained in the
5761 site means any set of copyrightable works thus published on the MMC
5764 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
5765 license published by Creative Commons Corporation, a not-for-profit
5766 corporation with a principal place of business in San Francisco,
5767 California, as well as future copyleft versions of that license
5768 published by that same organization.
5770 "Incorporate" means to publish or republish a Document, in whole or
5771 in part, as part of another Document.
5773 An MMC is "eligible for relicensing" if it is licensed under this
5774 License, and if all works that were first published under this
5775 License somewhere other than this MMC, and subsequently
5776 incorporated in whole or in part into the MMC, (1) had no cover
5777 texts or invariant sections, and (2) were thus incorporated prior
5778 to November 1, 2008.
5780 The operator of an MMC Site may republish an MMC contained in the
5781 site under CC-BY-SA on the same site at any time before August 1,
5782 2009, provided the MMC is eligible for relicensing.
5784 ADDENDUM: How to use this License for your documents
5785 ====================================================
5787 To use this License in a document you have written, include a copy of
5788 the License in the document and put the following copyright and license
5789 notices just after the title page:
5791 Copyright (C) YEAR YOUR NAME.
5792 Permission is granted to copy, distribute and/or modify this document
5793 under the terms of the GNU Free Documentation License, Version 1.3
5794 or any later version published by the Free Software Foundation;
5795 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
5796 Texts. A copy of the license is included in the section entitled ``GNU
5797 Free Documentation License''.
5799 If you have Invariant Sections, Front-Cover Texts and Back-Cover
5800 Texts, replace the "with...Texts." line with this:
5802 with the Invariant Sections being LIST THEIR TITLES, with
5803 the Front-Cover Texts being LIST, and with the Back-Cover Texts
5806 If you have Invariant Sections without Cover Texts, or some other
5807 combination of the three, merge those two alternatives to suit the
5810 If your document contains nontrivial examples of program code, we
5811 recommend releasing these examples in parallel under your choice of free
5812 software license, such as the GNU General Public License, to permit
5813 their use in free software.
5816 File: make.info, Node: Concept Index, Next: Name Index, Prev: GNU Free Documentation License, Up: Top
5824 * !=: Setting. (line 6)
5825 * !=, expansion: Reading Makefiles. (line 34)
5826 * # (comments), in makefile: Makefile Contents. (line 41)
5827 * # (comments), in recipes: Recipe Syntax. (line 29)
5828 * #include: Automatic Prerequisites.
5830 * $, in function call: Syntax of Functions. (line 6)
5831 * $, in rules: Rule Syntax. (line 33)
5832 * $, in variable name: Computed Names. (line 6)
5833 * $, in variable reference: Reference. (line 6)
5834 * %, in pattern rules: Pattern Intro. (line 9)
5835 * %, quoting in patsubst: Text Functions. (line 27)
5836 * %, quoting in static pattern: Static Usage. (line 37)
5837 * %, quoting in vpath: Selective Search. (line 39)
5838 * %, quoting with \ (backslash): Selective Search. (line 39)
5839 * %, quoting with \ (backslash) <1>: Static Usage. (line 37)
5840 * %, quoting with \ (backslash) <2>: Text Functions. (line 27)
5841 * * (wildcard character): Wildcards. (line 6)
5842 * +, and define: Canned Recipes. (line 49)
5843 * +, and recipe execution: Instead of Execution.
5845 * +, and recipes: MAKE Variable. (line 18)
5846 * +=: Appending. (line 6)
5847 * +=, expansion: Reading Makefiles. (line 34)
5848 * +=, expansion <1>: Reading Makefiles. (line 34)
5849 * ,v (RCS file extension): Catalogue of Rules. (line 167)
5850 * - (in recipes): Errors. (line 19)
5851 * -, and define: Canned Recipes. (line 49)
5852 * --always-make: Options Summary. (line 15)
5853 * --assume-new: Instead of Execution.
5855 * --assume-new <1>: Options Summary. (line 346)
5856 * --assume-new, and recursion: Options/Recursion. (line 30)
5857 * --assume-old: Avoiding Compilation.
5859 * --assume-old <1>: Options Summary. (line 186)
5860 * --assume-old, and recursion: Options/Recursion. (line 30)
5861 * --check-symlink-times: Options Summary. (line 167)
5862 * --debug: Options Summary. (line 43)
5863 * --directory: Recursion. (line 20)
5864 * --directory <1>: Options Summary. (line 26)
5865 * --directory, and --print-directory: -w Option. (line 20)
5866 * --directory, and recursion: Options/Recursion. (line 30)
5867 * --dry-run: Echoing. (line 18)
5868 * --dry-run <1>: Instead of Execution.
5870 * --dry-run <2>: Options Summary. (line 177)
5871 * --environment-overrides: Options Summary. (line 94)
5872 * --eval: Options Summary. (line 99)
5873 * --file: Makefile Names. (line 23)
5874 * --file <1>: Makefile Arguments. (line 6)
5875 * --file <2>: Options Summary. (line 107)
5876 * --file, and recursion: Options/Recursion. (line 30)
5877 * --help: Options Summary. (line 113)
5878 * --ignore-errors: Errors. (line 30)
5879 * --ignore-errors <1>: Options Summary. (line 118)
5880 * --include-dir: Include. (line 53)
5881 * --include-dir <1>: Options Summary. (line 123)
5882 * --jobs: Parallel. (line 6)
5883 * --jobs <1>: Options Summary. (line 134)
5884 * --jobs, and recursion: Options/Recursion. (line 33)
5885 * --jobserver-auth: Job Slots. (line 21)
5886 * --jobserver-style: Options Summary. (line 142)
5887 * --jobserver-style <1>: POSIX Jobserver. (line 13)
5888 * --jobserver-style for Windows: Windows Jobserver. (line 16)
5889 * --just-print: Echoing. (line 18)
5890 * --just-print <1>: Instead of Execution.
5892 * --just-print <2>: Options Summary. (line 176)
5893 * --keep-going: Errors. (line 46)
5894 * --keep-going <1>: Testing. (line 16)
5895 * --keep-going <2>: Options Summary. (line 152)
5896 * --load-average: Parallel. (line 35)
5897 * --load-average <1>: Options Summary. (line 159)
5898 * --makefile: Makefile Names. (line 23)
5899 * --makefile <1>: Makefile Arguments. (line 6)
5900 * --makefile <2>: Options Summary. (line 108)
5901 * --max-load: Parallel. (line 35)
5902 * --max-load <1>: Options Summary. (line 160)
5903 * --new-file: Instead of Execution.
5905 * --new-file <1>: Options Summary. (line 345)
5906 * --new-file, and recursion: Options/Recursion. (line 30)
5907 * --no-builtin-rules: Options Summary. (line 232)
5908 * --no-builtin-variables: Options Summary. (line 245)
5909 * --no-keep-going: Options Summary. (line 261)
5910 * --no-print-directory: -w Option. (line 20)
5911 * --no-print-directory <1>: Options Summary. (line 337)
5912 * --old-file: Avoiding Compilation.
5914 * --old-file <1>: Options Summary. (line 185)
5915 * --old-file, and recursion: Options/Recursion. (line 30)
5916 * --output-sync: Parallel Output. (line 11)
5917 * --output-sync <1>: Options Summary. (line 194)
5918 * --print-data-base: Options Summary. (line 210)
5919 * --print-directory: Options Summary. (line 329)
5920 * --print-directory, and --directory: -w Option. (line 20)
5921 * --print-directory, and recursion: -w Option. (line 20)
5922 * --print-directory, disabling: -w Option. (line 20)
5923 * --question: Instead of Execution.
5925 * --question <1>: Options Summary. (line 224)
5926 * --quiet: Echoing. (line 24)
5927 * --quiet <1>: Options Summary. (line 255)
5928 * --recon: Echoing. (line 18)
5929 * --recon <1>: Instead of Execution.
5931 * --recon <2>: Options Summary. (line 178)
5932 * --shuffle: Options Summary. (line 269)
5933 * --silent: Echoing. (line 24)
5934 * --silent <1>: Options Summary. (line 254)
5935 * --stop: Options Summary. (line 262)
5936 * --touch: Instead of Execution.
5938 * --touch <1>: Options Summary. (line 312)
5939 * --touch, and recursion: MAKE Variable. (line 35)
5940 * --trace: Options Summary. (line 319)
5941 * --version: Options Summary. (line 324)
5942 * --warn-undefined-variables: Options Summary. (line 354)
5943 * --what-if: Instead of Execution.
5945 * --what-if <1>: Options Summary. (line 344)
5946 * -b: Options Summary. (line 9)
5947 * -B: Options Summary. (line 14)
5948 * -C: Recursion. (line 20)
5949 * -C <1>: Options Summary. (line 25)
5950 * -C, and -w: -w Option. (line 20)
5951 * -C, and recursion: Options/Recursion. (line 30)
5952 * -d: Options Summary. (line 33)
5953 * -e: Options Summary. (line 93)
5954 * -E: Options Summary. (line 98)
5955 * -e (shell flag): Automatic Prerequisites.
5957 * -f: Makefile Names. (line 23)
5958 * -f <1>: Makefile Arguments. (line 6)
5959 * -f <2>: Options Summary. (line 106)
5960 * -f, and recursion: Options/Recursion. (line 30)
5961 * -h: Options Summary. (line 112)
5962 * -I: Include. (line 53)
5963 * -i: Errors. (line 30)
5964 * -i <1>: Options Summary. (line 117)
5965 * -I <1>: Options Summary. (line 122)
5966 * -j: Parallel. (line 6)
5967 * -j <1>: Options Summary. (line 133)
5968 * -j, and archive update: Archive Pitfalls. (line 6)
5969 * -j, and recursion: Options/Recursion. (line 33)
5970 * -k: Errors. (line 46)
5971 * -k <1>: Testing. (line 16)
5972 * -k <2>: Options Summary. (line 151)
5973 * -l: Options Summary. (line 158)
5974 * -L: Options Summary. (line 166)
5975 * -l (library search): Libraries/Search. (line 6)
5976 * -l (load average): Parallel. (line 35)
5977 * -m: Options Summary. (line 10)
5978 * -M (to compiler): Automatic Prerequisites.
5980 * -MM (to GNU compiler): Automatic Prerequisites.
5982 * -n: Echoing. (line 18)
5983 * -n <1>: Instead of Execution.
5985 * -n <2>: Options Summary. (line 175)
5986 * -O: Parallel Output. (line 11)
5987 * -o: Avoiding Compilation.
5989 * -o <1>: Options Summary. (line 184)
5990 * -O <1>: Options Summary. (line 193)
5991 * -o, and recursion: Options/Recursion. (line 30)
5992 * -p: Options Summary. (line 209)
5993 * -q: Instead of Execution.
5995 * -q <1>: Options Summary. (line 223)
5996 * -r: Options Summary. (line 231)
5997 * -R: Options Summary. (line 244)
5998 * -s: Echoing. (line 24)
5999 * -s <1>: Options Summary. (line 253)
6000 * -S: Options Summary. (line 260)
6001 * -t: Instead of Execution.
6003 * -t <1>: Options Summary. (line 311)
6004 * -t, and recursion: MAKE Variable. (line 35)
6005 * -v: Options Summary. (line 323)
6006 * -W: Instead of Execution.
6008 * -w: Options Summary. (line 328)
6009 * -W <1>: Options Summary. (line 343)
6010 * -w, and -C: -w Option. (line 20)
6011 * -W, and recursion: Options/Recursion. (line 30)
6012 * -w, and recursion: -w Option. (line 20)
6013 * -w, disabling: -w Option. (line 20)
6014 * .a (archives): Archive Suffix Rules.
6016 * .c: Catalogue of Rules. (line 35)
6017 * .C: Catalogue of Rules. (line 39)
6018 * .cc: Catalogue of Rules. (line 39)
6019 * .ch: Catalogue of Rules. (line 153)
6020 * .cpp: Catalogue of Rules. (line 39)
6021 * .d: Automatic Prerequisites.
6023 * .def: Catalogue of Rules. (line 73)
6024 * .dvi: Catalogue of Rules. (line 153)
6025 * .f: Catalogue of Rules. (line 51)
6026 * .F: Catalogue of Rules. (line 51)
6027 * .info: Catalogue of Rules. (line 160)
6028 * .l: Catalogue of Rules. (line 125)
6029 * .LIBPATTERNS, and link libraries: Libraries/Search. (line 6)
6030 * .ln: Catalogue of Rules. (line 147)
6031 * .mod: Catalogue of Rules. (line 73)
6032 * .NOTPARALLEL special target: Parallel Disable. (line 16)
6033 * .o: Catalogue of Rules. (line 35)
6034 * .o <1>: Catalogue of Rules. (line 86)
6035 * .ONESHELL, use of: One Shell. (line 6)
6036 * .p: Catalogue of Rules. (line 47)
6037 * .r: Catalogue of Rules. (line 51)
6038 * .s: Catalogue of Rules. (line 79)
6039 * .S: Catalogue of Rules. (line 82)
6040 * .sh: Catalogue of Rules. (line 182)
6041 * .SHELLFLAGS, value of: Choosing the Shell. (line 6)
6042 * .sym: Catalogue of Rules. (line 73)
6043 * .tex: Catalogue of Rules. (line 153)
6044 * .texi: Catalogue of Rules. (line 160)
6045 * .texinfo: Catalogue of Rules. (line 160)
6046 * .txinfo: Catalogue of Rules. (line 160)
6047 * .w: Catalogue of Rules. (line 153)
6048 * .WAIT special target: Parallel Disable. (line 51)
6049 * .web: Catalogue of Rules. (line 153)
6050 * .y: Catalogue of Rules. (line 121)
6051 * :: rules (double-colon): Double-Colon. (line 6)
6052 * :::=: Immediate Assignment.
6054 * :::= <1>: Setting. (line 6)
6055 * ::=: Simple Assignment. (line 9)
6056 * ::= <1>: Setting. (line 6)
6057 * :=: Simple Assignment. (line 9)
6058 * := <1>: Setting. (line 6)
6059 * =: Recursive Assignment.
6061 * = <1>: Setting. (line 6)
6062 * =, expansion: Reading Makefiles. (line 34)
6063 * ? (wildcard character): Wildcards. (line 6)
6064 * ?=: Conditional Assignment.
6066 * ?= <1>: Setting. (line 6)
6067 * ?=, expansion: Reading Makefiles. (line 34)
6068 * @ (in recipes): Echoing. (line 6)
6069 * @, and define: Canned Recipes. (line 49)
6070 * [...] (wildcard characters): Wildcards. (line 6)
6071 * \ (backslash), for continuation lines: Simple Makefile. (line 41)
6072 * \ (backslash), in recipes: Splitting Recipe Lines.
6074 * \ (backslash), to quote %: Selective Search. (line 39)
6075 * \ (backslash), to quote % <1>: Static Usage. (line 37)
6076 * \ (backslash), to quote % <2>: Text Functions. (line 27)
6077 * __.SYMDEF: Archive Symbols. (line 6)
6078 * ~ (tilde): Wildcards. (line 16)
6079 * abspath: File Name Functions. (line 120)
6080 * algorithm for directory search: Search Algorithm. (line 6)
6081 * all (standard target): Goals. (line 73)
6082 * appending to variables: Appending. (line 6)
6083 * ar: Implicit Variables. (line 40)
6084 * archive: Archives. (line 6)
6085 * archive member targets: Archive Members. (line 6)
6086 * archive symbol directory updating: Archive Symbols. (line 6)
6087 * archive, and -j: Archive Pitfalls. (line 6)
6088 * archive, and parallel execution: Archive Pitfalls. (line 6)
6089 * archive, suffix rule for: Archive Suffix Rules.
6091 * Arg list too long: Options/Recursion. (line 66)
6092 * arguments of functions: Syntax of Functions. (line 6)
6093 * as: Catalogue of Rules. (line 79)
6094 * as <1>: Implicit Variables. (line 43)
6095 * assembly, rule to compile: Catalogue of Rules. (line 79)
6096 * automatic generation of prerequisites: Include. (line 51)
6097 * automatic generation of prerequisites <1>: Automatic Prerequisites.
6099 * automatic variables: Automatic Variables. (line 6)
6100 * automatic variables in prerequisites: Automatic Variables. (line 17)
6101 * backquotes: Shell Function. (line 6)
6102 * backslash (\), for continuation lines: Simple Makefile. (line 41)
6103 * backslash (\), in recipes: Splitting Recipe Lines.
6105 * backslash (\), to quote %: Selective Search. (line 39)
6106 * backslash (\), to quote % <1>: Static Usage. (line 37)
6107 * backslash (\), to quote % <2>: Text Functions. (line 27)
6108 * backslash (\), to quote newlines: Splitting Lines. (line 6)
6109 * backslashes in pathnames and wildcard expansion: Wildcard Pitfall.
6111 * basename: File Name Functions. (line 56)
6112 * binary packages: Install Command Categories.
6114 * broken pipe: Parallel Input. (line 11)
6115 * bugs, reporting: Bugs. (line 6)
6116 * built-in special targets: Special Targets. (line 6)
6117 * C++, rule to compile: Catalogue of Rules. (line 39)
6118 * C, rule to compile: Catalogue of Rules. (line 35)
6119 * canned recipes: Canned Recipes. (line 6)
6120 * cc: Catalogue of Rules. (line 35)
6121 * cc <1>: Implicit Variables. (line 46)
6122 * cd (shell command): Execution. (line 12)
6123 * cd (shell command) <1>: MAKE Variable. (line 16)
6124 * chains of rules: Chained Rules. (line 6)
6125 * check (standard target): Goals. (line 115)
6126 * clean (standard target): Goals. (line 76)
6127 * clean target: Simple Makefile. (line 85)
6128 * clean target <1>: Cleanup. (line 11)
6129 * cleaning up: Cleanup. (line 6)
6130 * clobber (standard target): Goals. (line 87)
6131 * co: Catalogue of Rules. (line 167)
6132 * co <1>: Implicit Variables. (line 66)
6133 * combining rules by prerequisite: Combine By Prerequisite.
6135 * command expansion: Shell Function. (line 6)
6136 * command line variable definitions, and recursion: Options/Recursion.
6138 * command line variables: Overriding. (line 6)
6139 * commands, sequences of: Canned Recipes. (line 6)
6140 * comments, in makefile: Makefile Contents. (line 41)
6141 * comments, in recipes: Recipe Syntax. (line 29)
6142 * compatibility: Features. (line 6)
6143 * compatibility in exporting: Variables/Recursion. (line 94)
6144 * compilation, testing: Testing. (line 6)
6145 * computed variable name: Computed Names. (line 6)
6146 * conditional expansion: Conditional Functions.
6148 * conditional variable assignment: Conditional Assignment.
6150 * conditionals: Conditionals. (line 6)
6151 * continuation lines: Simple Makefile. (line 41)
6152 * controlling make: Make Control Functions.
6154 * conventions for makefiles: Makefile Conventions.
6156 * convert guile types: Guile Types. (line 6)
6157 * ctangle: Catalogue of Rules. (line 153)
6158 * ctangle <1>: Implicit Variables. (line 103)
6159 * cweave: Catalogue of Rules. (line 153)
6160 * cweave <1>: Implicit Variables. (line 97)
6161 * data base of make rules: Options Summary. (line 210)
6162 * deducing recipes (implicit rules): make Deduces. (line 6)
6163 * default directories for included makefiles: Include. (line 53)
6164 * default goal: How Make Works. (line 12)
6165 * default goal <1>: Rules. (line 11)
6166 * default makefile name: Makefile Names. (line 6)
6167 * default rules, last-resort: Last Resort. (line 6)
6168 * define, expansion: Reading Makefiles. (line 34)
6169 * defining variables verbatim: Multi-Line. (line 6)
6170 * deletion of target files: Errors. (line 63)
6171 * deletion of target files <1>: Interrupts. (line 6)
6172 * directive: Makefile Contents. (line 28)
6173 * directories, creating installation: Directory Variables. (line 20)
6174 * directories, printing them: -w Option. (line 6)
6175 * directories, updating archive symbol: Archive Symbols. (line 6)
6176 * directory part: File Name Functions. (line 16)
6177 * directory search (VPATH): Directory Search. (line 6)
6178 * directory search (VPATH), and implicit rules: Implicit/Search.
6180 * directory search (VPATH), and link libraries: Libraries/Search.
6182 * directory search (VPATH), and recipes: Recipes/Search. (line 6)
6183 * directory search algorithm: Search Algorithm. (line 6)
6184 * directory search, traditional (GPATH): Search Algorithm. (line 42)
6185 * disabling parallel execution: Parallel Disable. (line 6)
6186 * dist (standard target): Goals. (line 107)
6187 * distclean (standard target): Goals. (line 85)
6188 * dollar sign ($), in function call: Syntax of Functions. (line 6)
6189 * dollar sign ($), in rules: Rule Syntax. (line 33)
6190 * dollar sign ($), in variable name: Computed Names. (line 6)
6191 * dollar sign ($), in variable reference: Reference. (line 6)
6192 * DOS, choosing a shell in: Choosing the Shell. (line 38)
6193 * double-colon rules: Double-Colon. (line 6)
6194 * duplicate words, removing: Text Functions. (line 156)
6195 * E2BIG: Options/Recursion. (line 66)
6196 * echoing of recipes: Echoing. (line 6)
6197 * editor: Introduction. (line 22)
6198 * Emacs (M-x compile): Errors. (line 61)
6199 * empty recipes: Empty Recipes. (line 6)
6200 * empty targets: Empty Targets. (line 6)
6201 * environment: Environment. (line 6)
6202 * environment, and recursion: Variables/Recursion. (line 6)
6203 * environment, SHELL in: Choosing the Shell. (line 12)
6204 * error, stopping on: Make Control Functions.
6206 * errors (in recipes): Errors. (line 6)
6207 * errors with wildcards: Wildcard Pitfall. (line 6)
6208 * evaluating makefile syntax: Eval Function. (line 6)
6209 * example of loaded objects: Loaded Object Example.
6211 * example using Guile: Guile Example. (line 6)
6212 * execution, in parallel: Parallel. (line 6)
6213 * execution, instead of: Instead of Execution.
6215 * execution, of recipes: Execution. (line 6)
6216 * exit status (errors): Errors. (line 6)
6217 * exit status of make: Running. (line 18)
6218 * expansion, secondary: Secondary Expansion. (line 6)
6219 * explicit rule, definition of: Makefile Contents. (line 10)
6220 * explicit rule, expansion: Reading Makefiles. (line 103)
6221 * explicit rules, secondary expansion of: Secondary Expansion.
6223 * exporting variables: Variables/Recursion. (line 6)
6224 * extensions, Guile: Guile Integration. (line 6)
6225 * extensions, load directive: load Directive. (line 6)
6226 * extensions, loading: Loading Objects. (line 6)
6227 * f77: Catalogue of Rules. (line 51)
6228 * f77 <1>: Implicit Variables. (line 57)
6229 * FDL, GNU Free Documentation License: GNU Free Documentation License.
6231 * features of GNU make: Features. (line 6)
6232 * features, missing: Missing. (line 6)
6233 * file name functions: File Name Functions. (line 6)
6234 * file name of makefile: Makefile Names. (line 6)
6235 * file name of makefile, how to specify: Makefile Names. (line 31)
6236 * file name prefix, adding: File Name Functions. (line 78)
6237 * file name suffix: File Name Functions. (line 42)
6238 * file name suffix, adding: File Name Functions. (line 67)
6239 * file name with wildcards: Wildcards. (line 6)
6240 * file name, abspath of: File Name Functions. (line 120)
6241 * file name, basename of: File Name Functions. (line 56)
6242 * file name, directory part: File Name Functions. (line 16)
6243 * file name, nondirectory part: File Name Functions. (line 26)
6244 * file name, realpath of: File Name Functions. (line 113)
6245 * file, reading from: File Function. (line 6)
6246 * file, writing to: File Function. (line 6)
6247 * files, assuming new: Instead of Execution.
6249 * files, assuming old: Avoiding Compilation.
6251 * files, avoiding recompilation of: Avoiding Compilation.
6253 * files, intermediate: Chained Rules. (line 16)
6254 * filtering out words: Text Functions. (line 134)
6255 * filtering words: Text Functions. (line 116)
6256 * finding strings: Text Functions. (line 105)
6257 * flags: Options Summary. (line 6)
6258 * flags for compilers: Implicit Variables. (line 6)
6259 * flavor of variable: Flavor Function. (line 6)
6260 * flavors of variables: Flavors. (line 6)
6261 * FORCE: Force Targets. (line 6)
6262 * force targets: Force Targets. (line 6)
6263 * Fortran, rule to compile: Catalogue of Rules. (line 51)
6264 * function arguments, special characters in: Syntax of Functions.
6266 * functions: Functions. (line 6)
6267 * functions, for controlling make: Make Control Functions.
6269 * functions, for file names: File Name Functions. (line 6)
6270 * functions, for text: Text Functions. (line 6)
6271 * functions, syntax of: Syntax of Functions. (line 6)
6272 * functions, user defined: Call Function. (line 6)
6273 * g++: Catalogue of Rules. (line 39)
6274 * g++ <1>: Implicit Variables. (line 49)
6275 * gcc: Catalogue of Rules. (line 35)
6276 * generating prerequisites automatically: Include. (line 51)
6277 * generating prerequisites automatically <1>: Automatic Prerequisites.
6279 * get: Catalogue of Rules. (line 176)
6280 * get <1>: Implicit Variables. (line 69)
6281 * globbing (wildcards): Wildcards. (line 6)
6282 * goal: How Make Works. (line 12)
6283 * goal, default: How Make Works. (line 12)
6284 * goal, default <1>: Rules. (line 11)
6285 * goal, how to specify: Goals. (line 6)
6286 * grouped targets: Multiple Targets. (line 61)
6287 * Guile: Guile Function. (line 6)
6288 * Guile <1>: Guile Integration. (line 6)
6289 * Guile example: Guile Example. (line 6)
6290 * guile, conversion of types: Guile Types. (line 6)
6291 * home directory: Wildcards. (line 16)
6292 * IEEE Standard 1003.2: Overview. (line 13)
6293 * ifdef, expansion: Reading Makefiles. (line 93)
6294 * ifeq, expansion: Reading Makefiles. (line 93)
6295 * ifndef, expansion: Reading Makefiles. (line 93)
6296 * ifneq, expansion: Reading Makefiles. (line 93)
6297 * immediate variable assignment: Immediate Assignment.
6299 * implicit rule: Implicit Rules. (line 6)
6300 * implicit rule, and directory search: Implicit/Search. (line 6)
6301 * implicit rule, and VPATH: Implicit/Search. (line 6)
6302 * implicit rule, definition of: Makefile Contents. (line 16)
6303 * implicit rule, expansion: Reading Makefiles. (line 103)
6304 * implicit rule, how to use: Using Implicit. (line 6)
6305 * implicit rule, introduction to: make Deduces. (line 6)
6306 * implicit rule, predefined: Catalogue of Rules. (line 6)
6307 * implicit rule, search algorithm: Implicit Rule Search.
6309 * implicit rules, secondary expansion of: Secondary Expansion.
6311 * included makefiles, default directories: Include. (line 53)
6312 * including (MAKEFILES variable): MAKEFILES Variable. (line 6)
6313 * including (MAKEFILE_LIST variable): Special Variables. (line 8)
6314 * including other makefiles: Include. (line 6)
6315 * incompatibilities: Missing. (line 6)
6316 * independent targets: Multiple Targets. (line 14)
6317 * Info, rule to format: Catalogue of Rules. (line 160)
6318 * inheritance, suppressing: Suppressing Inheritance.
6320 * input during parallel execution: Parallel Input. (line 6)
6321 * install (standard target): Goals. (line 93)
6322 * installation directories, creating: Directory Variables. (line 20)
6323 * installations, staged: DESTDIR. (line 6)
6324 * interface for loaded objects: Loaded Object API. (line 6)
6325 * intermediate files: Chained Rules. (line 16)
6326 * intermediate files, preserving: Chained Rules. (line 63)
6327 * intermediate targets, explicit: Special Targets. (line 48)
6328 * interrupt: Interrupts. (line 6)
6329 * job slots: Parallel. (line 6)
6330 * job slots, and recursion: Options/Recursion. (line 33)
6331 * job slots, sharing: Job Slots. (line 6)
6332 * jobs, limiting based on load: Parallel. (line 35)
6333 * jobserver: Job Slots. (line 16)
6334 * jobserver on POSIX: POSIX Jobserver. (line 6)
6335 * jobserver on Windows: Windows Jobserver. (line 6)
6336 * joining lists of words: File Name Functions. (line 89)
6337 * killing (interruption): Interrupts. (line 6)
6338 * last-resort default rules: Last Resort. (line 6)
6339 * ld: Catalogue of Rules. (line 86)
6340 * lex: Catalogue of Rules. (line 125)
6341 * lex <1>: Implicit Variables. (line 73)
6342 * Lex, rule to run: Catalogue of Rules. (line 125)
6343 * libraries for linking, directory search: Libraries/Search. (line 6)
6344 * library archive, suffix rule for: Archive Suffix Rules.
6346 * limiting jobs based on load: Parallel. (line 35)
6347 * link libraries, and directory search: Libraries/Search. (line 6)
6348 * link libraries, patterns matching: Libraries/Search. (line 6)
6349 * linking, predefined rule for: Catalogue of Rules. (line 86)
6350 * lint: Catalogue of Rules. (line 147)
6351 * lint <1>: Implicit Variables. (line 80)
6352 * lint, rule to run: Catalogue of Rules. (line 147)
6353 * list of all prerequisites: Automatic Variables. (line 71)
6354 * list of changed prerequisites: Automatic Variables. (line 62)
6355 * load average: Parallel. (line 35)
6356 * load directive: load Directive. (line 6)
6357 * loaded object API: Loaded Object API. (line 6)
6358 * loaded object example: Loaded Object Example.
6360 * loaded object licensing: Loaded Object API. (line 31)
6361 * loaded objects: Loading Objects. (line 6)
6362 * loaded objects, remaking of: Remaking Loaded Objects.
6364 * long lines, splitting: Splitting Lines. (line 6)
6365 * loops in variable expansion: Recursive Assignment.
6367 * lpr (shell command): Wildcard Examples. (line 21)
6368 * lpr (shell command) <1>: Empty Targets. (line 25)
6369 * m2c: Catalogue of Rules. (line 73)
6370 * m2c <1>: Implicit Variables. (line 60)
6371 * macro: Using Variables. (line 10)
6372 * make depend: Automatic Prerequisites.
6374 * make extensions: Extending make. (line 6)
6375 * make integration: Integrating make. (line 6)
6376 * make interface to guile: Guile Interface. (line 6)
6377 * make procedures in guile: Guile Interface. (line 6)
6378 * makefile: Introduction. (line 7)
6379 * makefile name: Makefile Names. (line 6)
6380 * makefile name, how to specify: Makefile Names. (line 31)
6381 * makefile rule parts: Rule Introduction. (line 6)
6382 * makefile syntax, evaluating: Eval Function. (line 6)
6383 * makefile, and MAKEFILES variable: MAKEFILES Variable. (line 6)
6384 * makefile, conventions for: Makefile Conventions.
6386 * makefile, how make processes: How Make Works. (line 6)
6387 * makefile, how to write: Makefiles. (line 6)
6388 * makefile, including: Include. (line 6)
6389 * makefile, overriding: Overriding Makefiles.
6391 * makefile, reading: Reading Makefiles. (line 6)
6392 * makefile, remaking of: Remaking Makefiles. (line 6)
6393 * makefile, simple: Simple Makefile. (line 6)
6394 * makefiles, and MAKEFILE_LIST variable: Special Variables. (line 8)
6395 * makefiles, and special variables: Special Variables. (line 6)
6396 * makefiles, parsing: Parsing Makefiles. (line 6)
6397 * makeinfo: Catalogue of Rules. (line 160)
6398 * makeinfo <1>: Implicit Variables. (line 84)
6399 * MAKE_TMPDIR: Temporary Files. (line 10)
6400 * match-anything rule: Match-Anything Rules.
6402 * match-anything rule, used to override: Overriding Makefiles.
6404 * missing features: Missing. (line 6)
6405 * mistakes with wildcards: Wildcard Pitfall. (line 6)
6406 * modified variable reference: Substitution Refs. (line 6)
6407 * Modula-2, rule to compile: Catalogue of Rules. (line 73)
6408 * mostlyclean (standard target): Goals. (line 79)
6409 * multi-line variable definition: Multi-Line. (line 6)
6410 * multiple rules for one target: Multiple Rules. (line 6)
6411 * multiple rules for one target (::): Double-Colon. (line 6)
6412 * multiple targets: Multiple Targets. (line 6)
6413 * multiple targets, in pattern rule: Pattern Intro. (line 44)
6414 * name of makefile: Makefile Names. (line 6)
6415 * name of makefile, how to specify: Makefile Names. (line 31)
6416 * nested variable reference: Computed Names. (line 6)
6417 * newline, quoting, in makefile: Simple Makefile. (line 41)
6418 * newline, quoting, in recipes: Splitting Recipe Lines.
6420 * nondirectory part: File Name Functions. (line 26)
6421 * normal prerequisites: Prerequisite Types. (line 6)
6422 * not intermediate targets, explicit: Special Targets. (line 54)
6423 * obj: Variables Simplify. (line 20)
6424 * OBJ: Variables Simplify. (line 20)
6425 * objects: Variables Simplify. (line 14)
6426 * OBJECTS: Variables Simplify. (line 20)
6427 * objects, loaded: Loading Objects. (line 6)
6428 * objs: Variables Simplify. (line 20)
6429 * OBJS: Variables Simplify. (line 20)
6430 * old-fashioned suffix rules: Suffix Rules. (line 6)
6431 * options: Options Summary. (line 6)
6432 * options, and recursion: Options/Recursion. (line 6)
6433 * options, setting from environment: Options/Recursion. (line 89)
6434 * options, setting in makefiles: Options/Recursion. (line 89)
6435 * order of pattern rules: Pattern Match. (line 30)
6436 * order-only prerequisites: Prerequisite Types. (line 6)
6437 * origin of variable: Origin Function. (line 6)
6438 * output during parallel execution: Parallel Output. (line 6)
6439 * output during parallel execution <1>: Options Summary. (line 194)
6440 * overriding makefiles: Overriding Makefiles.
6442 * overriding variables with arguments: Overriding. (line 6)
6443 * overriding with override: Override Directive. (line 6)
6444 * parallel execution: Parallel. (line 6)
6445 * parallel execution, and archive update: Archive Pitfalls. (line 6)
6446 * parallel execution, disabling: Parallel Disable. (line 6)
6447 * parallel execution, input during: Parallel Input. (line 6)
6448 * parallel execution, output during: Parallel Output. (line 6)
6449 * parallel execution, output during <1>: Options Summary. (line 194)
6450 * parallel execution, overriding: Special Targets. (line 172)
6451 * parallel output to terminal: Terminal Output. (line 6)
6452 * parsing makefiles: Parsing Makefiles. (line 6)
6453 * parts of makefile rule: Rule Introduction. (line 6)
6454 * Pascal, rule to compile: Catalogue of Rules. (line 47)
6455 * pattern rule: Pattern Intro. (line 6)
6456 * pattern rule, expansion: Reading Makefiles. (line 103)
6457 * pattern rules, order of: Pattern Match. (line 30)
6458 * pattern rules, static (not implicit): Static Pattern. (line 6)
6459 * pattern rules, static, syntax of: Static Usage. (line 6)
6460 * pattern-specific variables: Pattern-specific. (line 6)
6461 * pc: Catalogue of Rules. (line 47)
6462 * pc <1>: Implicit Variables. (line 63)
6463 * phony targets: Phony Targets. (line 6)
6464 * phony targets and recipe execution: Instead of Execution.
6466 * pitfalls of wildcards: Wildcard Pitfall. (line 6)
6467 * plugin_is_GPL_compatible: Loaded Object API. (line 31)
6468 * portability: Features. (line 6)
6469 * POSIX: Overview. (line 13)
6470 * POSIX <1>: Options/Recursion. (line 69)
6471 * POSIX-conforming mode, setting: Special Targets. (line 192)
6472 * post-installation commands: Install Command Categories.
6474 * pre-installation commands: Install Command Categories.
6476 * precious targets: Special Targets. (line 32)
6477 * predefined rules and variables, printing: Options Summary. (line 210)
6478 * prefix, adding: File Name Functions. (line 78)
6479 * prerequisite: Rules. (line 6)
6480 * prerequisite pattern, implicit: Pattern Intro. (line 22)
6481 * prerequisite pattern, static (not implicit): Static Usage. (line 30)
6482 * prerequisite types: Prerequisite Types. (line 6)
6483 * prerequisite, expansion: Reading Makefiles. (line 103)
6484 * prerequisites: Rule Syntax. (line 47)
6485 * prerequisites, and automatic variables: Automatic Variables.
6487 * prerequisites, automatic generation: Include. (line 51)
6488 * prerequisites, automatic generation <1>: Automatic Prerequisites.
6490 * prerequisites, introduction to: Rule Introduction. (line 8)
6491 * prerequisites, list of all: Automatic Variables. (line 71)
6492 * prerequisites, list of changed: Automatic Variables. (line 62)
6493 * prerequisites, normal: Prerequisite Types. (line 6)
6494 * prerequisites, order-only: Prerequisite Types. (line 6)
6495 * prerequisites, varying (static pattern): Static Pattern. (line 6)
6496 * preserving intermediate files: Chained Rules. (line 63)
6497 * preserving with .PRECIOUS: Special Targets. (line 32)
6498 * preserving with .SECONDARY: Special Targets. (line 64)
6499 * print (standard target): Goals. (line 98)
6500 * print target: Wildcard Examples. (line 21)
6501 * print target <1>: Empty Targets. (line 25)
6502 * printing directories: -w Option. (line 6)
6503 * printing messages: Make Control Functions.
6505 * printing of recipes: Echoing. (line 6)
6506 * printing user warnings: Make Control Functions.
6508 * problems and bugs, reporting: Bugs. (line 6)
6509 * problems with wildcards: Wildcard Pitfall. (line 6)
6510 * processing a makefile: How Make Works. (line 6)
6511 * question mode: Instead of Execution.
6513 * quoting %, in patsubst: Text Functions. (line 27)
6514 * quoting %, in static pattern: Static Usage. (line 37)
6515 * quoting %, in vpath: Selective Search. (line 39)
6516 * quoting newline, in makefile: Simple Makefile. (line 41)
6517 * quoting newline, in recipes: Splitting Recipe Lines.
6519 * Ratfor, rule to compile: Catalogue of Rules. (line 51)
6520 * RCS, rule to extract from: Catalogue of Rules. (line 167)
6521 * reading from a file: File Function. (line 6)
6522 * reading makefiles: Reading Makefiles. (line 6)
6523 * README: Makefile Names. (line 9)
6524 * realclean (standard target): Goals. (line 86)
6525 * realpath: File Name Functions. (line 113)
6526 * recipe: Simple Makefile. (line 74)
6527 * recipe execution, single invocation: Special Targets. (line 185)
6528 * recipe lines, single shell: One Shell. (line 6)
6529 * recipe syntax: Recipe Syntax. (line 6)
6530 * recipe, execution: Execution. (line 6)
6531 * recipes: Rule Syntax. (line 25)
6532 * recipes <1>: Recipes. (line 6)
6533 * recipes setting shell variables: Execution. (line 12)
6534 * recipes, and directory search: Recipes/Search. (line 6)
6535 * recipes, backslash (\) in: Splitting Recipe Lines.
6537 * recipes, canned: Canned Recipes. (line 6)
6538 * recipes, comments in: Recipe Syntax. (line 29)
6539 * recipes, echoing: Echoing. (line 6)
6540 * recipes, empty: Empty Recipes. (line 6)
6541 * recipes, errors in: Errors. (line 6)
6542 * recipes, execution in parallel: Parallel. (line 6)
6543 * recipes, how to write: Recipes. (line 6)
6544 * recipes, instead of executing: Instead of Execution.
6546 * recipes, introduction to: Rule Introduction. (line 8)
6547 * recipes, quoting newlines in: Splitting Recipe Lines.
6549 * recipes, splitting: Splitting Recipe Lines.
6551 * recipes, using variables in: Variables in Recipes.
6553 * recompilation: Introduction. (line 22)
6554 * recompilation, avoiding: Avoiding Compilation.
6556 * recording events with empty targets: Empty Targets. (line 6)
6557 * recursion: Recursion. (line 6)
6558 * recursion, and -C: Options/Recursion. (line 30)
6559 * recursion, and -f: Options/Recursion. (line 30)
6560 * recursion, and -j: Options/Recursion. (line 33)
6561 * recursion, and -o: Options/Recursion. (line 30)
6562 * recursion, and -t: MAKE Variable. (line 35)
6563 * recursion, and -W: Options/Recursion. (line 30)
6564 * recursion, and -w: -w Option. (line 20)
6565 * recursion, and command line variable definitions: Options/Recursion.
6567 * recursion, and environment: Variables/Recursion. (line 6)
6568 * recursion, and MAKE variable: MAKE Variable. (line 6)
6569 * recursion, and MAKEFILES variable: MAKEFILES Variable. (line 15)
6570 * recursion, and options: Options/Recursion. (line 6)
6571 * recursion, and printing directories: -w Option. (line 6)
6572 * recursion, and variables: Variables/Recursion. (line 6)
6573 * recursion, level of: Variables/Recursion. (line 122)
6574 * recursive variable expansion: Using Variables. (line 6)
6575 * recursive variable expansion <1>: Flavors. (line 6)
6576 * recursively expanded variables: Flavors. (line 6)
6577 * reference to variables: Reference. (line 6)
6578 * reference to variables <1>: Advanced. (line 6)
6579 * relinking: How Make Works. (line 47)
6580 * remaking loaded objects: Remaking Loaded Objects.
6582 * remaking makefiles: Remaking Makefiles. (line 6)
6583 * removal of target files: Errors. (line 63)
6584 * removal of target files <1>: Interrupts. (line 6)
6585 * removing duplicate words: Text Functions. (line 156)
6586 * removing targets on failure: Special Targets. (line 101)
6587 * removing whitespace from split lines: Splitting Lines. (line 40)
6588 * removing, to clean up: Cleanup. (line 6)
6589 * reporting bugs: Bugs. (line 6)
6590 * rm: Implicit Variables. (line 106)
6591 * rm (shell command): Simple Makefile. (line 85)
6592 * rm (shell command) <1>: Wildcard Examples. (line 12)
6593 * rm (shell command) <2>: Phony Targets. (line 20)
6594 * rm (shell command) <3>: Errors. (line 27)
6595 * rule prerequisites: Rule Syntax. (line 47)
6596 * rule syntax: Rule Syntax. (line 6)
6597 * rule targets: Rule Syntax. (line 18)
6598 * rule, double-colon (::): Double-Colon. (line 6)
6599 * rule, explicit, definition of: Makefile Contents. (line 10)
6600 * rule, how to write: Rules. (line 6)
6601 * rule, implicit: Implicit Rules. (line 6)
6602 * rule, implicit, and directory search: Implicit/Search. (line 6)
6603 * rule, implicit, and VPATH: Implicit/Search. (line 6)
6604 * rule, implicit, chains of: Chained Rules. (line 6)
6605 * rule, implicit, definition of: Makefile Contents. (line 16)
6606 * rule, implicit, how to use: Using Implicit. (line 6)
6607 * rule, implicit, introduction to: make Deduces. (line 6)
6608 * rule, implicit, predefined: Catalogue of Rules. (line 6)
6609 * rule, introduction to: Rule Introduction. (line 6)
6610 * rule, multiple for one target: Multiple Rules. (line 6)
6611 * rule, no recipe or prerequisites: Force Targets. (line 6)
6612 * rule, pattern: Pattern Intro. (line 6)
6613 * rule, static pattern: Static Pattern. (line 6)
6614 * rule, static pattern versus implicit: Static versus Implicit.
6616 * rule, with multiple targets: Multiple Targets. (line 6)
6617 * rules, and $: Rule Syntax. (line 33)
6618 * s. (SCCS file prefix): Catalogue of Rules. (line 176)
6619 * SCCS, rule to extract from: Catalogue of Rules. (line 176)
6620 * search algorithm, implicit rule: Implicit Rule Search.
6622 * search path for prerequisites (VPATH): Directory Search. (line 6)
6623 * search path for prerequisites (VPATH), and implicit rules: Implicit/Search.
6625 * search path for prerequisites (VPATH), and link libraries: Libraries/Search.
6627 * searching for strings: Text Functions. (line 105)
6628 * secondary expansion: Secondary Expansion. (line 6)
6629 * secondary expansion and explicit rules: Secondary Expansion.
6631 * secondary expansion and implicit rules: Secondary Expansion.
6633 * secondary expansion and static pattern rules: Secondary Expansion.
6635 * secondary files: Chained Rules. (line 63)
6636 * secondary targets: Special Targets. (line 64)
6637 * sed (shell command): Automatic Prerequisites.
6639 * selecting a word: Text Functions. (line 160)
6640 * selecting word lists: Text Functions. (line 169)
6641 * sequences of commands: Canned Recipes. (line 6)
6642 * setting options from environment: Options/Recursion. (line 89)
6643 * setting options in makefiles: Options/Recursion. (line 89)
6644 * setting variables: Setting. (line 6)
6645 * several rules for one target: Multiple Rules. (line 6)
6646 * several targets in a rule: Multiple Targets. (line 6)
6647 * shar (standard target): Goals. (line 104)
6648 * shell command, function for: Shell Function. (line 6)
6649 * shell file name pattern (in include): Include. (line 13)
6650 * shell variables, setting in recipes: Execution. (line 12)
6651 * shell wildcards (in include): Include. (line 13)
6652 * shell, choosing the: Choosing the Shell. (line 6)
6653 * SHELL, exported value: Variables/Recursion. (line 21)
6654 * SHELL, import from environment: Environment. (line 36)
6655 * shell, in DOS and Windows: Choosing the Shell. (line 38)
6656 * SHELL, MS-DOS specifics: Choosing the Shell. (line 44)
6657 * SHELL, value of: Choosing the Shell. (line 6)
6658 * signal: Interrupts. (line 6)
6659 * silent operation: Echoing. (line 6)
6660 * simple makefile: Simple Makefile. (line 6)
6661 * simple variable expansion: Using Variables. (line 6)
6662 * simplifying with variables: Variables Simplify. (line 6)
6663 * simply expanded variables: Simple Assignment. (line 9)
6664 * sorting words: Text Functions. (line 148)
6665 * spaces, in variable values: Simple Assignment. (line 57)
6666 * spaces, stripping: Text Functions. (line 81)
6667 * special characters in function arguments: Syntax of Functions.
6669 * special targets: Special Targets. (line 6)
6670 * special variables: Special Variables. (line 6)
6671 * specifying makefile name: Makefile Names. (line 31)
6672 * splitting long lines: Splitting Lines. (line 6)
6673 * splitting recipes: Splitting Recipe Lines.
6675 * staged installs: DESTDIR. (line 6)
6676 * standard input: Parallel Input. (line 6)
6677 * standards conformance: Overview. (line 13)
6678 * standards for makefiles: Makefile Conventions.
6680 * static pattern rule: Static Pattern. (line 6)
6681 * static pattern rule, syntax of: Static Usage. (line 6)
6682 * static pattern rule, versus implicit: Static versus Implicit.
6684 * static pattern rules, secondary expansion of: Secondary Expansion.
6686 * stem: Static Usage. (line 17)
6687 * stem <1>: Pattern Match. (line 6)
6688 * stem, shortest: Pattern Match. (line 39)
6689 * stem, variable for: Automatic Variables. (line 87)
6690 * stopping make: Make Control Functions.
6692 * strings, searching for: Text Functions. (line 105)
6693 * stripping whitespace: Text Functions. (line 81)
6694 * sub-make: Variables/Recursion. (line 6)
6695 * subdirectories, recursion for: Recursion. (line 6)
6696 * substitution variable reference: Substitution Refs. (line 6)
6697 * suffix rule: Suffix Rules. (line 6)
6698 * suffix rule, for archive: Archive Suffix Rules.
6700 * suffix, adding: File Name Functions. (line 67)
6701 * suffix, function to find: File Name Functions. (line 42)
6702 * suffix, substituting in variables: Substitution Refs. (line 6)
6703 * suppressing inheritance: Suppressing Inheritance.
6705 * switches: Options Summary. (line 6)
6706 * symbol directories, updating archive: Archive Symbols. (line 6)
6707 * syntax of recipe: Recipe Syntax. (line 6)
6708 * syntax of rules: Rule Syntax. (line 6)
6709 * tab character (in commands): Rule Syntax. (line 25)
6710 * tabs in rules: Rule Introduction. (line 21)
6711 * TAGS (standard target): Goals. (line 112)
6712 * tangle: Catalogue of Rules. (line 153)
6713 * tangle <1>: Implicit Variables. (line 100)
6714 * tar (standard target): Goals. (line 101)
6715 * target: Rules. (line 6)
6716 * target pattern, implicit: Pattern Intro. (line 9)
6717 * target pattern, static (not implicit): Static Usage. (line 17)
6718 * target, deleting on error: Errors. (line 63)
6719 * target, deleting on interrupt: Interrupts. (line 6)
6720 * target, expansion: Reading Makefiles. (line 103)
6721 * target, multiple in pattern rule: Pattern Intro. (line 44)
6722 * target, multiple rules for one: Multiple Rules. (line 6)
6723 * target, touching: Instead of Execution.
6725 * target-specific variables: Target-specific. (line 6)
6726 * targets: Rule Syntax. (line 18)
6727 * targets without a file: Phony Targets. (line 6)
6728 * targets, built-in special: Special Targets. (line 6)
6729 * targets, empty: Empty Targets. (line 6)
6730 * targets, force: Force Targets. (line 6)
6731 * targets, grouped: Multiple Targets. (line 61)
6732 * targets, independent: Multiple Targets. (line 14)
6733 * targets, introduction to: Rule Introduction. (line 8)
6734 * targets, multiple: Multiple Targets. (line 6)
6735 * targets, phony: Phony Targets. (line 6)
6736 * TEMP: Temporary Files. (line 13)
6737 * temporary files: Temporary Files. (line 6)
6738 * terminal rule: Match-Anything Rules.
6740 * terminal, output to: Terminal Output. (line 6)
6741 * test (standard target): Goals. (line 116)
6742 * testing compilation: Testing. (line 6)
6743 * tex: Catalogue of Rules. (line 153)
6744 * tex <1>: Implicit Variables. (line 87)
6745 * TeX, rule to run: Catalogue of Rules. (line 153)
6746 * texi2dvi: Catalogue of Rules. (line 160)
6747 * texi2dvi <1>: Implicit Variables. (line 91)
6748 * Texinfo, rule to format: Catalogue of Rules. (line 160)
6749 * tilde (~): Wildcards. (line 16)
6750 * TMP: Temporary Files. (line 13)
6751 * TMPDIR: Temporary Files. (line 13)
6752 * tools, sharing job slots: Job Slots. (line 6)
6753 * touch (shell command): Wildcard Examples. (line 21)
6754 * touch (shell command) <1>: Empty Targets. (line 25)
6755 * touching files: Instead of Execution.
6757 * traditional directory search (GPATH): Search Algorithm. (line 42)
6758 * types of prerequisites: Prerequisite Types. (line 6)
6759 * types, conversion of: Guile Types. (line 6)
6760 * undefined variables, warning message: Options Summary. (line 354)
6761 * undefining variable: Undefine Directive. (line 6)
6762 * updating archive symbol directories: Archive Symbols. (line 6)
6763 * updating loaded objects: Remaking Loaded Objects.
6765 * updating makefiles: Remaking Makefiles. (line 6)
6766 * user defined functions: Call Function. (line 6)
6767 * value: Using Variables. (line 6)
6768 * value, how a variable gets it: Values. (line 6)
6769 * variable: Using Variables. (line 6)
6770 * variable definition: Makefile Contents. (line 22)
6771 * variable references in recipes: Variables in Recipes.
6773 * variables: Variables Simplify. (line 6)
6774 * variables, $ in name: Computed Names. (line 6)
6775 * variables, and implicit rule: Automatic Variables. (line 6)
6776 * variables, appending to: Appending. (line 6)
6777 * variables, automatic: Automatic Variables. (line 6)
6778 * variables, command line: Overriding. (line 6)
6779 * variables, command line, and recursion: Options/Recursion. (line 25)
6780 * variables, computed names: Computed Names. (line 6)
6781 * variables, conditional assignment: Conditional Assignment.
6783 * variables, defining verbatim: Multi-Line. (line 6)
6784 * variables, environment: Variables/Recursion. (line 6)
6785 * variables, environment <1>: Environment. (line 6)
6786 * variables, exporting: Variables/Recursion. (line 6)
6787 * variables, flavor of: Flavor Function. (line 6)
6788 * variables, flavors: Flavors. (line 6)
6789 * variables, how they get their values: Values. (line 6)
6790 * variables, how to reference: Reference. (line 6)
6791 * variables, immediate assignment: Immediate Assignment.
6793 * variables, local: Let Function. (line 6)
6794 * variables, loops in expansion: Recursive Assignment.
6796 * variables, modified reference: Substitution Refs. (line 6)
6797 * variables, multi-line: Multi-Line. (line 6)
6798 * variables, nested references: Computed Names. (line 6)
6799 * variables, origin of: Origin Function. (line 6)
6800 * variables, overriding: Override Directive. (line 6)
6801 * variables, overriding with arguments: Overriding. (line 6)
6802 * variables, pattern-specific: Pattern-specific. (line 6)
6803 * variables, recursively expanded: Flavors. (line 6)
6804 * variables, setting: Setting. (line 6)
6805 * variables, simply expanded: Simple Assignment. (line 9)
6806 * variables, spaces in values: Simple Assignment. (line 57)
6807 * variables, substituting suffix in: Substitution Refs. (line 6)
6808 * variables, substitution reference: Substitution Refs. (line 6)
6809 * variables, target-specific: Target-specific. (line 6)
6810 * variables, unexpanded value: Value Function. (line 6)
6811 * variables, warning for undefined: Options Summary. (line 354)
6812 * varying prerequisites: Static Pattern. (line 6)
6813 * verbatim variable definition: Multi-Line. (line 6)
6814 * vpath: Directory Search. (line 6)
6815 * VPATH, and implicit rules: Implicit/Search. (line 6)
6816 * VPATH, and link libraries: Libraries/Search. (line 6)
6817 * warnings, printing: Make Control Functions.
6819 * weave: Catalogue of Rules. (line 153)
6820 * weave <1>: Implicit Variables. (line 94)
6821 * Web, rule to run: Catalogue of Rules. (line 153)
6822 * what if: Instead of Execution.
6824 * whitespace, avoiding on line split: Splitting Lines. (line 40)
6825 * whitespace, in variable values: Simple Assignment. (line 57)
6826 * whitespace, stripping: Text Functions. (line 81)
6827 * wildcard: Wildcards. (line 6)
6828 * wildcard pitfalls: Wildcard Pitfall. (line 6)
6829 * wildcard, function: File Name Functions. (line 106)
6830 * wildcard, in archive member: Archive Members. (line 36)
6831 * wildcard, in include: Include. (line 13)
6832 * wildcards and MS-DOS/MS-Windows backslashes: Wildcard Pitfall.
6834 * Windows, choosing a shell in: Choosing the Shell. (line 38)
6835 * word, selecting a: Text Functions. (line 160)
6836 * words, extracting first: Text Functions. (line 186)
6837 * words, extracting last: Text Functions. (line 199)
6838 * words, filtering: Text Functions. (line 116)
6839 * words, filtering out: Text Functions. (line 134)
6840 * words, finding number: Text Functions. (line 181)
6841 * words, iterating over: Foreach Function. (line 6)
6842 * words, joining lists: File Name Functions. (line 89)
6843 * words, removing duplicates: Text Functions. (line 156)
6844 * words, selecting lists of: Text Functions. (line 169)
6845 * writing recipes: Recipes. (line 6)
6846 * writing rules: Rules. (line 6)
6847 * writing to a file: File Function. (line 6)
6848 * yacc: Catalogue of Rules. (line 121)
6849 * yacc <1>: Implicit Variables. (line 77)
6850 * yacc <2>: Canned Recipes. (line 18)
6851 * Yacc, rule to run: Catalogue of Rules. (line 121)