summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert J. Chassell <bob@rattlesnake.com>1992-12-30 23:57:35 +0000
committerRobert J. Chassell <bob@rattlesnake.com>1992-12-30 23:57:35 +0000
commit8c6ef34e563579ef6814cdde8466978692bd69ae (patch)
tree8b76ab079fcf558d91e2bfa4a00a9bb3b937cbf6
parentf4f6b2b97e89a5ea6561695a2f302ebc50a24950 (diff)
downloadgunmake-8c6ef34e563579ef6814cdde8466978692bd69ae.tar.gz
Formerly make.texinfo.~67~
-rw-r--r--make.texinfo535
1 files changed, 489 insertions, 46 deletions
diff --git a/make.texinfo b/make.texinfo
index fe9b95e..488f4aa 100644
--- a/make.texinfo
+++ b/make.texinfo
@@ -417,7 +417,7 @@ If you are familiar with other @code{make} programs, see @ref{Features,
Features}, which explains the few things GNU @code{make} lacks that
others have.
-To see a quick summary, see @ref{Options Summary}, @ref{Quick Reference},
+For a quick summary, see @ref{Options Summary}, @ref{Quick Reference},
and @ref{Special Targets}.
@node Bugs, , Reading, Overview
@@ -465,7 +465,7 @@ that is generated by the configuration process.
Non-bug suggestions are always welcome as well. If you have questions
about things that are unclear in the documentation or are just obscure
features, contact Roland McGrath; he will try to help you out, although
-he may not have the time to fix the problem.@refill
+he may not have time to fix the problem.@refill
You can send electronic mail to Roland McGrath either through the
@w{Internet} or via UUCP:
@@ -498,7 +498,7 @@ of a makefile, see @ref{Complex Makefile}.
When @code{make} recompiles the editor, each changed C source file
must be recompiled. If a header file has changed, each C source file
-that includes the header file must be recompiled, to be safe. Each
+that includes the header file must be recompiled to be safe. Each
compilation produces an object file corresponding to the source file.
Finally, if any source file has been recompiled, all the object files,
whether newly made or saved from previous compilations, must be linked
@@ -610,7 +610,7 @@ clean :
@end example
@noindent
-We split each long line into two lines using a backslash-newline; this is
+We split each long line into two lines using backslash-newline; this is
like using one long line, but is easier to read.
@cindex continuation lines
@cindex @code{\} (backslash), for continuation lines
@@ -639,7 +639,7 @@ In fact, each @samp{.o} file is both a target and a dependency.
Commands include @w{@samp{cc -c main.c}} and @w{@samp{cc -c kbd.c}}.
When a target is a file, it needs to be recompiled or relinked if any
-of its dependencies changes. In addition, any dependencies that are
+of its dependencies change. In addition, any dependencies that are
themselves automatically generated should be updated first. In this
example, @file{edit} depends on each of the eight object files; the
object file @file{main.o} depends on the source file @file{main.c} and
@@ -651,13 +651,14 @@ A tab character must come at the beginning of every command line to
distinguish commands lines from other lines in the makefile. (Bear in
mind that @code{make} does not know anything about how the commands
work. It is up to you to supply commands that will update the target
-file properly. All @code{make} does is execute the commands you have
-specified when the target file needs to be updated.)
+file properly. All @code{make} does is execute the commands in the rule
+you have specified when the target file needs to be updated.)
@cindex shell command
The target @samp{clean} is not a file, but merely the name of an
-action. Since you do not want to carry out the actions in this rule
-normally, @samp{clean} is not a dependency of any other rule.
+action. Since you
+normally
+do not want to carry out the actions in this rule, @samp{clean} is not a dependency of any other rule.
Consequently, @code{make} never does anything with it unless you tell
it specifically. Note that this rule not only is not a dependency, it
also does not have any dependencies, so the only purpose of the rule
@@ -665,7 +666,7 @@ is to run the specified commands. Targets that do not refer to files
but are just actions are called @dfn{phony targets}. @xref{Phony
Targets}, for information about this kind of target. @xref{Errors, ,
Errors in Commands}, to see how to cause @code{make} to ignore errors
-from @code{rm}.
+from @code{rm} or any other command.
@cindex @code{clean} target
@cindex @code{rm} (shell command)
@@ -1047,7 +1048,7 @@ important files such as @file{README}.) The first name checked,
use this name if you have a makefile that is specific to GNU
@code{make}, and will not be understood by other versions of
@code{make}. Other @code{make} programs look for @file{makefile} and
-@file{Makefile}, but not @code{GNUmakefile}.
+@file{Makefile}, but not @file{GNUmakefile}.
If @code{make} finds none of these names, it does not use any makefile.
Then you must specify a goal with a command argument, and @code{make}
@@ -1860,15 +1861,15 @@ foo.o : foo.c defs.h hack.h
@cindex rule, implicit, and @code{VPATH}
The search through the directories specified in @code{VPATH} or with
-@code{vpath} happens also during consideration of implicit rules
+@code{vpath} also happens during consideration of implicit rules
(@pxref{Implicit Rules, ,Using Implicit Rules}).
For example, when a file @file{foo.o} has no explicit rule, @code{make}
-considers implicit rules, such as to compile @file{foo.c} if that file
+considers implicit rules such as to compile @file{foo.c} if that file
exists. If such a file is lacking in the current directory, the
appropriate directories are searched for it. If @file{foo.c} exists (or is
mentioned in the makefile) in any of the directories, the implicit rule for
-C compilation is applicable.
+C compilation is applied.
The commands of implicit rules normally use automatic variables as a
matter of necessity; consequently they will use the file names found by
@@ -2131,7 +2132,7 @@ these commands executed on its behalf. @xref{Search Algorithm,
@cindex precious targets
@cindex preserving with @code{.PRECIOUS}
-The targets which @code{.PRECIOUS} depends on are given this special
+The targets which @code{.PRECIOUS} depends on are given the following special
treatment: if @code{make} is killed or interrupted during the
execution of their commands, the target is not deleted.
@xref{Interrupts, ,Interrupting or Killing @code{make}}.
@@ -2261,7 +2262,8 @@ If more than one rule gives commands for the same file,
@code{make} uses the last set given and prints an error message.
(As a special case, if the file's name begins with a dot, no
error message is printed. This odd behavior is only for
-compatibility with other @code{make}s.) There is no reason to
+compatibility with other implementations of @code{make}.)
+There is no reason to
write your makefiles this way; that is why @code{make} gives you
an error message.@refill
@@ -2279,7 +2281,7 @@ $(objects) : config.h
@end example
This could be inserted or taken out without changing the rules that really
-say how to make the object files, making it a convenient form to use if
+specify how to make the object files, making it a convenient form to use if
you wish to add the additional dependency intermittently.
Another wrinkle is that the additional dependencies could be specified with
@@ -2919,7 +2921,7 @@ might as well report the failure immediately. The @samp{-k} option says
that the real purpose is to test as many of the changes made in the
program as possible, perhaps to find several independent problems so
that you can correct them all before the next attempt to compile. This
-is why Emacs's @code{compile} command passes the @samp{-k} flag by
+is why Emacs' @code{compile} command passes the @samp{-k} flag by
default.
@cindex Emacs (@code{M-x compile})
@@ -3366,8 +3368,8 @@ variable you are defining.
@xref{Defining, ,Defining Variables Verbatim},
for a complete explanation of @code{define}.
-The first command in this example runs Yacc on the first dependency (of
-whichever rule uses the canned sequence). The output file from Yacc is
+The first command in this example runs Yacc on the first dependency of
+whichever rule uses the canned sequence. The output file from Yacc is
always named @file{y.tab.c}. The second command moves the output to the
rule's target file name.
@@ -4484,16 +4486,16 @@ Here @var{function} is a function name; one of a short list of names that
are part of @code{make}. There is no provision for defining new functions.
The @var{arguments} are the arguments of the function. They are separated
-from the function name by one or more spaces and/or tabs, and if there is
-more than one argument they are separated by commas. Such whitespace and
-commas are not part of any argument's value. The delimiters which you use
+from the function name by one or more spaces or tabs, and if there is
+more than one argument,then they are separated by commas. Such whitespace and
+commas are not part of an argument's value. The delimiters which you use
to surround the function call, whether parentheses or braces, can appear in
an argument only in matching pairs; the other kind of delimiters may appear
singly. If the arguments themselves contain other function calls or
variable references, it is wisest to use the same kind of delimiters for
-all the references; in other words, write @w{@samp{$(subst a,b,$(x))}}, not
-@w{@samp{$(subst a,b,$@{x@})}}. This is both because it is clearer, and
-because only one type of delimiters is matched to find the end of the
+all the references; write @w{@samp{$(subst a,b,$(x))}}, not
+@w{@samp{$(subst a,b,$@{x@})}}. This is because it is clearer, and
+because only one type of delimiter is matched to find the end of the
reference.
The text written for each argument is processed by substitution of
@@ -4506,7 +4508,7 @@ argument as written; leading spaces cannot appear in the text of the first
argument as written. These characters can be put into the argument value
by variable substitution. First define variables @code{comma} and
@code{space} whose values are isolated comma and space characters, then
-substitute those variables where such characters are wanted, like this:
+substitute these variables where such characters are wanted, like this:
@example
@group
@@ -5236,8 +5238,8 @@ But you might want to update only some of the files; you might want to use
a different compiler or different compiler options; you might want just to
find out which files are out of date without changing them.
-By specifying arguments when you run @code{make}, you can do any of these
-things or many others.
+By giving arguments when you run @code{make}, you can do any of these
+things and many others.
@menu
* Makefile Arguments:: How to specify which makefile to use.
@@ -5631,7 +5633,7 @@ goals up to date; once @code{make} learns that this is impossible, it might
as well report the failure immediately. The @samp{-k} flag says that the
real purpose is to test as much as possible of the changes made in the
program, perhaps to find several independent problems so that you can
-correct them all before the next attempt to compile. This is why Emacs's
+correct them all before the next attempt to compile. This is why Emacs'
@kbd{M-x compile} command passes the @samp{-k} flag by default.
@node Options Summary, , Testing, Running
@@ -6283,8 +6285,8 @@ the value @w{@samp{; mv $*.o $@@}}.
@cindex flags for compilers
The commands in built-in implicit rules make liberal use of certain
-predefined variables. You can alter these variables, in the makefile,
-with arguments to @code{make}, or in the environment, to alter how the
+predefined variables. You can alter these variables in the makefile,
+with arguments to @code{make}, or in the environment to alter how the
implicit rules work without redefining the rules themselves.
For example, the command used to compile a C source file actually says
@@ -6304,7 +6306,7 @@ some command arguments, but it must start with an actual executable program
name.) If a variable value contains more than one argument, separate them
with spaces.
-Here is a table of variables used as names of programs:
+Here is a table of variables used as names of programs in built-in rules:
@table @code
@item AR
@@ -6597,7 +6599,7 @@ Thus, a rule of the form
@end example
@noindent
-would specify how to make any file @file{@var{n}.o}, with another file
+specifies how to make a file @file{@var{n}.o}, with another file
@file{@var{n}.c} as its dependency, provided that @file{@var{n}.c}
exists or can be made.
@@ -6605,16 +6607,18 @@ There may also be dependencies that do not use @samp{%}; such a dependency
attaches to every file made by this pattern rule. These unvarying
dependencies are useful occasionally.
+@c !!! The following sentence should be rewritten. --bob
It is allowed for a pattern rule to have no dependencies that contain
@samp{%} or to have no dependencies at all. This is effectively a general
wildcard. It provides a way to make any file that matches the target pattern.
@xref{Last Resort}.
+@c !!! The end of of this paragraph should be rewritten. --bob
Pattern rules may have more than one target. Unlike normal rules, this
does not act as many different rules with the same dependencies and
commands. If a pattern rule has multiple targets, @code{make} knows that
the rule's commands are responsible for making all of the targets. The
-commands are executed only once to make all of the targets. When searching
+commands are executed only once to make all the targets. When searching
for a pattern rule to match a target, the target patterns of a rule other
than the one that matches the target in need of a rule are incidental:
@code{make} worries only about giving commands and dependencies to the file
@@ -6624,9 +6628,10 @@ other targets are marked as having been updated themselves.
@cindex target, multiple in pattern rule
The order in which pattern rules appear in the makefile is important
-because the rules are considered in that order. Of equally applicable
-rules, the first one found is used. The rules you write take precedence
-over those that are built in. Note, however, that a rule whose
+since this is the order in which they are considered.
+Of equally applicable
+rules, only the first one found is used. The rules you write take precedence
+over those that are built in. Note however, that a rule whose
dependencies actually exist or are mentioned always takes priority over a
rule with dependencies that must be made by chaining other implicit rules.
@cindex pattern rules, order of
@@ -6683,9 +6688,9 @@ make both @file{@var{x}.tab.c} and @file{@var{x}.tab.h}. If the file
and the file @file{scan.o} depends on the file @file{parse.tab.h},
when @file{parse.y} is changed, the command @samp{bison -d parse.y}
will be executed only once, and the dependencies of both
-@file{parse.tab.o} and @file{scan.o} will be satisfied. (Presumably,
+@file{parse.tab.o} and @file{scan.o} will be satisfied. (Presumably
the file @file{parse.tab.o} will be recompiled from @file{parse.tab.c}
-and the file @file{scan.o} from @file{scan.c}, and @file{foo} will be
+and the file @file{scan.o} from @file{scan.c}, while @file{foo} is
linked from @file{parse.tab.o}, @file{scan.o}, and its other
dependencies, and it will execute happily ever after.)@refill
@@ -6766,7 +6771,7 @@ in that way. Instead, if the target name ends with a recognized suffix
the target name minus the suffix. For example, if the target name is
@samp{foo.c}, then @samp{$*} is set to @samp{foo}, since @samp{.c} is a
suffix. GNU @code{make} does this bizarre thing only for compatibility
-with other versions of @code{make}. You should in general not use
+with other implementations of @code{make}. You should generally never use
@samp{$*} except in implicit rules or static pattern rules.@refill
If the target name in an explicit rule does not end with a recognized
@@ -6883,7 +6888,7 @@ turned into actual file names by substituting the stem for the character
@samp{%}. Thus, if in the same example one of the dependencies is written
as @samp{%.c}, it expands to @samp{test.c}.@refill
-When the target pattern does not contain a slash (and usually it does
+When the target pattern does not contain a slash (and it usually does
not), directory names in the file names are removed from the file name
before it is compared with the target prefix and suffix. After the
comparison of the file name to the target pattern, the directory
@@ -6917,8 +6922,8 @@ possibilities.
We know these possibilities are ridiculous since @file{foo.c} is a C source
file, not an executable. If @code{make} did consider these possibilities,
-it would ultimately reject them, because files such as @file{foo.c.o},
-@file{foo.c.p}, etc. would not exist. But these possibilities are so
+it would ultimately reject them, because files such as @file{foo.c.o} and
+@file{foo.c.p} would not exist. But these possibilities are so
numerous that @code{make} would run very slowly if it had to consider
them.@refill
@@ -7027,7 +7032,7 @@ commands are used for all dependencies which do not appear as targets in
any explicit rule, and for which no implicit rule applies. Naturally,
there is no @code{.DEFAULT} rule unless you write one.
-If you give @code{.DEFAULT} with no commands or dependencies:
+If you use @code{.DEFAULT} with no commands or dependencies:
@example
.DEFAULT:
@@ -8027,6 +8032,444 @@ a makefile to set flags.@*
The default list of suffixes before @code{make} reads any makefiles.
@end table
+@node Makefiles
+@appendix Makefile Conventions
+
+This appendix describes the GNU conventions for writing Makefiles.
+
+@menu
+* Makefile Basics::
+* Utilities in Makefiles::
+* Standard Targets::
+* Command Variables::
+* Directory Variables::
+@end menu
+
+@node Makefile Basics
+@appendixsec General Conventions for Makefiles
+
+Every Makefile should contain this line:
+
+@example
+SHELL = /bin/sh
+@end example
+
+@noindent
+to avoid trouble on systems where the @code{SHELL} variable might be
+inherited from the environment.
+
+Don't assume that @file{.} is in the path for command execution. When
+you need to run programs that are a part of your package during the
+make, please make sure that it uses @file{./} if the program is built as
+part of the make or @file{$(srcdir)/} if the file is an unchanging part
+of the source code. Without one of these prefixes, the current search
+path is used.
+
+The distinction between @file{./} and @file{$(srcdir)/} is important
+when using the @samp{--srcdir} option to @file{configure}. A rule of
+the form:
+
+@example
+foo.1 : foo.man sedscript
+ sed -e sedscript foo.man > foo.1
+@end example
+
+@noindent
+will fail when the current directory is not the source directory,
+because @file{foo.man} and @file{sedscript} are not in the current
+directory.
+
+Relying on @samp{VPATH} to find the source file will work in the case
+where there is a single dependency file, since the @file{make} automatic
+variable @samp{$<} will represent the source file wherever it is. A
+makefile target like
+
+@example
+foo.o : bar.c
+ $(CC) $(CFLAGS) -I. -I$(srcdir) -c bar.c -o foo.o
+@end example
+
+@noindent
+should instead be written as
+
+@example
+foo.o : bar.c
+ $(CC) $(CFLAGS) $< -o $@@
+@end example
+
+@noindent
+in order to allow @samp{VPATH} to work correctly. When the target has
+multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest
+way to make the rule work well. For example, the target above for
+@file{foo.1} is best written as:
+
+@example
+foo.1 : foo.man sedscript
+ sed -s $(srcdir)/sedscript $(srcdir)/foo.man > foo.1
+@end example
+
+@node Utilities in Makefiles
+@appendixsec Utilities in Makefiles
+
+Write the Makefile commands (and any shell scripts, such as
+@code{configure}) to run in @code{sh}, not in @code{csh}. Don't use any
+special features of @code{ksh} or @code{bash}.
+
+The @code{configure} script and the Makefile rules for building and
+installation should not use any utilities directly except these:
+
+@smallexample
+cat cmp cp echo egrep expr grep
+ln mkdir mv pwd rm rmdir sed test touch
+@end smallexample
+
+Stick to the generally supported options for these programs. For
+example, don't use @samp{mkdir -p}, convenient as it may be, because
+most systems don't support it.
+
+The Makefile rules for building and installation can also use compilers
+and related programs, but should do so via Make variables so that the
+user can substitute alternatives. Here are some of the programs we
+mean:
+
+@example
+ar bison cc flex install ld lex make ranlib yacc
+@end example
+
+When you use @code{ranlib}, you should test whether it exists, and run
+it only if it exists, so that the distribution will work on systems that
+don't have @code{ranlib}.
+
+If you use symbolic links, you should implement a fallback for systems
+that don't have symbolic links.
+
+It is ok to use other utilities in Makefile portions (or scripts)
+intended only for particular systems where you know those utilities to
+exist.
+
+@node Standard Targets
+@appendixsec Standard Targets for Users
+
+All GNU programs should have the following targets in their Makefiles:
+
+@table @samp
+@item all
+Compile the entire program. This should be the default target. This
+target need not rebuild any documentation files; info files should
+normally be included in the distribution, and DVI files should be made
+only when explicitly asked for.
+
+@item install
+Compile the program and copy the executables, libraries, and so on to
+the file names where they should reside for actual use. If there is a
+simple test to verify that a program is properly installed then run that
+test.
+
+Use @samp{-} before any command for installing a man page, so that
+@code{make} will ignore any errors. This is in case there are systems
+that don't have the Unix man page documentation system installed.
+
+In the future, when we have a standard way of installing info files,
+@samp{install} targets will be the proper place to do so.
+
+@item uninstall
+Delete all the installed files that the @samp{install} target would
+create (but not the noninstalled files such as @samp{make all} would
+create).
+
+@item clean
+Delete all files from the current directory that are normally created by
+building the program. Don't delete the files that record the
+configuration. Also preserve files that could be made by building, but
+normally aren't because the distribution comes with them.
+
+Delete @file{.dvi} files here if they are not part of the distribution.
+
+@item distclean
+Delete all files from the current directory that are created by
+configuring or building the program. If you have unpacked the source
+and built the program without creating any other files, @samp{make
+distclean} should leave only the files that were in the distribution.
+
+@item mostlyclean
+Like @samp{clean}, but may refrain from deleting a few files that people
+normally don't want to recompile. For example, the @samp{mostlyclean}
+target for GCC does not delete @file{libgcc.a}, because recompiling it
+is rarely necessary and takes a lot of time.
+
+@item realclean
+Delete everything from the current directory that can be reconstructed
+with this Makefile. This typically includes everything deleted by
+distclean, plus more: C source files produced by Bison, tags tables,
+info files, and so on.
+
+One exception, however: @samp{make realclean} should not delete
+@file{configure} even if @file{configure} can be remade using a rule in
+the Makefile. More generally, @samp{make realclean} should not delete
+anything that needs to exist in order to run @file{configure}
+and then begin to build the program.
+
+@item TAGS
+Update a tags table for this program.
+
+@item info
+Generate any info files needed. The best way to write the rules is as
+follows:
+
+@example
+info: foo.info
+
+foo.info: $(srcdir)/foo.texi $(srcdir)/chap1.texi $(srcdir)/chap2.texi
+ $(MAKEINFO) $(srcdir)/foo.texi
+@end example
+
+@noindent
+You must define the variable @code{MAKEINFO} in the Makefile.
+It should run the Makeinfo program, which is part of the Texinfo2 distribution.
+
+@item dvi
+Generate DVI files for all TeXinfo documentation.
+For example:
+
+@example
+dvi: foo.dvi
+
+foo.dvi: $(srcdir)/foo.texi $(srcdir)/chap1.texi $(srcdir)/chap2.texi
+ $(TEXI2DVI) $(srcdir)/foo.texi
+@end example
+
+@noindent
+You must define the variable @code{TEXI2DVI} in the Makefile. It should
+run the program @code{texi2dvi}, which is part of the Texinfo2
+distribution. Alternatively, write just the dependencies, and allow GNU
+Make to provide the command.
+
+@item dist
+Create a distribution tar file for this program. The tar file should be
+set up so that the file names in the tar file start with a subdirectory
+name which is the name of the package it is a distribution for. This
+name can include the version number.
+
+For example, the distribution tar file of GCC version 1.40 unpacks into
+a subdirectory named @file{gcc-1.40}.
+
+The easiest way to do this is to create a subdirectory appropriately
+named, use @code{ln} or @code{cp} to install the proper files in it, and
+then @code{tar} that subdirectory.
+
+The @code{dist} target should explicitly depend on all non-source files
+that are in the distribution, to make sure they are up to date in the
+distribution. @xref{Releases}.
+
+@item check
+Perform self-tests (if any). The user must build the program before
+running the tests, but need not install the program; you should write
+the self-tests so that they work when the program is built but not
+installed.
+@end table
+
+@node Command Variables
+@appendixsec Variables for Specifying Commands
+
+Makefiles should provide variables for overriding certain commands, options,
+and so on.
+
+In particular, you should run most utility programs via variables.
+Thus, if you use Bison, have a variable named @code{BISON} whose default
+value is set with @samp{BISON = bison}, and refer to it with
+@code{$(BISON)} whenever you need to use Bison.
+
+File management utilities such as @code{ln}, @code{rm}, @code{mv}, and
+so on, need not be referred to through variables in this way, since users
+don't need to replace them with other programs.
+
+Each program-name variable should come with an options variable that is
+used to supply options to the program. Append @samp{FLAGS} to the
+program-name variable name to get the options variable name---for
+example, @code{BISONFLAGS}. (The name @code{CFLAGS} is an exception to
+this rule, but we keep it because it is standard.) Use @code{CPPFLAGS}
+in any compilation command that runs the preprocessor, and use
+@code{LDFLAGS} in any compilation command that does linking as well as
+in any direct use of @code{ld}.
+
+If there are C compiler options that @emph{must} be used for proper
+compilation of certain files, do not include them in @code{CFLAGS}.
+Users expect to be able to specify @code{CFLAGS} freely themselves.
+Instead, arrange to pass the necessary options to the C compiler
+independently of @code{CFLAGS}, by writing them explicitly in the
+compilation commands or by defining an implicit rule, like this:
+
+@example
+CFLAGS = -g
+ALL_CFLAGS = $(CFLAGS) -I.
+.c.o:
+ $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $<
+@end example
+
+Do include the @samp{-g} option in @code{CFLAGS}, because that is not
+@emph{required} for proper compilation. You can consider it a default
+that is only recommended. If the package is set up so that it is
+compiled with GCC by default, then you might as well include @samp{-O}
+in the default value of @code{CFLAGS} as well.
+
+Every Makefile should define the variable @code{INSTALL}, which is the
+basic command for installing a file into the system.
+
+Every Makefile should also define variables @code{INSTALL_PROGRAM} and
+@code{INSTALL_DATA}. (The default for each of these should be
+@code{$(INSTALL)}.) Then it should use those variables as the commands
+for actual installation, for executables and nonexecutables
+respectively. Use these variables as follows:
+
+@example
+$(INSTALL_PROGRAM) foo $(bindir)/foo
+$(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
+@end example
+
+@noindent
+Always use a file name, not a directory name, as the second argument of
+the installation commands. Use a separate command for each file to be
+installed.
+
+@node Directory Variables
+@appendixsec Variables for Installation Directories
+
+Installation directories should always be named by variables, so it is
+easy to install in a nonstandard place. The standard names for these
+variables are:
+
+@table @samp
+@item prefix
+A prefix used in constructing the default values of the variables listed
+below. The default value of @code{prefix} should be @file{/usr/local}
+(at least for now).
+
+@item exec_prefix
+A prefix used in constructing the default values of the some of the
+variables listed below. The default value of @code{exec_prefix} should
+be @code{$(prefix)}.
+
+Generally, @code{$(exec_prefix)} is used for directories that contain
+machine-specific files (such as executables and subroutine libraries),
+while @code{$(prefix)} is used directly for other directories.
+
+@item bindir
+The directory for installing executable programs that users can run.
+This should normally be @file{/usr/local/bin}, but write it as
+@file{$(exec_prefix)/bin}.
+
+@item libdir
+The directory for installing executable files to be run by the program
+rather than by users. Object files and libraries of object code should
+also go in this directory. The idea is that this directory is used for
+files that pertain to a specific machine architecture, but need not be
+in the path for commands. The value of @code{libdir} should normally be
+@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
+
+@item datadir
+The directory for installing read-only data files which the programs
+refer to while they run. This directory is used for files which are
+independent of the type of machine being used. This should normally be
+@file{/usr/local/lib}, but write it as @file{$(prefix)/lib}.
+
+@item statedir
+The directory for installing data files which the programs modify while
+they run. These files should be independent of the type of machine
+being used, and it should be possible to share them among machines at a
+network installation. This should normally be @file{/usr/local/lib},
+but write it as @file{$(prefix)/lib}.
+
+@item includedir
+The directory for installing @samp{#include} header files to be included
+by user programs. This should normally be @file{/usr/local/include},
+but write it as @file{$(prefix)/include}.
+
+Most compilers other than GCC do not look for header files in
+@file{/usr/local/include}. So installing the header files this way is
+only useful with GCC. Sometimes this is not a problem because some
+libraries are only really intended to work with GCC. But some libraries
+are intended to work with other compilers. They should install their
+header files in two places, one specified by @code{includedir} and one
+specified by @code{oldincludedir}.
+
+@item oldincludedir
+The directory for installing @samp{#include} header files for use with
+compilers other than GCC. This should normally be @file{/usr/include}.
+
+The Makefile commands should check whether the value of
+@code{oldincludedir} is empty. If it is, they should not try to use
+it; they should cancel the second installation of the header files.
+
+A package should not replace an existing header in this directory unless
+the header came from the same package. Thus, if your Foo package
+provides a header file @file{foo.h}, then it should install the header
+file in the @code{oldincludedir} directory if either (1) there is no
+@file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo
+package.
+
+The way to tell whether @file{foo.h} came from the Foo package is to put
+a magic string in the file---part of a comment---and grep for that
+string.
+
+@item mandir
+The directory for installing the man pages (if any) for this package.
+It should include the suffix for the proper section of the
+manual---usually @samp{1} for a utility.
+
+@item man1dir
+The directory for installing section 1 man pages.
+@item man2dir
+The directory for installing section 2 man pages.
+@item @dots{}
+Use these names instead of @samp{mandir} if the package needs to install man
+pages in more than one section of the manual.
+
+@strong{Don't make the primary documentation for any GNU software be a
+man page. Write a manual in Texinfo instead. Man pages are just for
+the sake of people running GNU software on Unix, which is a secondary
+application only.}
+
+@item manext
+The file name extension for the installed man page. This should contain
+a period followed by the appropriate digit.
+
+@item infodir
+The directory for installing the info files for this package. By
+default, it should be @file{/usr/local/info}, but it should be written
+as @file{$(prefix)/info}.
+
+@item srcdir
+The directory for the sources being compiled. The value of this
+variable is normally inserted by the @code{configure} shell script.
+@end table
+
+For example:
+
+@example
+# Common prefix for installation directories.
+# NOTE: This directory must exist when you start installation.
+prefix = /usr/local
+exec_prefix = $(prefix)
+# Directory in which to put the executable for the command `gcc'
+bindir = $(exec_prefix)/bin
+# Directory in which to put the directories used by the compiler.
+libdir = $(exec_prefix)/lib
+# Directory in which to put the Info files.
+infodir = $(prefix)/info
+@end example
+
+If your program installs a large number of files into one of the
+standard user-specified directories, it might be useful to group them
+into a subdirectory particular to that program. If you do this, you
+should write the @code{install} rule to create these subdirectories.
+
+Do not expect the user to include the subdirectory name in the value of
+any of the variables listed above. The idea of having a uniform set of
+variable names for installation directories is to enable the user to
+specify the exact same values for several different GNU packages. In
+order for this to be useful, all the packages must be designed so that
+they will work sensibly when the user does so.
+
@node Complex Makefile, Concept Index, Quick Reference, Top
@appendix Complex Makefile Example
@@ -8059,7 +8502,7 @@ the same files as does @samp{make clean} but also the
distribution, but is not shown here.)
If you type @samp{make realclean}, then @code{make} removes the same
-files as does @samp{make distclean} and also the Info files
+files as does @samp{make distclean} and also removes the Info files
generated from @file{tar.texinfo}.
In addition, there are targets @code{shar} and @code{dist} that create