Skip to content

Commit

Permalink
Makefile: set MANDIR according to GNU Install Dirs guidelines
Browse files Browse the repository at this point in the history
As described in GNU Coding Standards.

This is especially useful for
- software distributions that do not follow FHS
- splitted packages
- slim environments, e.g containers

References:

- https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions
- https://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables
- https://refspecs.linuxfoundation.org/fhs.shtml
  • Loading branch information
AndersonTorres authored and rfjakob committed Aug 4, 2024
1 parent c759f1b commit 01d8a0e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ CFLAGS += -Wall -Wextra -Wformat-security -Wconversion -DVERSION=\"$(VERSION)\"
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= /bin
MANDIR ?= /share/man
MAN1DIR ?= $(MANDIR)/man1
SYSCONFDIR ?= /etc
SYSTEMDUNITDIR ?= $(SYSCONFDIR)/systemd/system
PANDOC := $(shell command -v pandoc 2> /dev/null)
Expand Down Expand Up @@ -59,8 +61,8 @@ install-bin: earlyoom

install-man: earlyoom.1.gz
ifdef PANDOC
install -d $(DESTDIR)$(PREFIX)/share/man/man1/
install -m 644 $< $(DESTDIR)$(PREFIX)/share/man/man1/
install -d $(DESTDIR) $(PREFIX)$(MAN1DIR)/
install -m 644 $< $(DESTDIR)$(PREFIX)$(MAN1DIR)/
endif

earlyoom.1.gz: earlyoom.1
Expand All @@ -73,7 +75,7 @@ uninstall: uninstall-bin uninstall-man
rm -f $(DESTDIR)$(SYSTEMDUNITDIR)/earlyoom.service

uninstall-man:
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/earlyoom.1.gz
rm -f $(DESTDIR)$(PREFIX)$(MAN1DIR)/earlyoom.1.gz

uninstall-initscript: uninstall-bin
rm -f $(DESTDIR)$(SYSCONFDIR)/init.d/earlyoom
Expand Down

0 comments on commit 01d8a0e

Please sign in to comment.