162306a36Sopenharmony_ciinclude ../scripts/Makefile.include 262306a36Sopenharmony_ci 362306a36Sopenharmony_ciifndef MK 462306a36Sopenharmony_ciifeq ($(MAKECMDGOALS),) 562306a36Sopenharmony_ci# no target specified, trigger the whole suite 662306a36Sopenharmony_ciall: 762306a36Sopenharmony_ci @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile 862306a36Sopenharmony_ci @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1 962306a36Sopenharmony_cielse 1062306a36Sopenharmony_ci# run only specific test over 'Makefile' 1162306a36Sopenharmony_ci%: 1262306a36Sopenharmony_ci @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile $@ 1362306a36Sopenharmony_ciendif 1462306a36Sopenharmony_cielse 1562306a36Sopenharmony_ciPERF := . 1662306a36Sopenharmony_ciPERF_O := $(PERF) 1762306a36Sopenharmony_ciO_OPT := 1862306a36Sopenharmony_ciFULL_O := $(shell readlink -f $(PERF_O) || echo $(PERF_O)) 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciifneq ($(O),) 2162306a36Sopenharmony_ci FULL_O := $(shell readlink -f $(O) || echo $(O)) 2262306a36Sopenharmony_ci PERF_O := $(FULL_O) 2362306a36Sopenharmony_ci ifeq ($(SET_O),1) 2462306a36Sopenharmony_ci O_OPT := 'O=$(FULL_O)' 2562306a36Sopenharmony_ci endif 2662306a36Sopenharmony_ci K_O_OPT := 'O=$(FULL_O)' 2762306a36Sopenharmony_ciendif 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciPARALLEL_OPT= 3062306a36Sopenharmony_ciifeq ($(SET_PARALLEL),1) 3162306a36Sopenharmony_ci ifeq ($(JOBS),) 3262306a36Sopenharmony_ci cores := $(shell (getconf _NPROCESSORS_ONLN || grep -E -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) 3362306a36Sopenharmony_ci ifeq ($(cores),0) 3462306a36Sopenharmony_ci cores := 1 3562306a36Sopenharmony_ci endif 3662306a36Sopenharmony_ci else 3762306a36Sopenharmony_ci cores=$(JOBS) 3862306a36Sopenharmony_ci endif 3962306a36Sopenharmony_ci PARALLEL_OPT="-j$(cores)" 4062306a36Sopenharmony_ciendif 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci# As per kernel Makefile, avoid funny character set dependencies 4362306a36Sopenharmony_ciunexport LC_ALL 4462306a36Sopenharmony_ciLC_COLLATE=C 4562306a36Sopenharmony_ciLC_NUMERIC=C 4662306a36Sopenharmony_ciexport LC_COLLATE LC_NUMERIC 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ciifeq ($(srctree),) 4962306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR))) 5062306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree))) 5162306a36Sopenharmony_ci#$(info Determined 'srctree' to be $(srctree)) 5262306a36Sopenharmony_ciendif 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciinclude $(srctree)/tools/scripts/Makefile.arch 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci# FIXME looks like x86 is the only arch running tests ;-) 5762306a36Sopenharmony_ci# we need some IS_(32/64) flag to make this generic 5862306a36Sopenharmony_ciifeq ($(ARCH)$(IS_64_BIT), x861) 5962306a36Sopenharmony_cilib = lib64 6062306a36Sopenharmony_cielse 6162306a36Sopenharmony_cilib = lib 6262306a36Sopenharmony_ciendif 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_cihas = $(shell which $1 2>/dev/null) 6562306a36Sopenharmony_cipython_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{print $$3}') 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci# standard single make variable specified 6862306a36Sopenharmony_cimake_clean_all := clean all 6962306a36Sopenharmony_cimake_python_perf_so := $(python_perf_so) 7062306a36Sopenharmony_cimake_debug := DEBUG=1 7162306a36Sopenharmony_cimake_nondistro := BUILD_NONDISTRO=1 7262306a36Sopenharmony_cimake_extra_tests := EXTRA_TESTS=1 7362306a36Sopenharmony_cimake_bpf_skel := BUILD_BPF_SKEL=1 7462306a36Sopenharmony_cimake_gen_vmlinux_h := BUILD_BPF_SKEL=1 GEN_VMLINUX_H=1 7562306a36Sopenharmony_cimake_no_libperl := NO_LIBPERL=1 7662306a36Sopenharmony_cimake_no_libpython := NO_LIBPYTHON=1 7762306a36Sopenharmony_cimake_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 7862306a36Sopenharmony_cimake_no_slang := NO_SLANG=1 7962306a36Sopenharmony_cimake_no_gtk2 := NO_GTK2=1 8062306a36Sopenharmony_cimake_no_ui := NO_SLANG=1 NO_GTK2=1 8162306a36Sopenharmony_cimake_no_demangle := NO_DEMANGLE=1 8262306a36Sopenharmony_cimake_no_libelf := NO_LIBELF=1 8362306a36Sopenharmony_cimake_no_libunwind := NO_LIBUNWIND=1 8462306a36Sopenharmony_cimake_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1 8562306a36Sopenharmony_cimake_no_backtrace := NO_BACKTRACE=1 8662306a36Sopenharmony_cimake_no_libnuma := NO_LIBNUMA=1 8762306a36Sopenharmony_cimake_no_libaudit := NO_LIBAUDIT=1 8862306a36Sopenharmony_cimake_no_libbionic := NO_LIBBIONIC=1 8962306a36Sopenharmony_cimake_no_auxtrace := NO_AUXTRACE=1 9062306a36Sopenharmony_cimake_no_libbpf := NO_LIBBPF=1 9162306a36Sopenharmony_cimake_libbpf_dynamic := LIBBPF_DYNAMIC=1 9262306a36Sopenharmony_cimake_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 9362306a36Sopenharmony_cimake_no_libcrypto := NO_LIBCRYPTO=1 9462306a36Sopenharmony_cimake_with_babeltrace:= LIBBABELTRACE=1 9562306a36Sopenharmony_cimake_with_coresight := CORESIGHT=1 9662306a36Sopenharmony_cimake_no_sdt := NO_SDT=1 9762306a36Sopenharmony_cimake_no_syscall_tbl := NO_SYSCALL_TABLE=1 9862306a36Sopenharmony_cimake_no_libpfm4 := NO_LIBPFM4=1 9962306a36Sopenharmony_cimake_with_gtk2 := GTK2=1 10062306a36Sopenharmony_cimake_refcnt_check := EXTRA_CFLAGS="-DREFCNT_CHECKING=1" 10162306a36Sopenharmony_cimake_tags := tags 10262306a36Sopenharmony_cimake_cscope := cscope 10362306a36Sopenharmony_cimake_help := help 10462306a36Sopenharmony_cimake_doc := doc 10562306a36Sopenharmony_cimake_perf_o := perf.o 10662306a36Sopenharmony_cimake_util_map_o := util/map.o 10762306a36Sopenharmony_cimake_util_pmu_bison_o := util/pmu-bison.o 10862306a36Sopenharmony_cimake_install := install 10962306a36Sopenharmony_cimake_install_bin := install-bin 11062306a36Sopenharmony_cimake_install_doc := install-doc 11162306a36Sopenharmony_cimake_install_man := install-man 11262306a36Sopenharmony_cimake_install_html := install-html 11362306a36Sopenharmony_cimake_install_info := install-info 11462306a36Sopenharmony_cimake_install_pdf := install-pdf 11562306a36Sopenharmony_cimake_install_prefix := install prefix=/tmp/krava 11662306a36Sopenharmony_cimake_install_prefix_slash := install prefix=/tmp/krava/ 11762306a36Sopenharmony_cimake_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 NO_LIBTRACEEVENT=1 NO_LIBELF=1 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci# all the NO_* variable combined 12062306a36Sopenharmony_cimake_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_GTK2=1 12162306a36Sopenharmony_cimake_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 12262306a36Sopenharmony_cimake_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 12362306a36Sopenharmony_cimake_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 12462306a36Sopenharmony_cimake_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 12562306a36Sopenharmony_cimake_minimal += NO_LIBCAP=1 NO_SYSCALL_TABLE=1 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci# $(run) contains all available tests 12862306a36Sopenharmony_cirun := make_pure 12962306a36Sopenharmony_ci# Targets 'clean all' can be run together only through top level 13062306a36Sopenharmony_ci# Makefile because we detect clean target in Makefile.perf and 13162306a36Sopenharmony_ci# disable features detection 13262306a36Sopenharmony_ciifeq ($(MK),Makefile) 13362306a36Sopenharmony_cirun += make_clean_all 13462306a36Sopenharmony_ciMAKE_F := $(MAKE) 13562306a36Sopenharmony_cielse 13662306a36Sopenharmony_ciMAKE_F := $(MAKE) -f $(MK) 13762306a36Sopenharmony_ciendif 13862306a36Sopenharmony_cirun += make_python_perf_so 13962306a36Sopenharmony_cirun += make_debug 14062306a36Sopenharmony_cirun += make_nondistro 14162306a36Sopenharmony_cirun += make_build_bpf_skel 14262306a36Sopenharmony_cirun += make_gen_vmlinux_h 14362306a36Sopenharmony_cirun += make_no_libperl 14462306a36Sopenharmony_cirun += make_no_libpython 14562306a36Sopenharmony_cirun += make_no_scripts 14662306a36Sopenharmony_cirun += make_no_slang 14762306a36Sopenharmony_cirun += make_no_gtk2 14862306a36Sopenharmony_cirun += make_no_ui 14962306a36Sopenharmony_cirun += make_no_demangle 15062306a36Sopenharmony_cirun += make_no_libelf 15162306a36Sopenharmony_cirun += make_no_libunwind 15262306a36Sopenharmony_cirun += make_no_libdw_dwarf_unwind 15362306a36Sopenharmony_cirun += make_no_backtrace 15462306a36Sopenharmony_cirun += make_no_libnuma 15562306a36Sopenharmony_cirun += make_no_libaudit 15662306a36Sopenharmony_cirun += make_no_libbionic 15762306a36Sopenharmony_cirun += make_no_auxtrace 15862306a36Sopenharmony_cirun += make_no_libbpf 15962306a36Sopenharmony_cirun += make_no_libbpf_DEBUG 16062306a36Sopenharmony_cirun += make_no_libcrypto 16162306a36Sopenharmony_cirun += make_no_sdt 16262306a36Sopenharmony_cirun += make_no_syscall_tbl 16362306a36Sopenharmony_cirun += make_with_babeltrace 16462306a36Sopenharmony_cirun += make_with_coresight 16562306a36Sopenharmony_cirun += make_with_clangllvm 16662306a36Sopenharmony_cirun += make_no_libpfm4 16762306a36Sopenharmony_cirun += make_refcnt_check 16862306a36Sopenharmony_cirun += make_help 16962306a36Sopenharmony_cirun += make_doc 17062306a36Sopenharmony_cirun += make_perf_o 17162306a36Sopenharmony_cirun += make_util_map_o 17262306a36Sopenharmony_cirun += make_util_pmu_bison_o 17362306a36Sopenharmony_cirun += make_install 17462306a36Sopenharmony_cirun += make_install_bin 17562306a36Sopenharmony_cirun += make_install_prefix 17662306a36Sopenharmony_cirun += make_install_prefix_slash 17762306a36Sopenharmony_ci# FIXME 'install-*' commented out till they're fixed 17862306a36Sopenharmony_ci# run += make_install_doc 17962306a36Sopenharmony_ci# run += make_install_man 18062306a36Sopenharmony_ci# run += make_install_html 18162306a36Sopenharmony_ci# run += make_install_info 18262306a36Sopenharmony_ci# run += make_install_pdf 18362306a36Sopenharmony_cirun += make_minimal 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ciold_libbpf := $(shell echo '\#include <bpf/libbpf.h>' | $(CC) -E -dM -x c -| egrep -q "define[[:space:]]+LIBBPF_MAJOR_VERSION[[:space:]]+0{1}") 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ciifneq ($(old_libbpf),) 18862306a36Sopenharmony_cirun += make_libbpf_dynamic 18962306a36Sopenharmony_ciendif 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ciifneq ($(call has,ctags),) 19262306a36Sopenharmony_cirun += make_tags 19362306a36Sopenharmony_ciendif 19462306a36Sopenharmony_ciifneq ($(call has,cscope),) 19562306a36Sopenharmony_cirun += make_cscope 19662306a36Sopenharmony_ciendif 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ci# $(run_O) contains same portion of $(run) tests with '_O' attached 19962306a36Sopenharmony_ci# to distinguish O=... tests 20062306a36Sopenharmony_cirun_O := $(addsuffix _O,$(run)) 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci# disable some tests for O=... 20362306a36Sopenharmony_cirun_O := $(filter-out make_python_perf_so_O,$(run_O)) 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci# define test for each compile as 'test_NAME' variable 20662306a36Sopenharmony_ci# with the test itself as a value 20762306a36Sopenharmony_citest_make_tags = test -f tags 20862306a36Sopenharmony_citest_make_cscope = test -f cscope.out 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_citest_make_tags_O := $(test_make_tags) 21162306a36Sopenharmony_citest_make_cscope_O := $(test_make_cscope) 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_citest_ok := true 21462306a36Sopenharmony_citest_make_help := $(test_ok) 21562306a36Sopenharmony_citest_make_doc := $(test_ok) 21662306a36Sopenharmony_citest_make_help_O := $(test_ok) 21762306a36Sopenharmony_citest_make_doc_O := $(test_ok) 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_citest_make_python_perf_so := test -f $(PERF_O)/$(python_perf_so) 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_citest_make_perf_o := test -f $(PERF_O)/perf.o 22262306a36Sopenharmony_citest_make_util_map_o := test -f $(PERF_O)/util/map.o 22362306a36Sopenharmony_citest_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_cidefine test_dest_files 22662306a36Sopenharmony_ci for file in $(1); do \ 22762306a36Sopenharmony_ci if [ ! -x $$TMP_DEST/$$file ]; then \ 22862306a36Sopenharmony_ci echo " failed to find: $$file"; \ 22962306a36Sopenharmony_ci fi \ 23062306a36Sopenharmony_ci done 23162306a36Sopenharmony_ciendef 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ciinstalled_files_bin := bin/perf 23462306a36Sopenharmony_ciinstalled_files_bin += etc/bash_completion.d/perf 23562306a36Sopenharmony_ciinstalled_files_bin += libexec/perf-core/perf-archive 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ciinstalled_files_all := $(installed_files_bin) 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_citest_make_install := $(call test_dest_files,$(installed_files_all)) 24062306a36Sopenharmony_citest_make_install_O := $(call test_dest_files,$(installed_files_all)) 24162306a36Sopenharmony_citest_make_install_bin := $(call test_dest_files,$(installed_files_bin)) 24262306a36Sopenharmony_citest_make_install_bin_O := $(call test_dest_files,$(installed_files_bin)) 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci# We prefix all installed files for make_install_prefix(_slash) 24562306a36Sopenharmony_ci# with '/tmp/krava' to match installed/prefix-ed files. 24662306a36Sopenharmony_ciinstalled_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all)) 24762306a36Sopenharmony_citest_make_install_prefix := $(call test_dest_files,$(installed_files_all_prefix)) 24862306a36Sopenharmony_citest_make_install_prefix_O := $(call test_dest_files,$(installed_files_all_prefix)) 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_citest_make_install_prefix_slash := $(test_make_install_prefix) 25162306a36Sopenharmony_citest_make_install_prefix_slash_O := $(test_make_install_prefix_O) 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci# FIXME nothing gets installed 25462306a36Sopenharmony_citest_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1 25562306a36Sopenharmony_citest_make_install_man_O := $(test_make_install_man) 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci# FIXME nothing gets installed 25862306a36Sopenharmony_citest_make_install_doc := $(test_ok) 25962306a36Sopenharmony_citest_make_install_doc_O := $(test_ok) 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci# FIXME nothing gets installed 26262306a36Sopenharmony_citest_make_install_html := $(test_ok) 26362306a36Sopenharmony_citest_make_install_html_O := $(test_ok) 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci# FIXME nothing gets installed 26662306a36Sopenharmony_citest_make_install_info := $(test_ok) 26762306a36Sopenharmony_citest_make_install_info_O := $(test_ok) 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci# FIXME nothing gets installed 27062306a36Sopenharmony_citest_make_install_pdf := $(test_ok) 27162306a36Sopenharmony_citest_make_install_pdf_O := $(test_ok) 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_citest_make_libbpf_dynamic := ldd $(PERF_O)/perf | grep -q libbpf 27462306a36Sopenharmony_citest_make_libbpf_dynamic_O := ldd $$TMP_O/perf | grep -q libbpf 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_citest_make_python_perf_so_O := test -f $$TMP_O/python/perf.so 27762306a36Sopenharmony_citest_make_perf_o_O := test -f $$TMP_O/perf.o 27862306a36Sopenharmony_citest_make_util_map_o_O := test -f $$TMP_O/util/map.o 27962306a36Sopenharmony_citest_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_citest_default = test -x $(PERF_O)/perf 28262306a36Sopenharmony_citest = $(if $(test_$1),$(test_$1),$(test_default)) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_citest_default_O = test -x $$TMP_O/perf 28562306a36Sopenharmony_citest_O = $(if $(test_$1),$(test_$1),$(test_default_O)) 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ciall: 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_ciifdef SHUF 29062306a36Sopenharmony_cirun := $(shell shuf -e $(run)) 29162306a36Sopenharmony_cirun_O := $(shell shuf -e $(run_O)) 29262306a36Sopenharmony_ciendif 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_cimax_width := $(shell echo $(run_O) | sed 's/ /\n/g' | wc -L) 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ciifdef DEBUG 29762306a36Sopenharmony_cid := $(info run $(run)) 29862306a36Sopenharmony_cid := $(info run_O $(run_O)) 29962306a36Sopenharmony_ciendif 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ciMAKEFLAGS := --no-print-directory 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ciclean := @(cd $(PERF); $(MAKE_F) -s $(O_OPT) clean >/dev/null && $(MAKE) -s $(O_OPT) -C ../build clean >/dev/null) 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci$(run): 30662306a36Sopenharmony_ci $(call clean) 30762306a36Sopenharmony_ci @TMP_DEST=$$(mktemp -d); \ 30862306a36Sopenharmony_ci cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \ 30962306a36Sopenharmony_ci printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \ 31062306a36Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1; \ 31162306a36Sopenharmony_ci echo " test: $(call test,$@)" >> $@ 2>&1; \ 31262306a36Sopenharmony_ci $(call test,$@) && \ 31362306a36Sopenharmony_ci rm -rf $@ $$TMP_DEST || (cat $@ ; false) 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_cimake_with_gtk2: 31662306a36Sopenharmony_ci $(call clean) 31762306a36Sopenharmony_ci @TMP_DEST=$$(mktemp -d); \ 31862306a36Sopenharmony_ci cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \ 31962306a36Sopenharmony_ci printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \ 32062306a36Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1; \ 32162306a36Sopenharmony_ci echo " test: $(call test,$@)" >> $@ 2>&1; \ 32262306a36Sopenharmony_ci $(call test,$@) && \ 32362306a36Sopenharmony_ci rm -rf $@ $$TMP_DEST || (cat $@ ; false) 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_cimake_static: 32662306a36Sopenharmony_ci $(call clean) 32762306a36Sopenharmony_ci @TMP_DEST=$$(mktemp -d); \ 32862306a36Sopenharmony_ci cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \ 32962306a36Sopenharmony_ci printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \ 33062306a36Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1; \ 33162306a36Sopenharmony_ci echo " test: $(call test,$@)" >> $@ 2>&1; \ 33262306a36Sopenharmony_ci $(call test,$@) && \ 33362306a36Sopenharmony_ci rm -rf $@ $$TMP_DEST || (cat $@ ; false) 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci$(run_O): 33662306a36Sopenharmony_ci $(call clean) 33762306a36Sopenharmony_ci @TMP_O=$$(mktemp -d); \ 33862306a36Sopenharmony_ci TMP_DEST=$$(mktemp -d); \ 33962306a36Sopenharmony_ci cmd="cd $(PERF) && $(MAKE_F) $($(patsubst %_O,%,$@)) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST"; \ 34062306a36Sopenharmony_ci printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \ 34162306a36Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1 && \ 34262306a36Sopenharmony_ci echo " test: $(call test_O,$@)" >> $@ 2>&1; \ 34362306a36Sopenharmony_ci $(call test_O,$@) && \ 34462306a36Sopenharmony_ci rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_citarpkg: 34762306a36Sopenharmony_ci @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \ 34862306a36Sopenharmony_ci echo "- $@: $$cmd" && echo $$cmd > $@ && \ 34962306a36Sopenharmony_ci ( eval $$cmd ) >> $@ 2>&1 && \ 35062306a36Sopenharmony_ci rm -f $@ 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ciKERNEL_O := ../.. 35362306a36Sopenharmony_ciifneq ($(O),) 35462306a36Sopenharmony_ci KERNEL_O := $(O) 35562306a36Sopenharmony_ciendif 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_cimake_kernelsrc: 35862306a36Sopenharmony_ci @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf" 35962306a36Sopenharmony_ci $(call clean); \ 36062306a36Sopenharmony_ci (make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \ 36162306a36Sopenharmony_ci test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false) 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_cimake_kernelsrc_tools: 36462306a36Sopenharmony_ci @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf" 36562306a36Sopenharmony_ci $(call clean); \ 36662306a36Sopenharmony_ci (make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \ 36762306a36Sopenharmony_ci test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false) 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_cimake_libperf: 37062306a36Sopenharmony_ci @echo "- make -C lib"; 37162306a36Sopenharmony_ci make -C lib clean >$@ 2>&1; make -C lib >>$@ 2>&1 && rm $@ 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ciFEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP 37462306a36Sopenharmony_ciFEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC 37562306a36Sopenharmony_ci 37662306a36Sopenharmony_ciall: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools 37762306a36Sopenharmony_ci @echo OK 37862306a36Sopenharmony_ci @rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ciout: $(run_O) 38162306a36Sopenharmony_ci @echo OK 38262306a36Sopenharmony_ci @rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC) 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ciifeq ($(REUSE_FEATURES_DUMP),1) 38562306a36Sopenharmony_ci$(FEATURES_DUMP_FILE): 38662306a36Sopenharmony_ci $(call clean) 38762306a36Sopenharmony_ci @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \ 38862306a36Sopenharmony_ci echo "- $@: $$cmd" && echo $$cmd && \ 38962306a36Sopenharmony_ci ( eval $$cmd ) > /dev/null 2>&1 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci$(FEATURES_DUMP_FILE_STATIC): 39262306a36Sopenharmony_ci $(call clean) 39362306a36Sopenharmony_ci @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \ 39462306a36Sopenharmony_ci echo "- $@: $$cmd" && echo $$cmd && \ 39562306a36Sopenharmony_ci ( eval $$cmd ) > /dev/null 2>&1 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci# Add feature dump dependency for run/run_O targets 39862306a36Sopenharmony_ci$(foreach t,$(run) $(run_O),$(eval \ 39962306a36Sopenharmony_ci $(t): $(if $(findstring make_static,$(t)),\ 40062306a36Sopenharmony_ci $(FEATURES_DUMP_FILE_STATIC),\ 40162306a36Sopenharmony_ci $(FEATURES_DUMP_FILE)))) 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci# Append 'FEATURES_DUMP=' option to all test cases. For example: 40462306a36Sopenharmony_ci# make_no_libbpf: NO_LIBBPF=1 --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP 40562306a36Sopenharmony_ci# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC 40662306a36Sopenharmony_ci$(foreach t,$(run),$(if $(findstring make_static,$(t)),\ 40762306a36Sopenharmony_ci $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\ 40862306a36Sopenharmony_ci $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE)))) 40962306a36Sopenharmony_ciendif 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools make_libperf 41262306a36Sopenharmony_ciendif # ifndef MK 413