mutt-wizard/Makefile
Ayman Bagabas cd5fd9bde2 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 <ayman.bagabas@gmail.com>
2019-07-01 18:34:07 -04:00

37 lines
1.0 KiB
Makefile

.POSIX:
OS = $(shell uname -s)
ifndef PREFIX
PREFIX = /usr/local
endif
MANPREFIX = $(PREFIX)/share/man
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
for script in bin/*; do \
cp -f $$script $(DESTDIR)$(PREFIX)/bin/; \
chmod 755 $(DESTDIR)$(PREFIX)/$$script; \
done
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
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 \
rm $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \
fi
uninstall:
for script in bin/*; do \
rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \
done
rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard
.PHONY: install uninstall