aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-27 13:21:22 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-27 13:21:22 +0100
commit1bd3372d30df987cf29bb9055e4bf6c210221231 (patch)
tree0e1d1c01ee23e8b64d03ab1cff8a11b7f87efb71 /Makefile
parentimprove makefile (diff)
downloadbfind-1bd3372d30df987cf29bb9055e4bf6c210221231.tar.gz
bfind-1bd3372d30df987cf29bb9055e4bf6c210221231.tar.bz2
bfind-1bd3372d30df987cf29bb9055e4bf6c210221231.tar.xz
add shell tab-completion
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile50
1 files changed, 46 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 98953ee..de78779 100644
--- a/Makefile
+++ b/Makefile
@@ -15,10 +15,10 @@ PY3_SHEBANG = /usr/bin/env python3
.PHONY: default
-default: cmd info
+default: cmd info shell
.PHONY: all
-all: cmd doc
+all: cmd doc shell
.PHONY: cmd
cmd: bin/bfind
@@ -62,13 +62,34 @@ bin/%.ps: doc/info/%.texinfo
cd obj/ps && texi2pdf --ps ../../"$<" < /dev/null
mv obj/ps/$*.ps $@
+.PHONY: shell
+shell: bash fish zsh
+
+.PHONY: bash
+bash: bin/bfind.bash-completion
+
+.PHONY: fish
+fish: bin/bfind.fish-completion
+
+.PHONY: zsh
+zsh: bin/bfind.zsh-completion
+
+obj/bfind.auto-completion: src/bfind.auto-completion
+ @mkdir -p obj
+ cp $< $@
+ sed -i 's/^(bfind$$/($(COMMAND)/' $@
+
+bin/bfind.%sh-completion: obj/bfind.auto-completion
+ @mkdir -p bin
+ auto-auto-complete $*sh --output $@ --source $<
+
.PHONY: install-default
-install-default: install-core install-info
+install-default: install-core install-info install-shell
.PHONY: install
-install: install-core install-doc
+install: install-core install-doc install-shell
.PHONY: install-core
install-core: install-cmd install-license
@@ -106,6 +127,24 @@ install-ps: bin/bfind.ps
install -dm755 -- "$(DESTDIR)$(DOCDIR)"
install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps"
+.PHONY: install-shell
+install-shell: install-bash install-fish install-zsh
+
+.PHONY: install-bash
+install-bash: bin/bfind.bash-completion
+ install -dm755 -- "$(DESTDIR)$(DATADIR)/bash-completion/completions"
+ install -m644 $< -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)"
+
+.PHONY: install-fish
+install-fish: bin/bfind.fish-completion
+ install -dm755 -- "$(DESTDIR)$(DATADIR)/fish/completions"
+ install -m644 $< -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish"
+
+.PHONY: install-zsh
+install-zsh: bin/bfind.zsh-completion
+ install -dm755 -- "$(DESTDIR)$(DATADIR)/zsh/site-functions"
+ install -m644 $< -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)"
+
.PHONY: uninstall
@@ -118,6 +157,9 @@ uninstall:
-rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf"
-rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi"
-rm -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps"
+ -rm -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)"
+ -rm -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish"
+ -rm -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)"