From cd5fd9bde283454bb64549bb064ecd3d50500d23 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 1 Jul 2019 18:14:16 -0400 Subject: Make use of PREFIX environment variable This patch puts the environment variable PREFIX in more use. If specified, mull-wizard Makefile substitute all instances of prefix with the provided environment variable. Signed-off-by: Ayman Bagabas --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 68db4ff..c0a6a05 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,8 @@ .POSIX: OS = $(shell uname -s) -ifeq ($(OS), Darwin) +ifndef PREFIX PREFIX = /usr/local -else - PREFIX = /usr endif MANPREFIX = $(PREFIX)/share/man @@ -18,12 +16,16 @@ install: for shared in share/*; do \ cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ done + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 + if [ "$(PREFIX)" ]; then \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ + fi if [ "$(OS)" = "Darwin" ]; then \ - sed -iba 's/\/usr\//\/usr\/local\//' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ rm $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ fi - mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 uninstall: for script in bin/*; do \ -- cgit v1.2.3