Debian Codegraph @

tools/tracing/rtla/Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
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 CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
70
71 export CFLAGS OUTPUT srctree
72
73 ifeq ($(BUILD_BPF_SKEL),1)
74 src/timerlat.bpf.o: src/timerlat.bpf.c
75 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@
76
77 src/timerlat.skel.h: src/timerlat.bpf.o
78 $(QUIET_GENSKEL)$(SYSTEM_BPFTOOL) gen skeleton $< > $@
79
80 example/timerlat_bpf_action.o: example/timerlat_bpf_action.c
81 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@
82
83 tests/bpf/bpf_action_map.o: tests/bpf/bpf_action_map.c
84 $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@
85 else
86 src/timerlat.skel.h:
87 $(Q)echo '/* BPF skeleton is disabled */' > src/timerlat.skel.h
88
89 example/timerlat_bpf_action.o: example/timerlat_bpf_action.c
90 $(Q)echo "BPF skeleton support is disabled, skipping example/timerlat_bpf_action.o"
91
92 tests/bpf/bpf_action_map.o: tests/bpf/bpf_action_map.c
93 $(Q)echo "BPF skeleton support is disabled, skipping tests/bpf/bpf_action_map.o"
94 endif
95
96 $(RTLA): $(RTLA_IN)
97 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RTLA) $(RTLA_IN) $(EXTLIBS)
98
99 static: $(RTLA_IN)
100 $(eval LDFLAGS += -static)
101 $(QUIET_LINK)$(CC) -static $(LDFLAGS) -o $(RTLA)-static $(RTLA_IN) $(EXTLIBS)
102
103 rtla.%: fixdep FORCE
104 make -f $(srctree)/tools/build/Makefile.build dir=. $@
105
106 $(RTLA_IN): fixdep FORCE src/timerlat.skel.h
107 make $(build)=rtla
108
109 clean: doc_clean fixdep-clean
110 $(call QUIET_CLEAN, rtla)
111 $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
112 $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-*
113 $(Q)rm -rf feature
114 $(Q)rm -f src/timerlat.bpf.o src/timerlat.skel.h example/timerlat_bpf_action.o
115 $(Q)rm -f $(UNIT_TESTS)
116
117 check: $(RTLA) tests/bpf/bpf_action_map.o
118 RTLA=$(RTLA) BPFTOOL=$(SYSTEM_BPFTOOL) prove -o -f -v tests/
119 examples: example/timerlat_bpf_action.o
120 .PHONY: FORCE clean check