fix: Use 'kernel_read' to read from procfs
[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 kvm_dep_lapic_check = $(wildcard $(kvm_dep_lapic))
34 ifneq ($(kvm_dep_lapic_check),)
35 # search for iodev.h in any of its known locations
36 kvm_dep_iodev = $(srctree)/virt/kvm/iodev.h $(srctree)/include/kvm/iodev.h
37 kvm_dep_iodev_check = $(wildcard $(kvm_dep_iodev))
38 ifneq ($(kvm_dep_iodev_check),)
39 kvm_dep_emulate = $(srctree)/arch/x86/kvm/kvm_emulate.h
40 kvm_dep_emulate_wildcard = $(wildcard $(kvm_dep_emulate))
41 kvm_dep_emulate_check = $(shell \
42 if [ \( $(VERSION) -ge 6 \
43 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 7 \) \) -a \
44 -z "$(kvm_dep_emulate_wildcard)" ] ; then \
45 echo "warn" ; \
46 else \
47 echo "ok" ; \
48 fi ;)
49 ifeq ($(kvm_dep_emulate_check),ok)
50 CFLAGS_lttng-probe-kvm-x86.o += -I$(srctree)/virt/kvm \
51 -I$(srctree)/arch/x86/kvm
52 CFLAGS_lttng-probe-kvm-x86-mmu.o += -I$(srctree)/virt/kvm
53 obj-$(CONFIG_LTTNG) += lttng-probe-kvm-x86.o
54 obj-$(CONFIG_LTTNG) += lttng-probe-kvm-x86-mmu.o
55 else # ($(kvm_dep_emulate_check),ok)
56 $(warning File $(kvm_dep_emulate) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
57 endif # ($(kvm_dep_emulate_check),ok)
58 else # $(kvm_dep_iodev_check)
59 $(warning File $(kvm_dep_iodev) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
60 endif # $(kvm_dep_iodev_check)
61 else # $(kvm_dep_lapic_check)
62 $(warning File $(kvm_dep_lapic) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
63 endif # $(kvm_dep_lapic_check)
64 endif # CONFIG_X86
65 endif # CONFIG_KVM
66
67 ifneq ($(CONFIG_X86),)
68 x86_irq_vectors_dep = $(srctree)/arch/x86/include/asm/trace/irq_vectors.h
69
70 ifneq ($(wildcard $(x86_irq_vectors_dep)),)
71 obj-$(CONFIG_LTTNG) += lttng-probe-x86-irq-vectors.o
72 endif # $(wildcard $(x86_irq_vectors_dep))
73
74 x86_exceptions_dep = $(srctree)/arch/x86/include/asm/trace/exceptions.h
75
76 ifneq ($(wildcard $(x86_exceptions_dep)),)
77 obj-$(CONFIG_LTTNG) += lttng-probe-x86-exceptions.o
78 endif # $(wildcard $(x86_exceptions_dep))
79 endif # CONFIG_X86
80
81 obj-$(CONFIG_LTTNG) += lttng-probe-signal.o
82
83 ifneq ($(CONFIG_BLOCK),)
84 # need blk_cmd_buf_len
85 ifneq ($(CONFIG_EVENT_TRACING),)
86 obj-$(CONFIG_LTTNG) += lttng-probe-block.o
87 endif # CONFIG_EVENT_TRACING
88 endif # CONFIG_BLOCK
89
90 ifneq ($(CONFIG_NET),)
91 obj-$(CONFIG_LTTNG) += lttng-probe-napi.o
92 obj-$(CONFIG_LTTNG) += lttng-probe-skb.o
93 obj-$(CONFIG_LTTNG) += lttng-probe-net.o
94 obj-$(CONFIG_LTTNG) += $(shell \
95 if [ $(VERSION) -ge 4 \
96 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
97 echo "lttng-probe-sock.o" ; fi;)
98 obj-$(CONFIG_LTTNG) += $(shell \
99 if [ $(VERSION) -ge 4 \
100 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
101 echo "lttng-probe-udp.o" ; fi;)
102 endif # CONFIG_NET
103
104 ifneq ($(CONFIG_SND_SOC),)
105 obj-$(CONFIG_LTTNG) += lttng-probe-asoc.o
106 endif # CONFIG_SND_SOC
107
108 ifneq ($(CONFIG_EXT3_FS),)
109 ext3_dep = $(srctree)/fs/ext3/*.h
110 ext3_dep_check = $(wildcard $(ext3_dep))
111 ext3 = $(shell \
112 if [ $(VERSION) -lt 4 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -lt 3 \) ] ; then \
113 if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
114 if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \
115 -z "$(ext3_dep_check)" ] ; then \
116 echo "warn" ; \
117 exit ; \
118 fi; \
119 echo "lttng-probe-ext3.o" ; \
120 fi; \
121 fi;)
122 ifeq ($(ext3),warn)
123 $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.)
124 ext3 =
125 endif # $(ext3),warn
126 obj-$(CONFIG_LTTNG) += $(ext3)
127 endif # CONFIG_EXT3_FS
128
129 ifneq ($(CONFIG_GPIOLIB),)
130 obj-$(CONFIG_LTTNG) += $(shell \
131 if [ $(VERSION) -ge 3 ] ; then \
132 echo "lttng-probe-gpio.o" ; fi;)
133 endif # CONFIG_GPIOLIB
134
135 ifneq ($(CONFIG_JBD2),)
136 obj-$(CONFIG_LTTNG) += lttng-probe-jbd2.o
137 endif # CONFIG_JBD2
138
139 ifneq ($(CONFIG_JBD),)
140 obj-$(CONFIG_LTTNG) += $(shell \
141 if [ $(VERSION) -ge 4 \
142 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
143 echo "lttng-probe-jbd.o" ; fi;)
144 endif # CONFIG_JBD
145
146 ifneq ($(CONFIG_REGULATOR),)
147 obj-$(CONFIG_LTTNG) += lttng-probe-regulator.o
148 endif # CONFIG_REGULATOR
149
150 ifneq ($(CONFIG_SCSI),)
151 obj-$(CONFIG_LTTNG) += lttng-probe-scsi.o
152 endif # CONFIG_SCSI
153
154 obj-$(CONFIG_LTTNG) += lttng-probe-vmscan.o
155
156 # lock probe does not work, so disabling it for now
157 #ifneq ($(CONFIG_LOCKDEP),)
158 # obj-$(CONFIG_LTTNG) += lttng-probe-lock.o
159 #endif # CONFIG_LOCKDEP
160
161 ifneq ($(CONFIG_BTRFS_FS),)
162 btrfs_dep = $(srctree)/fs/btrfs/*.h
163 ifneq ($(wildcard $(btrfs_dep)),)
164 obj-$(CONFIG_LTTNG) += lttng-probe-btrfs.o
165 else
166 $(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.)
167 endif # $(wildcard $(btrfs_dep))
168 endif # CONFIG_BTRFS_FS
169
170 obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o
171
172 ifneq ($(CONFIG_EXT4_FS),)
173 ext4_dep = $(srctree)/fs/ext4/*.h
174 ifneq ($(wildcard $(ext4_dep)),)
175 obj-$(CONFIG_LTTNG) += lttng-probe-ext4.o
176 else
177 $(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.)
178 endif # $(wildcard $(ext4_dep))
179 endif # CONFIG_EXT4_FS
180
181 obj-$(CONFIG_LTTNG) += $(shell \
182 if [ $(VERSION) -ge 4 \
183 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
184 echo "lttng-probe-printk.o" ; fi;)
185
186 ifneq ($(CONFIG_FRAME_WARN),0)
187 CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
188 endif
189
190 obj-$(CONFIG_LTTNG) += $(shell \
191 if [ $(VERSION) -ge 4 \
192 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
193 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
194 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
195 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \
196 echo "lttng-probe-random.o" ; fi;)
197
198 obj-$(CONFIG_LTTNG) += $(shell \
199 if [ $(VERSION) -ge 4 \
200 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
201 echo "lttng-probe-rcu.o" ; fi;)
202
203 ifneq ($(CONFIG_REGMAP),)
204 regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h
205 ifneq ($(wildcard $(regmap_dep_4_1)),)
206 obj-$(CONFIG_LTTNG) += lttng-probe-regmap.o
207 else
208 $(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.)
209 endif # $(wildcard $(regmap_dep_4_1)),
210 endif # CONFIG_REGMAP
211
212 ifneq ($(CONFIG_PM_RUNTIME),)
213 obj-$(CONFIG_LTTNG) += $(shell \
214 if [ $(VERSION) -ge 4 \
215 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
216 echo "lttng-probe-rpm.o" ; fi;)
217 endif # CONFIG_PM_RUNTIME
218
219 ifneq ($(CONFIG_SUNRPC),)
220 obj-$(CONFIG_LTTNG) += $(shell \
221 if [ $(VERSION) -ge 4 \
222 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
223 echo "lttng-probe-sunrpc.o" ; fi;)
224 endif # CONFIG_SUNRPC
225
226 ifneq ($(CONFIG_VIDEO_V4L2),)
227 obj-$(CONFIG_LTTNG) += $(shell \
228 if [ $(VERSION) -ge 4 \
229 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \
230 echo "lttng-probe-v4l2.o" ; fi;)
231 endif # CONFIG_VIDEO_V4L2
232
233 obj-$(CONFIG_LTTNG) += lttng-probe-workqueue.o
234
235 ifneq ($(CONFIG_KALLSYMS_ALL),)
236 obj-$(CONFIG_LTTNG) += lttng-probe-writeback.o
237 else
238 ifdef CONFIG_LOCALVERSION # Check if dot-config is included.
239 $(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.)
240 endif
241 endif # CONFIG_KALLSYMS_ALL
242
243 ifneq ($(CONFIG_KPROBES),)
244 obj-$(CONFIG_LTTNG) += lttng-kprobes.o
245 endif # CONFIG_KPROBES
246
247 ifneq ($(CONFIG_UPROBES),)
248 obj-$(CONFIG_LTTNG) += lttng-uprobes.o
249 endif # CONFIG_UPROBES
250
251 ifneq ($(CONFIG_KRETPROBES),)
252 obj-$(CONFIG_LTTNG) += lttng-kretprobes.o
253 endif # CONFIG_KRETPROBES
254
255 ifneq ($(CONFIG_PREEMPTIRQ_EVENTS),)
256 obj-$(CONFIG_LTTNG) += lttng-probe-preemptirq.o
257 endif # CONFIG_PREEMPTIRQ_EVENTS
258
259 # vim:syntax=make
This page took 0.034075 seconds and 4 git commands to generate.