Commit a9eb048d authored by Toke Høiland-Jørgensen's avatar Toke Høiland-Jørgensen Committed by Alexei Starovoitov

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: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Tested-by: default avatarAndrii Nakryiko <andriin@fb.com>
Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20191004153444.1711278-1-toke@redhat.com
parent b84fbfe2
...@@ -3,3 +3,6 @@ libbpf.pc ...@@ -3,3 +3,6 @@ libbpf.pc
FEATURE-DUMP.libbpf FEATURE-DUMP.libbpf
test_libbpf test_libbpf
libbpf.so.* libbpf.so.*
TAGS
tags
cscope.*
...@@ -133,6 +133,8 @@ LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) ...@@ -133,6 +133,8 @@ LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE)) LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
PC_FILE := $(addprefix $(OUTPUT),$(PC_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) | \ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \
...@@ -262,7 +264,7 @@ clean: ...@@ -262,7 +264,7 @@ clean:
PHONY += force elfdep bpfdep PHONY += force elfdep bpfdep cscope tags
force: force:
elfdep: elfdep:
...@@ -271,6 +273,14 @@ elfdep: ...@@ -271,6 +273,14 @@ elfdep:
bpfdep: bpfdep:
@if [ "$(feature-bpf)" != "1" ]; then echo "BPF API too old"; exit 1 ; fi @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 # 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. # information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY) .PHONY: $(PHONY)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment