From 7a2d1bfde3d21d21e55d7764de7ace29301aa6db Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 24 May 2016 18:28:33 +0530 Subject: [PATCH] (un)install options for auto-completion files. --- Makefile | 41 +++++++++++++++++++++++++++-------------- README.md | 11 ++++++++++- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 507f53f..0fc0150 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,35 @@ -PREFIX?= /usr/local -BINDIR?= $(PREFIX)/bin -MANDIR?= $(PREFIX)/share/man/man1 -DOCDIR?= $(PREFIX)/share/doc/buku +PREFIX ?= /usr/local +BINDIR ?= $(DESTDIR)$(PREFIX)/bin +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man/man1 +DOCDIR ?= $(DESTDIR)$(PREFIX)/share/doc/buku +BASHCOMPDIR = $(DESTDIR)$(PREFIX)/etc/bash_completion.d +FISHCOMPDIR = $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d +ZSHCOMPDIR = $(DESTDIR)$(PREFIX)/share/zsh/site-functions +.PHONY: all install install.comp uninstall uninstall.comp -.PHONY: install uninstall +all: install: - install -m755 -d $(DESTDIR)$(BINDIR) - install -m755 -d $(DESTDIR)$(MANDIR) - install -m755 -d $(DESTDIR)$(DOCDIR) + install -m755 -d $(BINDIR) + install -m755 -d $(MANDIR) + install -m755 -d $(DOCDIR) gzip -c buku.1 > buku.1.gz - install -m755 buku $(DESTDIR)$(BINDIR) - install -m644 buku.1.gz $(DESTDIR)$(MANDIR) - install -m644 README.md $(DESTDIR)$(DOCDIR) + install -m755 buku $(BINDIR) + install -m644 buku.1.gz $(MANDIR) + install -m644 README.md $(DOCDIR) rm -f buku.1.gz +install.comp: + install -m755 -d $(BASHCOMPDIR) $(FISHCOMPDIR) $(ZSHCOMPDIR) + install -m644 auto-completion/bash/buku-completion.bash $(BASHCOMPDIR) + install -m644 auto-completion/fish/buku.fish $(FISHCOMPDIR) + install -m644 auto-completion/zsh/_buku $(ZSHCOMPDIR) + uninstall: - rm -f $(DESTDIR)$(BINDIR)/buku - rm -f $(DESTDIR)$(MANDIR)/buku.1.gz - rm -rf $(DESTDIR)$(DOCDIR) + rm -f $(BINDIR)/buku + rm -f $(MANDIR)/buku.1.gz + rm -rf $(DOCDIR) + +uninstall.comp: + rm -f $(BASHCOMPDIR)/buku-completion.bash $(FISHCOMPDIR)/buku.fish $(ZSHCOMPDIR)/_buku diff --git a/README.md b/README.md index 9dc439d..a831049 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,16 @@ To remove, run: ## Shell completion -Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [auto-completion/](https://github.com/jarun/buku/blob/master/auto-completion). Please refer to your shell's manual for installation instructions. +Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [auto-completion/](https://github.com/jarun/buku/blob/master/auto-completion). + +Install shell completion scripts: + + $ sudo make install.comp + +Remove shell completion scripts: + + $ sudo make uninstall.comp +`PREFIX` is supported. ## Installing with a package manager