18c2ecf20Sopenharmony_ciinclude ../scripts/Makefile.include 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ciifndef MK 48c2ecf20Sopenharmony_ciifeq ($(MAKECMDGOALS),) 58c2ecf20Sopenharmony_ci# no target specified, trigger the whole suite 68c2ecf20Sopenharmony_ciall: 78c2ecf20Sopenharmony_ci @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile 88c2ecf20Sopenharmony_ci @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1 98c2ecf20Sopenharmony_cielse 108c2ecf20Sopenharmony_ci# run only specific test over 'Makefile' 118c2ecf20Sopenharmony_ci%: 128c2ecf20Sopenharmony_ci @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile $@ 138c2ecf20Sopenharmony_ciendif 148c2ecf20Sopenharmony_cielse 158c2ecf20Sopenharmony_ciPERF := . 168c2ecf20Sopenharmony_ciPERF_O := $(PERF) 178c2ecf20Sopenharmony_ciO_OPT := 188c2ecf20Sopenharmony_ciFULL_O := $(shell readlink -f $(PERF_O) || echo $(PERF_O)) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciifneq ($(O),) 218c2ecf20Sopenharmony_ci FULL_O := $(shell readlink -f $(O) || echo $(O)) 228c2ecf20Sopenharmony_ci PERF_O := $(FULL_O) 238c2ecf20Sopenharmony_ci ifeq ($(SET_O),1) 248c2ecf20Sopenharmony_ci O_OPT := 'O=$(FULL_O)' 258c2ecf20Sopenharmony_ci endif 268c2ecf20Sopenharmony_ci K_O_OPT := 'O=$(FULL_O)' 278c2ecf20Sopenharmony_ciendif 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciPARALLEL_OPT= 308c2ecf20Sopenharmony_ciifeq ($(SET_PARALLEL),1) 318c2ecf20Sopenharmony_ci ifeq ($(JOBS),) 328c2ecf20Sopenharmony_ci cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) 338c2ecf20Sopenharmony_ci ifeq ($(cores),0) 348c2ecf20Sopenharmony_ci cores := 1 358c2ecf20Sopenharmony_ci endif 368c2ecf20Sopenharmony_ci else 378c2ecf20Sopenharmony_ci cores=$(JOBS) 388c2ecf20Sopenharmony_ci endif 398c2ecf20Sopenharmony_ci PARALLEL_OPT="-j$(cores)" 408c2ecf20Sopenharmony_ciendif 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci# As per kernel Makefile, avoid funny character set dependencies 438c2ecf20Sopenharmony_ciunexport LC_ALL 448c2ecf20Sopenharmony_ciLC_COLLATE=C 458c2ecf20Sopenharmony_ciLC_NUMERIC=C 468c2ecf20Sopenharmony_ciexport LC_COLLATE LC_NUMERIC 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciifeq ($(srctree),) 498c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR))) 508c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree))) 518c2ecf20Sopenharmony_ci#$(info Determined 'srctree' to be $(srctree)) 528c2ecf20Sopenharmony_ciendif 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciinclude $(srctree)/tools/scripts/Makefile.arch 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci# FIXME looks like x86 is the only arch running tests ;-) 578c2ecf20Sopenharmony_ci# we need some IS_(32/64) flag to make this generic 588c2ecf20Sopenharmony_ciifeq ($(ARCH)$(IS_64_BIT), x861) 598c2ecf20Sopenharmony_cilib = lib64 608c2ecf20Sopenharmony_cielse 618c2ecf20Sopenharmony_cilib = lib 628c2ecf20Sopenharmony_ciendif 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_cihas = $(shell which $1 2>/dev/null) 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci# standard single make variable specified 678c2ecf20Sopenharmony_cimake_clean_all := clean all 688c2ecf20Sopenharmony_cimake_python_perf_so := python/perf.so 698c2ecf20Sopenharmony_cimake_debug := DEBUG=1 708c2ecf20Sopenharmony_cimake_no_libperl := NO_LIBPERL=1 718c2ecf20Sopenharmony_cimake_no_libpython := NO_LIBPYTHON=1 728c2ecf20Sopenharmony_cimake_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 738c2ecf20Sopenharmony_cimake_no_newt := NO_NEWT=1 748c2ecf20Sopenharmony_cimake_no_slang := NO_SLANG=1 758c2ecf20Sopenharmony_cimake_no_gtk2 := NO_GTK2=1 768c2ecf20Sopenharmony_cimake_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 778c2ecf20Sopenharmony_cimake_no_demangle := NO_DEMANGLE=1 788c2ecf20Sopenharmony_cimake_no_libelf := NO_LIBELF=1 798c2ecf20Sopenharmony_cimake_no_libunwind := NO_LIBUNWIND=1 808c2ecf20Sopenharmony_cimake_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1 818c2ecf20Sopenharmony_cimake_no_backtrace := NO_BACKTRACE=1 828c2ecf20Sopenharmony_cimake_no_libnuma := NO_LIBNUMA=1 838c2ecf20Sopenharmony_cimake_no_libaudit := NO_LIBAUDIT=1 848c2ecf20Sopenharmony_cimake_no_libbionic := NO_LIBBIONIC=1 858c2ecf20Sopenharmony_cimake_no_auxtrace := NO_AUXTRACE=1 868c2ecf20Sopenharmony_cimake_no_libbpf := NO_LIBBPF=1 878c2ecf20Sopenharmony_cimake_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 888c2ecf20Sopenharmony_cimake_no_libcrypto := NO_LIBCRYPTO=1 898c2ecf20Sopenharmony_cimake_with_babeltrace:= LIBBABELTRACE=1 908c2ecf20Sopenharmony_cimake_no_sdt := NO_SDT=1 918c2ecf20Sopenharmony_cimake_no_syscall_tbl := NO_SYSCALL_TABLE=1 928c2ecf20Sopenharmony_cimake_with_clangllvm := LIBCLANGLLVM=1 938c2ecf20Sopenharmony_cimake_with_libpfm4 := LIBPFM4=1 948c2ecf20Sopenharmony_cimake_with_gtk2 := GTK2=1 958c2ecf20Sopenharmony_cimake_tags := tags 968c2ecf20Sopenharmony_cimake_cscope := cscope 978c2ecf20Sopenharmony_cimake_help := help 988c2ecf20Sopenharmony_cimake_doc := doc 998c2ecf20Sopenharmony_cimake_perf_o := perf.o 1008c2ecf20Sopenharmony_cimake_util_map_o := util/map.o 1018c2ecf20Sopenharmony_cimake_util_pmu_bison_o := util/pmu-bison.o 1028c2ecf20Sopenharmony_cimake_install := install 1038c2ecf20Sopenharmony_cimake_install_bin := install-bin 1048c2ecf20Sopenharmony_cimake_install_doc := install-doc 1058c2ecf20Sopenharmony_cimake_install_man := install-man 1068c2ecf20Sopenharmony_cimake_install_html := install-html 1078c2ecf20Sopenharmony_cimake_install_info := install-info 1088c2ecf20Sopenharmony_cimake_install_pdf := install-pdf 1098c2ecf20Sopenharmony_cimake_install_prefix := install prefix=/tmp/krava 1108c2ecf20Sopenharmony_cimake_install_prefix_slash := install prefix=/tmp/krava/ 1118c2ecf20Sopenharmony_cimake_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci# all the NO_* variable combined 1148c2ecf20Sopenharmony_cimake_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 1158c2ecf20Sopenharmony_cimake_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 1168c2ecf20Sopenharmony_cimake_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 1178c2ecf20Sopenharmony_cimake_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 1188c2ecf20Sopenharmony_cimake_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 1198c2ecf20Sopenharmony_cimake_minimal += NO_LIBCAP=1 NO_SYSCALL_TABLE=1 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci# $(run) contains all available tests 1228c2ecf20Sopenharmony_cirun := make_pure 1238c2ecf20Sopenharmony_ci# Targets 'clean all' can be run together only through top level 1248c2ecf20Sopenharmony_ci# Makefile because we detect clean target in Makefile.perf and 1258c2ecf20Sopenharmony_ci# disable features detection 1268c2ecf20Sopenharmony_ciifeq ($(MK),Makefile) 1278c2ecf20Sopenharmony_cirun += make_clean_all 1288c2ecf20Sopenharmony_ciMAKE_F := $(MAKE) 1298c2ecf20Sopenharmony_cielse 1308c2ecf20Sopenharmony_ciMAKE_F := $(MAKE) -f $(MK) 1318c2ecf20Sopenharmony_ciendif 1328c2ecf20Sopenharmony_cirun += make_python_perf_so 1338c2ecf20Sopenharmony_cirun += make_debug 1348c2ecf20Sopenharmony_cirun += make_no_libperl 1358c2ecf20Sopenharmony_cirun += make_no_libpython 1368c2ecf20Sopenharmony_cirun += make_no_scripts 1378c2ecf20Sopenharmony_cirun += make_no_newt 1388c2ecf20Sopenharmony_cirun += make_no_slang 1398c2ecf20Sopenharmony_cirun += make_no_gtk2 1408c2ecf20Sopenharmony_cirun += make_no_ui 1418c2ecf20Sopenharmony_cirun += make_no_demangle 1428c2ecf20Sopenharmony_cirun += make_no_libelf 1438c2ecf20Sopenharmony_cirun += make_no_libunwind 1448c2ecf20Sopenharmony_cirun += make_no_libdw_dwarf_unwind 1458c2ecf20Sopenharmony_cirun += make_no_backtrace 1468c2ecf20Sopenharmony_cirun += make_no_libnuma 1478c2ecf20Sopenharmony_cirun += make_no_libaudit 1488c2ecf20Sopenharmony_cirun += make_no_libbionic 1498c2ecf20Sopenharmony_cirun += make_no_auxtrace 1508c2ecf20Sopenharmony_cirun += make_no_libbpf 1518c2ecf20Sopenharmony_cirun += make_no_libbpf_DEBUG 1528c2ecf20Sopenharmony_cirun += make_no_libcrypto 1538c2ecf20Sopenharmony_cirun += make_no_sdt 1548c2ecf20Sopenharmony_cirun += make_no_syscall_tbl 1558c2ecf20Sopenharmony_cirun += make_with_babeltrace 1568c2ecf20Sopenharmony_cirun += make_with_clangllvm 1578c2ecf20Sopenharmony_cirun += make_with_libpfm4 1588c2ecf20Sopenharmony_cirun += make_with_gtk2 1598c2ecf20Sopenharmony_cirun += make_help 1608c2ecf20Sopenharmony_cirun += make_doc 1618c2ecf20Sopenharmony_cirun += make_perf_o 1628c2ecf20Sopenharmony_cirun += make_util_map_o 1638c2ecf20Sopenharmony_cirun += make_util_pmu_bison_o 1648c2ecf20Sopenharmony_cirun += make_install 1658c2ecf20Sopenharmony_cirun += make_install_bin 1668c2ecf20Sopenharmony_cirun += make_install_prefix 1678c2ecf20Sopenharmony_cirun += make_install_prefix_slash 1688c2ecf20Sopenharmony_ci# FIXME 'install-*' commented out till they're fixed 1698c2ecf20Sopenharmony_ci# run += make_install_doc 1708c2ecf20Sopenharmony_ci# run += make_install_man 1718c2ecf20Sopenharmony_ci# run += make_install_html 1728c2ecf20Sopenharmony_ci# run += make_install_info 1738c2ecf20Sopenharmony_ci# run += make_install_pdf 1748c2ecf20Sopenharmony_cirun += make_minimal 1758c2ecf20Sopenharmony_cirun += make_static 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ciifneq ($(call has,ctags),) 1788c2ecf20Sopenharmony_cirun += make_tags 1798c2ecf20Sopenharmony_ciendif 1808c2ecf20Sopenharmony_ciifneq ($(call has,cscope),) 1818c2ecf20Sopenharmony_cirun += make_cscope 1828c2ecf20Sopenharmony_ciendif 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci# $(run_O) contains same portion of $(run) tests with '_O' attached 1858c2ecf20Sopenharmony_ci# to distinguish O=... tests 1868c2ecf20Sopenharmony_cirun_O := $(addsuffix _O,$(run)) 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci# disable some tests for O=... 1898c2ecf20Sopenharmony_cirun_O := $(filter-out make_python_perf_so_O,$(run_O)) 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci# define test for each compile as 'test_NAME' variable 1928c2ecf20Sopenharmony_ci# with the test itself as a value 1938c2ecf20Sopenharmony_citest_make_tags = test -f tags 1948c2ecf20Sopenharmony_citest_make_cscope = test -f cscope.out 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_citest_make_tags_O := $(test_make_tags) 1978c2ecf20Sopenharmony_citest_make_cscope_O := $(test_make_cscope) 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_citest_ok := true 2008c2ecf20Sopenharmony_citest_make_help := $(test_ok) 2018c2ecf20Sopenharmony_citest_make_doc := $(test_ok) 2028c2ecf20Sopenharmony_citest_make_help_O := $(test_ok) 2038c2ecf20Sopenharmony_citest_make_doc_O := $(test_ok) 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_citest_make_python_perf_so := test -f $(PERF_O)/python/perf.so 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_citest_make_perf_o := test -f $(PERF_O)/perf.o 2088c2ecf20Sopenharmony_citest_make_util_map_o := test -f $(PERF_O)/util/map.o 2098c2ecf20Sopenharmony_citest_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cidefine test_dest_files 2128c2ecf20Sopenharmony_ci for file in $(1); do \ 2138c2ecf20Sopenharmony_ci if [ ! -x $$TMP_DEST/$$file ]; then \ 2148c2ecf20Sopenharmony_ci echo " failed to find: $$file"; \ 2158c2ecf20Sopenharmony_ci fi \ 2168c2ecf20Sopenharmony_ci done 2178c2ecf20Sopenharmony_ciendef 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ciinstalled_files_bin := bin/perf 2208c2ecf20Sopenharmony_ciinstalled_files_bin += etc/bash_completion.d/perf 2218c2ecf20Sopenharmony_ciinstalled_files_bin += libexec/perf-core/perf-archive 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ciinstalled_files_plugins := $(lib)/traceevent/plugins/plugin_cfg80211.so 2248c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_scsi.so 2258c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_xen.so 2268c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_function.so 2278c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_sched_switch.so 2288c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_mac80211.so 2298c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_kvm.so 2308c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_kmem.so 2318c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_hrtimer.so 2328c2ecf20Sopenharmony_ciinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_jbd2.so 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ciinstalled_files_all := $(installed_files_bin) 2358c2ecf20Sopenharmony_ciinstalled_files_all += $(installed_files_plugins) 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_citest_make_install := $(call test_dest_files,$(installed_files_all)) 2388c2ecf20Sopenharmony_citest_make_install_O := $(call test_dest_files,$(installed_files_all)) 2398c2ecf20Sopenharmony_citest_make_install_bin := $(call test_dest_files,$(installed_files_bin)) 2408c2ecf20Sopenharmony_citest_make_install_bin_O := $(call test_dest_files,$(installed_files_bin)) 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci# We prefix all installed files for make_install_prefix(_slash) 2438c2ecf20Sopenharmony_ci# with '/tmp/krava' to match installed/prefix-ed files. 2448c2ecf20Sopenharmony_ciinstalled_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all)) 2458c2ecf20Sopenharmony_citest_make_install_prefix := $(call test_dest_files,$(installed_files_all_prefix)) 2468c2ecf20Sopenharmony_citest_make_install_prefix_O := $(call test_dest_files,$(installed_files_all_prefix)) 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_citest_make_install_prefix_slash := $(test_make_install_prefix) 2498c2ecf20Sopenharmony_citest_make_install_prefix_slash_O := $(test_make_install_prefix_O) 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci# FIXME nothing gets installed 2528c2ecf20Sopenharmony_citest_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1 2538c2ecf20Sopenharmony_citest_make_install_man_O := $(test_make_install_man) 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci# FIXME nothing gets installed 2568c2ecf20Sopenharmony_citest_make_install_doc := $(test_ok) 2578c2ecf20Sopenharmony_citest_make_install_doc_O := $(test_ok) 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci# FIXME nothing gets installed 2608c2ecf20Sopenharmony_citest_make_install_html := $(test_ok) 2618c2ecf20Sopenharmony_citest_make_install_html_O := $(test_ok) 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci# FIXME nothing gets installed 2648c2ecf20Sopenharmony_citest_make_install_info := $(test_ok) 2658c2ecf20Sopenharmony_citest_make_install_info_O := $(test_ok) 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci# FIXME nothing gets installed 2688c2ecf20Sopenharmony_citest_make_install_pdf := $(test_ok) 2698c2ecf20Sopenharmony_citest_make_install_pdf_O := $(test_ok) 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_citest_make_python_perf_so_O := test -f $$TMP_O/python/perf.so 2728c2ecf20Sopenharmony_citest_make_perf_o_O := test -f $$TMP_O/perf.o 2738c2ecf20Sopenharmony_citest_make_util_map_o_O := test -f $$TMP_O/util/map.o 2748c2ecf20Sopenharmony_citest_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_citest_default = test -x $(PERF_O)/perf 2778c2ecf20Sopenharmony_citest = $(if $(test_$1),$(test_$1),$(test_default)) 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_citest_default_O = test -x $$TMP_O/perf 2808c2ecf20Sopenharmony_citest_O = $(if $(test_$1),$(test_$1),$(test_default_O)) 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ciall: 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ciifdef SHUF 2858c2ecf20Sopenharmony_cirun := $(shell shuf -e $(run)) 2868c2ecf20Sopenharmony_cirun_O := $(shell shuf -e $(run_O)) 2878c2ecf20Sopenharmony_ciendif 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_cimax_width := $(shell echo $(run_O) | sed 's/ /\n/g' | wc -L) 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ciifdef DEBUG 2928c2ecf20Sopenharmony_cid := $(info run $(run)) 2938c2ecf20Sopenharmony_cid := $(info run_O $(run_O)) 2948c2ecf20Sopenharmony_ciendif 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ciMAKEFLAGS := --no-print-directory 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ciclean := @(cd $(PERF); $(MAKE_F) -s $(O_OPT) clean >/dev/null && $(MAKE) -s $(O_OPT) -C ../build clean >/dev/null) 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci$(run): 3018c2ecf20Sopenharmony_ci $(call clean) 3028c2ecf20Sopenharmony_ci @TMP_DEST=$$(mktemp -d); \ 3038c2ecf20Sopenharmony_ci cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \ 3048c2ecf20Sopenharmony_ci printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \ 3058c2ecf20Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1; \ 3068c2ecf20Sopenharmony_ci echo " test: $(call test,$@)" >> $@ 2>&1; \ 3078c2ecf20Sopenharmony_ci $(call test,$@) && \ 3088c2ecf20Sopenharmony_ci rm -rf $@ $$TMP_DEST || (cat $@ ; false) 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci$(run_O): 3118c2ecf20Sopenharmony_ci $(call clean) 3128c2ecf20Sopenharmony_ci @TMP_O=$$(mktemp -d); \ 3138c2ecf20Sopenharmony_ci TMP_DEST=$$(mktemp -d); \ 3148c2ecf20Sopenharmony_ci cmd="cd $(PERF) && $(MAKE_F) $($(patsubst %_O,%,$@)) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST"; \ 3158c2ecf20Sopenharmony_ci printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \ 3168c2ecf20Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1 && \ 3178c2ecf20Sopenharmony_ci echo " test: $(call test_O,$@)" >> $@ 2>&1; \ 3188c2ecf20Sopenharmony_ci $(call test_O,$@) && \ 3198c2ecf20Sopenharmony_ci rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_citarpkg: 3228c2ecf20Sopenharmony_ci @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \ 3238c2ecf20Sopenharmony_ci echo "- $@: $$cmd" && echo $$cmd > $@ && \ 3248c2ecf20Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1 && \ 3258c2ecf20Sopenharmony_ci rm -f $@ 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ciKERNEL_O := ../.. 3288c2ecf20Sopenharmony_ciifneq ($(O),) 3298c2ecf20Sopenharmony_ci KERNEL_O := $(O) 3308c2ecf20Sopenharmony_ciendif 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_cimake_kernelsrc: 3338c2ecf20Sopenharmony_ci @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf" 3348c2ecf20Sopenharmony_ci $(call clean); \ 3358c2ecf20Sopenharmony_ci (make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \ 3368c2ecf20Sopenharmony_ci test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false) 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cimake_kernelsrc_tools: 3398c2ecf20Sopenharmony_ci @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf" 3408c2ecf20Sopenharmony_ci $(call clean); \ 3418c2ecf20Sopenharmony_ci (make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \ 3428c2ecf20Sopenharmony_ci test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false) 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_cimake_libperf: 3458c2ecf20Sopenharmony_ci @echo "- make -C lib"; 3468c2ecf20Sopenharmony_ci make -C lib clean >$@ 2>&1; make -C lib >>$@ 2>&1 && rm $@ 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ciFEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP 3498c2ecf20Sopenharmony_ciFEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ciall: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools 3528c2ecf20Sopenharmony_ci @echo OK 3538c2ecf20Sopenharmony_ci @rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ciout: $(run_O) 3568c2ecf20Sopenharmony_ci @echo OK 3578c2ecf20Sopenharmony_ci @rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ciifeq ($(REUSE_FEATURES_DUMP),1) 3608c2ecf20Sopenharmony_ci$(FEATURES_DUMP_FILE): 3618c2ecf20Sopenharmony_ci $(call clean) 3628c2ecf20Sopenharmony_ci @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \ 3638c2ecf20Sopenharmony_ci echo "- $@: $$cmd" && echo $$cmd && \ 3648c2ecf20Sopenharmony_ci ( eval $$cmd ) > /dev/null 2>&1 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci$(FEATURES_DUMP_FILE_STATIC): 3678c2ecf20Sopenharmony_ci $(call clean) 3688c2ecf20Sopenharmony_ci @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \ 3698c2ecf20Sopenharmony_ci echo "- $@: $$cmd" && echo $$cmd && \ 3708c2ecf20Sopenharmony_ci ( eval $$cmd ) > /dev/null 2>&1 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci# Add feature dump dependency for run/run_O targets 3738c2ecf20Sopenharmony_ci$(foreach t,$(run) $(run_O),$(eval \ 3748c2ecf20Sopenharmony_ci $(t): $(if $(findstring make_static,$(t)),\ 3758c2ecf20Sopenharmony_ci $(FEATURES_DUMP_FILE_STATIC),\ 3768c2ecf20Sopenharmony_ci $(FEATURES_DUMP_FILE)))) 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci# Append 'FEATURES_DUMP=' option to all test cases. For example: 3798c2ecf20Sopenharmony_ci# make_no_libbpf: NO_LIBBPF=1 --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP 3808c2ecf20Sopenharmony_ci# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC 3818c2ecf20Sopenharmony_ci$(foreach t,$(run),$(if $(findstring make_static,$(t)),\ 3828c2ecf20Sopenharmony_ci $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\ 3838c2ecf20Sopenharmony_ci $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE)))) 3848c2ecf20Sopenharmony_ciendif 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools make_libperf 3878c2ecf20Sopenharmony_ciendif # ifndef MK 388