]> git.cworth.org Git - notmuch/commitdiff
contrib/notmuch-mutt: add install target
authorDavid Bremner <david@tethera.net>
Sun, 16 Sep 2018 17:08:07 +0000 (14:08 -0300)
committerDavid Bremner <david@tethera.net>
Tue, 18 Sep 2018 10:54:33 +0000 (07:54 -0300)
The main goal here is to be able to install the notmuch-mutt script
with an absolute shebang. I have tried to make the notmuch-mutt
Makefile use configure information from notmuch if available, but make
suitable guesses if not.

contrib/notmuch-mutt/Makefile

index 87f9031cb4777b27f863da8d33b2a2dbc4c176e7..855438be35779a8497a9a7b4981892fe66af05e3 100644 (file)
@@ -1,5 +1,11 @@
 NAME = notmuch-mutt
 
+-include ../../Makefile.config
+PERL_ABSOLUTE ?= $(shell command -v perl 2>/dev/null)
+prefix ?= /usr/local
+sysconfdir ?= ${prefix}/etc
+mandir ?= ${prefix}/share/man
+
 all: $(NAME) $(NAME).1
 
 $(NAME).1: $(NAME)
@@ -8,5 +14,12 @@ $(NAME).1: $(NAME)
 README.html: README
        markdown $< > $@
 
+install: all
+       mkdir -p $(DESTDIR)$(prefix)/bin
+       sed "1s|^#!.*|#! $(PERL_ABSOLUTE)|" < $(NAME) > $(DESTDIR)$(prefix)/bin/$(NAME)
+       chmod 755 $(DESTDIR)$(prefix)/bin/$(NAME)
+       install -D -m 644 $(NAME).1 $(DESTDIR)$(mandir)/man1/$(NAME).1
+       install -D -m 644 $(NAME).rc $(DESTDIR)$(sysconfdir)/Muttrc.d/$(NAME).rc
+
 clean:
        rm -f notmuch-mutt.1 README.html