summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/Makefile
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2017-10-27 00:16:05 +0300
committerDavid S. Miller <davem@davemloft.net>2017-10-29 12:37:33 +0300
commit995231c820e3bd3633cb38bf4ea6f2541e1da331 (patch)
tree8ffebe0e14827876e60e3dcd566836562ecda474 /tools/bpf/bpftool/Makefile
parent2660d226d9901c2c82c81f0b3dc5e6737eed2dfe (diff)
downloadlinux-995231c820e3bd3633cb38bf4ea6f2541e1da331.tar.xz
tools: bpftool: add bash completion for bpftool
Add a completion file for bash. The completion function runs bpftool when needed, making it smart enough to help users complete ids or tags for eBPF programs and maps currently on the system. Update Makefile to install completion file to /usr/share/bash-completion/completions when running `make install`. Emacs file mode and (at the end) Vim modeline have been added, to keep the style in use for most existing bash completion files. In this, it differs from tools/perf/perf-completion.sh, which seems to be the only other completion file among the kernel sources repository. This is also valid for indent style: 4-space indents, as in other completion files. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/bpf/bpftool/Makefile')
-rw-r--r--tools/bpf/bpftool/Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 4f339824ca57..813826c50936 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -46,6 +46,7 @@ $(LIBBPF)-clean:
$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null
prefix = /usr
+bash_compdir ?= $(prefix)/share/bash-completion/completions
CC = gcc
@@ -76,6 +77,8 @@ clean: $(LIBBPF)-clean
install:
install $(OUTPUT)bpftool $(prefix)/sbin/bpftool
+ install -m 0755 -d $(bash_compdir)
+ install -m 0644 bash-completion/bpftool $(bash_compdir)
doc:
$(Q)$(MAKE) -C Documentation/