summaryrefslogtreecommitdiff
path: root/Makefile
blob: 823e719719947a3929c4c330aae296628a347964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.POSIX:

OS = $(shell uname -s)
ifeq ($(OS), Darwin)
  PREFIX = /usr/local
else
  PREFIX = /usr
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
	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 scriptPath in bin/*; do \
		scriptFile=$$(basename $$scriptPath); \
		rm -f $(DESTDIR)$(PREFIX)/bin/$$scriptFile; \
	done
	rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard
	rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1

.PHONY: install uninstall