summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/Makefile
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@redhat.com>2019-10-04 18:34:44 +0300
committerAlexei Starovoitov <ast@kernel.org>2019-10-06 04:24:56 +0300
commita9eb048d5615152dc4b8aedb7e704a4e59bc2205 (patch)
tree58878a14962f410b46e4ee04529dc893993785da /tools/lib/bpf/Makefile
parentb84fbfe2ceed14a3623739ba72a2c1f4db003f1e (diff)
downloadlinux-a9eb048d5615152dc4b8aedb7e704a4e59bc2205.tar.xz
libbpf: Add cscope and tags targets to Makefile
Using cscope and/or TAGS files for navigating the source code is useful. Add simple targets to the Makefile to generate the index files for both tools. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20191004153444.1711278-1-toke@redhat.com
Diffstat (limited to 'tools/lib/bpf/Makefile')
-rw-r--r--tools/lib/bpf/Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index c6f94cffe06e..10b77644a17c 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -133,6 +133,8 @@ LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE))
+TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags)
+
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \
@@ -262,7 +264,7 @@ clean:
-PHONY += force elfdep bpfdep
+PHONY += force elfdep bpfdep cscope tags
force:
elfdep:
@@ -271,6 +273,14 @@ elfdep:
bpfdep:
@if [ "$(feature-bpf)" != "1" ]; then echo "BPF API too old"; exit 1 ; fi
+cscope:
+ ls *.c *.h > cscope.files
+ cscope -b -q -I $(srctree)/include -f cscope.out
+
+tags:
+ rm -f TAGS tags
+ ls *.c *.h | xargs $(TAGS_PROG) -a
+
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)