Make Makefile more portable

- Make PREFIX, SYSCONFDIR overridable
- Make MANDIR customizable (for instance, FreeBSD uses $(PREFIX)/man instead of $(PREFIX)/share/man)
This commit is contained in:
Dmitry Marakasov 2017-08-20 13:52:26 +03:00 committed by GitHub
parent ed30d1170a
commit f3be520826

View file

@ -1,5 +1,6 @@
PREFIX = /usr PREFIX ?= /usr
SYSCONFDIR = /etc SYSCONFDIR ?= /etc
MANDIR ?= $(PREFIX)/share/man
all: all:
@echo Run \'make install\' to install Neofetch. @echo Run \'make install\' to install Neofetch.
@ -8,7 +9,7 @@ install:
@echo 'Making directories...' @echo 'Making directories...'
@mkdir -p $(DESTDIR)$(PREFIX)/bin @mkdir -p $(DESTDIR)$(PREFIX)/bin
@mkdir -p $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro @mkdir -p $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro
@mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 @mkdir -p $(DESTDIR)$(MANDIR)/man1
@mkdir -p $(DESTDIR)$(SYSCONFDIR)/neofetch @mkdir -p $(DESTDIR)$(SYSCONFDIR)/neofetch
@echo 'Installing binaries...' @echo 'Installing binaries...'
@ -17,12 +18,12 @@ install:
@echo 'Installing ASCII files, man page and config file...' @echo 'Installing ASCII files, man page and config file...'
@cp -p ascii/distro/* $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro @cp -p ascii/distro/* $(DESTDIR)$(PREFIX)/share/neofetch/ascii/distro
@cp -p neofetch.1 $(DESTDIR)$(PREFIX)/share/man/man1 @cp -p neofetch.1 $(DESTDIR)$(MANDIR)/man1
@cp -p config/config.conf $(DESTDIR)$(SYSCONFDIR)/neofetch/config.conf @cp -p config/config.conf $(DESTDIR)$(SYSCONFDIR)/neofetch/config.conf
uninstall: uninstall:
@echo 'Removing files...' @echo 'Removing files...'
@rm -rf $(DESTDIR)$(PREFIX)/bin/neofetch @rm -rf $(DESTDIR)$(PREFIX)/bin/neofetch
@rm -rf $(DESTDIR)$(PREFIX)/share/man/man1/neofetch.1* @rm -rf $(DESTDIR)$(MANDIR)/man1/neofetch.1*
@rm -rf $(DESTDIR)$(PREFIX)/share/neofetch @rm -rf $(DESTDIR)$(PREFIX)/share/neofetch
@rm -rf $(DESTDIR)$(SYSCONFDIR)/neofetch @rm -rf $(DESTDIR)$(SYSCONFDIR)/neofetch