1# SPDX-License-Identifier: GPL-2.0
2
3# Do not instrument the tracer itself:
4
5ccflags-remove-$(CONFIG_FUNCTION_TRACER) += $(CC_FLAGS_FTRACE)
6
7ifdef CONFIG_FUNCTION_TRACER
8
9# Avoid recursion due to instrumentation.
10KCSAN_SANITIZE := n
11
12ifdef CONFIG_FTRACE_SELFTEST
13# selftest needs instrumentation
14CFLAGS_trace_selftest_dynamic.o = $(CC_FLAGS_FTRACE)
15obj-y += trace_selftest_dynamic.o
16endif
17endif
18
19ifdef CONFIG_FTRACE_STARTUP_TEST
20CFLAGS_trace_kprobe_selftest.o = $(CC_FLAGS_FTRACE)
21obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe_selftest.o
22endif
23
24# If unlikely tracing is enabled, do not trace these files
25ifdef CONFIG_TRACING_BRANCHES
26KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
27endif
28
29# for GCOV coverage profiling
30ifdef CONFIG_GCOV_PROFILE_FTRACE
31GCOV_PROFILE := y
32endif
33
34CFLAGS_bpf_trace.o := -I$(src)
35
36CFLAGS_trace_benchmark.o := -I$(src)
37CFLAGS_trace_events_filter.o := -I$(src)
38
39obj-$(CONFIG_TRACE_CLOCK) += trace_clock.o
40
41obj-$(CONFIG_FUNCTION_TRACER) += libftrace.o
42obj-$(CONFIG_RING_BUFFER) += ring_buffer.o
43obj-$(CONFIG_RING_BUFFER_BENCHMARK) += ring_buffer_benchmark.o
44
45obj-$(CONFIG_TRACING) += trace.o
46obj-$(CONFIG_TRACING) += trace_output.o
47obj-$(CONFIG_TRACING) += trace_seq.o
48obj-$(CONFIG_TRACING) += trace_stat.o
49obj-$(CONFIG_TRACING) += trace_printk.o
50obj-$(CONFIG_TRACING) += 	pid_list.o
51obj-$(CONFIG_TRACING_MAP) += tracing_map.o
52obj-$(CONFIG_PREEMPTIRQ_DELAY_TEST) += preemptirq_delay_test.o
53obj-$(CONFIG_SYNTH_EVENT_GEN_TEST) += synth_event_gen_test.o
54obj-$(CONFIG_KPROBE_EVENT_GEN_TEST) += kprobe_event_gen_test.o
55obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
56obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
57obj-$(CONFIG_PREEMPTIRQ_TRACEPOINTS) += trace_preemptirq.o
58obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
59obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
60obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o
61obj-$(CONFIG_HWLAT_TRACER) += trace_hwlat.o
62obj-$(CONFIG_OSNOISE_TRACER) += trace_osnoise.o
63obj-$(CONFIG_NOP_TRACER) += trace_nop.o
64obj-$(CONFIG_STACK_TRACER) += trace_stack.o
65obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o
66obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += trace_functions_graph.o
67obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o
68obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o
69obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += fgraph.o
70ifeq ($(CONFIG_BLOCK),y)
71obj-$(CONFIG_EVENT_TRACING) += blktrace.o
72endif
73obj-$(CONFIG_EVENT_TRACING) += trace_events.o
74obj-$(CONFIG_EVENT_TRACING) += trace_export.o
75obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
76ifeq ($(CONFIG_PERF_EVENTS),y)
77obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o
78endif
79obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
80obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
81obj-$(CONFIG_PROBE_EVENTS) += trace_eprobe.o
82obj-$(CONFIG_TRACE_EVENT_INJECT) += trace_events_inject.o
83obj-$(CONFIG_SYNTH_EVENTS) += trace_events_synth.o
84obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
85obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
86obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
87obj-$(CONFIG_TRACEPOINTS) += error_report-traces.o
88obj-$(CONFIG_TRACEPOINTS) += power-traces.o
89ifeq ($(CONFIG_PM),y)
90obj-$(CONFIG_TRACEPOINTS) += rpm-traces.o
91endif
92ifeq ($(CONFIG_TRACING),y)
93obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
94endif
95obj-$(CONFIG_DYNAMIC_EVENTS) += trace_dynevent.o
96obj-$(CONFIG_PROBE_EVENTS) += trace_probe.o
97obj-$(CONFIG_UPROBE_EVENTS) += trace_uprobe.o
98obj-$(CONFIG_BOOTTIME_TRACING) += trace_boot.o
99obj-$(CONFIG_FTRACE_RECORD_RECURSION) += trace_recursion_record.o
100
101obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o
102
103libftrace-y := ftrace.o
104