zmk.Directories - Man Page

module providing names and rules for common directories

Synopsis

include z.mk

$(eval $(call ZMK.Import,Directories))

Description

The module Directories provides names and rules for commonly used directories. Is is used indirectly by other targets, to know where to install files of various types, but can be also imported and used directly for custom rules.

All directories are derived from the value of prefix. The default value is /usr/local, which is suitable for locally-built and installed software packages. Linux distribution packages are compiled with prefix of /usr, along with dedicated values of sysconfdir and other variables. This customization is usually handled by invoking the configure script with specific command-line options.

Targets

This module provides targets that create all the directories mentioned below, also taking into account the $(Destdir) variable.

Variables

This module provides the following variables.

Destdir

Temporary staging location used while building software packages. It is prepended to all installation targets, to allow them to be redirected to another directory, usually without root privileges.

prefix

Prefix of all the other directories.

The default value is /usr/local.

exec_prefix

Prefix of directories where executables are installed.

The default value is $(prefix).

bindir

Directory with programs available to all users.

The default value is $(exec_prefix)/bin.

sbindir

Directory with programs available to system administrators.

The default value is $(exec_prefix)/sbin.

libexecdir

Directory with programs used not directly invoked by the user.

The default value is $(exec_prefix)/libexec.

This directory differs between two major distribution lines, RedHat and Debian and their respective derivatives. The former uses /usr/libexec while the latter uses /usr/lib.

datarootdir

Directory several classes of data files.

The default value is $(prefix)/share.

datadir

Directory with architecture independent data files.

The default value is $(datarootdir).

sysconfdir

Directory with system configuration files.

The default value is $(prefix)/etc.

In distribution packaging this directory is typically overridden to be detached from prefix and hold the literal value /etc.

sharedstatedir

Directory with system state shared among machines on the network. Virtually extinct, do not use it.

The default value is $(prefix)/com.

localstatedir

Directory with persistent system state, private to the current machine.

The default value is $(prefix)/var.

runstatedir

Directory with ephemeral system state, private to the current machine.

The default value is $(prefix)/run.

includedir

Directory with C, C++ and Objective C header files.

The default value is $(prefix)/include.

docdir

Directory with documentation specific to the project.

The default value is $(prefix)/doc/$(Project.Name). Since the value depends on Project.Name, it is only defined when Project.Name is non-empty.

infodir

Directory with documentation in the Info format.

The default value is $(prefix)/doc/info.

libdir

Directory with static or dynamic libraries.

The default value is $(exec_prefix)/lib.

This directory differs between Linux distributions. Some distributions differentiate between 32bit and 64bit libraries while others store libraries in a directory named after the architecture triplet they are compiled for. It is common for one system to use a mixture of directories used at the same time, mainly to adhere to file system hierarchy standards.

localedir

Directory with localization catalogs, including message translation tables.

The default value is $(datarootdir)/locale.

mandir

Directory root for manual pages. Actual manual pages are stored in sub-directories named after the manual section number.

The default value is $(datarootdir)/man.

man1dir .. man9dir

Directory with manual pages of a specific section.

The default value is $(mandir)/man1 .. $(mandir)/man9.

Examples

The following example illustrates a way to install the program foo to the directory with programs available to all the users. The order-only prerequisite ensures that the target directory is created.

include z.mk

$(eval $(call ZMK.Import,Directories))

$(DESTDIR)$(bindir)/foo: foo | $(DESTDIR)$(bindir)
	install $< $@

History

The Directories module first appeared in zmk 0.3

Authors

Zygmunt Krynicki <me@zygoon.pl>

Info

May 3, 2020