From: Willy Tarreau Date: Wed, 27 Mar 2019 09:36:35 +0000 (+0100) Subject: BUILD: Makefile: consider a variable's origin and not its value for the options list X-Git-Tag: v2.0-dev3~383 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09fe5669365aa20af55e6a3b85e90db724305e35;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/Makefile b/Makefile index 9f2c9bce45..80a52238d8 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