-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory-Variables.html
More file actions
274 lines (228 loc) · 12.5 KB
/
Directory-Variables.html
File metadata and controls
274 lines (228 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<html lang="en">
<head>
<title>GNU `make'</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU `make'">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="Directory%20Variables">Directory Variables</a>,
Next:<a rel="next" accesskey="n" href="Standard-Targets.html#Standard%20Targets">Standard Targets</a>,
Previous:<a rel="previous" accesskey="p" href="Command-Variables.html#Command%20Variables">Command Variables</a>,
Up:<a rel="up" accesskey="u" href="Makefile-Conventions.html#Makefile%20Conventions">Makefile Conventions</a>
<hr><br>
</div>
<h3 class="section">Variables for Installation Directories</h3>
<p>Installation directories should always be named by variables, so it is
easy to install in a nonstandard place. The standard names for these
variables are described below. They are based on a standard filesystem
layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4,
and other modern operating systems.
<p>These two variables set the root for the installation. All the other
installation directories should be subdirectories of one of these two,
and nothing should be directly installed into these two directories.
<dl>
<dt><code>prefix</code>
<dd>A prefix used in constructing the default values of the variables listed
below. The default value of <code>prefix</code> should be <code>/usr/local</code>.
When building the complete GNU system, the prefix will be empty and
<code>/usr</code> will be a symbolic link to <code>/</code>.
(If you are using Autoconf, write it as <code>@prefix@</code>.)
<p>Running <code>make install</code> with a different value of <code>prefix</code> from
the one used to build the program should <em>not</em> recompile the
program.
<br><dt><code>exec_prefix</code>
<dd>A prefix used in constructing the default values of some of the
variables listed below. The default value of <code>exec_prefix</code> should
be <code>$(prefix)</code>.
(If you are using Autoconf, write it as <code>@exec_prefix@</code>.)
<p>Generally, <code>$(exec_prefix)</code> is used for directories that contain
machine-specific files (such as executables and subroutine libraries),
while <code>$(prefix)</code> is used directly for other directories.
<p>Running <code>make install</code> with a different value of <code>exec_prefix</code>
from the one used to build the program should <em>not</em> recompile the
program.
</dl>
<p>Executable programs are installed in one of the following directories.
<dl>
<dt><code>bindir</code>
<dd>The directory for installing executable programs that users can run.
This should normally be <code>/usr/local/bin</code>, but write it as
<code>$(exec_prefix)/bin</code>.
(If you are using Autoconf, write it as <code>@bindir@</code>.)
<br><dt><code>sbindir</code>
<dd>The directory for installing executable programs that can be run from
the shell, but are only generally useful to system administrators. This
should normally be <code>/usr/local/sbin</code>, but write it as
<code>$(exec_prefix)/sbin</code>.
(If you are using Autoconf, write it as <code>@sbindir@</code>.)
<br><dt><code>libexecdir</code>
<dd>The directory for installing executable programs to be run by other
programs rather than by users. This directory should normally be
<code>/usr/local/libexec</code>, but write it as <code>$(exec_prefix)/libexec</code>.
(If you are using Autoconf, write it as <code>@libexecdir@</code>.)
</dl>
<p>Data files used by the program during its execution are divided into
categories in two ways.
<ul>
<li>Some files are normally modified by programs; others are never normally
modified (though users may edit some of these).
<li>Some files are architecture-independent and can be shared by all
machines at a site; some are architecture-dependent and can be shared
only by machines of the same kind and operating system; others may never
be shared between two machines.
</ul>
<p>This makes for six different possibilities. However, we want to
discourage the use of architecture-dependent files, aside from object
files and libraries. It is much cleaner to make other data files
architecture-independent, and it is generally not hard.
<p>Therefore, here are the variables Makefiles should use to specify
directories:
<dl>
<dt><code>datadir</code>
<dd>The directory for installing read-only architecture independent data
files. This should normally be <code>/usr/local/share</code>, but write it as
<code>$(prefix)/share</code>.
(If you are using Autoconf, write it as <code>@datadir@</code>.)
As a special exception, see <code>$(infodir)</code>
and <code>$(includedir)</code> below.
<br><dt><code>sysconfdir</code>
<dd>The directory for installing read-only data files that pertain to a
single machine-that is to say, files for configuring a host. Mailer
and network configuration files, <code>/etc/passwd</code>, and so forth belong
here. All the files in this directory should be ordinary ASCII text
files. This directory should normally be <code>/usr/local/etc</code>, but
write it as <code>$(prefix)/etc</code>.
(If you are using Autoconf, write it as <code>@sysconfdir@</code>.)
<p>Do not install executables here in this directory (they probably belong
in <code>$(libexecdir)</code> or <code>$(sbindir)</code>). Also do not install
files that are modified in the normal course of their use (programs
whose purpose is to change the configuration of the system excluded).
Those probably belong in <code>$(localstatedir)</code>.
<br><dt><code>sharedstatedir</code>
<dd>The directory for installing architecture-independent data files which
the programs modify while they run. This should normally be
<code>/usr/local/com</code>, but write it as <code>$(prefix)/com</code>.
(If you are using Autoconf, write it as <code>@sharedstatedir@</code>.)
<br><dt><code>localstatedir</code>
<dd>The directory for installing data files which the programs modify while
they run, and that pertain to one specific machine. Users should never
need to modify files in this directory to configure the package's
operation; put such configuration information in separate files that go
in <code>$(datadir)</code> or <code>$(sysconfdir)</code>. <code>$(localstatedir)</code>
should normally be <code>/usr/local/var</code>, but write it as
<code>$(prefix)/var</code>.
(If you are using Autoconf, write it as <code>@localstatedir@</code>.)
<br><dt><code>libdir</code>
<dd>The directory for object files and libraries of object code. Do not
install executables here, they probably ought to go in <code>$(libexecdir)</code>
instead. The value of <code>libdir</code> should normally be
<code>/usr/local/lib</code>, but write it as <code>$(exec_prefix)/lib</code>.
(If you are using Autoconf, write it as <code>@libdir@</code>.)
<br><dt><code>infodir</code>
<dd>The directory for installing the Info files for this package. By
default, it should be <code>/usr/local/info</code>, but it should be written
as <code>$(prefix)/info</code>.
(If you are using Autoconf, write it as <code>@infodir@</code>.)
<br><dt><code>lispdir</code>
<dd>The directory for installing any Emacs Lisp files in this package. By
default, it should be <code>/usr/local/share/emacs/site-lisp</code>, but it
should be written as <code>$(prefix)/share/emacs/site-lisp</code>.
<p>If you are using Autoconf, write the default as <code>@lispdir@</code>.
In order to make <code>@lispdir@</code> work, you need the following lines
in your <code>configure.in</code> file:
<pre class="example"> lispdir='${datadir}/emacs/site-lisp'
AC_SUBST(lispdir)
</pre>
<br><dt><code>includedir</code>
<dd>The directory for installing header files to be included by user
programs with the C <code>#include</code> preprocessor directive. This
should normally be <code>/usr/local/include</code>, but write it as
<code>$(prefix)/include</code>.
(If you are using Autoconf, write it as <code>@includedir@</code>.)
<p>Most compilers other than GCC do not look for header files in directory
<code>/usr/local/include</code>. So installing the header files this way is
only useful with GCC. Sometimes this is not a problem because some
libraries are only really intended to work with GCC. But some libraries
are intended to work with other compilers. They should install their
header files in two places, one specified by <code>includedir</code> and one
specified by <code>oldincludedir</code>.
<br><dt><code>oldincludedir</code>
<dd>The directory for installing <code>#include</code> header files for use with
compilers other than GCC. This should normally be <code>/usr/include</code>.
(If you are using Autoconf, you can write it as <code>@oldincludedir@</code>.)
<p>The Makefile commands should check whether the value of
<code>oldincludedir</code> is empty. If it is, they should not try to use
it; they should cancel the second installation of the header files.
<p>A package should not replace an existing header in this directory unless
the header came from the same package. Thus, if your Foo package
provides a header file <code>foo.h</code>, then it should install the header
file in the <code>oldincludedir</code> directory if either (1) there is no
<code>foo.h</code> there or (2) the <code>foo.h</code> that exists came from the Foo
package.
<p>To tell whether <code>foo.h</code> came from the Foo package, put a magic
string in the file--part of a comment--and <code>grep</code> for that string.
</dl>
<p>Unix-style man pages are installed in one of the following:
<dl>
<dt><code>mandir</code>
<dd>The top-level directory for installing the man pages (if any) for this
package. It will normally be <code>/usr/local/man</code>, but you should
write it as <code>$(prefix)/man</code>.
(If you are using Autoconf, write it as <code>@mandir@</code>.)
<br><dt><code>man1dir</code>
<dd>The directory for installing section 1 man pages. Write it as
<code>$(mandir)/man1</code>.
<br><dt><code>man2dir</code>
<dd>The directory for installing section 2 man pages. Write it as
<code>$(mandir)/man2</code>
<br><dt><code>...</code>
<dd>
<strong>Don't make the primary documentation for any GNU software be a
man page. Write a manual in Texinfo instead. Man pages are just for
the sake of people running GNU software on Unix, which is a secondary
application only.</strong>
<br><dt><code>manext</code>
<dd>The file name extension for the installed man page. This should contain
a period followed by the appropriate digit; it should normally be <code>.1</code>.
<br><dt><code>man1ext</code>
<dd>The file name extension for installed section 1 man pages.
<br><dt><code>man2ext</code>
<dd>The file name extension for installed section 2 man pages.
<br><dt><code>...</code>
<dd>Use these names instead of <code>manext</code> if the package needs to install man
pages in more than one section of the manual.
</dl>
<p>And finally, you should set the following variable:
<dl>
<dt><code>srcdir</code>
<dd>The directory for the sources being compiled. The value of this
variable is normally inserted by the <code>configure</code> shell script.
(If you are using Autconf, use <code>srcdir = @srcdir@</code>.)
</dl>
<p>For example:
<pre class="smallexample"> # Common prefix for installation directories.
# NOTE: This directory must exist when you start the install.
prefix = /usr/local
exec_prefix = $(prefix)
# Where to put the executable for the command `gcc'.
bindir = $(exec_prefix)/bin
# Where to put the directories used by the compiler.
libexecdir = $(exec_prefix)/libexec
# Where to put the Info files.
infodir = $(prefix)/info
</pre>
<p>If your program installs a large number of files into one of the
standard user-specified directories, it might be useful to group them
into a subdirectory particular to that program. If you do this, you
should write the <code>install</code> rule to create these subdirectories.
<p>Do not expect the user to include the subdirectory name in the value of
any of the variables listed above. The idea of having a uniform set of
variable names for installation directories is to enable the user to
specify the exact same values for several different GNU packages. In
order for this to be useful, all the packages must be designed so that
they will work sensibly when the user does so.
</body></html>