[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZpksMGZhggHd=wHVStrN9Wb8RRw-PyDm7fGL3A7YSXdQ@mail.gmail.com>
Date: Thu, 3 Oct 2019 10:14:56 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...com>,
Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] libbpf: Add cscope and TAGS targets to Makefile
On Thu, Oct 3, 2019 at 1:46 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> 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@...hat.com>
> ---
Thanks a lot for adding this!
I tested cscope only and it works (especially without -k), so:
Tested-by: Andrii Nakryiko <andriin@...com>
> tools/lib/bpf/.gitignore | 2 ++
> tools/lib/bpf/Makefile | 10 +++++++++-
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> index d9e9dec04605..c1057c01223e 100644
> --- a/tools/lib/bpf/.gitignore
> +++ b/tools/lib/bpf/.gitignore
> @@ -3,3 +3,5 @@ libbpf.pc
> FEATURE-DUMP.libbpf
> test_libbpf
> libbpf.so.*
> +TAGS
> +cscope.*
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index c6f94cffe06e..57df6b933196 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -262,7 +262,7 @@ clean:
>
>
>
> -PHONY += force elfdep bpfdep
> +PHONY += force elfdep bpfdep cscope TAGS
> force:
>
> elfdep:
> @@ -271,6 +271,14 @@ elfdep:
> bpfdep:
> @if [ "$(feature-bpf)" != "1" ]; then echo "BPF API too old"; exit 1 ; fi
>
> +cscope:
> + (echo \-k; echo \-q; for f in *.c *.h; do echo $$f; done) > cscope.files
> + cscope -b -f cscope.out
1. I'd drop -k, given libbpf is user-land library, so it's convenient
to jump into system headers for some of BPF definitions.
2. Wouldn't this be simpler and work exactly the same?
ls *.c *.h > cscope.files
cscope -b -q -f cscope.out
> +
> +TAGS:
let's make it lower-case, please? Linux makefile supports both `make
tags` and `make TAGS`, but all-caps is terrible :)
> + rm -f TAGS
> + echo *.c *.h | xargs etags -a
nit: might as well do ls *.c *.h for consistency with cscope
suggestion above (though in both cases we just rely on shell expansion
logic, so doesn't matter).
> +
> # 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)
> --
> 2.23.0
>
Powered by blists - more mailing lists