annotate doc/make-stds.texi @ 17476:6057744acd2c default tip master

autoupdate
author Karl Berry <karl@freefriends.org>
date Fri, 16 Aug 2013 06:32:22 -0700
parents 93d4e55aa8a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1 @comment This file is included by both standards.texi and make.texinfo.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
2 @comment It was broken out of standards.texi on 1/6/93 by roland.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
3
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
4 @node Makefile Conventions
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
5 @chapter Makefile Conventions
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
6 @cindex makefile, conventions for
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
7 @cindex conventions for makefiles
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
8 @cindex standards for makefiles
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
9
10770
6f79b0e4356c fdl 1.3 tweaks
Karl Berry <karl@freefriends.org>
parents: 10762
diff changeset
10 @c Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
12817
d30052be2767 autoupdate
Karl Berry <karl@freefriends.org>
parents: 12585
diff changeset
11 @c 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
10770
6f79b0e4356c fdl 1.3 tweaks
Karl Berry <karl@freefriends.org>
parents: 10762
diff changeset
12 @c
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
13 @c Permission is granted to copy, distribute and/or modify this document
10762
d67664a4e01c Change license to GFDLv1.3+.
Simon Josefsson <simon@josefsson.org>
parents: 9969
diff changeset
14 @c under the terms of the GNU Free Documentation License, Version 1.3
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
15 @c or any later version published by the Free Software Foundation;
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
16 @c with no Invariant Sections, with no
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
17 @c Front-Cover Texts, and with no Back-Cover Texts.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
18 @c A copy of the license is included in the section entitled ``GNU
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
19 @c Free Documentation License''.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
20
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
21 This
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
22 @ifinfo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
23 node
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
24 @end ifinfo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
25 @iftex
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
26 @ifset CODESTD
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
27 section
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
28 @end ifset
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
29 @ifclear CODESTD
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
30 chapter
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
31 @end ifclear
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
32 @end iftex
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
33 describes conventions for writing the Makefiles for GNU programs.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
34 Using Automake will help you write a Makefile that follows these
9812
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
35 conventions. For more information on portable Makefiles, see
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
36 @sc{posix} and @ref{Portable Make, Portable Make Programming,, autoconf,
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
37 Autoconf}.
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
38
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
39
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
40 @menu
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
41 * Makefile Basics:: General conventions for Makefiles.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
42 * Utilities in Makefiles:: Utilities to be used in Makefiles.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
43 * Command Variables:: Variables for specifying commands.
7159
1256f83e76b1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 7137
diff changeset
44 * DESTDIR:: Supporting staged installs.
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
45 * Directory Variables:: Variables for installation directories.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
46 * Standard Targets:: Standard targets for users.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
47 * Install Command Categories:: Three categories of commands in the `install'
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
48 rule: normal, pre-install and post-install.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
49 @end menu
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
50
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
51 @node Makefile Basics
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
52 @section General Conventions for Makefiles
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
53
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
54 Every Makefile should contain this line:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
55
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
56 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
57 SHELL = /bin/sh
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
58 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
59
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
60 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
61 to avoid trouble on systems where the @code{SHELL} variable might be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
62 inherited from the environment. (This is never a problem with GNU
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
63 @code{make}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
64
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
65 Different @code{make} programs have incompatible suffix lists and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
66 implicit rules, and this sometimes creates confusion or misbehavior. So
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
67 it is a good idea to set the suffix list explicitly using only the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
68 suffixes you need in the particular Makefile, like this:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
69
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
70 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
71 .SUFFIXES:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
72 .SUFFIXES: .c .o
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
73 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
74
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
75 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
76 The first line clears out the suffix list, the second introduces all
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
77 suffixes which may be subject to implicit rules in this Makefile.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
78
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
79 Don't assume that @file{.} is in the path for command execution. When
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
80 you need to run programs that are a part of your package during the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
81 make, please make sure that it uses @file{./} if the program is built as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
82 part of the make or @file{$(srcdir)/} if the file is an unchanging part
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
83 of the source code. Without one of these prefixes, the current search
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
84 path is used.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
85
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
86 The distinction between @file{./} (the @dfn{build directory}) and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
87 @file{$(srcdir)/} (the @dfn{source directory}) is important because
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
88 users can build in a separate directory using the @samp{--srcdir} option
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
89 to @file{configure}. A rule of the form:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
90
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
91 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
92 foo.1 : foo.man sedscript
12817
d30052be2767 autoupdate
Karl Berry <karl@freefriends.org>
parents: 12585
diff changeset
93 sed -f sedscript foo.man > foo.1
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
94 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
95
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
96 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
97 will fail when the build directory is not the source directory, because
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
98 @file{foo.man} and @file{sedscript} are in the source directory.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
99
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
100 When using GNU @code{make}, relying on @samp{VPATH} to find the source
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
101 file will work in the case where there is a single dependency file,
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
102 since the @code{make} automatic variable @samp{$<} will represent the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
103 source file wherever it is. (Many versions of @code{make} set @samp{$<}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
104 only in implicit rules.) A Makefile target like
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
105
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
106 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
107 foo.o : bar.c
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
108 $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
109 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
110
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
111 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
112 should instead be written as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
113
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
114 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
115 foo.o : bar.c
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
116 $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
117 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
118
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
119 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
120 in order to allow @samp{VPATH} to work correctly. When the target has
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
121 multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
122 way to make the rule work well. For example, the target above for
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
123 @file{foo.1} is best written as:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
124
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
125 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
126 foo.1 : foo.man sedscript
12817
d30052be2767 autoupdate
Karl Berry <karl@freefriends.org>
parents: 12585
diff changeset
127 sed -f $(srcdir)/sedscript $(srcdir)/foo.man > $@@
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
128 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
129
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
130 GNU distributions usually contain some files which are not source
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
131 files---for example, Info files, and the output from Autoconf, Automake,
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
132 Bison or Flex. Since these files normally appear in the source
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
133 directory, they should always appear in the source directory, not in the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
134 build directory. So Makefile rules to update them should put the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
135 updated files in the source directory.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
136
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
137 However, if a file does not appear in the distribution, then the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
138 Makefile should not put it in the source directory, because building a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
139 program in ordinary circumstances should not modify the source directory
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
140 in any way.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
141
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
142 Try to make the build and installation targets, at least (and all their
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
143 subtargets) work correctly with a parallel @code{make}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
144
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
145 @node Utilities in Makefiles
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
146 @section Utilities in Makefiles
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
147
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
148 Write the Makefile commands (and any shell scripts, such as
9812
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
149 @code{configure}) to run under @code{sh} (both the traditional Bourne
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
150 shell and the @sc{posix} shell), not @code{csh}. Don't use any
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
151 special features of @code{ksh} or @code{bash}, or @sc{posix} features
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
152 not widely supported in traditional Bourne @code{sh}.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
153
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
154 The @code{configure} script and the Makefile rules for building and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
155 installation should not use any utilities directly except these:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
156
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
157 @c dd find
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
158 @c gunzip gzip md5sum
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
159 @c mkfifo mknod tee uname
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
160
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
161 @example
13219
41881f944956 autoupdate
Karl Berry <karl@freefriends.org>
parents: 12897
diff changeset
162 awk cat cmp cp diff echo egrep expr false grep install-info ln ls
41881f944956 autoupdate
Karl Berry <karl@freefriends.org>
parents: 12897
diff changeset
163 mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
164 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
165
9708
4460cc7bf40d autoupdate
Karl Berry <karl@freefriends.org>
parents: 9492
diff changeset
166 Compression programs such as @code{gzip} can be used in the
4460cc7bf40d autoupdate
Karl Berry <karl@freefriends.org>
parents: 9492
diff changeset
167 @code{dist} rule.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
168
9812
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
169 Generally, stick to the widely-supported (usually
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
170 @sc{posix}-specified) options and features of these programs. For
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
171 example, don't use @samp{mkdir -p}, convenient as it may be, because a
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
172 few systems don't support it at all and with others, it is not safe
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
173 for parallel execution. For a list of known incompatibilities, see
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
174 @ref{Portable Shell, Portable Shell Programming,, autoconf, Autoconf}.
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
175
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
176
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
177 It is a good idea to avoid creating symbolic links in makefiles, since a
9812
23c2f4de4b25 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9708
diff changeset
178 few file systems don't support them.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
179
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
180 The Makefile rules for building and installation can also use compilers
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
181 and related programs, but should do so via @code{make} variables so that the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
182 user can substitute alternatives. Here are some of the programs we
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
183 mean:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
184
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
185 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
186 ar bison cc flex install ld ldconfig lex
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
187 make makeinfo ranlib texi2dvi yacc
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
188 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
189
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
190 Use the following @code{make} variables to run those programs:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
191
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
192 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
193 $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
194 $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
195 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
196
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
197 When you use @code{ranlib} or @code{ldconfig}, you should make sure
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
198 nothing bad happens if the system does not have the program in question.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
199 Arrange to ignore an error from that command, and print a message before
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
200 the command to tell the user that failure of this command does not mean
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
201 a problem. (The Autoconf @samp{AC_PROG_RANLIB} macro can help with
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
202 this.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
203
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
204 If you use symbolic links, you should implement a fallback for systems
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
205 that don't have symbolic links.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
206
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
207 Additional utilities that can be used via Make variables are:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
208
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
209 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
210 chgrp chmod chown mknod
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
211 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
212
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
213 It is ok to use other utilities in Makefile portions (or scripts)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
214 intended only for particular systems where you know those utilities
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
215 exist.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
216
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
217 @node Command Variables
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
218 @section Variables for Specifying Commands
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
219
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
220 Makefiles should provide variables for overriding certain commands, options,
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
221 and so on.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
222
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
223 In particular, you should run most utility programs via variables.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
224 Thus, if you use Bison, have a variable named @code{BISON} whose default
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
225 value is set with @samp{BISON = bison}, and refer to it with
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
226 @code{$(BISON)} whenever you need to use Bison.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
227
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
228 File management utilities such as @code{ln}, @code{rm}, @code{mv}, and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
229 so on, need not be referred to through variables in this way, since users
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
230 don't need to replace them with other programs.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
231
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
232 Each program-name variable should come with an options variable that is
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
233 used to supply options to the program. Append @samp{FLAGS} to the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
234 program-name variable name to get the options variable name---for
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
235 example, @code{BISONFLAGS}. (The names @code{CFLAGS} for the C
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
236 compiler, @code{YFLAGS} for yacc, and @code{LFLAGS} for lex, are
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
237 exceptions to this rule, but we keep them because they are standard.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
238 Use @code{CPPFLAGS} in any compilation command that runs the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
239 preprocessor, and use @code{LDFLAGS} in any compilation command that
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
240 does linking as well as in any direct use of @code{ld}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
241
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
242 If there are C compiler options that @emph{must} be used for proper
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
243 compilation of certain files, do not include them in @code{CFLAGS}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
244 Users expect to be able to specify @code{CFLAGS} freely themselves.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
245 Instead, arrange to pass the necessary options to the C compiler
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
246 independently of @code{CFLAGS}, by writing them explicitly in the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
247 compilation commands or by defining an implicit rule, like this:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
248
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
249 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
250 CFLAGS = -g
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
251 ALL_CFLAGS = -I. $(CFLAGS)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
252 .c.o:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
253 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
254 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
255
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
256 Do include the @samp{-g} option in @code{CFLAGS}, because that is not
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
257 @emph{required} for proper compilation. You can consider it a default
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
258 that is only recommended. If the package is set up so that it is
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
259 compiled with GCC by default, then you might as well include @samp{-O}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
260 in the default value of @code{CFLAGS} as well.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
261
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
262 Put @code{CFLAGS} last in the compilation command, after other variables
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
263 containing compiler options, so the user can use @code{CFLAGS} to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
264 override the others.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
265
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
266 @code{CFLAGS} should be used in every invocation of the C compiler,
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
267 both those which do compilation and those which do linking.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
268
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
269 Every Makefile should define the variable @code{INSTALL}, which is the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
270 basic command for installing a file into the system.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
271
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
272 Every Makefile should also define the variables @code{INSTALL_PROGRAM}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
273 and @code{INSTALL_DATA}. (The default for @code{INSTALL_PROGRAM} should
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
274 be @code{$(INSTALL)}; the default for @code{INSTALL_DATA} should be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
275 @code{$@{INSTALL@} -m 644}.) Then it should use those variables as the
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
276 commands for actual installation, for executables and non-executables
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
277 respectively. Minimal use of these variables is as follows:
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
278
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
279 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
280 $(INSTALL_PROGRAM) foo $(bindir)/foo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
281 $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
282 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
283
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
284 However, it is preferable to support a @code{DESTDIR} prefix on the
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
285 target files, as explained in the next section.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
286
9492
5561da1401f1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9205
diff changeset
287 It is acceptable, but not required, to install multiple files in one
5561da1401f1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9205
diff changeset
288 command, with the final argument being a directory, as in:
5561da1401f1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9205
diff changeset
289
5561da1401f1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9205
diff changeset
290 @example
5561da1401f1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9205
diff changeset
291 $(INSTALL_PROGRAM) foo bar baz $(bindir)
5561da1401f1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 9205
diff changeset
292 @end example
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
293
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
294
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
295 @node DESTDIR
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
296 @section @code{DESTDIR}: Support for Staged Installs
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
297
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
298 @vindex DESTDIR
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
299 @cindex staged installs
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
300 @cindex installations, staged
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
301
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
302 @code{DESTDIR} is a variable prepended to each installed target file,
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
303 like this:
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
304
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
305 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
306 $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
307 $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
308 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
309
7159
1256f83e76b1 autoupdate
Karl Berry <karl@freefriends.org>
parents: 7137
diff changeset
310 The @code{DESTDIR} variable is specified by the user on the @code{make}
9156
f37411290a94 autoupdate
Karl Berry <karl@freefriends.org>
parents: 7159
diff changeset
311 command line as an absolute file name. For example:
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
312
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
313 @example
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
314 make DESTDIR=/tmp/stage install
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
315 @end example
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
316
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
317 @noindent
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
318 @code{DESTDIR} should be supported only in the @code{install*} and
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
319 @code{uninstall*} targets, as those are the only targets where it is
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
320 useful.
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
321
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
322 If your installation step would normally install
13300
6aeb740648c5 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13219
diff changeset
323 @file{/usr/local/bin/foo} and @file{/usr/@/local/@/lib/@/libfoo.a}, then an
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
324 installation invoked as in the example above would install
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
325 @file{/tmp/stage/usr/local/bin/foo} and
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
326 @file{/tmp/stage/usr/local/lib/libfoo.a} instead.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
327
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
328 Prepending the variable @code{DESTDIR} to each target in this way
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
329 provides for @dfn{staged installs}, where the installed files are not
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
330 placed directly into their expected location but are instead copied
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
331 into a temporary location (@code{DESTDIR}). However, installed files
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
332 maintain their relative directory structure and any embedded file names
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
333 will not be modified.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
334
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
335 You should not set the value of @code{DESTDIR} in your @file{Makefile}
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
336 at all; then the files are installed into their expected locations by
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
337 default. Also, specifying @code{DESTDIR} should not change the
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
338 operation of the software in any way, so its value should not be
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
339 included in any file contents.
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
340
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
341 @code{DESTDIR} support is commonly used in package creation. It is
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
342 also helpful to users who want to understand what a given package will
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
343 install where, and to allow users who don't normally have permissions
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
344 to install into protected areas to build and install before gaining
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
345 those permissions. Finally, it can be useful with tools such as
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
346 @code{stow}, where code is installed in one place but made to appear
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
347 to be installed somewhere else using symbolic links or special mount
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
348 operations. So, we strongly recommend GNU packages support
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
349 @code{DESTDIR}, though it is not an absolute requirement.
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
350
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
351
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
352 @node Directory Variables
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
353 @section Variables for Installation Directories
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
354
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
355 Installation directories should always be named by variables, so it is
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
356 easy to install in a nonstandard place. The standard names for these
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
357 variables and the values they should have in GNU packages are
6723
82dc3ee09c34 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5642
diff changeset
358 described below. They are based on a standard file system layout;
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
359 variants of it are used in GNU/Linux and other modern operating
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
360 systems.
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
361
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
362 Installers are expected to override these values when calling
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
363 @command{make} (e.g., @kbd{make prefix=/usr install} or
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
364 @command{configure} (e.g., @kbd{configure --prefix=/usr}). GNU
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
365 packages should not try to guess which value should be appropriate for
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
366 these variables on the system they are being installed onto: use the
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
367 default settings specified here so that all GNU packages behave
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
368 identically, allowing the installer to achieve any desired layout.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
369
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
370 @cindex directories, creating installation
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
371 @cindex installation directories, creating
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
372 All installation directories, and their parent directories, should be
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
373 created (if necessary) before they are installed into.
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
374
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
375 These first two variables set the root for the installation. All the
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
376 other installation directories should be subdirectories of one of
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
377 these two, and nothing should be directly installed into these two
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
378 directories.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
379
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
380 @table @code
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
381 @item prefix
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
382 @vindex prefix
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
383 A prefix used in constructing the default values of the variables listed
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
384 below. The default value of @code{prefix} should be @file{/usr/local}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
385 When building the complete GNU system, the prefix will be empty and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
386 @file{/usr} will be a symbolic link to @file{/}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
387 (If you are using Autoconf, write it as @samp{@@prefix@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
388
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
389 Running @samp{make install} with a different value of @code{prefix} from
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
390 the one used to build the program should @emph{not} recompile the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
391 program.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
392
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
393 @item exec_prefix
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
394 @vindex exec_prefix
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
395 A prefix used in constructing the default values of some of the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
396 variables listed below. The default value of @code{exec_prefix} should
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
397 be @code{$(prefix)}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
398 (If you are using Autoconf, write it as @samp{@@exec_prefix@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
399
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
400 Generally, @code{$(exec_prefix)} is used for directories that contain
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
401 machine-specific files (such as executables and subroutine libraries),
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
402 while @code{$(prefix)} is used directly for other directories.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
403
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
404 Running @samp{make install} with a different value of @code{exec_prefix}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
405 from the one used to build the program should @emph{not} recompile the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
406 program.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
407 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
408
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
409 Executable programs are installed in one of the following directories.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
410
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
411 @table @code
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
412 @item bindir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
413 @vindex bindir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
414 The directory for installing executable programs that users can run.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
415 This should normally be @file{/usr/local/bin}, but write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
416 @file{$(exec_prefix)/bin}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
417 (If you are using Autoconf, write it as @samp{@@bindir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
418
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
419 @item sbindir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
420 @vindex sbindir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
421 The directory for installing executable programs that can be run from
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
422 the shell, but are only generally useful to system administrators. This
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
423 should normally be @file{/usr/local/sbin}, but write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
424 @file{$(exec_prefix)/sbin}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
425 (If you are using Autoconf, write it as @samp{@@sbindir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
426
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
427 @item libexecdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
428 @vindex libexecdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
429 @comment This paragraph adjusted to avoid overfull hbox --roland 5jul94
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
430 The directory for installing executable programs to be run by other
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
431 programs rather than by users. This directory should normally be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
432 @file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
433 (If you are using Autoconf, write it as @samp{@@libexecdir@@}.)
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
434
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
435 The definition of @samp{libexecdir} is the same for all packages, so
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
436 you should install your data in a subdirectory thereof. Most packages
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
437 install their data under @file{$(libexecdir)/@var{package-name}/},
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
438 possibly within additional subdirectories thereof, such as
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
439 @file{$(libexecdir)/@var{package-name}/@var{machine}/@var{version}}.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
440 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
441
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
442 Data files used by the program during its execution are divided into
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
443 categories in two ways.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
444
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
445 @itemize @bullet
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
446 @item
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
447 Some files are normally modified by programs; others are never normally
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
448 modified (though users may edit some of these).
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
449
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
450 @item
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
451 Some files are architecture-independent and can be shared by all
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
452 machines at a site; some are architecture-dependent and can be shared
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
453 only by machines of the same kind and operating system; others may never
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
454 be shared between two machines.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
455 @end itemize
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
456
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
457 This makes for six different possibilities. However, we want to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
458 discourage the use of architecture-dependent files, aside from object
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
459 files and libraries. It is much cleaner to make other data files
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
460 architecture-independent, and it is generally not hard.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
461
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
462 Here are the variables Makefiles should use to specify directories
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
463 to put these various kinds of files in:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
464
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
465 @table @samp
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
466 @item datarootdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
467 The root of the directory tree for read-only architecture-independent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
468 data files. This should normally be @file{/usr/local/share}, but
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
469 write it as @file{$(prefix)/share}. (If you are using Autoconf, write
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
470 it as @samp{@@datarootdir@@}.) @samp{datadir}'s default value is
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
471 based on this variable; so are @samp{infodir}, @samp{mandir}, and
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
472 others.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
473
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
474 @item datadir
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
475 The directory for installing idiosyncratic read-only
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
476 architecture-independent data files for this program. This is usually
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
477 the same place as @samp{datarootdir}, but we use the two separate
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
478 variables so that you can move these program-specific files without
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
479 altering the location for Info files, man pages, etc.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
480
13401
7d14ab8b5c99 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13300
diff changeset
481 @c raggedright (not until next Texinfo release)
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
482 This should normally be @file{/usr/local/share}, but write it as
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
483 @file{$(datarootdir)}. (If you are using Autoconf, write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
484 @samp{@@datadir@@}.)
13401
7d14ab8b5c99 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13300
diff changeset
485 @c end raggedright
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
486
5642
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
487 The definition of @samp{datadir} is the same for all packages, so you
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
488 should install your data in a subdirectory thereof. Most packages
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
489 install their data under @file{$(datadir)/@var{package-name}/}.
94b470dee2a3 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 5626
diff changeset
490
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
491 @item sysconfdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
492 The directory for installing read-only data files that pertain to a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
493 single machine--that is to say, files for configuring a host. Mailer
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
494 and network configuration files, @file{/etc/passwd}, and so forth belong
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
495 here. All the files in this directory should be ordinary ASCII text
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
496 files. This directory should normally be @file{/usr/local/etc}, but
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
497 write it as @file{$(prefix)/etc}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
498 (If you are using Autoconf, write it as @samp{@@sysconfdir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
499
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
500 Do not install executables here in this directory (they probably belong
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
501 in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not install
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
502 files that are modified in the normal course of their use (programs
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
503 whose purpose is to change the configuration of the system excluded).
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
504 Those probably belong in @file{$(localstatedir)}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
505
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
506 @item sharedstatedir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
507 The directory for installing architecture-independent data files which
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
508 the programs modify while they run. This should normally be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
509 @file{/usr/local/com}, but write it as @file{$(prefix)/com}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
510 (If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
511
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
512 @item localstatedir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
513 The directory for installing data files which the programs modify while
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
514 they run, and that pertain to one specific machine. Users should never
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
515 need to modify files in this directory to configure the package's
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
516 operation; put such configuration information in separate files that go
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
517 in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
518 should normally be @file{/usr/local/var}, but write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
519 @file{$(prefix)/var}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
520 (If you are using Autoconf, write it as @samp{@@localstatedir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
521 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
522
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
523 These variables specify the directory for installing certain specific
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
524 types of files, if your program has them. Every GNU package should
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
525 have Info files, so every program needs @samp{infodir}, but not all
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
526 need @samp{libdir} or @samp{lispdir}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
527
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
528 @table @samp
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
529 @item includedir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
530 The directory for installing header files to be included by user
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
531 programs with the C @samp{#include} preprocessor directive. This
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
532 should normally be @file{/usr/local/include}, but write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
533 @file{$(prefix)/include}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
534 (If you are using Autoconf, write it as @samp{@@includedir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
535
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
536 Most compilers other than GCC do not look for header files in directory
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
537 @file{/usr/local/include}. So installing the header files this way is
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
538 only useful with GCC. Sometimes this is not a problem because some
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
539 libraries are only really intended to work with GCC. But some libraries
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
540 are intended to work with other compilers. They should install their
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
541 header files in two places, one specified by @code{includedir} and one
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
542 specified by @code{oldincludedir}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
543
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
544 @item oldincludedir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
545 The directory for installing @samp{#include} header files for use with
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
546 compilers other than GCC. This should normally be @file{/usr/include}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
547 (If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
548
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
549 The Makefile commands should check whether the value of
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
550 @code{oldincludedir} is empty. If it is, they should not try to use
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
551 it; they should cancel the second installation of the header files.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
552
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
553 A package should not replace an existing header in this directory unless
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
554 the header came from the same package. Thus, if your Foo package
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
555 provides a header file @file{foo.h}, then it should install the header
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
556 file in the @code{oldincludedir} directory if either (1) there is no
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
557 @file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
558 package.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
559
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
560 To tell whether @file{foo.h} came from the Foo package, put a magic
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
561 string in the file---part of a comment---and @code{grep} for that string.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
562
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
563 @item docdir
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
564 The directory for installing documentation files (other than Info) for
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
565 this package. By default, it should be
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
566 @file{/usr/local/share/doc/@var{yourpkg}}, but it should be written as
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
567 @file{$(datarootdir)/doc/@var{yourpkg}}. (If you are using Autoconf,
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
568 write it as @samp{@@docdir@@}.) The @var{yourpkg} subdirectory, which
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
569 may include a version number, prevents collisions among files with
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
570 common names, such as @file{README}.
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
571
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
572 @item infodir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
573 The directory for installing the Info files for this package. By
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
574 default, it should be @file{/usr/local/share/info}, but it should be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
575 written as @file{$(datarootdir)/info}. (If you are using Autoconf,
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
576 write it as @samp{@@infodir@@}.) @code{infodir} is separate from
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
577 @code{docdir} for compatibility with existing practice.
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
578
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
579 @item htmldir
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
580 @itemx dvidir
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
581 @itemx pdfdir
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
582 @itemx psdir
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
583 Directories for installing documentation files in the particular
6943
64f144ace584 Sync from upstream.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6775
diff changeset
584 format. They should all be set to @code{$(docdir)} by default. (If
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
585 you are using Autoconf, write them as @samp{@@htmldir@@},
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
586 @samp{@@dvidir@@}, etc.) Packages which supply several translations
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
587 of their documentation should install them in
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
588 @samp{$(htmldir)/}@var{ll}, @samp{$(pdfdir)/}@var{ll}, etc. where
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
589 @var{ll} is a locale abbreviation such as @samp{en} or @samp{pt_BR}.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
590
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
591 @item libdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
592 The directory for object files and libraries of object code. Do not
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
593 install executables here, they probably ought to go in @file{$(libexecdir)}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
594 instead. The value of @code{libdir} should normally be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
595 @file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
596 (If you are using Autoconf, write it as @samp{@@libdir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
597
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
598 @item lispdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
599 The directory for installing any Emacs Lisp files in this package. By
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
600 default, it should be @file{/usr/local/share/emacs/site-lisp}, but it
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
601 should be written as @file{$(datarootdir)/emacs/site-lisp}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
602
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
603 If you are using Autoconf, write the default as @samp{@@lispdir@@}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
604 In order to make @samp{@@lispdir@@} work, you need the following lines
16989
93d4e55aa8a9 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13894
diff changeset
605 in your @file{configure.ac} file:
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
606
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
607 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
608 lispdir='$@{datarootdir@}/emacs/site-lisp'
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
609 AC_SUBST(lispdir)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
610 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
611
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
612 @item localedir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
613 The directory for installing locale-specific message catalogs for this
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
614 package. By default, it should be @file{/usr/local/share/locale}, but
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
615 it should be written as @file{$(datarootdir)/locale}. (If you are
5626
c35473670545 gnustandards sync
Karl Berry <karl@freefriends.org>
parents: 5567
diff changeset
616 using Autoconf, write it as @samp{@@localedir@@}.) This directory
c35473670545 gnustandards sync
Karl Berry <karl@freefriends.org>
parents: 5567
diff changeset
617 usually has a subdirectory per locale.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
618 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
619
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
620 Unix-style man pages are installed in one of the following:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
621
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
622 @table @samp
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
623 @item mandir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
624 The top-level directory for installing the man pages (if any) for this
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
625 package. It will normally be @file{/usr/local/share/man}, but you
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
626 should write it as @file{$(datarootdir)/man}. (If you are using
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
627 Autoconf, write it as @samp{@@mandir@@}.)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
628
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
629 @item man1dir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
630 The directory for installing section 1 man pages. Write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
631 @file{$(mandir)/man1}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
632 @item man2dir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
633 The directory for installing section 2 man pages. Write it as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
634 @file{$(mandir)/man2}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
635 @item @dots{}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
636
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
637 @strong{Don't make the primary documentation for any GNU software be a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
638 man page. Write a manual in Texinfo instead. Man pages are just for
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
639 the sake of people running GNU software on Unix, which is a secondary
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
640 application only.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
641
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
642 @item manext
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
643 The file name extension for the installed man page. This should contain
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
644 a period followed by the appropriate digit; it should normally be @samp{.1}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
645
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
646 @item man1ext
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
647 The file name extension for installed section 1 man pages.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
648 @item man2ext
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
649 The file name extension for installed section 2 man pages.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
650 @item @dots{}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
651 Use these names instead of @samp{manext} if the package needs to install man
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
652 pages in more than one section of the manual.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
653 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
654
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
655 And finally, you should set the following variable:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
656
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
657 @table @samp
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
658 @item srcdir
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
659 The directory for the sources being compiled. The value of this
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
660 variable is normally inserted by the @code{configure} shell script.
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
661 (If you are using Autoconf, use @samp{srcdir = @@srcdir@@}.)
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
662 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
663
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
664 For example:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
665
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
666 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
667 @c I have changed some of the comments here slightly to fix an overfull
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
668 @c hbox, so the make manual can format correctly. --roland
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
669 # Common prefix for installation directories.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
670 # NOTE: This directory must exist when you start the install.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
671 prefix = /usr/local
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
672 datarootdir = $(prefix)/share
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
673 datadir = $(datarootdir)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
674 exec_prefix = $(prefix)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
675 # Where to put the executable for the command `gcc'.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
676 bindir = $(exec_prefix)/bin
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
677 # Where to put the directories used by the compiler.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
678 libexecdir = $(exec_prefix)/libexec
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
679 # Where to put the Info files.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
680 infodir = $(datarootdir)/info
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
681 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
682
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
683 If your program installs a large number of files into one of the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
684 standard user-specified directories, it might be useful to group them
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
685 into a subdirectory particular to that program. If you do this, you
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
686 should write the @code{install} rule to create these subdirectories.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
687
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
688 Do not expect the user to include the subdirectory name in the value of
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
689 any of the variables listed above. The idea of having a uniform set of
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
690 variable names for installation directories is to enable the user to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
691 specify the exact same values for several different GNU packages. In
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
692 order for this to be useful, all the packages must be designed so that
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
693 they will work sensibly when the user does so.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
694
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
695 At times, not all of these variables may be implemented in the current
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
696 release of Autoconf and/or Automake; but as of Autoconf@tie{}2.60, we
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
697 believe all of them are. When any are missing, the descriptions here
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
698 serve as specifications for what Autoconf will implement. As a
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
699 programmer, you can either use a development version of Autoconf or
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
700 avoid using these variables until a stable release is made which
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
701 supports them.
6775
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
702
21acfa839f4f autoupdate
Karl Berry <karl@freefriends.org>
parents: 6723
diff changeset
703
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
704 @node Standard Targets
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
705 @section Standard Targets for Users
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
706
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
707 All GNU programs should have the following targets in their Makefiles:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
708
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
709 @table @samp
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
710 @item all
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
711 Compile the entire program. This should be the default target. This
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
712 target need not rebuild any documentation files; Info files should
6943
64f144ace584 Sync from upstream.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6775
diff changeset
713 normally be included in the distribution, and DVI (and other
64f144ace584 Sync from upstream.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6775
diff changeset
714 documentation format) files should be made only when explicitly asked
64f144ace584 Sync from upstream.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6775
diff changeset
715 for.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
716
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
717 By default, the Make rules should compile and link with @samp{-g}, so
13894
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
718 that executable programs have debugging symbols. Otherwise, you are
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
719 essentially helpless in the face of a crash, and it is often far from
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
720 easy to reproduce with a fresh build.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
721
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
722 @item install
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
723 Compile the program and copy the executables, libraries, and so on to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
724 the file names where they should reside for actual use. If there is a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
725 simple test to verify that a program is properly installed, this target
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
726 should run that test.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
727
13894
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
728 Do not strip executables when installing them. This helps eventual
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
729 debugging that may be needed later, and nowadays disk space is cheap
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
730 and dynamic loaders typically ensure debug sections are not loaded during
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
731 normal execution. Users that need stripped binaries may invoke the
9e50fbc43e85 autoupdate
Karl Berry <karl@freefriends.org>
parents: 13575
diff changeset
732 @code{install-strip} target to do that.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
733
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
734 If possible, write the @code{install} target rule so that it does not
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
735 modify anything in the directory where the program was built, provided
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
736 @samp{make all} has just been done. This is convenient for building the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
737 program under one user name and installing it under another.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
738
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
739 The commands should create all the directories in which files are to be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
740 installed, if they don't already exist. This includes the directories
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
741 specified as the values of the variables @code{prefix} and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
742 @code{exec_prefix}, as well as all subdirectories that are needed.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
743 One way to do this is by means of an @code{installdirs} target
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
744 as described below.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
745
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
746 Use @samp{-} before any command for installing a man page, so that
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
747 @code{make} will ignore any errors. This is in case there are systems
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
748 that don't have the Unix man page documentation system installed.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
749
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
750 The way to install Info files is to copy them into @file{$(infodir)}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
751 with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
752 the @code{install-info} program if it is present. @code{install-info}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
753 is a program that edits the Info @file{dir} file to add or update the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
754 menu entry for the given Info file; it is part of the Texinfo package.
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
755
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
756 Here is a sample rule to install an Info file that also tries to
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
757 handle some additional situations, such as @code{install-info} not
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
758 being present.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
759
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
760 @comment This example has been carefully formatted for the Make manual.
6943
64f144ace584 Sync from upstream.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6775
diff changeset
761 @comment Please do not reformat it without talking to bug-make@gnu.org.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
762 @smallexample
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
763 do-install-info: foo.info installdirs
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
764 $(NORMAL_INSTALL)
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
765 # Prefer an info file in . to one in srcdir.
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
766 if test -f foo.info; then d=.; \
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
767 else d="$(srcdir)"; fi; \
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
768 $(INSTALL_DATA) $$d/foo.info \
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
769 "$(DESTDIR)$(infodir)/foo.info"
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
770 # Run install-info only if it exists.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
771 # Use `if' instead of just prepending `-' to the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
772 # line so we notice real errors from install-info.
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
773 # Use `$(SHELL) -c' because some shells do not
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
774 # fail gracefully when there is an unknown command.
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
775 $(POST_INSTALL)
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
776 if $(SHELL) -c 'install-info --version' \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
777 >/dev/null 2>&1; then \
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
778 install-info --dir-file="$(DESTDIR)$(infodir)/dir" \
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
779 "$(DESTDIR)$(infodir)/foo.info"; \
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
780 else true; fi
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
781 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
782
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
783 When writing the @code{install} target, you must classify all the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
784 commands into three categories: normal ones, @dfn{pre-installation}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
785 commands and @dfn{post-installation} commands. @xref{Install Command
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
786 Categories}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
787
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
788 @item install-html
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
789 @itemx install-dvi
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
790 @itemx install-pdf
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
791 @itemx install-ps
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
792 These targets install documentation in formats other than Info;
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
793 they're intended to be called explicitly by the person installing the
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
794 package, if that format is desired. GNU prefers Info files, so these
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
795 must be installed by the @code{install} target.
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
796
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
797 When you have many documentation files to install, we recommend that
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
798 you avoid collisions and clutter by arranging for these targets to
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
799 install in subdirectories of the appropriate installation directory,
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
800 such as @code{htmldir}. As one example, if your package has multiple
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
801 manuals, and you wish to install HTML documentation with many files
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
802 (such as the ``split'' mode output by @code{makeinfo --html}), you'll
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
803 certainly want to use subdirectories, or two nodes with the same name
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
804 in different manuals will overwrite each other.
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
805
7137
cb7baccfb818 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6946
diff changeset
806 Please make these @code{install-@var{format}} targets invoke the
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
807 commands for the @var{format} target, for example, by making
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
808 @var{format} a dependency.
6943
64f144ace584 Sync from upstream.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6775
diff changeset
809
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
810 @item uninstall
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
811 Delete all the installed files---the copies that the @samp{install}
5560
c4421f9ee757 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5514
diff changeset
812 and @samp{install-*} targets create.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
813
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
814 This rule should not modify the directories where compilation is done,
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
815 only the directories where files are installed.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
816
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
817 The uninstallation commands are divided into three categories, just like
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
818 the installation commands. @xref{Install Command Categories}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
819
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
820 @item install-strip
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
821 Like @code{install}, but strip the executable files while installing
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
822 them. In simple cases, this target can use the @code{install} target in
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
823 a simple way:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
824
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
825 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
826 install-strip:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
827 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
828 install
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
829 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
830
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
831 But if the package installs scripts as well as real executables, the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
832 @code{install-strip} target can't just refer to the @code{install}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
833 target; it has to strip the executables but not the scripts.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
834
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
835 @code{install-strip} should not strip the executables in the build
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
836 directory which are being copied for installation. It should only strip
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
837 the copies that are installed.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
838
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
839 Normally we do not recommend stripping an executable unless you are sure
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
840 the program has no bugs. However, it can be reasonable to install a
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
841 stripped executable for actual execution while saving the unstripped
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
842 executable elsewhere in case there is a bug.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
843
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
844 @item clean
5514
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
845 Delete all files in the current directory that are normally created by
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
846 building the program. Also delete files in other directories if they
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
847 are created by this makefile. However, don't delete the files that
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
848 record the configuration. Also preserve files that could be made by
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
849 building, but normally aren't because the distribution comes with
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
850 them. There is no need to delete parent directories that were created
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
851 with @samp{mkdir -p}, since they could have existed anyway.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
852
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
853 Delete @file{.dvi} files here if they are not part of the distribution.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
854
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
855 @item distclean
5514
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
856 Delete all files in the current directory (or created by this
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
857 makefile) that are created by configuring or building the program. If
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
858 you have unpacked the source and built the program without creating
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
859 any other files, @samp{make distclean} should leave only the files
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
860 that were in the distribution. However, there is no need to delete
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
861 parent directories that were created with @samp{mkdir -p}, since they
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
862 could have existed anyway.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
863
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
864 @item mostlyclean
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
865 Like @samp{clean}, but may refrain from deleting a few files that people
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
866 normally don't want to recompile. For example, the @samp{mostlyclean}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
867 target for GCC does not delete @file{libgcc.a}, because recompiling it
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
868 is rarely necessary and takes a lot of time.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
869
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
870 @item maintainer-clean
5514
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
871 Delete almost everything that can be reconstructed with this Makefile.
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
872 This typically includes everything deleted by @code{distclean}, plus
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
873 more: C source files produced by Bison, tags tables, Info files, and
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
874 so on.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
875
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
876 The reason we say ``almost everything'' is that running the command
5514
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
877 @samp{make maintainer-clean} should not delete @file{configure} even
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
878 if @file{configure} can be remade using a rule in the Makefile. More
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
879 generally, @samp{make maintainer-clean} should not delete anything
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
880 that needs to exist in order to run @file{configure} and then begin to
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
881 build the program. Also, there is no need to delete parent
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
882 directories that were created with @samp{mkdir -p}, since they could
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
883 have existed anyway. These are the only exceptions;
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
884 @code{maintainer-clean} should delete everything else that can be
f5fa8f8e0958 autoupdate
Karl Berry <karl@freefriends.org>
parents: 5495
diff changeset
885 rebuilt.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
886
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
887 The @samp{maintainer-clean} target is intended to be used by a maintainer of
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
888 the package, not by ordinary users. You may need special tools to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
889 reconstruct some of the files that @samp{make maintainer-clean} deletes.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
890 Since these files are normally included in the distribution, we don't
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
891 take care to make them easy to reconstruct. If you find you need to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
892 unpack the full distribution again, don't blame us.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
893
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
894 To help make users aware of this, the commands for the special
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
895 @code{maintainer-clean} target should start with these two:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
896
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
897 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
898 @@echo 'This command is intended for maintainers to use; it'
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
899 @@echo 'deletes files that may need special tools to rebuild.'
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
900 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
901
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
902 @item TAGS
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
903 Update a tags table for this program.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
904 @c ADR: how?
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
905
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
906 @item info
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
907 Generate any Info files needed. The best way to write the rules is as
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
908 follows:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
909
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
910 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
911 info: foo.info
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
912
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
913 foo.info: foo.texi chap1.texi chap2.texi
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
914 $(MAKEINFO) $(srcdir)/foo.texi
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
915 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
916
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
917 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
918 You must define the variable @code{MAKEINFO} in the Makefile. It should
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
919 run the @code{makeinfo} program, which is part of the Texinfo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
920 distribution.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
921
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
922 Normally a GNU distribution comes with Info files, and that means the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
923 Info files are present in the source directory. Therefore, the Make
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
924 rule for an info file should update it in the source directory. When
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
925 users build the package, ordinarily Make will not update the Info files
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
926 because they will already be up to date.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
927
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
928 @item dvi
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
929 @itemx html
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
930 @itemx pdf
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
931 @itemx ps
6946
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
932 Generate documentation files in the given format. These targets
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
933 should always exist, but any or all can be a no-op if the given output
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
934 format cannot be generated. These targets should not be dependencies
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
935 of the @code{all} target; the user must manually invoke them.
440215b69978 autoupdate
Karl Berry <karl@freefriends.org>
parents: 6943
diff changeset
936
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
937 Here's an example rule for generating DVI files from Texinfo:
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
938
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
939 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
940 dvi: foo.dvi
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
941
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
942 foo.dvi: foo.texi chap1.texi chap2.texi
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
943 $(TEXI2DVI) $(srcdir)/foo.texi
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
944 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
945
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
946 @noindent
13575
34fed8ca014c autoupdate
Karl Berry <karl@freefriends.org>
parents: 13401
diff changeset
947 You must define the variable @code{TEXI2DVI} in the Makefile. It
34fed8ca014c autoupdate
Karl Berry <karl@freefriends.org>
parents: 13401
diff changeset
948 should run the program @code{texi2dvi}, which is part of the Texinfo
34fed8ca014c autoupdate
Karl Berry <karl@freefriends.org>
parents: 13401
diff changeset
949 distribution. (@code{texi2dvi} uses @TeX{} to do the real work of
34fed8ca014c autoupdate
Karl Berry <karl@freefriends.org>
parents: 13401
diff changeset
950 formatting. @TeX{} is not distributed with Texinfo.) Alternatively,
34fed8ca014c autoupdate
Karl Berry <karl@freefriends.org>
parents: 13401
diff changeset
951 write only the dependencies, and allow GNU @code{make} to provide the
34fed8ca014c autoupdate
Karl Berry <karl@freefriends.org>
parents: 13401
diff changeset
952 command.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
953
5495
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
954 Here's another example, this one for generating HTML from Texinfo:
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
955
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
956 @smallexample
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
957 html: foo.html
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
958
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
959 foo.html: foo.texi chap1.texi chap2.texi
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
960 $(TEXI2HTML) $(srcdir)/foo.texi
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
961 @end smallexample
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
962
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
963 @noindent
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
964 Again, you would define the variable @code{TEXI2HTML} in the Makefile;
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
965 for example, it might run @code{makeinfo --no-split --html}
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
966 (@command{makeinfo} is part of the Texinfo distribution).
5fe0551f4ec2 update from gnustandards
Karl Berry <karl@freefriends.org>
parents: 4958
diff changeset
967
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
968 @item dist
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
969 Create a distribution tar file for this program. The tar file should be
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
970 set up so that the file names in the tar file start with a subdirectory
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
971 name which is the name of the package it is a distribution for. This
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
972 name can include the version number.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
973
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
974 For example, the distribution tar file of GCC version 1.40 unpacks into
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
975 a subdirectory named @file{gcc-1.40}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
976
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
977 The easiest way to do this is to create a subdirectory appropriately
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
978 named, use @code{ln} or @code{cp} to install the proper files in it, and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
979 then @code{tar} that subdirectory.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
980
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
981 Compress the tar file with @code{gzip}. For example, the actual
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
982 distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}.
12585
6e2f4ea77ab4 autoupdate
Karl Berry <karl@freefriends.org>
parents: 10774
diff changeset
983 It is ok to support other free compression formats as well.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
984
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
985 The @code{dist} target should explicitly depend on all non-source files
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
986 that are in the distribution, to make sure they are up to date in the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
987 distribution.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
988 @ifset CODESTD
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
989 @xref{Releases, , Making Releases}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
990 @end ifset
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
991 @ifclear CODESTD
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
992 @xref{Releases, , Making Releases, standards, GNU Coding Standards}.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
993 @end ifclear
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
994
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
995 @item check
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
996 Perform self-tests (if any). The user must build the program before
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
997 running the tests, but need not install the program; you should write
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
998 the self-tests so that they work when the program is built but not
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
999 installed.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1000 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1001
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1002 The following targets are suggested as conventional names, for programs
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1003 in which they are useful.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1004
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1005 @table @code
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1006 @item installcheck
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1007 Perform installation tests (if any). The user must build and install
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1008 the program before running the tests. You should not assume that
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1009 @file{$(bindir)} is in the search path.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1010
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1011 @item installdirs
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1012 It's useful to add a target named @samp{installdirs} to create the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1013 directories where files are installed, and their parent directories.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1014 There is a script called @file{mkinstalldirs} which is convenient for
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
1015 this; you can find it in the Gnulib package.
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1016 You can use a rule like this:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1017
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1018 @comment This has been carefully formatted to look decent in the Make manual.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1019 @comment Please be sure not to make it extend any further to the right.--roland
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1020 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1021 # Make sure all installation directories (e.g. $(bindir))
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1022 # actually exist by making them if necessary.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1023 installdirs: mkinstalldirs
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1024 $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1025 $(libdir) $(infodir) \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1026 $(mandir)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1027 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1028
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1029 @noindent
12897
ac01417be8dc autoupdate
Karl Berry <karl@freefriends.org>
parents: 12817
diff changeset
1030 or, if you wish to support @env{DESTDIR} (strongly encouraged),
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1031
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1032 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1033 # Make sure all installation directories (e.g. $(bindir))
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1034 # actually exist by making them if necessary.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1035 installdirs: mkinstalldirs
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1036 $(srcdir)/mkinstalldirs \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1037 $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1038 $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1039 $(DESTDIR)$(mandir)
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1040 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1041
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1042 This rule should not modify the directories where compilation is done.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1043 It should do nothing but create installation directories.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1044 @end table
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1045
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1046 @node Install Command Categories
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1047 @section Install Command Categories
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1048
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1049 @cindex pre-installation commands
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1050 @cindex post-installation commands
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1051 When writing the @code{install} target, you must classify all the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1052 commands into three categories: normal ones, @dfn{pre-installation}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1053 commands and @dfn{post-installation} commands.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1054
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1055 Normal commands move files into their proper places, and set their
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1056 modes. They may not alter any files except the ones that come entirely
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1057 from the package they belong to.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1058
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1059 Pre-installation and post-installation commands may alter other files;
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1060 in particular, they can edit global configuration files or data bases.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1061
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1062 Pre-installation commands are typically executed before the normal
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1063 commands, and post-installation commands are typically run after the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1064 normal commands.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1065
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1066 The most common use for a post-installation command is to run
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1067 @code{install-info}. This cannot be done with a normal command, since
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1068 it alters a file (the Info directory) which does not come entirely and
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1069 solely from the package being installed. It is a post-installation
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1070 command because it needs to be done after the normal command which
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1071 installs the package's Info files.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1072
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1073 Most programs don't need any pre-installation commands, but we have the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1074 feature just in case it is needed.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1075
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1076 To classify the commands in the @code{install} rule into these three
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1077 categories, insert @dfn{category lines} among them. A category line
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1078 specifies the category for the commands that follow.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1079
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1080 A category line consists of a tab and a reference to a special Make
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1081 variable, plus an optional comment at the end. There are three
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1082 variables you can use, one for each category; the variable name
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1083 specifies the category. Category lines are no-ops in ordinary execution
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1084 because these three Make variables are normally undefined (and you
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1085 @emph{should not} define them in the makefile).
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1086
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1087 Here are the three possible category lines, each with a comment that
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1088 explains what it means:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1089
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1090 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1091 $(PRE_INSTALL) # @r{Pre-install commands follow.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1092 $(POST_INSTALL) # @r{Post-install commands follow.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1093 $(NORMAL_INSTALL) # @r{Normal commands follow.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1094 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1095
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1096 If you don't use a category line at the beginning of the @code{install}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1097 rule, all the commands are classified as normal until the first category
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1098 line. If you don't use any category lines, all the commands are
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1099 classified as normal.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1100
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1101 These are the category lines for @code{uninstall}:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1102
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1103 @smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1104 $(PRE_UNINSTALL) # @r{Pre-uninstall commands follow.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1105 $(POST_UNINSTALL) # @r{Post-uninstall commands follow.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1106 $(NORMAL_UNINSTALL) # @r{Normal commands follow.}
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1107 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1108
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1109 Typically, a pre-uninstall command would be used for deleting entries
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1110 from the Info directory.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1111
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1112 If the @code{install} or @code{uninstall} target has any dependencies
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1113 which act as subroutines of installation, then you should start
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1114 @emph{each} dependency's commands with a category line, and start the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1115 main target's commands with a category line also. This way, you can
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1116 ensure that each command is placed in the right category regardless of
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1117 which of the dependencies actually run.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1118
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1119 Pre-installation and post-installation commands should not run any
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1120 programs except for these:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1121
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1122 @example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1123 [ basename bash cat chgrp chmod chown cmp cp dd diff echo
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1124 egrep expand expr false fgrep find getopt grep gunzip gzip
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1125 hostname install install-info kill ldconfig ln ls md5sum
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1126 mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1127 test touch true uname xargs yes
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1128 @end example
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1129
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1130 @cindex binary packages
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1131 The reason for distinguishing the commands in this way is for the sake
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1132 of making binary packages. Typically a binary package contains all the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1133 executables and other files that need to be installed, and has its own
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1134 method of installing them---so it does not need to run the normal
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1135 installation commands. But installing the binary package does need to
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1136 execute the pre-installation and post-installation commands.
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1137
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1138 Programs to build binary packages work by extracting the
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1139 pre-installation and post-installation commands. Here is one way of
5567
946a798ce6cd autoupdate
Karl Berry <karl@freefriends.org>
parents: 5560
diff changeset
1140 extracting the pre-installation commands (the @option{-s} option to
946a798ce6cd autoupdate
Karl Berry <karl@freefriends.org>
parents: 5560
diff changeset
1141 @command{make} is needed to silence messages about entering
946a798ce6cd autoupdate
Karl Berry <karl@freefriends.org>
parents: 5560
diff changeset
1142 subdirectories):
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1143
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1144 @smallexample
5567
946a798ce6cd autoupdate
Karl Berry <karl@freefriends.org>
parents: 5560
diff changeset
1145 make -s -n install -o all \
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1146 PRE_INSTALL=pre-install \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1147 POST_INSTALL=post-install \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1148 NORMAL_INSTALL=normal-install \
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1149 | gawk -f pre-install.awk
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1150 @end smallexample
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1151
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1152 @noindent
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1153 where the file @file{pre-install.awk} could contain this:
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1154
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1155 @smallexample
5567
946a798ce6cd autoupdate
Karl Berry <karl@freefriends.org>
parents: 5560
diff changeset
1156 $0 ~ /^(normal-install|post-install)[ \t]*$/ @{on = 0@}
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1157 on @{print $0@}
5567
946a798ce6cd autoupdate
Karl Berry <karl@freefriends.org>
parents: 5560
diff changeset
1158 $0 ~ /^pre-install[ \t]*$/ @{on = 1@}
4958
93b3f9c4c71e add maintain/standards docs
Karl Berry <karl@freefriends.org>
parents:
diff changeset
1159 @end smallexample