Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools build: Display logical OR of a feature flavors

Sometimes, features are simply different flavors of another feature, to
properly detect the exact dependencies needed by different Linux
distributions.

For example, libbfd has three flavors: libbfd if the distro does not
require any additional dependency; libbfd-liberty if it requires libiberty;
libbfd-liberty-z if it requires libiberty and libz.

It might not be clear to the user whether a feature has been successfully
detected or not, given that some of its flavors will be set to OFF, others
to ON.

Instead, display only the feature main flavor if not in verbose mode
(VF != 1), and set it to ON if at least one of its flavors has been
successfully detected (logical OR), OFF otherwise. Omit the other flavors.

Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
variable, with the list of the other flavors as variable value. For now, do
it just for libbfd.

In verbose mode, of if no group is defined for a feature, show the feature
detection result as before.

Committer testing:

Collecting the output from:

$ make -C tools/bpf/bpftool/ clean
$ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10

$ diff -u before after
--- before 2022-08-18 10:06:40.422086966 -0300
+++ after 2022-08-18 10:07:59.202138282 -0300
@@ -1,6 +1,4 @@
Auto-detecting system features:
... libbfd: [ on ]
-... libbfd-liberty: [ on ]
-... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
$

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Roberto Sassu and committed by
Arnaldo Carvalho de Melo
74ef1cc9 74da7697

+25 -2
+25 -2
tools/build/Makefile.feature
··· 137 137 libaio \ 138 138 libzstd 139 139 140 + # 141 + # Declare group members of a feature to display the logical OR of the detection 142 + # result instead of each member result. 143 + # 144 + FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z 145 + 140 146 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. 141 147 # If in the future we need per-feature checks/flags for features not 142 148 # mentioned in this list we need to refactor this ;-). ··· 185 179 # 186 180 feature_print_status = $(eval $(feature_print_status_code)) 187 181 182 + feature_group = $(eval $(feature_gen_group)) $(GROUP) 183 + 184 + define feature_gen_group 185 + GROUP := $(1) 186 + ifneq ($(feature_verbose),1) 187 + GROUP += $(FEATURE_GROUP_MEMBERS-$(1)) 188 + endif 189 + endef 190 + 188 191 define feature_print_status_code 189 - ifeq ($(feature-$(1)), 1) 192 + ifneq (,$(filter 1,$(foreach feat,$(call feature_group,$(feat)),$(feature-$(feat))))) 190 193 MSG = $(shell printf '...%40s: [ \033[32mon\033[m ]' $(1)) 191 194 else 192 195 MSG = $(shell printf '...%40s: [ \033[31mOFF\033[m ]' $(1)) ··· 259 244 feature_verbose := 1 260 245 endif 261 246 247 + ifneq ($(feature_verbose),1) 248 + # 249 + # Determine the features to omit from the displayed message, as only the 250 + # logical OR of the detection result will be shown. 251 + # 252 + FEATURE_OMIT := $(foreach feat,$(FEATURE_DISPLAY),$(FEATURE_GROUP_MEMBERS-$(feat))) 253 + endif 254 + 262 255 feature_display_entries = $(eval $(feature_display_entries_code)) 263 256 define feature_display_entries_code 264 257 ifeq ($(feature_display),1) 265 258 $$(info ) 266 259 $$(info Auto-detecting system features:) 267 - $(foreach feat,$(FEATURE_DISPLAY),$(call feature_print_status,$(feat),) $$(info $(MSG))) 260 + $(foreach feat,$(filter-out $(FEATURE_OMIT),$(FEATURE_DISPLAY)),$(call feature_print_status,$(feat),) $$(info $(MSG))) 268 261 endif 269 262 270 263 ifeq ($(feature_verbose),1)