From 09fe5669365aa20af55e6a3b85e90db724305e35 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 27 Mar 2019 10:36:35 +0100 Subject: [PATCH] BUILD: Makefile: consider a variable's origin and not its value for the options list 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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9f2c9bce4..80a52238d 100644 --- 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