bpftool: Fix version string in recursive builds
authorBen Hutchings <benh@debian.org>
Thu, 13 Aug 2020 23:43:54 +0000 (00:43 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Wed, 9 Feb 2022 08:35:55 +0000 (08:35 +0000)
Forwarded: https://lore.kernel.org/bpf/20200813235837.GA497088@decadent.org.uk/T/#u

When bpftool is built as part of a Debian package build, which itself
uses make, "bpftool version" shows:

    bpftool vmake[4]: Entering directory /build/linux-5.8/tools/bpf/bpftool 5.8.8.0 make[4]: Leaving directory /build/linux-5.8

Although we pass the "--no-print-directory" option, this is overridden
by the environment variable "MAKEFLAGS=w".  Clear MAKEFLAGS for the
"make kernelversion" command.

I have no explanation for the doubled ".8" in the version string, but
this seems to fix that as well.

Signed-off-by: Ben Hutchings <benh@debian.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name bpftool-fix-version-string-in-recursive-builds.patch

tools/bpf/bpftool/Makefile

index b83dbd3cb9c7be60b36c25d5428102b0eec12d97..a509431fdda023522ecb26dda9dfafe924ca377e 100644 (file)
@@ -40,7 +40,7 @@ LIBBPF_INTERNAL_HDRS := $(addprefix $(LIBBPF_HDRS_DIR)/,hashmap.h nlattr.h)
 LIBBPF_BOOTSTRAP_INTERNAL_HDRS := $(addprefix $(LIBBPF_BOOTSTRAP_HDRS_DIR)/,hashmap.h)
 
 ifeq ($(BPFTOOL_VERSION),)
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
+BPFTOOL_VERSION := $(shell MAKEFLAGS= make -rR --no-print-directory -sC ../../.. kernelversion)
 endif
 
 $(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR) $(LIBBPF_BOOTSTRAP_HDRS_DIR):