aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/Makefile.perf4
-rw-r--r--tools/perf/config/Makefile123
2 files changed, 85 insertions, 42 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5fedd6946f32..bde91f8307ff 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -7,6 +7,8 @@ include config/utilities.mak
7 7
8# Define V to have a more verbose compile. 8# Define V to have a more verbose compile.
9# 9#
10# Define VF to have a more verbose feature check output.
11#
10# Define O to save output files in a separate directory. 12# Define O to save output files in a separate directory.
11# 13#
12# Define ARCH as name of target architecture if you want cross-builds. 14# Define ARCH as name of target architecture if you want cross-builds.
@@ -897,7 +899,7 @@ config-clean:
897clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean 899clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
898 $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS) 900 $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
899 $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf 901 $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
900 $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* 902 $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
901 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean 903 $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
902 $(python-clean) 904 $(python-clean)
903 905
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 1686583ff7fc..39e6e6cca8ed 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -149,6 +149,32 @@ CORE_FEATURE_TESTS = \
149 stackprotector-all \ 149 stackprotector-all \
150 timerfd 150 timerfd
151 151
152LIB_FEATURE_TESTS = \
153 dwarf \
154 glibc \
155 gtk2 \
156 libaudit \
157 libbfd \
158 libelf \
159 libnuma \
160 libperl \
161 libpython \
162 libslang \
163 libunwind
164
165VF_FEATURE_TESTS = \
166 backtrace \
167 fortify-source \
168 gtk2-infobar \
169 libelf-getphdrnum \
170 libelf-mmap \
171 libpython-version \
172 on-exit \
173 stackprotector-all \
174 timerfd \
175 libunwind-debug-frame \
176 bionic
177
152# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. 178# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
153# If in the future we need per-feature checks/flags for features not 179# If in the future we need per-feature checks/flags for features not
154# mentioned in this list we need to refactor this ;-). 180# mentioned in this list we need to refactor this ;-).
@@ -161,17 +187,6 @@ endef
161$(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat))) 187$(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
162 188
163# 189#
164# So here we detect whether test-all was rebuilt, to be able
165# to skip the print-out of the long features list if the file
166# existed before and after it was built:
167#
168ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
169 test-all-failed := 1
170else
171 test-all-failed := 0
172endif
173
174#
175# Special fast-path for the 'all features are available' case: 190# Special fast-path for the 'all features are available' case:
176# 191#
177$(call feature_check,all,$(MSG)) 192$(call feature_check,all,$(MSG))
@@ -180,15 +195,6 @@ $(call feature_check,all,$(MSG))
180# Just in case the build freshly failed, make sure we print the 195# Just in case the build freshly failed, make sure we print the
181# feature matrix: 196# feature matrix:
182# 197#
183ifeq ($(feature-all), 0)
184 test-all-failed := 1
185endif
186
187ifeq ($(test-all-failed),1)
188 $(info )
189 $(info Auto-detecting system features:)
190endif
191
192ifeq ($(feature-all), 1) 198ifeq ($(feature-all), 1)
193 # 199 #
194 # test-all.c passed - just set all the core feature flags to 1: 200 # test-all.c passed - just set all the core feature flags to 1:
@@ -199,27 +205,6 @@ else
199 $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) 205 $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
200endif 206endif
201 207
202#
203# Print the result of the feature test:
204#
205feature_print = $(eval $(feature_print_code)) $(info $(MSG))
206
207define feature_print_code
208 ifeq ($(feature-$(1)), 1)
209 MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
210 else
211 MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
212 endif
213endef
214
215#
216# Only print out our features if we rebuilt the testcases or if a test failed:
217#
218ifeq ($(test-all-failed), 1)
219 $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat)))
220 $(info )
221endif
222
223ifeq ($(feature-stackprotector-all), 1) 208ifeq ($(feature-stackprotector-all), 1)
224 CFLAGS += -fstack-protector-all 209 CFLAGS += -fstack-protector-all
225endif 210endif
@@ -602,3 +587,59 @@ ifdef DESTDIR
602plugindir=$(libdir)/traceevent/plugins 587plugindir=$(libdir)/traceevent/plugins
603plugindir_SQ= $(subst ','\'',$(plugindir)) 588plugindir_SQ= $(subst ','\'',$(plugindir))
604endif 589endif
590
591#
592# Print the result of the feature test:
593#
594feature_print = $(eval $(feature_print_code)) $(info $(MSG))
595
596define feature_print_code
597 ifeq ($(feature-$(1)), 1)
598 MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
599 else
600 MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
601 endif
602endef
603
604PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
605PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
606
607# The $(display_lib) controls the default detection message
608# output. It's set if:
609# - detected features differes from stored features from
610# last build (in PERF-FEATURES file)
611# - one of the $(LIB_FEATURE_TESTS) is not detected
612# - VF is enabled
613
614ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
615 $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
616 display_lib := 1
617endif
618
619feature_check = $(eval $(feature_check_code))
620define feature_check_code
621 ifneq ($(feature-$(1)), 1)
622 display_lib := 1
623 endif
624endef
625
626$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
627
628ifeq ($(VF),1)
629 display_lib := 1
630 display_vf := 1
631endif
632
633ifeq ($(display_lib),1)
634 $(info )
635 $(info Auto-detecting system features:)
636 $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print,$(feat),))
637endif
638
639ifeq ($(display_vf),1)
640 $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print,$(feat),))
641endif
642
643ifeq ($(display_lib),1)
644 $(info )
645endif