mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
This never was in the default build for perf, is difficult to maintain
as it uses clang/llvm internals so ditch it, keeping, for now, the
external compilation of .c BPF into .o bytecode and its subsequent
loading, that is also going to be removed, do it separately to help
bisection and to properly document what is being removed and why.
Committer notes:
Extracted from a larger patch and removed some leftovers, namely
deleting these now unused feature tests:
tools/build/feature/test-clang.cpp
tools/build/feature/test-cxx.cpp
tools/build/feature/test-llvm-version.cpp
tools/build/feature/test-llvm.cpp
Testing the use of BPF events after applying this patch:
To use the external clang/llvm toolchain to compile a .c event and then
use libbpf to load it, to get the syscalls:sys_enter_open* tracepoints
and read the filename pointer, putting it into the ring buffer right
after the usual tracepoint payload for 'perf trace' to then print it:
[root@quaco ~]# perf trace -e /home/acme/git/perf-tools-next/tools/perf/examples/bpf/augmented_raw_syscalls.c,open* --max-events=10
0.000 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
0.083 abrt-dump-jour/1453 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.063 abrt-dump-jour/1454 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.082 abrt-dump-jour/1455 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
250.124 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
250.521 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/app.slice/memory.pressure", flags: RDONLY|CLOEXEC) = 12
251.047 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/app.slice/memory.current", flags: RDONLY|CLOEXEC) = 12
251.162 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/app.slice/memory.min", flags: RDONLY|CLOEXEC) = 12
251.242 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/app.slice/memory.low", flags: RDONLY|CLOEXEC) = 12
251.353 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/app.slice/memory.swap.current", flags: RDONLY|CLOEXEC) = 12
[root@quaco ~]#
Same thing, but with a prebuilt .o BPF bytecode:
[root@quaco ~]# perf trace -e /home/acme/git/perf-tools-next/tools/perf/examples/bpf/augmented_raw_syscalls.o,open* --max-events=10
0.000 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
0.083 abrt-dump-jour/1453 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.083 abrt-dump-jour/1455 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.062 abrt-dump-jour/1454 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
249.985 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
466.763 thermald/1234 openat(dfd: CWD, filename: "/sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:2/energy_uj") = 13
467.145 thermald/1234 openat(dfd: CWD, filename: "/sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj") = 13
467.311 thermald/1234 openat(dfd: CWD, filename: "/sys/class/thermal/thermal_zone2/temp") = 13
500.040 cgroupify/24006 openat(dfd: 4, filename: ".", flags: RDONLY|CLOEXEC|DIRECTORY|NONBLOCK) = 5
500.295 cgroupify/24006 openat(dfd: 4, filename: "24616/cgroup.procs") = 5
[root@quaco ~]#
Signed-off-by: Ian Rogers <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Anshuman Khandual <[email protected]>
Cc: Athira Rajeev <[email protected]>
Cc: Brendan Gregg <[email protected]>
Cc: Carsten Haitzler <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Cc: Fangrui Song <[email protected]>
Cc: He Kuang <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: "Naveen N. Rao" <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Tiezhu Yang <[email protected]>
Cc: Tom Rix <[email protected]>
Cc: Wang Nan <[email protected]>
Cc: Wang ShaoBo <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: Yonghong Song <[email protected]>
Cc: YueHaibing <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
413 lines
13 KiB
Plaintext
413 lines
13 KiB
Plaintext
include ../scripts/Makefile.include
|
|
|
|
ifndef MK
|
|
ifeq ($(MAKECMDGOALS),)
|
|
# no target specified, trigger the whole suite
|
|
all:
|
|
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
|
|
@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1
|
|
else
|
|
# run only specific test over 'Makefile'
|
|
%:
|
|
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile $@
|
|
endif
|
|
else
|
|
PERF := .
|
|
PERF_O := $(PERF)
|
|
O_OPT :=
|
|
FULL_O := $(shell readlink -f $(PERF_O) || echo $(PERF_O))
|
|
|
|
ifneq ($(O),)
|
|
FULL_O := $(shell readlink -f $(O) || echo $(O))
|
|
PERF_O := $(FULL_O)
|
|
ifeq ($(SET_O),1)
|
|
O_OPT := 'O=$(FULL_O)'
|
|
endif
|
|
K_O_OPT := 'O=$(FULL_O)'
|
|
endif
|
|
|
|
PARALLEL_OPT=
|
|
ifeq ($(SET_PARALLEL),1)
|
|
ifeq ($(JOBS),)
|
|
cores := $(shell (getconf _NPROCESSORS_ONLN || grep -E -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
|
|
ifeq ($(cores),0)
|
|
cores := 1
|
|
endif
|
|
else
|
|
cores=$(JOBS)
|
|
endif
|
|
PARALLEL_OPT="-j$(cores)"
|
|
endif
|
|
|
|
# As per kernel Makefile, avoid funny character set dependencies
|
|
unexport LC_ALL
|
|
LC_COLLATE=C
|
|
LC_NUMERIC=C
|
|
export LC_COLLATE LC_NUMERIC
|
|
|
|
ifeq ($(srctree),)
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
#$(info Determined 'srctree' to be $(srctree))
|
|
endif
|
|
|
|
include $(srctree)/tools/scripts/Makefile.arch
|
|
|
|
# FIXME looks like x86 is the only arch running tests ;-)
|
|
# we need some IS_(32/64) flag to make this generic
|
|
ifeq ($(ARCH)$(IS_64_BIT), x861)
|
|
lib = lib64
|
|
else
|
|
lib = lib
|
|
endif
|
|
|
|
has = $(shell which $1 2>/dev/null)
|
|
python_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{print $$3}')
|
|
|
|
# standard single make variable specified
|
|
make_clean_all := clean all
|
|
make_python_perf_so := $(python_perf_so)
|
|
make_debug := DEBUG=1
|
|
make_nondistro := BUILD_NONDISTRO=1
|
|
make_extra_tests := EXTRA_TESTS=1
|
|
make_bpf_skel := BUILD_BPF_SKEL=1
|
|
make_gen_vmlinux_h := BUILD_BPF_SKEL=1 GEN_VMLINUX_H=1
|
|
make_no_libperl := NO_LIBPERL=1
|
|
make_no_libpython := NO_LIBPYTHON=1
|
|
make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
|
|
make_no_slang := NO_SLANG=1
|
|
make_no_gtk2 := NO_GTK2=1
|
|
make_no_ui := NO_SLANG=1 NO_GTK2=1
|
|
make_no_demangle := NO_DEMANGLE=1
|
|
make_no_libelf := NO_LIBELF=1
|
|
make_no_libunwind := NO_LIBUNWIND=1
|
|
make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
|
|
make_no_backtrace := NO_BACKTRACE=1
|
|
make_no_libnuma := NO_LIBNUMA=1
|
|
make_no_libaudit := NO_LIBAUDIT=1
|
|
make_no_libbionic := NO_LIBBIONIC=1
|
|
make_no_auxtrace := NO_AUXTRACE=1
|
|
make_no_libbpf := NO_LIBBPF=1
|
|
make_libbpf_dynamic := LIBBPF_DYNAMIC=1
|
|
make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1
|
|
make_no_libcrypto := NO_LIBCRYPTO=1
|
|
make_with_babeltrace:= LIBBABELTRACE=1
|
|
make_with_coresight := CORESIGHT=1
|
|
make_no_sdt := NO_SDT=1
|
|
make_no_syscall_tbl := NO_SYSCALL_TABLE=1
|
|
make_no_libpfm4 := NO_LIBPFM4=1
|
|
make_with_gtk2 := GTK2=1
|
|
make_refcnt_check := EXTRA_CFLAGS="-DREFCNT_CHECKING=1"
|
|
make_tags := tags
|
|
make_cscope := cscope
|
|
make_help := help
|
|
make_doc := doc
|
|
make_perf_o := perf.o
|
|
make_util_map_o := util/map.o
|
|
make_util_pmu_bison_o := util/pmu-bison.o
|
|
make_install := install
|
|
make_install_bin := install-bin
|
|
make_install_doc := install-doc
|
|
make_install_man := install-man
|
|
make_install_html := install-html
|
|
make_install_info := install-info
|
|
make_install_pdf := install-pdf
|
|
make_install_prefix := install prefix=/tmp/krava
|
|
make_install_prefix_slash := install prefix=/tmp/krava/
|
|
make_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 NO_LIBTRACEEVENT=1 NO_LIBELF=1
|
|
|
|
# all the NO_* variable combined
|
|
make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_GTK2=1
|
|
make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
|
|
make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
|
|
make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
|
|
make_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
|
|
make_minimal += NO_LIBCAP=1 NO_SYSCALL_TABLE=1
|
|
|
|
# $(run) contains all available tests
|
|
run := make_pure
|
|
# Targets 'clean all' can be run together only through top level
|
|
# Makefile because we detect clean target in Makefile.perf and
|
|
# disable features detection
|
|
ifeq ($(MK),Makefile)
|
|
run += make_clean_all
|
|
MAKE_F := $(MAKE)
|
|
else
|
|
MAKE_F := $(MAKE) -f $(MK)
|
|
endif
|
|
run += make_python_perf_so
|
|
run += make_debug
|
|
run += make_nondistro
|
|
run += make_build_bpf_skel
|
|
run += make_gen_vmlinux_h
|
|
run += make_no_libperl
|
|
run += make_no_libpython
|
|
run += make_no_scripts
|
|
run += make_no_slang
|
|
run += make_no_gtk2
|
|
run += make_no_ui
|
|
run += make_no_demangle
|
|
run += make_no_libelf
|
|
run += make_no_libunwind
|
|
run += make_no_libdw_dwarf_unwind
|
|
run += make_no_backtrace
|
|
run += make_no_libnuma
|
|
run += make_no_libaudit
|
|
run += make_no_libbionic
|
|
run += make_no_auxtrace
|
|
run += make_no_libbpf
|
|
run += make_no_libbpf_DEBUG
|
|
run += make_no_libcrypto
|
|
run += make_no_sdt
|
|
run += make_no_syscall_tbl
|
|
run += make_with_babeltrace
|
|
run += make_with_coresight
|
|
run += make_with_clangllvm
|
|
run += make_no_libpfm4
|
|
run += make_refcnt_check
|
|
run += make_help
|
|
run += make_doc
|
|
run += make_perf_o
|
|
run += make_util_map_o
|
|
run += make_util_pmu_bison_o
|
|
run += make_install
|
|
run += make_install_bin
|
|
run += make_install_prefix
|
|
run += make_install_prefix_slash
|
|
# FIXME 'install-*' commented out till they're fixed
|
|
# run += make_install_doc
|
|
# run += make_install_man
|
|
# run += make_install_html
|
|
# run += make_install_info
|
|
# run += make_install_pdf
|
|
run += make_minimal
|
|
|
|
old_libbpf := $(shell echo '\#include <bpf/libbpf.h>' | $(CC) -E -dM -x c -| egrep -q "define[[:space:]]+LIBBPF_MAJOR_VERSION[[:space:]]+0{1}")
|
|
|
|
ifneq ($(old_libbpf),)
|
|
run += make_libbpf_dynamic
|
|
endif
|
|
|
|
ifneq ($(call has,ctags),)
|
|
run += make_tags
|
|
endif
|
|
ifneq ($(call has,cscope),)
|
|
run += make_cscope
|
|
endif
|
|
|
|
# $(run_O) contains same portion of $(run) tests with '_O' attached
|
|
# to distinguish O=... tests
|
|
run_O := $(addsuffix _O,$(run))
|
|
|
|
# disable some tests for O=...
|
|
run_O := $(filter-out make_python_perf_so_O,$(run_O))
|
|
|
|
# define test for each compile as 'test_NAME' variable
|
|
# with the test itself as a value
|
|
test_make_tags = test -f tags
|
|
test_make_cscope = test -f cscope.out
|
|
|
|
test_make_tags_O := $(test_make_tags)
|
|
test_make_cscope_O := $(test_make_cscope)
|
|
|
|
test_ok := true
|
|
test_make_help := $(test_ok)
|
|
test_make_doc := $(test_ok)
|
|
test_make_help_O := $(test_ok)
|
|
test_make_doc_O := $(test_ok)
|
|
|
|
test_make_python_perf_so := test -f $(PERF_O)/$(python_perf_so)
|
|
|
|
test_make_perf_o := test -f $(PERF_O)/perf.o
|
|
test_make_util_map_o := test -f $(PERF_O)/util/map.o
|
|
test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
|
|
|
|
define test_dest_files
|
|
for file in $(1); do \
|
|
if [ ! -x $$TMP_DEST/$$file ]; then \
|
|
echo " failed to find: $$file"; \
|
|
fi \
|
|
done
|
|
endef
|
|
|
|
installed_files_bin := bin/perf
|
|
installed_files_bin += etc/bash_completion.d/perf
|
|
installed_files_bin += libexec/perf-core/perf-archive
|
|
|
|
installed_files_all := $(installed_files_bin)
|
|
|
|
test_make_install := $(call test_dest_files,$(installed_files_all))
|
|
test_make_install_O := $(call test_dest_files,$(installed_files_all))
|
|
test_make_install_bin := $(call test_dest_files,$(installed_files_bin))
|
|
test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
|
|
|
|
# We prefix all installed files for make_install_prefix(_slash)
|
|
# with '/tmp/krava' to match installed/prefix-ed files.
|
|
installed_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all))
|
|
test_make_install_prefix := $(call test_dest_files,$(installed_files_all_prefix))
|
|
test_make_install_prefix_O := $(call test_dest_files,$(installed_files_all_prefix))
|
|
|
|
test_make_install_prefix_slash := $(test_make_install_prefix)
|
|
test_make_install_prefix_slash_O := $(test_make_install_prefix_O)
|
|
|
|
# FIXME nothing gets installed
|
|
test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1
|
|
test_make_install_man_O := $(test_make_install_man)
|
|
|
|
# FIXME nothing gets installed
|
|
test_make_install_doc := $(test_ok)
|
|
test_make_install_doc_O := $(test_ok)
|
|
|
|
# FIXME nothing gets installed
|
|
test_make_install_html := $(test_ok)
|
|
test_make_install_html_O := $(test_ok)
|
|
|
|
# FIXME nothing gets installed
|
|
test_make_install_info := $(test_ok)
|
|
test_make_install_info_O := $(test_ok)
|
|
|
|
# FIXME nothing gets installed
|
|
test_make_install_pdf := $(test_ok)
|
|
test_make_install_pdf_O := $(test_ok)
|
|
|
|
test_make_libbpf_dynamic := ldd $(PERF_O)/perf | grep -q libbpf
|
|
test_make_libbpf_dynamic_O := ldd $$TMP_O/perf | grep -q libbpf
|
|
|
|
test_make_python_perf_so_O := test -f $$TMP_O/python/perf.so
|
|
test_make_perf_o_O := test -f $$TMP_O/perf.o
|
|
test_make_util_map_o_O := test -f $$TMP_O/util/map.o
|
|
test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
|
|
|
|
test_default = test -x $(PERF_O)/perf
|
|
test = $(if $(test_$1),$(test_$1),$(test_default))
|
|
|
|
test_default_O = test -x $$TMP_O/perf
|
|
test_O = $(if $(test_$1),$(test_$1),$(test_default_O))
|
|
|
|
all:
|
|
|
|
ifdef SHUF
|
|
run := $(shell shuf -e $(run))
|
|
run_O := $(shell shuf -e $(run_O))
|
|
endif
|
|
|
|
max_width := $(shell echo $(run_O) | sed 's/ /\n/g' | wc -L)
|
|
|
|
ifdef DEBUG
|
|
d := $(info run $(run))
|
|
d := $(info run_O $(run_O))
|
|
endif
|
|
|
|
MAKEFLAGS := --no-print-directory
|
|
|
|
clean := @(cd $(PERF); $(MAKE_F) -s $(O_OPT) clean >/dev/null && $(MAKE) -s $(O_OPT) -C ../build clean >/dev/null)
|
|
|
|
$(run):
|
|
$(call clean)
|
|
@TMP_DEST=$$(mktemp -d); \
|
|
cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
|
|
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
|
|
( eval $$cmd ) >> $@ 2>&1; \
|
|
echo " test: $(call test,$@)" >> $@ 2>&1; \
|
|
$(call test,$@) && \
|
|
rm -rf $@ $$TMP_DEST || (cat $@ ; false)
|
|
|
|
make_with_gtk2:
|
|
$(call clean)
|
|
@TMP_DEST=$$(mktemp -d); \
|
|
cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
|
|
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
|
|
( eval $$cmd ) >> $@ 2>&1; \
|
|
echo " test: $(call test,$@)" >> $@ 2>&1; \
|
|
$(call test,$@) && \
|
|
rm -rf $@ $$TMP_DEST || (cat $@ ; false)
|
|
|
|
make_static:
|
|
$(call clean)
|
|
@TMP_DEST=$$(mktemp -d); \
|
|
cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
|
|
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
|
|
( eval $$cmd ) >> $@ 2>&1; \
|
|
echo " test: $(call test,$@)" >> $@ 2>&1; \
|
|
$(call test,$@) && \
|
|
rm -rf $@ $$TMP_DEST || (cat $@ ; false)
|
|
|
|
$(run_O):
|
|
$(call clean)
|
|
@TMP_O=$$(mktemp -d); \
|
|
TMP_DEST=$$(mktemp -d); \
|
|
cmd="cd $(PERF) && $(MAKE_F) $($(patsubst %_O,%,$@)) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST"; \
|
|
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
|
|
( eval $$cmd ) >> $@ 2>&1 && \
|
|
echo " test: $(call test_O,$@)" >> $@ 2>&1; \
|
|
$(call test_O,$@) && \
|
|
rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false)
|
|
|
|
tarpkg:
|
|
@cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
|
|
echo "- $@: $$cmd" && echo $$cmd > $@ && \
|
|
( eval $$cmd ) >> $@ 2>&1 && \
|
|
rm -f $@
|
|
|
|
KERNEL_O := ../..
|
|
ifneq ($(O),)
|
|
KERNEL_O := $(O)
|
|
endif
|
|
|
|
make_kernelsrc:
|
|
@echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
|
|
$(call clean); \
|
|
(make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
|
|
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
|
|
|
|
make_kernelsrc_tools:
|
|
@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
|
|
$(call clean); \
|
|
(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
|
|
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
|
|
|
|
make_libperf:
|
|
@echo "- make -C lib";
|
|
make -C lib clean >$@ 2>&1; make -C lib >>$@ 2>&1 && rm $@
|
|
|
|
FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
|
|
FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
|
|
|
|
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
|
|
@echo OK
|
|
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
|
|
|
|
out: $(run_O)
|
|
@echo OK
|
|
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
|
|
|
|
ifeq ($(REUSE_FEATURES_DUMP),1)
|
|
$(FEATURES_DUMP_FILE):
|
|
$(call clean)
|
|
@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \
|
|
echo "- $@: $$cmd" && echo $$cmd && \
|
|
( eval $$cmd ) > /dev/null 2>&1
|
|
|
|
$(FEATURES_DUMP_FILE_STATIC):
|
|
$(call clean)
|
|
@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \
|
|
echo "- $@: $$cmd" && echo $$cmd && \
|
|
( eval $$cmd ) > /dev/null 2>&1
|
|
|
|
# Add feature dump dependency for run/run_O targets
|
|
$(foreach t,$(run) $(run_O),$(eval \
|
|
$(t): $(if $(findstring make_static,$(t)),\
|
|
$(FEATURES_DUMP_FILE_STATIC),\
|
|
$(FEATURES_DUMP_FILE))))
|
|
|
|
# Append 'FEATURES_DUMP=' option to all test cases. For example:
|
|
# make_no_libbpf: NO_LIBBPF=1 --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP
|
|
# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC
|
|
$(foreach t,$(run),$(if $(findstring make_static,$(t)),\
|
|
$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\
|
|
$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
|
|
endif
|
|
|
|
.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools make_libperf
|
|
endif # ifndef MK
|