xref: /linux/tools/tracing/rtla/Makefile.config (revision ef59e454156eb068ba3f2d9e14b397fd7953f65a)
1# SPDX-License-Identifier: GPL-2.0-only
2
3include $(srctree)/tools/scripts/utilities.mak
4
5STOP_ERROR :=
6
7LIBTRACEEVENT_MIN_VERSION = 1.5
8LIBTRACEFS_MIN_VERSION = 1.6
9
10ifndef ($(NO_LIBTRACEEVENT),1)
11  ifeq ($(call get-executable,$(PKG_CONFIG)),)
12    $(error Error: $(PKG_CONFIG) needed by libtraceevent/libtracefs is missing on this system, please install it)
13  endif
14endif
15
16define lib_setup
17  $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
18  $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)"))
19  $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)"))
20endef
21
22$(call feature_check,libtraceevent)
23ifeq ($(feature-libtraceevent), 1)
24  $(call detected,CONFIG_LIBTRACEEVENT)
25
26  TEST = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 && echo y || echo n")
27  ifeq ($(TEST),n)
28    $(info libtraceevent version is too low, it must be at least $(LIBTRACEEVENT_MIN_VERSION))
29    STOP_ERROR := 1
30  endif
31
32  $(call lib_setup,traceevent)
33else
34  STOP_ERROR := 1
35  $(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel)
36endif
37
38$(call feature_check,libtracefs)
39ifeq ($(feature-libtracefs), 1)
40  $(call detected,CONFIG_LIBTRACEFS)
41
42  TEST = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 && echo y || echo n")
43  ifeq ($(TEST),n)
44    $(info libtracefs version is too low, it must be at least $(LIBTRACEFS_MIN_VERSION))
45    STOP_ERROR := 1
46  endif
47
48  $(call lib_setup,tracefs)
49else
50  STOP_ERROR := 1
51  $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel)
52endif
53
54$(call feature_check,libcpupower)
55ifeq ($(feature-libcpupower), 1)
56  $(call detected,CONFIG_LIBCPUPOWER)
57  CFLAGS += -DHAVE_LIBCPUPOWER_SUPPORT
58  EXTLIBS += -lcpupower
59else
60  $(info libcpupower is missing, building without --deepest-idle-state support.)
61  $(info Please install libcpupower-dev/kernel-tools-libs-devel)
62endif
63
64$(call feature_check,libcheck)
65ifeq ($(feature-libcheck), 1)
66  $(call detected,CONFIG_LIBCHECK)
67else
68  $(info libcheck is missing, building without unit tests support.)
69  $(info Please install check-devel/check)
70endif
71
72ifndef BUILD_BPF_SKEL
73  # BPF skeletons are used to implement improved sample collection, enable
74  # them by default.
75  BUILD_BPF_SKEL := 1
76endif
77
78ifeq ($(BUILD_BPF_SKEL),0)
79  $(info BPF skeleton support disabled, building without BPF skeleton support.)
80endif
81
82$(call feature_check,libbpf)
83ifeq ($(feature-libbpf), 1)
84  $(call detected,CONFIG_LIBBPF)
85else
86  $(info libbpf is missing, building without BPF skeleton support.)
87  $(info Please install libbpf-dev/libbpf-devel)
88  BUILD_BPF_SKEL := 0
89endif
90
91$(call feature_check,clang-bpf-co-re)
92ifeq ($(feature-clang-bpf-co-re), 1)
93  $(call detected,CONFIG_CLANG_BPF_CO_RE)
94else
95  $(info clang is missing or does not support BPF CO-RE, building without BPF skeleton support.)
96  $(info Please install clang)
97  BUILD_BPF_SKEL := 0
98endif
99
100$(call feature_check,bpftool-skeletons)
101ifeq ($(feature-bpftool-skeletons), 1)
102  $(call detected,CONFIG_BPFTOOL_SKELETONS)
103else
104  $(info bpftool is missing or not supporting skeletons, building without BPF skeleton support.)
105  $(info Please install bpftool)
106  BUILD_BPF_SKEL := 0
107endif
108
109ifeq ($(BUILD_BPF_SKEL),1)
110  CFLAGS += -DHAVE_BPF_SKEL
111  EXTLIBS += -lbpf
112endif
113
114ifeq ($(STOP_ERROR),1)
115  $(error Please, check the errors above.)
116endif
117