From ea3e67f8918299451cc25698dfcd411c05d8a4ef Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 22 Dec 2022 18:24:46 +0100 Subject: [PATCH] BUILD: makefile: start to automatically collect CFLAGS/LDFLAGS Now OPTIONS_CFLAGS and OPTIONS_LDFLAGS don't need to be set anymore for options USE_xxx that set xxx_CFLAGS or xxx_LDFLAGS. These ones will be automatically connected. The only entry for now that was ready for this was PCRE2, so it was adjusted so as not to append to OPTIONS_LDFLAGS anymore. More will come later. --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 98a1399531..7f96dbc570 100644 --- a/Makefile +++ b/Makefile @@ -795,14 +795,17 @@ OPTIONS_CFLAGS += -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=$(PCRE2_WIDTH) OPTIONS_CFLAGS += $(if $(PCRE2_INC), -I$(PCRE2_INC)) ifneq ($(USE_STATIC_PCRE2),) -OPTIONS_LDFLAGS += $(if $(PCRE2_LIB),-L$(PCRE2_LIB)) -Wl,-Bstatic -L$(PCRE2_LIB) $(PCRE2_LDFLAGS) -Wl,-Bdynamic +PCRE2_LDFLAGS := $(if $(PCRE2_LIB),-L$(PCRE2_LIB)) -Wl,-Bstatic -L$(PCRE2_LIB) $(PCRE2_LDFLAGS) -Wl,-Bdynamic else -OPTIONS_LDFLAGS += $(if $(PCRE2_LIB),-L$(PCRE2_LIB)) -L$(PCRE2_LIB) $(PCRE2_LDFLAGS) +PCRE2_LDFLAGS := $(if $(PCRE2_LIB),-L$(PCRE2_LIB)) -L$(PCRE2_LIB) $(PCRE2_LDFLAGS) endif endif endif +# appends all foo_{C,LD}FLAGS to OPTIONS_{C,LD}FLAGS +$(collect_opts_flags) + #### Global compile options VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) COPTS = -Iinclude