xref: /openbmc/linux/tools/perf/tests/make (revision 814568db641f6587c1e98a3a85f214cb6a30fe10)
1935e6bd3SWang Naninclude ../scripts/Makefile.include
2935e6bd3SWang Nan
3502819c5SJiri Olsaifndef MK
4502819c5SJiri Olsaifeq ($(MAKECMDGOALS),)
5502819c5SJiri Olsa# no target specified, trigger the whole suite
6502819c5SJiri Olsaall:
7502819c5SJiri Olsa	@echo "Testing Makefile";      $(MAKE) -sf tests/make MK=Makefile
8eb807730SWang Nan	@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1
9502819c5SJiri Olsaelse
10502819c5SJiri Olsa# run only specific test over 'Makefile'
11502819c5SJiri Olsa%:
12502819c5SJiri Olsa	@echo "Testing Makefile";      $(MAKE) -sf tests/make MK=Makefile $@
13502819c5SJiri Olsaendif
14502819c5SJiri Olsaelse
15095ae69bSJiri OlsaPERF := .
1668824de1SWang NanPERF_O := $(PERF)
17eb807730SWang NanO_OPT :=
1879191c89SWang NanFULL_O := $(shell readlink -f $(PERF_O) || echo $(PERF_O))
19eb807730SWang Nan
20eb807730SWang Nanifneq ($(O),)
21eb807730SWang Nan  FULL_O := $(shell readlink -f $(O) || echo $(O))
2268824de1SWang Nan  PERF_O := $(FULL_O)
23eb807730SWang Nan  ifeq ($(SET_O),1)
24eb807730SWang Nan    O_OPT := 'O=$(FULL_O)'
25eb807730SWang Nan  endif
26c15e758cSWang Nan  K_O_OPT := 'O=$(FULL_O)'
27eb807730SWang Nanendif
28095ae69bSJiri Olsa
297be43dfbSWang NanPARALLEL_OPT=
307be43dfbSWang Nanifeq ($(SET_PARALLEL),1)
317be43dfbSWang Nan  cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
327be43dfbSWang Nan  ifeq ($(cores),0)
337be43dfbSWang Nan    cores := 1
347be43dfbSWang Nan  endif
357be43dfbSWang Nan  PARALLEL_OPT="-j$(cores)"
367be43dfbSWang Nanendif
377be43dfbSWang Nan
38935e6bd3SWang Nan# As per kernel Makefile, avoid funny character set dependencies
39935e6bd3SWang Nanunexport LC_ALL
40935e6bd3SWang NanLC_COLLATE=C
41935e6bd3SWang NanLC_NUMERIC=C
42935e6bd3SWang Nanexport LC_COLLATE LC_NUMERIC
43935e6bd3SWang Nan
44935e6bd3SWang Nanifeq ($(srctree),)
45935e6bd3SWang Nansrctree := $(patsubst %/,%,$(dir $(shell pwd)))
46935e6bd3SWang Nansrctree := $(patsubst %/,%,$(dir $(srctree)))
47935e6bd3SWang Nan#$(info Determined 'srctree' to be $(srctree))
48935e6bd3SWang Nanendif
49935e6bd3SWang Nan
50935e6bd3SWang Naninclude $(srctree)/tools/scripts/Makefile.arch
51f7c64474SJiri Olsa
52f7c64474SJiri Olsa# FIXME looks like x86 is the only arch running tests ;-)
53f7c64474SJiri Olsa# we need some IS_(32/64) flag to make this generic
5476aea773SH.J. Luifeq ($(ARCH)$(IS_64_BIT), x861)
55f7c64474SJiri Olsalib = lib64
56f7c64474SJiri Olsaelse
57f7c64474SJiri Olsalib = lib
58f7c64474SJiri Olsaendif
59f7c64474SJiri Olsa
600659e669SJiri Olsahas = $(shell which $1 2>/dev/null)
610659e669SJiri Olsa
62095ae69bSJiri Olsa# standard single make variable specified
63095ae69bSJiri Olsamake_clean_all      := clean all
64095ae69bSJiri Olsamake_python_perf_so := python/perf.so
65095ae69bSJiri Olsamake_debug          := DEBUG=1
66095ae69bSJiri Olsamake_no_libperl     := NO_LIBPERL=1
67095ae69bSJiri Olsamake_no_libpython   := NO_LIBPYTHON=1
68095ae69bSJiri Olsamake_no_scripts     := NO_LIBPYTHON=1 NO_LIBPERL=1
69095ae69bSJiri Olsamake_no_newt        := NO_NEWT=1
70095ae69bSJiri Olsamake_no_slang       := NO_SLANG=1
71095ae69bSJiri Olsamake_no_gtk2        := NO_GTK2=1
72095ae69bSJiri Olsamake_no_ui          := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
73095ae69bSJiri Olsamake_no_demangle    := NO_DEMANGLE=1
74095ae69bSJiri Olsamake_no_libelf      := NO_LIBELF=1
75095ae69bSJiri Olsamake_no_libunwind   := NO_LIBUNWIND=1
769e8c06eaSJiri Olsamake_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
77095ae69bSJiri Olsamake_no_backtrace   := NO_BACKTRACE=1
78095ae69bSJiri Olsamake_no_libnuma     := NO_LIBNUMA=1
79095ae69bSJiri Olsamake_no_libaudit    := NO_LIBAUDIT=1
80095ae69bSJiri Olsamake_no_libbionic   := NO_LIBBIONIC=1
81e31f0d01SAdrian Huntermake_no_auxtrace    := NO_AUXTRACE=1
82ed63f34cSWang Nanmake_no_libbpf	    := NO_LIBBPF=1
83095ae69bSJiri Olsamake_tags           := tags
84095ae69bSJiri Olsamake_cscope         := cscope
85095ae69bSJiri Olsamake_help           := help
86095ae69bSJiri Olsamake_doc            := doc
87095ae69bSJiri Olsamake_perf_o           := perf.o
88095ae69bSJiri Olsamake_util_map_o       := util/map.o
892a94f6c4SJiri Olsamake_util_pmu_bison_o := util/pmu-bison.o
90c0ec1108SJiri Olsamake_install        := install
91c0ec1108SJiri Olsamake_install_bin    := install-bin
92dbad4189SJiri Olsamake_install_doc    := install-doc
93dbad4189SJiri Olsamake_install_man    := install-man
94dbad4189SJiri Olsamake_install_html   := install-html
95dbad4189SJiri Olsamake_install_info   := install-info
96dbad4189SJiri Olsamake_install_pdf    := install-pdf
97eb30d2c5SJiri Olsamake_install_prefix       := install prefix=/tmp/krava
98aa53c09eSJiri Olsamake_install_prefix_slash := install prefix=/tmp/krava/
99611ec127SJiri Olsamake_static         := LDFLAGS=-static
100095ae69bSJiri Olsa
101095ae69bSJiri Olsa# all the NO_* variable combined
102095ae69bSJiri Olsamake_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
103095ae69bSJiri Olsamake_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
104095ae69bSJiri Olsamake_minimal        += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
105ed63f34cSWang Nanmake_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
106095ae69bSJiri Olsa
107095ae69bSJiri Olsa# $(run) contains all available tests
108095ae69bSJiri Olsarun := make_pure
109502819c5SJiri Olsa# Targets 'clean all' can be run together only through top level
110502819c5SJiri Olsa# Makefile because we detect clean target in Makefile.perf and
111502819c5SJiri Olsa# disable features detection
112502819c5SJiri Olsaifeq ($(MK),Makefile)
113095ae69bSJiri Olsarun += make_clean_all
114502819c5SJiri Olsaendif
115095ae69bSJiri Olsarun += make_python_perf_so
116095ae69bSJiri Olsarun += make_debug
117095ae69bSJiri Olsarun += make_no_libperl
118095ae69bSJiri Olsarun += make_no_libpython
119095ae69bSJiri Olsarun += make_no_scripts
120095ae69bSJiri Olsarun += make_no_newt
121095ae69bSJiri Olsarun += make_no_slang
122095ae69bSJiri Olsarun += make_no_gtk2
123095ae69bSJiri Olsarun += make_no_ui
124095ae69bSJiri Olsarun += make_no_demangle
125095ae69bSJiri Olsarun += make_no_libelf
126095ae69bSJiri Olsarun += make_no_libunwind
1279e8c06eaSJiri Olsarun += make_no_libdw_dwarf_unwind
128095ae69bSJiri Olsarun += make_no_backtrace
129095ae69bSJiri Olsarun += make_no_libnuma
130095ae69bSJiri Olsarun += make_no_libaudit
131095ae69bSJiri Olsarun += make_no_libbionic
132e31f0d01SAdrian Hunterrun += make_no_auxtrace
133ed63f34cSWang Nanrun += make_no_libbpf
134095ae69bSJiri Olsarun += make_help
135095ae69bSJiri Olsarun += make_doc
136095ae69bSJiri Olsarun += make_perf_o
137095ae69bSJiri Olsarun += make_util_map_o
1382a94f6c4SJiri Olsarun += make_util_pmu_bison_o
139c0ec1108SJiri Olsarun += make_install
140c0ec1108SJiri Olsarun += make_install_bin
141eb30d2c5SJiri Olsarun += make_install_prefix
142aa53c09eSJiri Olsarun += make_install_prefix_slash
143dbad4189SJiri Olsa# FIXME 'install-*' commented out till they're fixed
144dbad4189SJiri Olsa# run += make_install_doc
145dbad4189SJiri Olsa# run += make_install_man
146dbad4189SJiri Olsa# run += make_install_html
147dbad4189SJiri Olsa# run += make_install_info
148dbad4189SJiri Olsa# run += make_install_pdf
149095ae69bSJiri Olsarun += make_minimal
150611ec127SJiri Olsarun += make_static
151095ae69bSJiri Olsa
1520659e669SJiri Olsaifneq ($(call has,ctags),)
1530659e669SJiri Olsarun += make_tags
1540659e669SJiri Olsaendif
1550659e669SJiri Olsaifneq ($(call has,cscope),)
1560659e669SJiri Olsarun += make_cscope
1570659e669SJiri Olsaendif
1580659e669SJiri Olsa
159095ae69bSJiri Olsa# $(run_O) contains same portion of $(run) tests with '_O' attached
160095ae69bSJiri Olsa# to distinguish O=... tests
161095ae69bSJiri Olsarun_O := $(addsuffix _O,$(run))
162095ae69bSJiri Olsa
163095ae69bSJiri Olsa# disable some tests for O=...
164095ae69bSJiri Olsarun_O := $(filter-out make_python_perf_so_O,$(run_O))
165095ae69bSJiri Olsa
166095ae69bSJiri Olsa# define test for each compile as 'test_NAME' variable
167095ae69bSJiri Olsa# with the test itself as a value
168095ae69bSJiri Olsatest_make_tags   = test -f tags
169095ae69bSJiri Olsatest_make_cscope = test -f cscope.out
170095ae69bSJiri Olsa
171095ae69bSJiri Olsatest_make_tags_O   := $(test_make_tags)
172095ae69bSJiri Olsatest_make_cscope_O := $(test_make_cscope)
173095ae69bSJiri Olsa
174095ae69bSJiri Olsatest_ok          := true
175095ae69bSJiri Olsatest_make_help   := $(test_ok)
176095ae69bSJiri Olsatest_make_doc    := $(test_ok)
177095ae69bSJiri Olsatest_make_help_O := $(test_ok)
178095ae69bSJiri Olsatest_make_doc_O  := $(test_ok)
179095ae69bSJiri Olsa
18068824de1SWang Nantest_make_python_perf_so := test -f $(PERF_O)/python/perf.so
181095ae69bSJiri Olsa
18268824de1SWang Nantest_make_perf_o           := test -f $(PERF_O)/perf.o
18368824de1SWang Nantest_make_util_map_o       := test -f $(PERF_O)/util/map.o
18468824de1SWang Nantest_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
185095ae69bSJiri Olsa
186ee4ad93eSJiri Olsadefine test_dest_files
187ee4ad93eSJiri Olsa  for file in $(1); do				\
188ee4ad93eSJiri Olsa    if [ ! -x $$TMP_DEST/$$file ]; then		\
189ee4ad93eSJiri Olsa      echo "  failed to find: $$file";		\
190ee4ad93eSJiri Olsa    fi						\
191ee4ad93eSJiri Olsa  done
192ee4ad93eSJiri Olsaendef
193ee4ad93eSJiri Olsa
194ee4ad93eSJiri Olsainstalled_files_bin := bin/perf
195ee4ad93eSJiri Olsainstalled_files_bin += etc/bash_completion.d/perf
196ee4ad93eSJiri Olsainstalled_files_bin += libexec/perf-core/perf-archive
197ee4ad93eSJiri Olsa
198f7c64474SJiri Olsainstalled_files_plugins := $(lib)/traceevent/plugins/plugin_cfg80211.so
199f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_scsi.so
200f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_xen.so
201f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_function.so
202f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_sched_switch.so
203f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_mac80211.so
204f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_kvm.so
205f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_kmem.so
206f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_hrtimer.so
207f7c64474SJiri Olsainstalled_files_plugins += $(lib)/traceevent/plugins/plugin_jbd2.so
208ee4ad93eSJiri Olsa
209ee4ad93eSJiri Olsainstalled_files_all := $(installed_files_bin)
210ee4ad93eSJiri Olsainstalled_files_all += $(installed_files_plugins)
211ee4ad93eSJiri Olsa
212ee4ad93eSJiri Olsatest_make_install       := $(call test_dest_files,$(installed_files_all))
213ee4ad93eSJiri Olsatest_make_install_O     := $(call test_dest_files,$(installed_files_all))
214ee4ad93eSJiri Olsatest_make_install_bin   := $(call test_dest_files,$(installed_files_bin))
215ee4ad93eSJiri Olsatest_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
216c0ec1108SJiri Olsa
217aa53c09eSJiri Olsa# We prefix all installed files for make_install_prefix(_slash)
218eb30d2c5SJiri Olsa# with '/tmp/krava' to match installed/prefix-ed files.
219eb30d2c5SJiri Olsainstalled_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all))
220eb30d2c5SJiri Olsatest_make_install_prefix   :=  $(call test_dest_files,$(installed_files_all_prefix))
221eb30d2c5SJiri Olsatest_make_install_prefix_O :=  $(call test_dest_files,$(installed_files_all_prefix))
222eb30d2c5SJiri Olsa
223aa53c09eSJiri Olsatest_make_install_prefix_slash   := $(test_make_install_prefix)
224aa53c09eSJiri Olsatest_make_install_prefix_slash_O := $(test_make_install_prefix_O)
225aa53c09eSJiri Olsa
226dbad4189SJiri Olsa# FIXME nothing gets installed
227dbad4189SJiri Olsatest_make_install_man    := test -f $$TMP_DEST/share/man/man1/perf.1
228dbad4189SJiri Olsatest_make_install_man_O  := $(test_make_install_man)
229dbad4189SJiri Olsa
230dbad4189SJiri Olsa# FIXME nothing gets installed
231dbad4189SJiri Olsatest_make_install_doc    := $(test_ok)
232dbad4189SJiri Olsatest_make_install_doc_O  := $(test_ok)
233dbad4189SJiri Olsa
234dbad4189SJiri Olsa# FIXME nothing gets installed
235dbad4189SJiri Olsatest_make_install_html   := $(test_ok)
236dbad4189SJiri Olsatest_make_install_html_O := $(test_ok)
237dbad4189SJiri Olsa
238dbad4189SJiri Olsa# FIXME nothing gets installed
239dbad4189SJiri Olsatest_make_install_info   := $(test_ok)
240dbad4189SJiri Olsatest_make_install_info_O := $(test_ok)
241dbad4189SJiri Olsa
242dbad4189SJiri Olsa# FIXME nothing gets installed
243dbad4189SJiri Olsatest_make_install_pdf    := $(test_ok)
244dbad4189SJiri Olsatest_make_install_pdf_O  := $(test_ok)
245dbad4189SJiri Olsa
24604b01a1dSJiri Olsatest_make_python_perf_so_O    := test -f $$TMP_O/python/perf.so
24704b01a1dSJiri Olsatest_make_perf_o_O            := test -f $$TMP_O/perf.o
24804b01a1dSJiri Olsatest_make_util_map_o_O        := test -f $$TMP_O/util/map.o
2492a94f6c4SJiri Olsatest_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
250095ae69bSJiri Olsa
25168824de1SWang Nantest_default = test -x $(PERF_O)/perf
252095ae69bSJiri Olsatest = $(if $(test_$1),$(test_$1),$(test_default))
253095ae69bSJiri Olsa
2548ba7cdeaSJiri Olsatest_default_O = test -x $$TMP_O/perf
255095ae69bSJiri Olsatest_O = $(if $(test_$1),$(test_$1),$(test_default_O))
256095ae69bSJiri Olsa
257095ae69bSJiri Olsaall:
258095ae69bSJiri Olsa
25998916392SArnaldo Carvalho de Meloifdef SHUF
26098916392SArnaldo Carvalho de Melorun := $(shell shuf -e $(run))
26198916392SArnaldo Carvalho de Melorun_O := $(shell shuf -e $(run_O))
26298916392SArnaldo Carvalho de Meloendif
26398916392SArnaldo Carvalho de Melo
264*814568dbSArnaldo Carvalho de Melomax_width := $(shell echo $(run_O) | sed 's/ /\n/g' | wc -L)
265*814568dbSArnaldo Carvalho de Melo
266095ae69bSJiri Olsaifdef DEBUG
267095ae69bSJiri Olsad := $(info run   $(run))
268095ae69bSJiri Olsad := $(info run_O $(run_O))
269095ae69bSJiri Olsaendif
270095ae69bSJiri Olsa
271095ae69bSJiri OlsaMAKEFLAGS := --no-print-directory
272095ae69bSJiri Olsa
273eb807730SWang Nanclean := @(cd $(PERF); make -s -f $(MK) $(O_OPT) clean >/dev/null)
274095ae69bSJiri Olsa
275095ae69bSJiri Olsa$(run):
276095ae69bSJiri Olsa	$(call clean)
277c9311674SJiri Olsa	@TMP_DEST=$$(mktemp -d); \
278eb807730SWang Nan	cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \
279*814568dbSArnaldo Carvalho de Melo	printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
280095ae69bSJiri Olsa	( eval $$cmd ) >> $@ 2>&1; \
281ee4ad93eSJiri Olsa	echo "  test: $(call test,$@)" >> $@ 2>&1; \
282095ae69bSJiri Olsa	$(call test,$@) && \
283a5c5009fSArnaldo Carvalho de Melo	rm -rf $@ $$TMP_DEST || (cat $@ ; false)
284095ae69bSJiri Olsa
285095ae69bSJiri Olsa$(run_O):
286095ae69bSJiri Olsa	$(call clean)
2878ba7cdeaSJiri Olsa	@TMP_O=$$(mktemp -d); \
288c9311674SJiri Olsa	TMP_DEST=$$(mktemp -d); \
2897be43dfbSWang Nan	cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
290*814568dbSArnaldo Carvalho de Melo	printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
291095ae69bSJiri Olsa	( eval $$cmd ) >> $@ 2>&1 && \
292ee4ad93eSJiri Olsa	echo "  test: $(call test_O,$@)" >> $@ 2>&1; \
293095ae69bSJiri Olsa	$(call test_O,$@) && \
294a5c5009fSArnaldo Carvalho de Melo	rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false)
295095ae69bSJiri Olsa
29648878053SArnaldo Carvalho de Melotarpkg:
29748878053SArnaldo Carvalho de Melo	@cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
29848878053SArnaldo Carvalho de Melo	echo "- $@: $$cmd" && echo $$cmd > $@ && \
299004bd89dSJosh Poimboeuf	( eval $$cmd ) >> $@ 2>&1 && \
300004bd89dSJosh Poimboeuf	rm -f $@
30148878053SArnaldo Carvalho de Melo
30268824de1SWang NanKERNEL_O := ../..
30368824de1SWang Nanifneq ($(O),)
30468824de1SWang Nan  KERNEL_O := $(O)
30568824de1SWang Nanendif
30668824de1SWang Nan
307c41c6647SJiri Olsamake_kernelsrc:
308c15e758cSWang Nan	@echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
309c41c6647SJiri Olsa	$(call clean); \
310c15e758cSWang Nan	(make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
31168824de1SWang Nan	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
312c41c6647SJiri Olsa
313c41c6647SJiri Olsamake_kernelsrc_tools:
314c15e758cSWang Nan	@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
315c41c6647SJiri Olsa	$(call clean); \
316c15e758cSWang Nan	(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
31768824de1SWang Nan	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
318c41c6647SJiri Olsa
31979191c89SWang NanFEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
32079191c89SWang NanFEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
32179191c89SWang Nan
322c41c6647SJiri Olsaall: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
323095ae69bSJiri Olsa	@echo OK
32479191c89SWang Nan	@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
325095ae69bSJiri Olsa
326095ae69bSJiri Olsaout: $(run_O)
327095ae69bSJiri Olsa	@echo OK
32879191c89SWang Nan	@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
32979191c89SWang Nan
33079191c89SWang Nanifeq ($(REUSE_FEATURES_DUMP),1)
33179191c89SWang Nan$(FEATURES_DUMP_FILE):
33279191c89SWang Nan	$(call clean)
33379191c89SWang Nan	@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \
33479191c89SWang Nan	echo "- $@: $$cmd" && echo $$cmd && \
33579191c89SWang Nan	( eval $$cmd ) > /dev/null 2>&1
33679191c89SWang Nan
33779191c89SWang Nan$(FEATURES_DUMP_FILE_STATIC):
33879191c89SWang Nan	$(call clean)
33979191c89SWang Nan	@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \
34079191c89SWang Nan	echo "- $@: $$cmd" && echo $$cmd && \
34179191c89SWang Nan	( eval $$cmd ) > /dev/null 2>&1
34279191c89SWang Nan
34379191c89SWang Nan# Add feature dump dependency for run/run_O targets
34479191c89SWang Nan$(foreach t,$(run) $(run_O),$(eval \
34579191c89SWang Nan	$(t): $(if $(findstring make_static,$(t)),\
34679191c89SWang Nan		$(FEATURES_DUMP_FILE_STATIC),\
34779191c89SWang Nan		$(FEATURES_DUMP_FILE))))
34879191c89SWang Nan
34979191c89SWang Nan# Append 'FEATURES_DUMP=' option to all test cases. For example:
35079191c89SWang Nan# make_no_libbpf: NO_LIBBPF=1  --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP
35179191c89SWang Nan# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC
35279191c89SWang Nan$(foreach t,$(run),$(if $(findstring make_static,$(t)),\
35379191c89SWang Nan			$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\
35479191c89SWang Nan			$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
35579191c89SWang Nanendif
356095ae69bSJiri Olsa
3573167eea2SWang Nan.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
358502819c5SJiri Olsaendif # ifndef MK
359