Cleanup: move to kernel style SPDX license identifiers
[deliverable/lttng-modules.git] / probes / Kbuild
1 # SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2
3 TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/..
4
5 include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common
6
7 ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)
8
9 obj-$(CONFIG_LTTNG) += lttng-probe-sched.o
10 obj-$(CONFIG_LTTNG) += lttng-probe-irq.o
11 obj-$(CONFIG_LTTNG) += lttng-probe-timer.o
12 obj-$(CONFIG_LTTNG) += lttng-probe-kmem.o
13 obj-$(CONFIG_LTTNG) += lttng-probe-module.o
14 obj-$(CONFIG_LTTNG) += lttng-probe-power.o
15 obj-$(CONFIG_LTTNG) += lttng-probe-statedump.o
16
17 ifneq ($(CONFIG_NET_9P),)
18 obj-$(CONFIG_LTTNG) += $(shell \
19 if [ $(VERSION) -ge 4 \
20 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 10 \) ] ; then \
21 echo "lttng-probe-9p.o" ; fi;)
22 endif # CONFIG_NET_9P
23
24 i2c_dep = $(srctree)/include/trace/events/i2c.h
25 ifneq ($(wildcard $(i2c_dep)),)
26 obj-$(CONFIG_LTTNG) += lttng-probe-i2c.o
27 endif
28
29 ifneq ($(CONFIG_KVM),)
30 obj-$(CONFIG_LTTNG) += lttng-probe-kvm.o
31 ifneq ($(CONFIG_X86),)
32 kvm_dep_lapic = $(srctree)/arch/x86/kvm/lapic.h
33 ifneq ($(wildcard $(kvm_dep_lapic)),)
34 kvm_dep = $(srctree)/virt/kvm/iodev.h $(srctree)/include/kvm/iodev.h
35 ifneq ($(wildcard $(kvm_dep)),)
36 CFLAGS_lttng-probe-kvm-x86.o += -I$(srctree)/virt/kvm
37 CFLAGS_lttng-probe-kvm-x86-mmu.o += -I$(srctree)/virt/kvm
38 obj-$(CONFIG_LTTNG) += $(shell \
39 if [ $(VERSION) -ge 3 \
40 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
41 echo "lttng-probe-kvm-x86.o" ; fi;)
42 obj-$(CONFIG_LTTNG) += $(shell \
43 if [ $(VERSION) -ge 3 \
44 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
45 echo "lttng-probe-kvm-x86-mmu.o" ; fi;)
46 else
47 $(warning File $(kvm_dep) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
48 endif # $(wildcard $(kvm_dep))
49 else
50 $(warning File $(kvm_dep_lapic) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
51 endif # $(wildcard $(kvm_dep_lapic))
52 endif # CONFIG_X86
53 endif # CONFIG_KVM
54
55 ifneq ($(CONFIG_X86),)
56 x86_irq_vectors_dep = $(srctree)/arch/x86/include/asm/trace/irq_vectors.h
57
58 ifneq ($(wildcard $(x86_irq_vectors_dep)),)
59 obj-$(CONFIG_LTTNG) += lttng-probe-x86-irq-vectors.o
60 endif # $(wildcard $(x86_irq_vectors_dep))
61
62 x86_exceptions_dep = $(srctree)/arch/x86/include/asm/trace/exceptions.h
63
64 ifneq ($(wildcard $(x86_exceptions_dep)),)
65 obj-$(CONFIG_LTTNG) += lttng-probe-x86-exceptions.o
66 endif # $(wildcard $(x86_exceptions_dep))
67 endif # CONFIG_X86
68
69 obj-$(CONFIG_LTTNG) += $(shell \
70 if [ $(VERSION) -ge 3 \
71 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \
72 echo "lttng-probe-signal.o" ; fi;)
73
74 ifneq ($(CONFIG_BLOCK),)
75 # need blk_cmd_buf_len
76 ifneq ($(CONFIG_EVENT_TRACING),)
77 obj-$(CONFIG_LTTNG) += lttng-probe-block.o
78 endif # CONFIG_EVENT_TRACING
79 endif # CONFIG_BLOCK
80
81 ifneq ($(CONFIG_NET),)
82 obj-$(CONFIG_LTTNG) += lttng-probe-napi.o
83 obj-$(CONFIG_LTTNG) += lttng-probe-skb.o
84 obj-$(CONFIG_LTTNG) += $(shell \
85 if [ $(VERSION) -ge 3 \
86 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 37 \) ] ; then \
87 echo "lttng-probe-net.o" ; fi;)
88 obj-$(CONFIG_LTTNG) += $(shell \
89 if [ $(VERSION) -ge 4 \
90 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
91 echo "lttng-probe-sock.o" ; fi;)
92 obj-$(CONFIG_LTTNG) += $(shell \
93 if [ $(VERSION) -ge 4 \
94 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
95 echo "lttng-probe-udp.o" ; fi;)
96 endif # CONFIG_NET
97
98 ifneq ($(CONFIG_SND_SOC),)
99 obj-$(CONFIG_LTTNG) += $(shell \
100 if [ $(VERSION) -ge 3 \
101 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
102 echo "lttng-probe-asoc.o" ; fi;)
103 endif # CONFIG_SND_SOC
104
105 ifneq ($(CONFIG_EXT3_FS),)
106 ext3_dep = $(srctree)/fs/ext3/*.h
107 ext3_dep_check = $(wildcard $(ext3_dep))
108 ext3 = $(shell \
109 if [ $(VERSION) -lt 4 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -lt 3 \) ] ; then \
110 if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
111 if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \
112 -z "$(ext3_dep_check)" ] ; then \
113 echo "warn" ; \
114 exit ; \
115 fi; \
116 echo "lttng-probe-ext3.o" ; \
117 fi; \
118 fi;)
119 ifeq ($(ext3),warn)
120 $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.)
121 ext3 =
122 endif # $(ext3),warn
123 obj-$(CONFIG_LTTNG) += $(ext3)
124 endif # CONFIG_EXT3_FS
125
126 ifneq ($(CONFIG_GPIOLIB),)
127 obj-$(CONFIG_LTTNG) += $(shell \
128 if [ $(VERSION) -ge 3 ] ; then \
129 echo "lttng-probe-gpio.o" ; fi;)
130 endif # CONFIG_GPIOLIB
131
132 ifneq ($(CONFIG_JBD2),)
133 obj-$(CONFIG_LTTNG) += lttng-probe-jbd2.o
134 endif # CONFIG_JBD2
135
136 ifneq ($(CONFIG_JBD),)
137 obj-$(CONFIG_LTTNG) += $(shell \
138 if [ $(VERSION) -ge 4 \
139 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
140 echo "lttng-probe-jbd.o" ; fi;)
141 endif # CONFIG_JBD
142
143 ifneq ($(CONFIG_REGULATOR),)
144 obj-$(CONFIG_LTTNG) += $(shell \
145 if [ $(VERSION) -ge 3 \
146 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
147 echo "lttng-probe-regulator.o" ; fi;)
148 endif # CONFIG_REGULATOR
149
150 ifneq ($(CONFIG_SCSI),)
151 obj-$(CONFIG_LTTNG) += $(shell \
152 if [ $(VERSION) -ge 3 \
153 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 35 \) ] ; then \
154 echo "lttng-probe-scsi.o" ; fi;)
155 endif # CONFIG_SCSI
156
157 obj-$(CONFIG_LTTNG) += $(shell \
158 if [ $(VERSION) -ge 3 \
159 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \
160 echo "lttng-probe-vmscan.o" ; fi;)
161
162 # lock probe does not work, so disabling it for now
163 #ifneq ($(CONFIG_LOCKDEP),)
164 # obj-$(CONFIG_LTTNG) += lttng-probe-lock.o
165 #endif # CONFIG_LOCKDEP
166
167 ifneq ($(CONFIG_BTRFS_FS),)
168 btrfs_dep = $(srctree)/fs/btrfs/*.h
169 btrfs = $(shell \
170 if [ $(VERSION) -ge 3 \
171 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 39 \) ] ; then \
172 echo "lttng-probe-btrfs.o" ; fi;)
173 ifneq ($(btrfs),)
174 ifeq ($(wildcard $(btrfs_dep)),)
175 $(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.)
176 btrfs =
177 endif # $(wildcard $(btrfs_dep))
178 endif # $(btrfs)
179 obj-$(CONFIG_LTTNG) += $(btrfs)
180 endif # CONFIG_BTRFS_FS
181
182 obj-$(CONFIG_LTTNG) += $(shell \
183 if [ $(VERSION) -ge 3 \
184 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
185 echo "lttng-probe-compaction.o" ; fi;)
186
187 ifneq ($(CONFIG_EXT4_FS),)
188 ext4_dep = $(srctree)/fs/ext4/*.h
189 ext4 = lttng-probe-ext4.o
190 ifeq ($(wildcard $(ext4_dep)),)
191 $(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.)
192 ext4 =
193 endif # $(wildcard $(ext4_dep))
194 obj-$(CONFIG_LTTNG) += $(ext4)
195 endif # CONFIG_EXT4_FS
196
197 obj-$(CONFIG_LTTNG) += $(shell \
198 if [ $(VERSION) -ge 4 \
199 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
200 echo "lttng-probe-printk.o" ; fi;)
201
202 ifneq ($(CONFIG_FRAME_WARN),0)
203 CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
204 endif
205
206 obj-$(CONFIG_LTTNG) += $(shell \
207 if [ $(VERSION) -ge 4 \
208 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
209 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
210 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
211 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \
212 echo "lttng-probe-random.o" ; fi;)
213
214 obj-$(CONFIG_LTTNG) += $(shell \
215 if [ $(VERSION) -ge 4 \
216 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
217 echo "lttng-probe-rcu.o" ; fi;)
218
219 ifneq ($(CONFIG_REGMAP),)
220 regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h
221 ifneq ($(wildcard $(regmap_dep_4_1)),)
222 obj-$(CONFIG_LTTNG) += lttng-probe-regmap.o
223 else
224 $(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.)
225 endif # $(wildcard $(regmap_dep_4_1)),
226 endif # CONFIG_REGMAP
227
228 ifneq ($(CONFIG_PM_RUNTIME),)
229 obj-$(CONFIG_LTTNG) += $(shell \
230 if [ $(VERSION) -ge 4 \
231 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
232 echo "lttng-probe-rpm.o" ; fi;)
233 endif # CONFIG_PM_RUNTIME
234
235 ifneq ($(CONFIG_SUNRPC),)
236 obj-$(CONFIG_LTTNG) += $(shell \
237 if [ $(VERSION) -ge 4 \
238 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
239 echo "lttng-probe-sunrpc.o" ; fi;)
240 endif # CONFIG_SUNRPC
241
242 ifneq ($(CONFIG_VIDEO_V4L2),)
243 obj-$(CONFIG_LTTNG) += $(shell \
244 if [ $(VERSION) -ge 4 \
245 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \
246 echo "lttng-probe-v4l2.o" ; fi;)
247 endif # CONFIG_VIDEO_V4L2
248
249 obj-$(CONFIG_LTTNG) += lttng-probe-workqueue.o
250
251 ifneq ($(CONFIG_KALLSYMS_ALL),)
252 obj-$(CONFIG_LTTNG) += $(shell \
253 if [ $(VERSION) -ge 3 \
254 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -eq 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \
255 echo "lttng-probe-writeback.o" ; fi;)
256 else
257 ifdef CONFIG_LOCALVERSION # Check if dot-config is included.
258 $(warning CONFIG_KALLSYMS_ALL is disabled, therefore probe "writeback" is disabled. Rebuild your kernel with this configuration option enabled in order to trace this subsystem.)
259 endif
260 endif # CONFIG_KALLSYMS_ALL
261
262 ifneq ($(CONFIG_KPROBES),)
263 obj-$(CONFIG_LTTNG) += lttng-kprobes.o
264 endif # CONFIG_KPROBES
265
266 ifneq ($(CONFIG_KRETPROBES),)
267 obj-$(CONFIG_LTTNG) += lttng-kretprobes.o
268 endif # CONFIG_KRETPROBES
269
270 ifneq ($(CONFIG_DYNAMIC_FTRACE),)
271 ifeq ($(have_ftrace_header),yes)
272 obj-$(CONFIG_LTTNG) += lttng-ftrace.o
273 else
274 $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.)
275 endif
276 endif # CONFIG_DYNAMIC_FTRACE
277
278 ifneq ($(CONFIG_PREEMPTIRQ_EVENTS),)
279 obj-$(CONFIG_LTTNG) += lttng-probe-preemptirq.o
280 endif # CONFIG_PREEMPTIRQ_EVENTS
281
282 # vim:syntax=make
This page took 0.039987 seconds and 5 git commands to generate.