Willy Tarreau | 69e7b7f | 2022-12-22 19:32:24 +0100 | [diff] [blame] | 1 | # this contains various functions and macros used to manipulate USE_* options |
| 2 | # and their flags |
| 3 | |
| 4 | # Depending on the target platform, some options are set, as well as some |
| 5 | # CFLAGS and LDFLAGS. All variables pre-set here will not appear in the build |
| 6 | # options string. They may be set to any value, but are historically set to |
| 7 | # "implicit" which eases debugging. You should not have to change anything |
| 8 | # there unless you're adding support for a new platform. |
| 9 | default_opts = $(foreach name,$(1),$(eval $(name)=implicit)) |
| 10 | |
| 11 | # Return USE_xxx=$(USE_xxx) if the variable was set from the environment or the |
| 12 | # command line. |
| 13 | ignore_implicit = $(if $(subst environment,,$(origin $(1))), \ |
| 14 | $(if $(subst command line,,$(origin $(1))),, \ |
| 15 | $(1)=$($(1))), \ |
| 16 | $(1)=$($(1))) \ |
| 17 | |
| 18 | # This macro collects all USE_* values except those set to "implicit". This |
| 19 | # is used to report a list of all flags which were used to build this version. |
| 20 | # Do not assign anything to it. |
| 21 | build_options = $(foreach opt,$(use_opts),$(call ignore_implicit,$(opt))) |
| 22 | |
| 23 | # Make a list of all known features with +/- prepended depending on their |
| 24 | # activation status. Must be a macro so that dynamically enabled ones are |
| 25 | # evaluated with their current status. |
Willy Tarreau | 848362f | 2022-12-22 19:51:30 +0100 | [diff] [blame^] | 26 | build_features = $(foreach opt,$(patsubst USE_%,%,$(sort $(use_opts))),$(if $(USE_$(opt)),+$(opt),-$(opt))) |
Willy Tarreau | 69e7b7f | 2022-12-22 19:32:24 +0100 | [diff] [blame] | 27 | |
| 28 | # This returns a list of -DUSE_* for all known USE_* that are set |
| 29 | opts_as_defines = $(foreach opt,$(use_opts),$(if $($(opt)),-D$(opt),)) |
| 30 | |
| 31 | # Lists all enabled or disabled options without the "USE_" prefix |
| 32 | enabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),$(opt),)) |
| 33 | disabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt)),,$(opt))) |