ZMK.DIRECTORIES(5)

πŸ’– zmk.Directories(5) πŸ’–

okay so bestie, welcome to the Directories module β€” it's from the zmk world, it lives in the LOCAL manual section, and it's genuinely one of the most useful little gremlins in the whole build system. It's all about where stuff goes. πŸ‘‘


✨ NAME ✨

Directories β€” a module that gives you the names and the rules for all the common directories. πŸŽ€


🌸 SYNOPSIS 🌸

include z.mk

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

πŸ¦‹ DESCRIPTION πŸ¦‹

So the Directories module hands you names and rules for the directories everybody keeps using. Other targets import it indirectly so they know where to drop files of every different type β€” but you can totally import it yourself and use it directly for your own custom rules too. no gatekeeping here πŸ’…

Every single directory is derived from the value of prefix. The default is /usr/local, which is the vibe for locally-built and locally-installed software packages. Linux distribution packages though? They get compiled with a prefix of /usr, plus their own dedicated values of sysconfdir and the other variables. That customization is usually handled by invoking the configure script with specific command-line options. iykyk ✨


πŸ”₯ TARGETS πŸ”₯

This module provides targets that create all the directories mentioned below β€” and yes, they take the $(DESTDIR) variable into account too. it's giving thoughtful 🫢


πŸ’œ VARIABLES πŸ’œ

This module provides the following variables. buckle up, there's a lot and they're all iconic in their own way 🌈

🌟 DESTDIR

Temporary staging location used while building software packages. It gets prepended to all installation targets so they can be redirected to another directory β€” usually so you can do the whole thing without root privileges. no sudo, no problem πŸ’…

🌟 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. drama fr fr 😭

🌟 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. πŸ’€ like, it's a fossil, leave it alone bestie

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. conditional queen πŸ‘‘

🌟 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. chaotic but make it standards-compliant ✨

🌟 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. no cap, that pipe is doing the heavy lifting 🫢

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. throwback ✨


πŸ‘‘ AUTHORS πŸ‘‘

Zygmunt Krynicki <me@zygoon.pl> β€” the main character who made all of this πŸ’œ


and that's the whole page bestie!! this is zmk.Directories(5) from the LOCAL manual, and it shipped as part of zmk 0.5.1 dated May 3, 2020. slay, go make some directories πŸŒΈπŸ’–πŸ¦‹