On Wed, 20 Dec 2017 20:19:43 +0000, Roman Gushchin wrote: > Bpftool determines it's own version based on the kernel > version, which is picked from the linux/version.h header. > > It's strange to use the version of the installed kernel > headers, and makes much more sense to use the version > of the actual source tree, where bpftool sources are. > > This patch adds $(srctree)/usr/include to the list > of include files, which causes bpftool to use the version > from the source tree. > > Example: > before: > > $ bpftool version > bpftool v4.14.6 > > after: > $ bpftool version > bpftool v4.15.0
Thanks for the patch, this would indeed use some improvement. How about we just run make to get the version like liblockdep does? LIBLOCKDEP_VERSION=$(shell make --no-print-directory -sC ../../.. kernelversion) probably s@../../..@$(srctree)@ $(srctree)/usr/include is not going to be there for out-of-source builds. > Signed-off-by: Roman Gushchin <[email protected]> > Cc: Jakub Kicinski <[email protected]> > Cc: Alexei Starovoitov <[email protected]> > Cc: Daniel Borkmann <[email protected]> > --- > tools/bpf/bpftool/Makefile | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index 9c089cfa5f3f..6864d416c49e 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -37,7 +37,9 @@ CC = gcc > > CFLAGS += -O2 > CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow > -CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi > -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf -I$(srctree)/kernel/bpf/ > +CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi > +CFLAGS += -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf > +CFLAGS += -I$(srctree)/kernel/bpf/ -I$(srctree)/usr/include > LIBS = -lelf -lbfd -lopcodes $(LIBBPF) > > INSTALL ?= install
