diff mbox series

[bpf,v1] tools/bpftool: support passing BPFTOOL_VERSION to make

Message ID 20200917115833.1235518-1-Tony.Ambardar@gmail.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [bpf,v1] tools/bpftool: support passing BPFTOOL_VERSION to make | expand

Commit Message

Tony Ambardar Sept. 17, 2020, 11:58 a.m. UTC
This change facilitates out-of-tree builds, packaging, and versioning for
test and debug purposes. Defining BPFTOOL_VERSION allows self-contained
builds within the tools tree, since it avoids use of the 'kernelversion'
target in the top-level makefile, which would otherwise pull in several
other includes from outside the tools tree.

Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
---
 tools/bpf/bpftool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Quentin Monnet Sept. 17, 2020, 2:56 p.m. UTC | #1
On 17/09/2020 12:58, Tony Ambardar wrote:
> This change facilitates out-of-tree builds, packaging, and versioning for
> test and debug purposes. Defining BPFTOOL_VERSION allows self-contained
> builds within the tools tree, since it avoids use of the 'kernelversion'
> target in the top-level makefile, which would otherwise pull in several
> other includes from outside the tools tree.
> 
> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>

Acked-by: Quentin Monnet <quentin@isovalent.com>
Song Liu Sept. 17, 2020, 11:27 p.m. UTC | #2
On Thu, Sep 17, 2020 at 7:58 AM Quentin Monnet <quentin@isovalent.com> wrote:
>
> On 17/09/2020 12:58, Tony Ambardar wrote:
> > This change facilitates out-of-tree builds, packaging, and versioning for
> > test and debug purposes. Defining BPFTOOL_VERSION allows self-contained
> > builds within the tools tree, since it avoids use of the 'kernelversion'
> > target in the top-level makefile, which would otherwise pull in several
> > other includes from outside the tools tree.
> >
> > Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
>
> Acked-by: Quentin Monnet <quentin@isovalent.com>

Acked-by: Song Liu <songliubraving@fb.com>
Tony Ambardar Sept. 18, 2020, 1:08 a.m. UTC | #3
On Thu, 17 Sep 2020 at 16:27, Song Liu <song@kernel.org> wrote:
>
> On Thu, Sep 17, 2020 at 7:58 AM Quentin Monnet <quentin@isovalent.com> wrote:
> >
> > On 17/09/2020 12:58, Tony Ambardar wrote:
> > > This change facilitates out-of-tree builds, packaging, and versioning for
> > > test and debug purposes. Defining BPFTOOL_VERSION allows self-contained
> > > builds within the tools tree, since it avoids use of the 'kernelversion'
> > > target in the top-level makefile, which would otherwise pull in several
> > > other includes from outside the tools tree.
> > >
> > > Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
> >
> > Acked-by: Quentin Monnet <quentin@isovalent.com>
>
> Acked-by: Song Liu <songliubraving@fb.com>

I should clarify for those performing stand-alone builds that a few
items are still required from outside the tools/ tree:
kernel/bpf/disasm.[ch] and scripts/bpf_helpers_doc.py. Not sure that's
worth updating the commit description however.
Daniel Borkmann Sept. 18, 2020, 11:11 p.m. UTC | #4
On 9/17/20 1:58 PM, Tony Ambardar wrote:
> This change facilitates out-of-tree builds, packaging, and versioning for
> test and debug purposes. Defining BPFTOOL_VERSION allows self-contained
> builds within the tools tree, since it avoids use of the 'kernelversion'
> target in the top-level makefile, which would otherwise pull in several
> other includes from outside the tools tree.
> 
> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 8462690a039b..4828913703b6 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -25,7 +25,7 @@  endif
 
 LIBBPF = $(LIBBPF_PATH)libbpf.a
 
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
+BPFTOOL_VERSION ?= $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
 
 $(LIBBPF): FORCE
 	$(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))