Debian Codegraph @

tools/tracing/rtla/Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 # SPDX-License-Identifier: GPL-2.0-only
2
3 ifeq ($(srctree),)
4 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5 srctree := $(patsubst %/,%,$(dir $(srctree)))
6 srctree := $(patsubst %/,%,$(dir $(srctree)))
7 endif
8
9 include $(srctree)/tools/scripts/Makefile.include
10
11 # O is an alias for OUTPUT
12 OUTPUT := $(O)
13
14 ifeq ($(OUTPUT),)
15 OUTPUT := $(CURDIR)
16 else
17 # subdir is used by the ../Makefile in $(call descend,)
18 ifneq ($(subdir),)
19 OUTPUT := $(OUTPUT)/$(subdir)
20 endif
21 endif
22
23 ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
24 OUTPUT := $(OUTPUT)/
25 endif
26
27 RTLA := $(OUTPUT)rtla
28 RTLA_IN := $(RTLA)-in.o
29
30 VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")
31 DOCSRC := ../../../Documentation/tools/rtla/
32
33 FEATURE_TESTS := libtraceevent
34 FEATURE_TESTS += libtracefs
35 FEATURE_TESTS += libcpupower
36 FEATURE_TESTS += libcheck
37 FEATURE_TESTS += libbpf
38 FEATURE_TESTS += clang-bpf-co-re
39 FEATURE_TESTS += bpftool-skeletons
40 FEATURE_DISPLAY := libtraceevent
41 FEATURE_DISPLAY += libtracefs
42 FEATURE_DISPLAY += libcpupower
43 FEATURE_DISPLAY += libcheck
44 FEATURE_DISPLAY += libbpf
45 FEATURE_DISPLAY += clang-bpf-co-re
46 FEATURE_DISPLAY += bpftool-skeletons
47
48 all: $(RTLA)
49
50 include $(srctree)/tools/build/Makefile.include
51 include Makefile.rtla
52 include tests/unit/Makefile.unit
53
54 # check for dependencies only on required targets
55 NON_CONFIG_TARGETS := clean install tarball doc doc_clean doc_install
56
57 config := 1
58 ifdef MAKECMDGOALS
59 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
60 config := 0
61 endif
62 endif
63
64 ifeq ($(config),1)
65 include $(srctree)/tools/build/Makefile.feature
66 include Makefile.config
67 endif
68
•69 INCLUDES = -I$(OUTPUT)src
70
71 CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
72
73 export CFLAGS OUTPUT srctree
74
75 ifeq ($(BUILD_BPF_SKEL),1)
•76 $(OUTPUT)src/timerlat.bpf.o: src/timerlat.bpf.c
77 mkdir -p $(@D)
78 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@
79
•80 $(OUTPUT)src/timerlat.skel.h: $(OUTPUT)src/timerlat.bpf.o
81 mkdir -p $(@D)
82 $(QUIET_GENSKEL)$(SYSTEM_BPFTOOL) gen skeleton $< > $@
83
•84 $(OUTPUT)example/timerlat_bpf_action.o: example/timerlat_bpf_action.c
85 mkdir -p $(@D)
86 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@
87
•88 $(OUTPUT)tests/bpf/bpf_action_map.o: tests/bpf/bpf_action_map.c
89 mkdir -p $(@D)
90 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@
91 else
•92 $(OUTPUT)src/timerlat.skel.h:
93 mkdir -p $(@D)
94 $(Q)echo '/* BPF skeleton is disabled */' > $@
95
•96 $(OUTPUT)example/timerlat_bpf_action.o: example/timerlat_bpf_action.c
97 $(Q)echo "BPF skeleton support is disabled, skipping example/timerlat_bpf_action.o"
98
•99 $(OUTPUT)tests/bpf/bpf_action_map.o: tests/bpf/bpf_action_map.c
100 $(Q)echo "BPF skeleton support is disabled, skipping tests/bpf/bpf_action_map.o"
101 endif
102
103 $(RTLA): $(RTLA_IN)
104 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RTLA) $(RTLA_IN) $(EXTLIBS)
105
106 static: $(RTLA_IN)
107 $(eval LDFLAGS += -static)
108 $(QUIET_LINK)$(CC) -static $(LDFLAGS) -o $(RTLA)-static $(RTLA_IN) $(EXTLIBS)
109
110 rtla.%: fixdep FORCE
111 make -f $(srctree)/tools/build/Makefile.build dir=. $@
112
•113 $(RTLA_IN): fixdep FORCE $(OUTPUT)src/timerlat.skel.h
114 make $(build)=rtla
115
116 clean: doc_clean fixdep-clean
117 $(call QUIET_CLEAN, rtla)
118 $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
119 $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-*
120 $(Q)rm -rf feature
•121 $(Q)rm -f $(OUTPUT)src/timerlat.bpf.o $(OUTPUT)src/timerlat.skel.h $(OUTPUT)example/timerlat_bpf_action.o
122 $(Q)rm -f $(UNIT_TESTS)
123
•124 check: $(RTLA) $(OUTPUT)tests/bpf/bpf_action_map.o
125 RTLA=$(RTLA) BPFTOOL=$(SYSTEM_BPFTOOL) prove -o -f -v tests/
•126 examples: $(OUTPUT)example/timerlat_bpf_action.o
127 .PHONY: FORCE clean check