include z.mk $(eval $(call ZMK.Import,Directories))
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.
This module provides targets that create all the directories mentioned below, also taking into account the $(Destdir) variable.
This module provides the following variables.
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 of all the other directories.
The default value is /usr/local.
Prefix of directories where executables are installed.
The default value is $(prefix).
Directory with programs available to all users.
The default value is $(exec_prefix)/bin.
Directory with programs available to system administrators.
The default value is $(exec_prefix)/sbin.
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.
Directory several classes of data files.
The default value is $(prefix)/share.
Directory with architecture independent data files.
The default value is $(datarootdir).
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.
Directory with persistent system state, private to the current machine.
The default value is $(prefix)/var.
Directory with ephemeral system state, private to the current machine.
The default value is $(prefix)/run.
Directory with C, C++ and Objective C header files.
The default value is $(prefix)/include.
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.
Directory with documentation in the Info format.
The default value is $(prefix)/doc/info.
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.
Directory with localization catalogs, including message translation tables.
The default value is $(datarootdir)/locale.
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.
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 $< $@
The Directories module first appeared in zmk 0.3
Zygmunt Krynicki <firstname.lastname@example.org>