From c42fca1db27f3b79fa0b52869c3eb94104a82561 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 10 Apr 2024 09:36:48 +0200 Subject: [PATCH] BUILD: makefile: get rid of the config CFLAGS variable CFLAGS currently is a concatenation of 4 other variables, some of which are dynamically determined. This has long been totally unusable to pass any extra option. Let's just get rid of it and pass the 4 variables at the 3 only places CFLAGS was used. This will later allow us to make CFLAGS something really usable. This also has the benefit of implicitly restoring the build on AIX5 which needs to disable DEBUG_CFLAGS to solve symbol issues when built with -g. Indeed, that one got ignored since the targets moved past the CFLAGS definition which collects DEBUG_CFLAGS. --- Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 441238fcd..77f22a1bd 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,6 @@ # CC is set to "cc" by default and is used for compilation only. # LD is set to "cc" by default and is used for linking only. # ARCH may be useful to force build of 32-bit binary on 64-bit systems -# CFLAGS is automatically set for the specified CPU and may be overridden. # LDFLAGS is automatically set to -g and may be overridden. # DEP may be cleared to ignore changes to include files during development # SMALL_OPTS may be used to specify some options to shrink memory usage. @@ -285,12 +284,6 @@ ARCH_FLAGS.i686 = -m32 -march=i686 ARCH_FLAGS.x86_64 = -m64 -march=x86-64 ARCH_FLAGS = $(ARCH_FLAGS.$(ARCH)) -#### Common CFLAGS -# These CFLAGS contain general optimization options, CPU-specific optimizations -# and debug flags. They may be overridden by some distributions which prefer to -# set all of them at once instead of playing with the CPU and DEBUG variables. -CFLAGS = $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) - #### Common LDFLAGS # These LDFLAGS are used as the first "ld" options, regardless of any library # path or any other option. They may be changed to add any linker-specific @@ -471,7 +464,7 @@ $(set_target_defaults) # linking with it by default as it's not always available nor deployed # (especially on archs which do not need it). ifneq ($(USE_THREAD:0=),) - ifneq ($(shell $(CC) $(CFLAGS) -dM -E -xc - /dev/null | grep -c 'LOCK_FREE.*1'),0) + ifneq ($(shell $(CC) $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) -dM -E -xc - /dev/null | grep -c 'LOCK_FREE.*1'),0) USE_LIBATOMIC = implicit endif endif @@ -840,10 +833,10 @@ endif $(collect_opts_flags) #### Global compile options -VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) +VERBOSE_CFLAGS = $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) COPTS = -Iinclude -COPTS += $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE) +COPTS += $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE) COPTS += $(DEBUG) $(OPTIONS_CFLAGS) $(ADDINC) ifneq ($(VERSION)$(SUBVERS)$(EXTRAVERSION),)