You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

65 lines
2.5 KiB

  1. .POSIX:
  2. OS = $(shell uname -s)
  3. ifndef PREFIX
  4. PREFIX = /usr/local
  5. endif
  6. ifndef MANPREFIX
  7. MANPREFIX = $(PREFIX)/share/man
  8. endif
  9. ifndef XDG_DATA_HOME
  10. XDG_DATA_HOME = $(HOME)/.local/share
  11. endif
  12. DESTDIR = mutt-wizard
  13. PREFIX_LOCAL = $(XDG_DATA_HOME)
  14. BIN_LOCAL = $(HOME)/.local/bin
  15. MANPREFIX_LOCAL = $(PREFIX_LOCAL)/man
  16. install-local:
  17. cp -f bin/mw bin/mailsync bin/openfile $(BIN_LOCAL)
  18. mkdir -p $(PREFIX_LOCAL)/$(DESTDIR)
  19. cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc $(PREFIX_LOCAL)/$(DESTDIR)
  20. mkdir -p $(MANPREFIX_LOCAL)/man1
  21. cp -f mw.1 $(MANPREFIX_LOCAL)/man1/mw.1
  22. if [ "$(PREFIX_LOCAL)" ]; then \
  23. sed -iba 's:/usr/local:$(PREFIX_LOCAL):' $(PREFIX_LOCAL)/$(DESTDIR)/mutt-wizard.muttrc; \
  24. rm -f $(PREFIX_LOCAL)/$(DESTDIR)/mutt-wizard.muttrcba; \
  25. sed -iba 's:/usr/local:$(PREFIX_LOCAL):' $(BIN_LOCAL)/mw; \
  26. rm -f $(BIN_LOCAL)/mwba; \
  27. sed -iba 's:/usr/local:$(PREFIX_LOCAL):' $(MANPREFIX_LOCAL)/man1/mw.1; \
  28. rm -f $(MANPREFIX_LOCAL)/man1/mw.1ba; \
  29. fi
  30. uninstall-local:
  31. rm -f $(BIN_LOCAL)/mw $(BIN_LOCAL)/mailsync $(BIN_LOCAL)/openfile
  32. rm -rf $(PREFIX_LOCAL)/$(DESTDIR)
  33. rm -f $(MANPREFIX_LOCAL)/man1/mw.1
  34. install:
  35. mkdir -p $(DESTDIR)$(PREFIX)/bin
  36. cp -f bin/mw bin/mailsync bin/openfile $(DESTDIR)$(PREFIX)/bin/
  37. chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile
  38. mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
  39. chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard
  40. cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard
  41. chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc
  42. mkdir -p $(DESTDIR)$(MANPREFIX)/man1
  43. cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
  44. chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1
  45. if [ "$(PREFIX)" ]; then \
  46. sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \
  47. rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \
  48. sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \
  49. rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \
  50. sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \
  51. rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \
  52. fi
  53. uninstall:
  54. rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile
  55. rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard
  56. rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1
  57. .PHONY: install-local uninstall-local install uninstall