Next: Portable programming, Previous: Flowchart of files and programs, Up: Top [Contents][Index]
The following are directories where the build system installs files. For each of these directories, there is a corresponding variable that Makefile rules can refer to. (Note that accessing these as shell variables within configure.ac is not reliable.)
Each of these variables has a default value.
They may be also be set by the person installing the project;
either when they run
make
(e.g., make prefix=/usr install), or
when they run
configure
(e.g., configure --prefix=/usr).
(Exception: there is no way to override the pkg*
directories from
Automake, except by overriding the variables they are based on).
See also see Directory Variables in The GNU Coding Standards.
Their default values come from the values of prefix
and
exec_prefix
, which are settable with options to the configure
script.
The default value of prefix
is /usr/local, and
the default value of exec_prefix
is ‘$(prefix)’.
Generally, exec_prefix
is used for directories that contain
machine-specific files (such as executables and subroutine libraries),
while $(prefix)
is used directly for other directories.
The build system installs executable programs in the following directories:
bindir
The directory for installing executable programs that users can run. The default value is $(exec_prefix)/bin.
sbindir
The directory for installing executable programs that can be run from the shell, but are only generally useful to system administrators. The default value is $(exec_prefix)/sbin.
libexecdir
pkglibexecdir
The directory for installing executable programs to be run by other programs rather than by users. The default value is $(exec_prefix)/libexec.
The definition of ‘libexecdir’ is the same for all packages, so you should install your data in a subdirectory thereof. Most packages install their data under $(libexecdir)/package-name/, possibly within additional subdirectories thereof, such as $(libexecdir)/package-name/machine/version.
The build system installs data files used by the program in the following directories:
datarootdir
The root of the directory tree for read-only architecture-independent data files. This should normally be /usr/local/share, but The default value is $(prefix)/share. ‘datadir’’s default value is based on this variable; so are ‘infodir’, ‘mandir’, and others.
datadir
pkgdatadir
The directory for installing idiosyncratic read-only architecture-independent data files for this program. This is usually the same place as ‘datarootdir’, but we use the two separate variables so that you can move these program-specific files without altering the location for Info files, man pages, etc.
The default is $(datarootdir).
The definition of ‘datadir’ is the same for all packages, so you should install your data in a subdirectory thereof. Most packages install their data under $(datadir)/package-name/.
sysconfdir
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, /etc/passwd, and so forth belong
here. All the files in this directory should be ordinary ASCII text
files.
The default is $(prefix)/etc.
Do not install executables here in this directory (they probably belong in $(libexecdir) or $(sbindir)). 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 $(localstatedir).
sharedstatedir
The directory for installing architecture-independent data files which the programs modify while they run. The default is $(prefix)/com.
localstatedir
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 $(datadir) or $(sysconfdir). $(localstatedir) The default is $(prefix)/var.
runstatedir
The directory for installing data files which the programs modify
while they run, that pertain to one specific machine, and which need
not persist longer than the execution of the program—which is
generally long-lived, for example, until the next reboot. PID files
for system daemons are a typical use. In addition, this directory
should not be cleaned except perhaps at reboot, while the general
/tmp (TMPDIR
) may be cleaned arbitrarily.
The default is $(localstatedir)/run. Having it as a separate
variable allows
the use of /run if desired, for example.
The following are the directories for installing certain specific types of files:
includedir
pkgincludedir
The directory for installing header files to be included by user programs with the C ‘#include’ preprocessor directive. The default is $(prefix)/include.
Most compilers other than GCC do not look for header files in directory
/usr/local/include. So installing the header files this way is
only useful with GCC. Sometimes this is not a problem because some
libraries are only really intended to work with GCC. But some libraries
are intended to work with other compilers. They should install their
header files in two places, one specified by includedir
and one
specified by oldincludedir
.
oldincludedir
The directory for installing ‘#include’ header files for use with compilers other than GCC. The default is /usr/include.
The Makefile commands should check whether the value of
oldincludedir
is empty. If it is, they should not try to use
it; they should cancel the second installation of the header files.
A package should not replace an existing header in this directory unless
the header came from the same package. Thus, if your Foo package
provides a header file foo.h, then it should install the header
file in the oldincludedir
directory if either (1) there is no
foo.h there or (2) the foo.h that exists came from the Foo
package.
To tell whether foo.h came from the Foo package, put a magic
string in the file—part of a comment—and grep
for that string.
docdir
The directory for installing documentation files (other than Info) for this package. The default is $(datarootdir)/doc/yourpkg. The yourpkg subdirectory, which may include a version number, prevents collisions among files with common names, such as README.
infodir
The directory for installing the Info files for this package.
The default is $(datarootdir)/info.
infodir
is separate from
docdir
for compatibility with existing practice.
htmldir
dvidir
pdfdir
psdir
Directories for installing documentation files in the particular
format. They should all be set to $(docdir)
by default.
Packages which supply several translations
of their documentation should install them in
‘$(htmldir)/’ll, ‘$(pdfdir)/’ll, etc. where
ll is a locale abbreviation such as ‘en’ or ‘pt_BR’.
libdir
pkglibdir
The directory for object files and libraries of object code. Do not install executables here, they probably ought to go in $(libexecdir) instead. The default is $(exec_prefix)/lib.
lispdir
The directory for installing any Emacs Lisp files in this package. The default is $(datarootdir)/emacs/site-lisp.
In order to make ‘@lispdir@’ work, you need the following lines in your configure.ac file:
lispdir='${datarootdir}/emacs/site-lisp' AC_SUBST(lispdir)
localedir
The directory for installing locale-specific message catalogs for this package. The default is $(datarootdir)/locale. This directory usually has a subdirectory per locale.
Unix-style man pages are installed in one of the following:
mandir
The top-level directory for installing the man pages (if any) for this package. The default is $(datarootdir)/man.
man1dir
The directory for installing section 1 man pages. Write it as $(mandir)/man1.
man2dir
The directory for installing section 2 man pages. Write it as $(mandir)/man2
…
• Other Automake installation directories |
Next: Portable programming, Previous: Flowchart of files and programs, Up: Top [Contents][Index]