1 This is make.info, produced by makeinfo version 4.2 from make.texi.
3 INFO-DIR-SECTION GNU Packages
5 * Make: (make). Remake files automatically.
8 This file documents the GNU Make utility, which determines
9 automatically which pieces of a large program need to be recompiled,
10 and issues the commands to recompile them.
12 This is Edition 0.60, last updated 08 July 2002, of `The GNU Make
13 Manual', for `make', Version 3.80.
15 Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
16 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License, Version 1.1 or
20 any later version published by the Free Software Foundation; with no
21 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
22 Texts. A copy of the license is included in the section entitled "GNU
23 Free Documentation License".
26 File: make.info, Node: Directory Variables, Next: Standard Targets, Prev: Command Variables, Up: Makefile Conventions
28 Variables for Installation Directories
29 ======================================
31 Installation directories should always be named by variables, so it
32 is easy to install in a nonstandard place. The standard names for these
33 variables are described below. They are based on a standard filesystem
34 layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4,
35 and other modern operating systems.
37 These two variables set the root for the installation. All the other
38 installation directories should be subdirectories of one of these two,
39 and nothing should be directly installed into these two directories.
42 A prefix used in constructing the default values of the variables
43 listed below. The default value of `prefix' should be
44 `/usr/local'. When building the complete GNU system, the prefix
45 will be empty and `/usr' will be a symbolic link to `/'. (If you
46 are using Autoconf, write it as `@prefix@'.)
48 Running `make install' with a different value of `prefix' from the
49 one used to build the program should _not_ recompile the program.
52 A prefix used in constructing the default values of some of the
53 variables listed below. The default value of `exec_prefix' should
54 be `$(prefix)'. (If you are using Autoconf, write it as
57 Generally, `$(exec_prefix)' is used for directories that contain
58 machine-specific files (such as executables and subroutine
59 libraries), while `$(prefix)' is used directly for other
62 Running `make install' with a different value of `exec_prefix'
63 from the one used to build the program should _not_ recompile the
66 Executable programs are installed in one of the following
70 The directory for installing executable programs that users can
71 run. This should normally be `/usr/local/bin', but write it as
72 `$(exec_prefix)/bin'. (If you are using Autoconf, write it as
76 The directory for installing executable programs that can be run
77 from the shell, but are only generally useful to system
78 administrators. This should normally be `/usr/local/sbin', but
79 write it as `$(exec_prefix)/sbin'. (If you are using Autoconf,
80 write it as `@sbindir@'.)
83 The directory for installing executable programs to be run by other
84 programs rather than by users. This directory should normally be
85 `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'.
86 (If you are using Autoconf, write it as `@libexecdir@'.)
88 Data files used by the program during its execution are divided into
89 categories in two ways.
91 * Some files are normally modified by programs; others are never
92 normally modified (though users may edit some of these).
94 * Some files are architecture-independent and can be shared by all
95 machines at a site; some are architecture-dependent and can be
96 shared only by machines of the same kind and operating system;
97 others may never be shared between two machines.
99 This makes for six different possibilities. However, we want to
100 discourage the use of architecture-dependent files, aside from object
101 files and libraries. It is much cleaner to make other data files
102 architecture-independent, and it is generally not hard.
104 Therefore, here are the variables Makefiles should use to specify
108 The directory for installing read-only architecture independent
109 data files. This should normally be `/usr/local/share', but write
110 it as `$(prefix)/share'. (If you are using Autoconf, write it as
111 `@datadir@'.) As a special exception, see `$(infodir)' and
112 `$(includedir)' below.
115 The directory for installing read-only data files that pertain to a
116 single machine-that is to say, files for configuring a host.
117 Mailer and network configuration files, `/etc/passwd', and so
118 forth belong here. All the files in this directory should be
119 ordinary ASCII text files. This directory should normally be
120 `/usr/local/etc', but write it as `$(prefix)/etc'. (If you are
121 using Autoconf, write it as `@sysconfdir@'.)
123 Do not install executables here in this directory (they probably
124 belong in `$(libexecdir)' or `$(sbindir)'). Also do not install
125 files that are modified in the normal course of their use (programs
126 whose purpose is to change the configuration of the system
127 excluded). Those probably belong in `$(localstatedir)'.
130 The directory for installing architecture-independent data files
131 which the programs modify while they run. This should normally be
132 `/usr/local/com', but write it as `$(prefix)/com'. (If you are
133 using Autoconf, write it as `@sharedstatedir@'.)
136 The directory for installing data files which the programs modify
137 while they run, and that pertain to one specific machine. Users
138 should never need to modify files in this directory to configure
139 the package's operation; put such configuration information in
140 separate files that go in `$(datadir)' or `$(sysconfdir)'.
141 `$(localstatedir)' should normally be `/usr/local/var', but write
142 it as `$(prefix)/var'. (If you are using Autoconf, write it as
146 The directory for object files and libraries of object code. Do
147 not install executables here, they probably ought to go in
148 `$(libexecdir)' instead. The value of `libdir' should normally be
149 `/usr/local/lib', but write it as `$(exec_prefix)/lib'. (If you
150 are using Autoconf, write it as `@libdir@'.)
153 The directory for installing the Info files for this package. By
154 default, it should be `/usr/local/info', but it should be written
155 as `$(prefix)/info'. (If you are using Autoconf, write it as
159 The directory for installing any Emacs Lisp files in this package.
160 By default, it should be `/usr/local/share/emacs/site-lisp', but
161 it should be written as `$(prefix)/share/emacs/site-lisp'.
163 If you are using Autoconf, write the default as `@lispdir@'. In
164 order to make `@lispdir@' work, you need the following lines in
165 your `configure.in' file:
167 lispdir='${datadir}/emacs/site-lisp'
171 The directory for installing header files to be included by user
172 programs with the C `#include' preprocessor directive. This
173 should normally be `/usr/local/include', but write it as
174 `$(prefix)/include'. (If you are using Autoconf, write it as
177 Most compilers other than GCC do not look for header files in
178 directory `/usr/local/include'. So installing the header files
179 this way is only useful with GCC. Sometimes this is not a problem
180 because some libraries are only really intended to work with GCC.
181 But some libraries are intended to work with other compilers.
182 They should install their header files in two places, one
183 specified by `includedir' and one specified by `oldincludedir'.
186 The directory for installing `#include' header files for use with
187 compilers other than GCC. This should normally be `/usr/include'.
188 (If you are using Autoconf, you can write it as `@oldincludedir@'.)
190 The Makefile commands should check whether the value of
191 `oldincludedir' is empty. If it is, they should not try to use
192 it; they should cancel the second installation of the header files.
194 A package should not replace an existing header in this directory
195 unless the header came from the same package. Thus, if your Foo
196 package provides a header file `foo.h', then it should install the
197 header file in the `oldincludedir' directory if either (1) there
198 is no `foo.h' there or (2) the `foo.h' that exists came from the
201 To tell whether `foo.h' came from the Foo package, put a magic
202 string in the file--part of a comment--and `grep' for that string.
204 Unix-style man pages are installed in one of the following:
207 The top-level directory for installing the man pages (if any) for
208 this package. It will normally be `/usr/local/man', but you should
209 write it as `$(prefix)/man'. (If you are using Autoconf, write it
213 The directory for installing section 1 man pages. Write it as
217 The directory for installing section 2 man pages. Write it as
221 *Don't make the primary documentation for any GNU software be a
222 man page. Write a manual in Texinfo instead. Man pages are just
223 for the sake of people running GNU software on Unix, which is a
224 secondary application only.*
227 The file name extension for the installed man page. This should
228 contain a period followed by the appropriate digit; it should
232 The file name extension for installed section 1 man pages.
235 The file name extension for installed section 2 man pages.
238 Use these names instead of `manext' if the package needs to
239 install man pages in more than one section of the manual.
241 And finally, you should set the following variable:
244 The directory for the sources being compiled. The value of this
245 variable is normally inserted by the `configure' shell script.
246 (If you are using Autconf, use `srcdir = @srcdir@'.)
250 # Common prefix for installation directories.
251 # NOTE: This directory must exist when you start the install.
253 exec_prefix = $(prefix)
254 # Where to put the executable for the command `gcc'.
255 bindir = $(exec_prefix)/bin
256 # Where to put the directories used by the compiler.
257 libexecdir = $(exec_prefix)/libexec
258 # Where to put the Info files.
259 infodir = $(prefix)/info
261 If your program installs a large number of files into one of the
262 standard user-specified directories, it might be useful to group them
263 into a subdirectory particular to that program. If you do this, you
264 should write the `install' rule to create these subdirectories.
266 Do not expect the user to include the subdirectory name in the value
267 of any of the variables listed above. The idea of having a uniform set
268 of variable names for installation directories is to enable the user to
269 specify the exact same values for several different GNU packages. In
270 order for this to be useful, all the packages must be designed so that
271 they will work sensibly when the user does so.
274 File: make.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions
276 Standard Targets for Users
277 ==========================
279 All GNU programs should have the following targets in their
283 Compile the entire program. This should be the default target.
284 This target need not rebuild any documentation files; Info files
285 should normally be included in the distribution, and DVI files
286 should be made only when explicitly asked for.
288 By default, the Make rules should compile and link with `-g', so
289 that executable programs have debugging symbols. Users who don't
290 mind being helpless can strip the executables later if they wish.
293 Compile the program and copy the executables, libraries, and so on
294 to the file names where they should reside for actual use. If
295 there is a simple test to verify that a program is properly
296 installed, this target should run that test.
298 Do not strip executables when installing them. Devil-may-care
299 users can use the `install-strip' target to do that.
301 If possible, write the `install' target rule so that it does not
302 modify anything in the directory where the program was built,
303 provided `make all' has just been done. This is convenient for
304 building the program under one user name and installing it under
307 The commands should create all the directories in which files are
308 to be installed, if they don't already exist. This includes the
309 directories specified as the values of the variables `prefix' and
310 `exec_prefix', as well as all subdirectories that are needed. One
311 way to do this is by means of an `installdirs' target as described
314 Use `-' before any command for installing a man page, so that
315 `make' will ignore any errors. This is in case there are systems
316 that don't have the Unix man page documentation system installed.
318 The way to install Info files is to copy them into `$(infodir)'
319 with `$(INSTALL_DATA)' (*note Command Variables::), and then run
320 the `install-info' program if it is present. `install-info' is a
321 program that edits the Info `dir' file to add or update the menu
322 entry for the given Info file; it is part of the Texinfo package.
323 Here is a sample rule to install an Info file:
325 $(DESTDIR)$(infodir)/foo.info: foo.info
327 # There may be a newer info file in . than in srcdir.
328 -if test -f foo.info; then d=.; \
329 else d=$(srcdir); fi; \
330 $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@; \
331 # Run install-info only if it exists.
332 # Use `if' instead of just prepending `-' to the
333 # line so we notice real errors from install-info.
334 # We use `$(SHELL) -c' because some shells do not
335 # fail gracefully when there is an unknown command.
336 if $(SHELL) -c 'install-info --version' \
337 >/dev/null 2>&1; then \
338 install-info --dir-file=$(DESTDIR)$(infodir)/dir \
339 $(DESTDIR)$(infodir)/foo.info; \
342 When writing the `install' target, you must classify all the
343 commands into three categories: normal ones, "pre-installation"
344 commands and "post-installation" commands. *Note Install Command
348 Delete all the installed files--the copies that the `install'
351 This rule should not modify the directories where compilation is
352 done, only the directories where files are installed.
354 The uninstallation commands are divided into three categories,
355 just like the installation commands. *Note Install Command
359 Like `install', but strip the executable files while installing
360 them. In simple cases, this target can use the `install' target in
364 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
367 But if the package installs scripts as well as real executables,
368 the `install-strip' target can't just refer to the `install'
369 target; it has to strip the executables but not the scripts.
371 `install-strip' should not strip the executables in the build
372 directory which are being copied for installation. It should only
373 strip the copies that are installed.
375 Normally we do not recommend stripping an executable unless you
376 are sure the program has no bugs. However, it can be reasonable
377 to install a stripped executable for actual execution while saving
378 the unstripped executable elsewhere in case there is a bug.
381 Delete all files from the current directory that are normally
382 created by building the program. Don't delete the files that
383 record the configuration. Also preserve files that could be made
384 by building, but normally aren't because the distribution comes
387 Delete `.dvi' files here if they are not part of the distribution.
390 Delete all files from the current directory that are created by
391 configuring or building the program. If you have unpacked the
392 source and built the program without creating any other files,
393 `make distclean' should leave only the files that were in the
397 Like `clean', but may refrain from deleting a few files that people
398 normally don't want to recompile. For example, the `mostlyclean'
399 target for GCC does not delete `libgcc.a', because recompiling it
400 is rarely necessary and takes a lot of time.
403 Delete almost everything from the current directory that can be
404 reconstructed with this Makefile. This typically includes
405 everything deleted by `distclean', plus more: C source files
406 produced by Bison, tags tables, Info files, and so on.
408 The reason we say "almost everything" is that running the command
409 `make maintainer-clean' should not delete `configure' even if
410 `configure' can be remade using a rule in the Makefile. More
411 generally, `make maintainer-clean' should not delete anything that
412 needs to exist in order to run `configure' and then begin to build
413 the program. This is the only exception; `maintainer-clean' should
414 delete everything else that can be rebuilt.
416 The `maintainer-clean' target is intended to be used by a
417 maintainer of the package, not by ordinary users. You may need
418 special tools to reconstruct some of the files that `make
419 maintainer-clean' deletes. Since these files are normally
420 included in the distribution, we don't take care to make them easy
421 to reconstruct. If you find you need to unpack the full
422 distribution again, don't blame us.
424 To help make users aware of this, the commands for the special
425 `maintainer-clean' target should start with these two:
427 @echo 'This command is intended for maintainers to use; it'
428 @echo 'deletes files that may need special tools to rebuild.'
431 Update a tags table for this program.
434 Generate any Info files needed. The best way to write the rules
439 foo.info: foo.texi chap1.texi chap2.texi
440 $(MAKEINFO) $(srcdir)/foo.texi
442 You must define the variable `MAKEINFO' in the Makefile. It should
443 run the `makeinfo' program, which is part of the Texinfo
446 Normally a GNU distribution comes with Info files, and that means
447 the Info files are present in the source directory. Therefore,
448 the Make rule for an info file should update it in the source
449 directory. When users build the package, ordinarily Make will not
450 update the Info files because they will already be up to date.
453 Generate DVI files for all Texinfo documentation. For example:
457 foo.dvi: foo.texi chap1.texi chap2.texi
458 $(TEXI2DVI) $(srcdir)/foo.texi
460 You must define the variable `TEXI2DVI' in the Makefile. It should
461 run the program `texi2dvi', which is part of the Texinfo
462 distribution.(1) Alternatively, write just the dependencies, and
463 allow GNU `make' to provide the command.
466 Create a distribution tar file for this program. The tar file
467 should be set up so that the file names in the tar file start with
468 a subdirectory name which is the name of the package it is a
469 distribution for. This name can include the version number.
471 For example, the distribution tar file of GCC version 1.40 unpacks
472 into a subdirectory named `gcc-1.40'.
474 The easiest way to do this is to create a subdirectory
475 appropriately named, use `ln' or `cp' to install the proper files
476 in it, and then `tar' that subdirectory.
478 Compress the tar file with `gzip'. For example, the actual
479 distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'.
481 The `dist' target should explicitly depend on all non-source files
482 that are in the distribution, to make sure they are up to date in
483 the distribution. *Note Making Releases: (standards)Releases.
486 Perform self-tests (if any). The user must build the program
487 before running the tests, but need not install the program; you
488 should write the self-tests so that they work when the program is
489 built but not installed.
491 The following targets are suggested as conventional names, for
492 programs in which they are useful.
495 Perform installation tests (if any). The user must build and
496 install the program before running the tests. You should not
497 assume that `$(bindir)' is in the search path.
500 It's useful to add a target named `installdirs' to create the
501 directories where files are installed, and their parent
502 directories. There is a script called `mkinstalldirs' which is
503 convenient for this; you can find it in the Texinfo package. You
504 can use a rule like this:
506 # Make sure all installation directories (e.g. $(bindir))
507 # actually exist by making them if necessary.
508 installdirs: mkinstalldirs
509 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
510 $(libdir) $(infodir) \
513 or, if you wish to support `DESTDIR',
515 # Make sure all installation directories (e.g. $(bindir))
516 # actually exist by making them if necessary.
517 installdirs: mkinstalldirs
518 $(srcdir)/mkinstalldirs \
519 $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
520 $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \
523 This rule should not modify the directories where compilation is
524 done. It should do nothing but create installation directories.
526 ---------- Footnotes ----------
528 (1) `texi2dvi' uses TeX to do the real work of formatting. TeX is
529 not distributed with Texinfo.
532 File: make.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions
534 Install Command Categories
535 ==========================
537 When writing the `install' target, you must classify all the
538 commands into three categories: normal ones, "pre-installation"
539 commands and "post-installation" commands.
541 Normal commands move files into their proper places, and set their
542 modes. They may not alter any files except the ones that come entirely
543 from the package they belong to.
545 Pre-installation and post-installation commands may alter other
546 files; in particular, they can edit global configuration files or data
549 Pre-installation commands are typically executed before the normal
550 commands, and post-installation commands are typically run after the
553 The most common use for a post-installation command is to run
554 `install-info'. This cannot be done with a normal command, since it
555 alters a file (the Info directory) which does not come entirely and
556 solely from the package being installed. It is a post-installation
557 command because it needs to be done after the normal command which
558 installs the package's Info files.
560 Most programs don't need any pre-installation commands, but we have
561 the feature just in case it is needed.
563 To classify the commands in the `install' rule into these three
564 categories, insert "category lines" among them. A category line
565 specifies the category for the commands that follow.
567 A category line consists of a tab and a reference to a special Make
568 variable, plus an optional comment at the end. There are three
569 variables you can use, one for each category; the variable name
570 specifies the category. Category lines are no-ops in ordinary execution
571 because these three Make variables are normally undefined (and you
572 _should not_ define them in the makefile).
574 Here are the three possible category lines, each with a comment that
575 explains what it means:
577 $(PRE_INSTALL) # Pre-install commands follow.
578 $(POST_INSTALL) # Post-install commands follow.
579 $(NORMAL_INSTALL) # Normal commands follow.
581 If you don't use a category line at the beginning of the `install'
582 rule, all the commands are classified as normal until the first category
583 line. If you don't use any category lines, all the commands are
584 classified as normal.
586 These are the category lines for `uninstall':
588 $(PRE_UNINSTALL) # Pre-uninstall commands follow.
589 $(POST_UNINSTALL) # Post-uninstall commands follow.
590 $(NORMAL_UNINSTALL) # Normal commands follow.
592 Typically, a pre-uninstall command would be used for deleting entries
593 from the Info directory.
595 If the `install' or `uninstall' target has any dependencies which
596 act as subroutines of installation, then you should start _each_
597 dependency's commands with a category line, and start the main target's
598 commands with a category line also. This way, you can ensure that each
599 command is placed in the right category regardless of which of the
600 dependencies actually run.
602 Pre-installation and post-installation commands should not run any
603 programs except for these:
605 [ basename bash cat chgrp chmod chown cmp cp dd diff echo
606 egrep expand expr false fgrep find getopt grep gunzip gzip
607 hostname install install-info kill ldconfig ln ls md5sum
608 mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
609 test touch true uname xargs yes
611 The reason for distinguishing the commands in this way is for the
612 sake of making binary packages. Typically a binary package contains
613 all the executables and other files that need to be installed, and has
614 its own method of installing them--so it does not need to run the normal
615 installation commands. But installing the binary package does need to
616 execute the pre-installation and post-installation commands.
618 Programs to build binary packages work by extracting the
619 pre-installation and post-installation commands. Here is one way of
620 extracting the pre-installation commands:
622 make -n install -o all \
623 PRE_INSTALL=pre-install \
624 POST_INSTALL=post-install \
625 NORMAL_INSTALL=normal-install \
626 | gawk -f pre-install.awk
628 where the file `pre-install.awk' could contain this:
630 $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0}
632 $0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1}
634 The resulting file of pre-installation commands is executed as a
635 shell script as part of installing the binary package.
638 File: make.info, Node: Quick Reference, Next: Error Messages, Prev: Makefile Conventions, Up: Top
643 This appendix summarizes the directives, text manipulation functions,
644 and special variables which GNU `make' understands. *Note Special
645 Targets::, *Note Catalogue of Implicit Rules: Catalogue of Rules, and
646 *Note Summary of Options: Options Summary, for other summaries.
648 Here is a summary of the directives GNU `make' recognizes:
652 Define a multi-line, recursively-expanded variable.
665 Conditionally evaluate part of the makefile.
666 *Note Conditionals::.
671 Include another makefile.
672 *Note Including Other Makefiles: Include.
674 `override VARIABLE = VALUE'
675 `override VARIABLE := VALUE'
676 `override VARIABLE += VALUE'
677 `override VARIABLE ?= VALUE'
678 `override define VARIABLE'
680 Define a variable, overriding any previous definition, even one
681 from the command line.
682 *Note The `override' Directive: Override Directive.
685 Tell `make' to export all variables to child processes by default.
686 *Note Communicating Variables to a Sub-`make': Variables/Recursion.
689 `export VARIABLE = VALUE'
690 `export VARIABLE := VALUE'
691 `export VARIABLE += VALUE'
692 `export VARIABLE ?= VALUE'
694 Tell `make' whether or not to export a particular variable to child
696 *Note Communicating Variables to a Sub-`make': Variables/Recursion.
699 Specify a search path for files matching a `%' pattern.
700 *Note The `vpath' Directive: Selective Search.
703 Remove all search paths previously specified for PATTERN.
706 Remove all search paths previously specified in any `vpath'
709 Here is a summary of the text manipulation functions (*note
712 `$(subst FROM,TO,TEXT)'
713 Replace FROM with TO in TEXT.
714 *Note Functions for String Substitution and Analysis: Text
717 `$(patsubst PATTERN,REPLACEMENT,TEXT)'
718 Replace words matching PATTERN with REPLACEMENT in TEXT.
719 *Note Functions for String Substitution and Analysis: Text
723 Remove excess whitespace characters from STRING.
724 *Note Functions for String Substitution and Analysis: Text
727 `$(findstring FIND,TEXT)'
729 *Note Functions for String Substitution and Analysis: Text
732 `$(filter PATTERN...,TEXT)'
733 Select words in TEXT that match one of the PATTERN words.
734 *Note Functions for String Substitution and Analysis: Text
737 `$(filter-out PATTERN...,TEXT)'
738 Select words in TEXT that _do not_ match any of the PATTERN words.
739 *Note Functions for String Substitution and Analysis: Text
743 Sort the words in LIST lexicographically, removing duplicates.
744 *Note Functions for String Substitution and Analysis: Text
748 Extract the directory part of each file name.
749 *Note Functions for File Names: File Name Functions.
752 Extract the non-directory part of each file name.
753 *Note Functions for File Names: File Name Functions.
756 Extract the suffix (the last `.' and following characters) of each
758 *Note Functions for File Names: File Name Functions.
760 `$(basename NAMES...)'
761 Extract the base name (name without suffix) of each file name.
762 *Note Functions for File Names: File Name Functions.
764 `$(addsuffix SUFFIX,NAMES...)'
765 Append SUFFIX to each word in NAMES.
766 *Note Functions for File Names: File Name Functions.
768 `$(addprefix PREFIX,NAMES...)'
769 Prepend PREFIX to each word in NAMES.
770 *Note Functions for File Names: File Name Functions.
772 `$(join LIST1,LIST2)'
773 Join two parallel lists of words.
774 *Note Functions for File Names: File Name Functions.
777 Extract the Nth word (one-origin) of TEXT.
778 *Note Functions for File Names: File Name Functions.
781 Count the number of words in TEXT.
782 *Note Functions for File Names: File Name Functions.
784 `$(wordlist S,E,TEXT)'
785 Returns the list of words in TEXT from S to E.
786 *Note Functions for File Names: File Name Functions.
788 `$(firstword NAMES...)'
789 Extract the first word of NAMES.
790 *Note Functions for File Names: File Name Functions.
792 `$(wildcard PATTERN...)'
793 Find file names matching a shell file name pattern (_not_ a `%'
795 *Note The Function `wildcard': Wildcard Function.
798 When this function is evaluated, `make' generates a fatal error
799 with the message TEXT.
800 *Note Functions That Control Make: Make Control Functions.
803 When this function is evaluated, `make' generates a warning with
805 *Note Functions That Control Make: Make Control Functions.
808 Execute a shell command and return its output.
809 *Note The `shell' Function: Shell Function.
812 Return a string describing how the `make' variable VARIABLE was
814 *Note The `origin' Function: Origin Function.
816 `$(foreach VAR,WORDS,TEXT)'
817 Evaluate TEXT with VAR bound to each word in WORDS, and
818 concatenate the results.
819 *Note The `foreach' Function: Foreach Function.
821 `$(call VAR,PARAM,...)'
822 Evaluate the variable VAR replacing any references to `$(1)',
823 `$(2)' with the first, second, etc. PARAM values.
824 *Note The `call' Function: Call Function.
826 Here is a summary of the automatic variables. *Note Automatic
827 Variables: Automatic, for full information.
830 The file name of the target.
833 The target member name, when the target is an archive member.
836 The name of the first prerequisite.
839 The names of all the prerequisites that are newer than the target,
840 with spaces between them. For prerequisites which are archive
841 members, only the member named is used (*note Archives::).
845 The names of all the prerequisites, with spaces between them. For
846 prerequisites which are archive members, only the member named is
847 used (*note Archives::). The value of `$^' omits duplicate
848 prerequisites, while `$+' retains them and preserves their order.
851 The stem with which an implicit rule matches (*note How Patterns
852 Match: Pattern Match.).
856 The directory part and the file-within-directory part of `$@'.
860 The directory part and the file-within-directory part of `$*'.
864 The directory part and the file-within-directory part of `$%'.
868 The directory part and the file-within-directory part of `$<'.
872 The directory part and the file-within-directory part of `$^'.
876 The directory part and the file-within-directory part of `$+'.
880 The directory part and the file-within-directory part of `$?'.
882 These variables are used specially by GNU `make':
885 Makefiles to be read on every invocation of `make'.
886 *Note The Variable `MAKEFILES': MAKEFILES Variable.
889 Directory search path for files not found in the current directory.
890 *Note `VPATH' Search Path for All Prerequisites: General Search.
893 The name of the system default command interpreter, usually
894 `/bin/sh'. You can set `SHELL' in the makefile to change the
895 shell used to run commands. *Note Command Execution: Execution.
898 On MS-DOS only, the name of the command interpreter that is to be
899 used by `make'. This value takes precedence over the value of
900 `SHELL'. *Note MAKESHELL variable: Execution.
903 The name with which `make' was invoked. Using this variable in
904 commands has special meaning. *Note How the `MAKE' Variable
905 Works: MAKE Variable.
908 The number of levels of recursion (sub-`make's).
909 *Note Variables/Recursion::.
912 The flags given to `make'. You can set this in the environment or
913 a makefile to set flags.
914 *Note Communicating Options to a Sub-`make': Options/Recursion.
916 It is _never_ appropriate to use `MAKEFLAGS' directly on a command
917 line: its contents may not be quoted correctly for use in the
918 shell. Always allow recursive `make''s to obtain these values
919 through the environment from its parent.
922 The targets given to `make' on the command line. Setting this
923 variable has no effect on the operation of `make'.
924 *Note Arguments to Specify the Goals: Goals.
927 Set to the pathname of the current working directory (after all
928 `-C' options are processed, if any). Setting this variable has no
929 effect on the operation of `make'.
930 *Note Recursive Use of `make': Recursion.
933 The default list of suffixes before `make' reads any makefiles.
936 Defines the naming of the libraries `make' searches for, and their
938 *Note Directory Search for Link Libraries: Libraries/Search.
941 File: make.info, Node: Error Messages, Next: Complex Makefile, Prev: Quick Reference, Up: Top
943 Errors Generated by Make
944 ************************
946 Here is a list of the more common errors you might see generated by
947 `make', and some information about what they mean and how to fix them.
949 Sometimes `make' errors are not fatal, especially in the presence of
950 a `-' prefix on a command script line, or the `-k' command line option.
951 Errors that are fatal are prefixed with the string `***'.
953 Error messages are all either prefixed with the name of the program
954 (usually `make'), or, if the error is found in a makefile, the name of
955 the file and linenumber containing the problem.
957 In the table below, these common prefixes are left off.
960 `[FOO] SIGNAL DESCRIPTION'
961 These errors are not really `make' errors at all. They mean that a
962 program that `make' invoked as part of a command script returned a
963 non-0 error code (`Error NN'), which `make' interprets as failure,
964 or it exited in some other abnormal fashion (with a signal of some
965 type). *Note Errors in Commands: Errors.
967 If no `***' is attached to the message, then the subprocess failed
968 but the rule in the makefile was prefixed with the `-' special
969 character, so `make' ignored the error.
971 `missing separator. Stop.'
972 `missing separator (did you mean TAB instead of 8 spaces?). Stop.'
973 This means that `make' could not understand much of anything about
974 the command line it just read. GNU `make' looks for various kinds
975 of separators (`:', `=', TAB characters, etc.) to help it decide
976 what kind of commandline it's seeing. This means it couldn't find
979 One of the most common reasons for this message is that you (or
980 perhaps your oh-so-helpful editor, as is the case with many
981 MS-Windows editors) have attempted to indent your command scripts
982 with spaces instead of a TAB character. In this case, `make' will
983 use the second form of the error above. Remember that every line
984 in the command script must begin with a TAB character. Eight
985 spaces do not count. *Note Rule Syntax::.
987 `commands commence before first target. Stop.'
988 `missing rule before commands. Stop.'
989 This means the first thing in the makefile seems to be part of a
990 command script: it begins with a TAB character and doesn't appear
991 to be a legal `make' command (such as a variable assignment).
992 Command scripts must always be associated with a target.
994 The second form is generated if the line has a semicolon as the
995 first non-whitespace character; `make' interprets this to mean you
996 left out the "target: prerequisite" section of a rule. *Note Rule
999 `No rule to make target `XXX'.'
1000 `No rule to make target `XXX', needed by `YYY'.'
1001 This means that `make' decided it needed to build a target, but
1002 then couldn't find any instructions in the makefile on how to do
1003 that, either explicit or implicit (including in the default rules
1006 If you want that file to be built, you will need to add a rule to
1007 your makefile describing how that target can be built. Other
1008 possible sources of this problem are typos in the makefile (if
1009 that filename is wrong) or a corrupted source tree (if that file
1010 is not supposed to be built, but rather only a prerequisite).
1012 `No targets specified and no makefile found. Stop.'
1014 The former means that you didn't provide any targets to be built
1015 on the command line, and `make' couldn't find any makefiles to
1016 read in. The latter means that some makefile was found, but it
1017 didn't contain any default target and none was given on the
1018 command line. GNU `make' has nothing to do in these situations.
1019 *Note Arguments to Specify the Makefile: Makefile Arguments.
1021 `Makefile `XXX' was not found.'
1022 `Included makefile `XXX' was not found.'
1023 A makefile specified on the command line (first form) or included
1024 (second form) was not found.
1026 `warning: overriding commands for target `XXX''
1027 `warning: ignoring old commands for target `XXX''
1028 GNU `make' allows commands to be specified only once per target
1029 (except for double-colon rules). If you give commands for a target
1030 which already has been defined to have commands, this warning is
1031 issued and the second set of commands will overwrite the first set.
1032 *Note Multiple Rules for One Target: Multiple Rules.
1034 `Circular XXX <- YYY dependency dropped.'
1035 This means that `make' detected a loop in the dependency graph:
1036 after tracing the prerequisite YYY of target XXX, and its
1037 prerequisites, etc., one of them depended on XXX again.
1039 `Recursive variable `XXX' references itself (eventually). Stop.'
1040 This means you've defined a normal (recursive) `make' variable XXX
1041 that, when it's expanded, will refer to itself (XXX). This is not
1042 allowed; either use simply-expanded variables (`:=') or use the
1043 append operator (`+='). *Note How to Use Variables: Using
1046 `Unterminated variable reference. Stop.'
1047 This means you forgot to provide the proper closing parenthesis or
1048 brace in your variable or function reference.
1050 `insufficient arguments to function `XXX'. Stop.'
1051 This means you haven't provided the requisite number of arguments
1052 for this function. See the documentation of the function for a
1053 description of its arguments. *Note Functions for Transforming
1056 `missing target pattern. Stop.'
1057 `multiple target patterns. Stop.'
1058 `target pattern contains no `%'. Stop.'
1059 `mixed implicit and static pattern rules. Stop.'
1060 These are generated for malformed static pattern rules. The first
1061 means there's no pattern in the target section of the rule; the
1062 second means there are multiple patterns in the target section;
1063 the third means the target doesn't contain a pattern character
1064 (`%'); and the fourth means that all three parts of the static
1065 pattern rule contain pattern characters (`%')-only the first two
1066 parts should. *Note Syntax of Static Pattern Rules: Static Usage.
1068 `warning: -jN forced in submake: disabling jobserver mode.'
1069 This warning and the next are generated if `make' detects error
1070 conditions related to parallel processing on systems where
1071 sub-`make's can communicate (*note Communicating Options to a
1072 Sub-`make': Options/Recursion.). This warning is generated if a
1073 recursive invocation of a `make' process is forced to have `-jN'
1074 in its argument list (where N is greater than one). This could
1075 happen, for example, if you set the `MAKE' environment variable to
1076 `make -j2'. In this case, the sub-`make' doesn't communicate with
1077 other `make' processes and will simply pretend it has two jobs of
1080 `warning: jobserver unavailable: using -j1. Add `+' to parent make rule.'
1081 In order for `make' processes to communicate, the parent will pass
1082 information to the child. Since this could result in problems if
1083 the child process isn't actually a `make', the parent will only do
1084 this if it thinks the child is a `make'. The parent uses the
1085 normal algorithms to determine this (*note How the `MAKE' Variable
1086 Works: MAKE Variable.). If the makefile is constructed such that
1087 the parent doesn't know the child is a `make' process, then the
1088 child will receive only part of the information necessary. In
1089 this case, the child will generate this warning message and
1090 proceed with its build in a sequential manner.