]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: ensure that all USE_* handlers appear before CFLAGS are used
authorWilly Tarreau <w@1wt.eu>
Thu, 22 Dec 2022 16:58:24 +0000 (17:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Dec 2022 15:53:35 +0000 (16:53 +0100)
It happens that a few "if USE_foo" were placed too low in the makefile,
and would mostly work by luck thanks to not using variables that were
already referenced before. The opentracing include is even trickier
because it extends OPTIONS_CFLAGS that was last read a few lines before
being included, but it only works because COPTS is defined as a macro and
not a variable, so it will be evaluated later. At least now it doesn't
touch OPTIONS_* anymore and since it's cleanly arranged, it will work by
default via the flags collector.

Let's just move these late USE_* handlers upper and place a visible
delimiter after them reminding not to add any after.

Makefile
addons/ot/Makefile

index 7f96dbc570ab127bab372b51f8bbb7d5b7a90a97..5f09c835d733c93a12769fc9f367d847d9110bdc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -803,6 +803,21 @@ endif
 endif
 endif
 
+ifneq ($(USE_NS),)
+OPTIONS_OBJS  += src/namespace.o
+endif
+
+ifneq ($(USE_OT),)
+include addons/ot/Makefile
+endif
+
+ifneq ($(USE_LIBATOMIC),)
+  TARGET_LDFLAGS += -latomic
+endif
+
+#### End of the USE_* options handling, any such option that would be added
+#### below could be silently ignored.
+
 # appends all foo_{C,LD}FLAGS to OPTIONS_{C,LD}FLAGS
 $(collect_opts_flags)
 
@@ -827,18 +842,6 @@ TRACE_COPTS := $(filter-out -O0 -O1 -O2 -pg -finstrument-functions,$(COPTS)) -O3
 COPTS += -finstrument-functions
 endif
 
-ifneq ($(USE_NS),)
-OPTIONS_OBJS  += src/namespace.o
-endif
-
-ifneq ($(USE_OT),)
-include addons/ot/Makefile
-endif
-
-ifneq ($(USE_LIBATOMIC),)
-  TARGET_LDFLAGS += -latomic
-endif
-
 #### Global link options
 # These options are added at the end of the "ld" command line. Use LDFLAGS to
 # add options at the beginning of the "ld" command line if needed.
index 2ee74d32c4583dc5b491afacef8a10a7fc14ff4c..5bf8d9e8ed12e16d290c885085910d0e81d6a517 100644 (file)
@@ -70,6 +70,4 @@ OPTIONS_OBJS += \
        addons/ot/src/vars.o
 endif
 
-OPTIONS_CFLAGS  += $(OT_CFLAGS) -Iaddons/ot/include
-OPTIONS_LDFLAGS += $(OT_LDFLAGS)
-OPTIONS_CFLAGS  += $(OT_DEFINE)
+OT_CFLAGS := $(OT_CFLAGS) -Iaddons/ot/include $(OT_DEFINE)