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.
This commit is contained in:
Willy Tarreau 2019-03-27 10:36:35 +01:00
parent c3643517f3
commit 09fe566936

View File

@ -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