[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e6c41e47c6a8ab73945e6aac319e0dd53337e1b.1751712192.git.sam@gentoo.org>
Date: Sat, 5 Jul 2025 11:43:12 +0100
From: Sam James <sam@...too.org>
To: bpf@...r.kernel.org,
Andrii Nakryiko <andrii@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Sam James <sam@...too.org>
Subject: [PATCH] tools/libbpf: add WERROR option
Check the 'WERROR' variable and suppress adding '-Werror' if WERROR=0.
This mirrors what tools/perf and other directories in tools do to handle
-Werror rather than adding it unconditionally.
Signed-off-by: Sam James <sam@...too.org>
---
tools/lib/bpf/Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 168140f8e646..9563d37265da 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -77,10 +77,15 @@ else
CFLAGS := -g -O2
endif
+# Treat warnings as errors unless directed not to
+ifneq ($(WERROR),0)
+ CFLAGS += -Werror
+endif
+
# Append required CFLAGS
override CFLAGS += -std=gnu89
override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
-override CFLAGS += -Werror -Wall
+override CFLAGS += -Wall
override CFLAGS += $(INCLUDES)
override CFLAGS += -fvisibility=hidden
override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
--
2.50.0
Powered by blists - more mailing lists