summaryrefslogtreecommitdiff
path: root/tools/perf/config/Makefile
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-10-01 12:14:31 (GMT)
committerIngo Molnar <mingo@kernel.org>2013-10-09 06:48:49 (GMT)
commitbaa9c30e1e250abf3e53b98e5bcf415dccdc7ba2 (patch)
tree1bf3e1b7548aa685eb2b187690aa11fbe49f38fc /tools/perf/config/Makefile
parentfb1c9185e36cf9c616ac15f54e54a01f052672bd (diff)
downloadlinux-baa9c30e1e250abf3e53b98e5bcf415dccdc7ba2.tar.xz
tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target
Concatenate all feature checks into test-all.c. This can be built and checked faster than all the individual tests. If test-all fails then we still check all the individual features, so this is a pure speedup, it should have no effects on functionality. Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Namhyung Kim <namhyung@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-5hlcb2qorzwfwrWTjiygjjih@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/config/Makefile')
-rw-r--r--tools/perf/config/Makefile45
1 files changed, 39 insertions, 6 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 3207c25..cbd7cdc 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -89,17 +89,21 @@ CFLAGS += -std=gnu99
EXTLIBS = -lelf -lpthread -lrt -lm -ldl
-feature_check = $(eval $(feature_check_code)); $(info CHK: config/feature-checks/test-$(1))
+feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(2) := $(shell make -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+endef
+
+feature_set = $(eval $(feature_set_code))
+define feature_set_code
+ feature-$(1) := 1
endef
#
# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
#
-$(info Testing features:)
-$(shell make -i -j -C config/feature-checks >/dev/null 2>&1)
-$(info done)
+$(info )
+$(info Auto-detecting system features:)
FEATURE_TESTS = \
hello \
@@ -126,7 +130,36 @@ FEATURE_TESTS = \
backtrace \
libnuma
-$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
+#
+# Special fast-path for the 'all features are available' case:
+#
+$(call feature_check,all)
+
+ifeq ($(feature-all), 1)
+ $(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat)))
+else
+ $(shell $(MAKE) -i -j -C config/feature-checks >/dev/null 2>&1)
+ $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat)))
+endif
+
+feature_print = $(eval $(feature_print_code))
+
+#
+# Print the result of the feature test:
+#
+define feature_print_code
+ ifeq ($(feature-$(1)), 1)
+ MSG := $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
+ else
+ MSG := $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
+ endif
+ $(info $(MSG))
+endef
+
+$(foreach feat,$(FEATURE_TESTS) DUMMY,$(call feature_print,$(feat)))
+
+# newline at the end of the feature printouts:
+$(info )
ifeq ($(feature-stackprotector-all), 1)
CFLAGS += -fstack-protector-all