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