Next: , Previous: , Up: Use Cases for the GNU Build System   [Contents][Index]


2.2.3 Standard Directory Variables

The GNU Coding Standards also specify a hierarchy of variables to denote installation directories. Some of these are:

Directory variableDefault value
prefix/usr/local
  exec_prefix${prefix}
    bindir${exec_prefix}/bin
    libdir${exec_prefix}/lib
    …
  includedir${prefix}/include
  datarootdir${prefix}/share
    datadir${datarootdir}
    mandir${datarootdir}/man
    infodir${datarootdir}/info
    docdir${datarootdir}/doc/${PACKAGE}
  …

Each of these directories has a role which is often obvious from its name. In a package, any installable file will be installed in one of these directories. For instance in amhello-1.0, the program hello is to be installed in bindir, the directory for binaries. The default value for this directory is /usr/local/bin, but the user can supply a different value when calling configure. Also the file README will be installed into docdir, which defaults to /usr/local/share/doc/amhello.

As a user, if you wish to install a package on your own account, you could proceed as follows:

~/amhello-1.0 % ./configure --prefix ~/usr
…
~/amhello-1.0 % make
…
~/amhello-1.0 % make install

This would install ~/usr/bin/hello and ~/usr/share/doc/amhello/README.

The list of all such directory options is shown by ./configure --help.