From de4e6e11f26e4dedc39a851eeb2d3ae3ede1f1f2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 11 Apr 2024 15:51:38 +0200 Subject: [PATCH] BUILD: makefile: do not pass warnings to VERBOSE_CFLAGS The VERBOSE_CFLAGS variable is used to report the CFLAGS used in the output of "haproxy -vv". It currently contains all -Wxxx and -Wno-xxx because there was no other possibility till now, but these warnings are highly specific to the compiler version in use, are automatically detected and do not bring value being presented here. Worse, by encouraging users to copy-paste them, they can end up with warnings that are not relevant to their build environment. In addition, their presence there doesn't give indication of whether or not they triggered, so they cannot vouch for the output code quality. Better just not report them there. However, as part of VERBOSE_CFLAGS they were also used to detect whether or not to rebuild, via build_opts, so they still have to be explicitly mentioned there if we want to make sure that changing warning options triggers a rebuild to see their effect. Now we can have more useful outputs like this one which indicate precisely what to use to safely rebuild the executable: Build options : TARGET = linux-glibc CC = gcc CFLAGS = -O2 -g -fwrapv OPTIONS = USE_OPENSSL=1 USE_LUA=1 USE_ZLIB= USE_SLZ=1 USE_DEVICEATLAS=1 USE_51DEGREES=1 USE_WURFL=1 USE_QUIC=1 USE_PROMEX=1 USE_PCRE=1 DEBUG = -DDEBUG_DONT_SHARE_POOLS -DDEBUG_MEMORY_POOLS -DDEBUG_EXPR -DDEBUG_STRICT=2 -DDEBUG_DEV -DDEBUG_MEM_STATS -DDEBUG_POOL_TRACING --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 10b83036a5..8fd32131da 100644 --- a/Makefile +++ b/Makefile @@ -859,7 +859,7 @@ endif $(collect_opts_flags) #### Global compile options -VERBOSE_CFLAGS = $(OPT_CFLAGS) $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(STD_CFLAGS) $(WARN_CFLAGS) $(NOWARN_CFLAGS) $(TARGET_CFLAGS) $(CFLAGS) $(DEFINE) +VERBOSE_CFLAGS = $(OPT_CFLAGS) $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(STD_CFLAGS) $(TARGET_CFLAGS) $(CFLAGS) $(DEFINE) COPTS = -Iinclude COPTS += $(OPT_CFLAGS) $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(STD_CFLAGS) $(WARN_CFLAGS) $(NOWARN_CFLAGS) $(ERROR_CFLAGS) $(TARGET_CFLAGS) $(DEFINE) $(SILENT_DEFINE) @@ -1010,7 +1010,7 @@ IGNORE_OPTS=help install install-man install-doc install-bin \ ifneq ($(TARGET),) ifeq ($(filter $(firstword $(MAKECMDGOALS)),$(IGNORE_OPTS)),) -build_opts = $(shell rm -f .build_opts.new; echo \'$(TARGET) $(BUILD_OPTIONS) $(VERBOSE_CFLAGS) $(DEBUG)\' > .build_opts.new; if cmp -s .build_opts .build_opts.new; then rm -f .build_opts.new; else mv -f .build_opts.new .build_opts; fi) +build_opts = $(shell rm -f .build_opts.new; echo \'$(TARGET) $(BUILD_OPTIONS) $(VERBOSE_CFLAGS) $(WARN_CFLAGS) $(NOWARN_CFLAGS) $(DEBUG)\' > .build_opts.new; if cmp -s .build_opts .build_opts.new; then rm -f .build_opts.new; else mv -f .build_opts.new .build_opts; fi) .build_opts: $(build_opts) else .build_opts: -- 2.47.3