Merge tag 'pci-v3.15-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[deliverable/linux.git] / tools / perf / tests / make
CommitLineData
095ae69b
JO
1PERF := .
2MK := Makefile
3
f7c64474
JO
4include config/Makefile.arch
5
6# FIXME looks like x86 is the only arch running tests ;-)
7# we need some IS_(32/64) flag to make this generic
8ifeq ($(IS_X86_64),1)
9lib = lib64
10else
11lib = lib
12endif
13
0659e669
JO
14has = $(shell which $1 2>/dev/null)
15
095ae69b
JO
16# standard single make variable specified
17make_clean_all := clean all
18make_python_perf_so := python/perf.so
19make_debug := DEBUG=1
20make_no_libperl := NO_LIBPERL=1
21make_no_libpython := NO_LIBPYTHON=1
22make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
23make_no_newt := NO_NEWT=1
24make_no_slang := NO_SLANG=1
25make_no_gtk2 := NO_GTK2=1
26make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
27make_no_demangle := NO_DEMANGLE=1
28make_no_libelf := NO_LIBELF=1
29make_no_libunwind := NO_LIBUNWIND=1
9e8c06ea 30make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
095ae69b
JO
31make_no_backtrace := NO_BACKTRACE=1
32make_no_libnuma := NO_LIBNUMA=1
33make_no_libaudit := NO_LIBAUDIT=1
34make_no_libbionic := NO_LIBBIONIC=1
35make_tags := tags
36make_cscope := cscope
37make_help := help
38make_doc := doc
2a94f6c4
JO
39make_perf_o := perf.o
40make_util_map_o := util/map.o
41make_util_pmu_bison_o := util/pmu-bison.o
c0ec1108
JO
42make_install := install
43make_install_bin := install-bin
dbad4189
JO
44make_install_doc := install-doc
45make_install_man := install-man
46make_install_html := install-html
47make_install_info := install-info
48make_install_pdf := install-pdf
095ae69b
JO
49
50# all the NO_* variable combined
51make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
52make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
53make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
9e8c06ea 54make_minimal += NO_LIBDW_DWARF_UNWIND=1
095ae69b
JO
55
56# $(run) contains all available tests
57run := make_pure
58run += make_clean_all
59run += make_python_perf_so
60run += make_debug
61run += make_no_libperl
62run += make_no_libpython
63run += make_no_scripts
64run += make_no_newt
65run += make_no_slang
66run += make_no_gtk2
67run += make_no_ui
68run += make_no_demangle
69run += make_no_libelf
70run += make_no_libunwind
9e8c06ea 71run += make_no_libdw_dwarf_unwind
095ae69b
JO
72run += make_no_backtrace
73run += make_no_libnuma
74run += make_no_libaudit
75run += make_no_libbionic
095ae69b
JO
76run += make_help
77run += make_doc
78run += make_perf_o
79run += make_util_map_o
2a94f6c4 80run += make_util_pmu_bison_o
c0ec1108
JO
81run += make_install
82run += make_install_bin
dbad4189
JO
83# FIXME 'install-*' commented out till they're fixed
84# run += make_install_doc
85# run += make_install_man
86# run += make_install_html
87# run += make_install_info
88# run += make_install_pdf
095ae69b
JO
89run += make_minimal
90
0659e669
JO
91ifneq ($(call has,ctags),)
92run += make_tags
93endif
94ifneq ($(call has,cscope),)
95run += make_cscope
96endif
97
095ae69b
JO
98# $(run_O) contains same portion of $(run) tests with '_O' attached
99# to distinguish O=... tests
100run_O := $(addsuffix _O,$(run))
101
102# disable some tests for O=...
103run_O := $(filter-out make_python_perf_so_O,$(run_O))
104
105# define test for each compile as 'test_NAME' variable
106# with the test itself as a value
107test_make_tags = test -f tags
108test_make_cscope = test -f cscope.out
109
110test_make_tags_O := $(test_make_tags)
111test_make_cscope_O := $(test_make_cscope)
112
113test_ok := true
114test_make_help := $(test_ok)
115test_make_doc := $(test_ok)
116test_make_help_O := $(test_ok)
117test_make_doc_O := $(test_ok)
118
119test_make_python_perf_so := test -f $(PERF)/python/perf.so
120
2a94f6c4
JO
121test_make_perf_o := test -f $(PERF)/perf.o
122test_make_util_map_o := test -f $(PERF)/util/map.o
123test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o
095ae69b 124
ee4ad93e
JO
125define test_dest_files
126 for file in $(1); do \
127 if [ ! -x $$TMP_DEST/$$file ]; then \
128 echo " failed to find: $$file"; \
129 fi \
130 done
131endef
132
133installed_files_bin := bin/perf
134installed_files_bin += etc/bash_completion.d/perf
135installed_files_bin += libexec/perf-core/perf-archive
136
f7c64474
JO
137installed_files_plugins := $(lib)/traceevent/plugins/plugin_cfg80211.so
138installed_files_plugins += $(lib)/traceevent/plugins/plugin_scsi.so
139installed_files_plugins += $(lib)/traceevent/plugins/plugin_xen.so
140installed_files_plugins += $(lib)/traceevent/plugins/plugin_function.so
141installed_files_plugins += $(lib)/traceevent/plugins/plugin_sched_switch.so
142installed_files_plugins += $(lib)/traceevent/plugins/plugin_mac80211.so
143installed_files_plugins += $(lib)/traceevent/plugins/plugin_kvm.so
144installed_files_plugins += $(lib)/traceevent/plugins/plugin_kmem.so
145installed_files_plugins += $(lib)/traceevent/plugins/plugin_hrtimer.so
146installed_files_plugins += $(lib)/traceevent/plugins/plugin_jbd2.so
ee4ad93e
JO
147
148installed_files_all := $(installed_files_bin)
149installed_files_all += $(installed_files_plugins)
150
151test_make_install := $(call test_dest_files,$(installed_files_all))
152test_make_install_O := $(call test_dest_files,$(installed_files_all))
153test_make_install_bin := $(call test_dest_files,$(installed_files_bin))
154test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
c0ec1108 155
dbad4189
JO
156# FIXME nothing gets installed
157test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1
158test_make_install_man_O := $(test_make_install_man)
159
160# FIXME nothing gets installed
161test_make_install_doc := $(test_ok)
162test_make_install_doc_O := $(test_ok)
163
164# FIXME nothing gets installed
165test_make_install_html := $(test_ok)
166test_make_install_html_O := $(test_ok)
167
168# FIXME nothing gets installed
169test_make_install_info := $(test_ok)
170test_make_install_info_O := $(test_ok)
171
172# FIXME nothing gets installed
173test_make_install_pdf := $(test_ok)
174test_make_install_pdf_O := $(test_ok)
175
04b01a1d
JO
176test_make_python_perf_so_O := test -f $$TMP_O/python/perf.so
177test_make_perf_o_O := test -f $$TMP_O/perf.o
178test_make_util_map_o_O := test -f $$TMP_O/util/map.o
2a94f6c4 179test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
095ae69b
JO
180
181test_default = test -x $(PERF)/perf
182test = $(if $(test_$1),$(test_$1),$(test_default))
183
8ba7cdea 184test_default_O = test -x $$TMP_O/perf
095ae69b
JO
185test_O = $(if $(test_$1),$(test_$1),$(test_default_O))
186
187all:
188
189ifdef DEBUG
190d := $(info run $(run))
191d := $(info run_O $(run_O))
192endif
193
194MAKEFLAGS := --no-print-directory
195
196clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
197
198$(run):
199 $(call clean)
c9311674
JO
200 @TMP_DEST=$$(mktemp -d); \
201 cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \
095ae69b
JO
202 echo "- $@: $$cmd" && echo $$cmd > $@ && \
203 ( eval $$cmd ) >> $@ 2>&1; \
ee4ad93e 204 echo " test: $(call test,$@)" >> $@ 2>&1; \
095ae69b 205 $(call test,$@) && \
c9311674
JO
206 rm -f $@ \
207 rm -rf $$TMP_DEST
095ae69b
JO
208
209$(run_O):
210 $(call clean)
8ba7cdea 211 @TMP_O=$$(mktemp -d); \
c9311674
JO
212 TMP_DEST=$$(mktemp -d); \
213 cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
095ae69b
JO
214 echo "- $@: $$cmd" && echo $$cmd > $@ && \
215 ( eval $$cmd ) >> $@ 2>&1 && \
ee4ad93e 216 echo " test: $(call test_O,$@)" >> $@ 2>&1; \
095ae69b
JO
217 $(call test_O,$@) && \
218 rm -f $@ && \
c9311674
JO
219 rm -rf $$TMP_O \
220 rm -rf $$TMP_DEST
095ae69b 221
48878053
ACM
222tarpkg:
223 @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
224 echo "- $@: $$cmd" && echo $$cmd > $@ && \
225 ( eval $$cmd ) >> $@ 2>&1
226
227
228all: $(run) $(run_O) tarpkg
095ae69b
JO
229 @echo OK
230
231out: $(run_O)
232 @echo OK
233
48878053 234.PHONY: all $(run) $(run_O) tarpkg clean
This page took 0.054186 seconds and 5 git commands to generate.