BACKPORT: 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.

Change-Id: I9453b09945b2a290be088a556e3f7d853589d4c7
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
This commit is contained in:
Toke Høiland-Jørgensen 2019-10-04 17:34:44 +02:00 • committed by basamaryan
commit 5c5b664130
No known key found for this signature in database
GPG key ID: 210D5384FB2A5885
2 changed files with 14 additions and 1 deletions

View file

@ -3,3 +3,6 @@ libbpf.pc
FEATURE-DUMP.libbpf
test_libbpf
libbpf.so.*
TAGS
tags
cscope.*

View file

@ -143,6 +143,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_SHARED) | \
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
sed 's/\[.*\]//' | \
@ -277,7 +279,7 @@ clean:
PHONY += force elfdep bpfdep
PHONY += force elfdep bpfdep cscope tags
force:
elfdep:
@ -286,6 +288,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)