]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: Makefile: consider a variable's origin and not its value for the options list
authorWilly Tarreau <w@1wt.eu>
Wed, 27 Mar 2019 09:36:35 +0000 (10:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Mar 2019 13:30:16 +0000 (14:30 +0100)
Right now it's annoying not to be able to enumerate disabled options that
are set by default for a given target. The reason is that we rely on the
fact that the variable is neither cleared nor set to "implicit" in order
to list it.

Here we modify the ignore_implicit function to check the variable's origin
instead of its value. We consider as modified any variable whose origin is
"environment" or "command". Other ones are "undefined" (variable not set)
and "file" (variable set in the Makefile). For now this doesn't change
anything since variables are only dumped when not empty. However if a
variable was forced to "implicit" on the command line, it would now appear.

Makefile

index 9f2c9bce455cd9170a46914ed0918f9b1d4ce6a2..80a52238d8a010c512804f323c14600a6cebcb9e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -469,10 +469,14 @@ EXTRA_OBJS =
 # Do not assign anything to it.
 BUILD_OPTIONS =
 
-# Return USE_xxx=$(USE_xxx) unless $(USE_xxx) = "implicit"
-# Usage: 
+# Return USE_xxx=$(USE_xxx) if the variable was set from the environment or the
+# command line.
+# Usage:
 #   BUILD_OPTIONS += $(call ignore_implicit,USE_xxx)
-ignore_implicit = $(patsubst %=implicit,,$(1)=$($(1)))
+ignore_implicit = $(if $(subst environment,,$(origin $(1))),         \
+                       $(if $(subst command line,,$(origin $(1))),,  \
+                            $(1)=$($(1))),                           \
+                       $(1)=$($(1)))                                 \
 
 ifneq ($(USE_LINUX_SPLICE),)
 OPTIONS_CFLAGS += -DCONFIG_HAP_LINUX_SPLICE