Commit | Line | Data |
---|---|---|
6d61b34d MD |
1 | # |
2 | # Makefile for the LTT probes. | |
df4b4094 | 3 | # Only build from the package top-level directory. Never use with make directly. |
6d61b34d MD |
4 | |
5 | ifneq ($(KERNELRELEASE),) | |
6 | ifneq ($(CONFIG_TRACEPOINTS),) | |
7 | ||
b37d476e MD |
8 | KERNELDIR = ${LTTNG_KERNELDIR} |
9 | MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST))) | |
72e6c528 | 10 | |
b37d476e | 11 | include $(MAKEFILEDIR)/../Makefile.ABI.workarounds |
72e6c528 | 12 | |
6d61b34d | 13 | ccflags-y += -I$(PWD)/probes |
40652b65 | 14 | obj-m += lttng-types.o |
6d61b34d | 15 | |
6db3d13b | 16 | obj-m += lttng-probe-sched.o |
0d1d4002 | 17 | obj-m += lttng-probe-irq.o |
e54456f5 | 18 | obj-m += lttng-probe-timer.o |
b283666f PW |
19 | obj-m += lttng-probe-kmem.o |
20 | obj-m += lttng-probe-module.o | |
21 | obj-m += lttng-probe-power.o | |
8c468a9b | 22 | |
c337ddc2 MD |
23 | obj-m += lttng-probe-statedump.o |
24 | ||
056f5922 | 25 | ifneq ($(CONFIG_KVM),) |
0862130a | 26 | obj-m += lttng-probe-kvm.o |
b3c40230 | 27 | ifneq ($(CONFIG_X86),) |
a3a64dff CA |
28 | kvm_dep_lapic = $(srctree)/arch/x86/kvm/lapic.h |
29 | ifneq ($(wildcard $(kvm_dep_lapic)),) | |
1de8b2e4 | 30 | kvm_dep = $(srctree)/virt/kvm/iodev.h $(srctree)/include/kvm/iodev.h |
0862130a MD |
31 | ifneq ($(wildcard $(kvm_dep)),) |
32 | CFLAGS_lttng-probe-kvm-x86.o += -I$(srctree)/virt/kvm | |
33 | CFLAGS_lttng-probe-kvm-x86-mmu.o += -I$(srctree)/virt/kvm | |
01ba366e MD |
34 | obj-m += $(shell \ |
35 | if [ $(VERSION) -ge 3 \ | |
36 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
37 | echo "lttng-probe-kvm-x86.o" ; fi;) | |
38 | obj-m += $(shell \ | |
39 | if [ $(VERSION) -ge 3 \ | |
40 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
41 | echo "lttng-probe-kvm-x86-mmu.o" ; fi;) | |
0862130a MD |
42 | else |
43 | $(warning File $(kvm_dep) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.) | |
a3a64dff CA |
44 | endif |
45 | else | |
46 | $(warning File $(kvm_dep_lapic) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.) | |
b3c40230 | 47 | endif |
b3c40230 | 48 | endif |
056f5922 MD |
49 | endif |
50 | ||
d2507215 | 51 | ifneq ($(CONFIG_X86),) |
da0f6c58 | 52 | |
d2507215 MD |
53 | x86_irq_vectors_dep = $(srctree)/arch/x86/include/asm/trace/irq_vectors.h |
54 | ifneq ($(wildcard $(x86_irq_vectors_dep)),) | |
55 | obj-m += lttng-probe-x86-irq-vectors.o | |
56 | endif | |
da0f6c58 MD |
57 | |
58 | x86_exceptions_dep = $(srctree)/arch/x86/include/asm/trace/exceptions.h | |
59 | ifneq ($(wildcard $(x86_exceptions_dep)),) | |
60 | obj-m += lttng-probe-x86-exceptions.o | |
61 | endif | |
62 | ||
d2507215 MD |
63 | endif |
64 | ||
3a523f5b MD |
65 | obj-m += $(shell \ |
66 | if [ $(VERSION) -ge 3 \ | |
7c68b363 | 67 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \ |
3a523f5b MD |
68 | echo "lttng-probe-signal.o" ; fi;) |
69 | ||
c9604bd3 MD |
70 | ifneq ($(CONFIG_BLOCK),) |
71 | ifneq ($(CONFIG_EVENT_TRACING),) # need blk_cmd_buf_len | |
7c68b363 | 72 | obj-m += lttng-probe-block.o |
c9604bd3 MD |
73 | endif |
74 | endif | |
75 | ||
b283666f | 76 | ifneq ($(CONFIG_NET),) |
b283666f PW |
77 | obj-m += lttng-probe-napi.o |
78 | obj-m += lttng-probe-skb.o | |
7c68b363 AG |
79 | obj-m += $(shell \ |
80 | if [ $(VERSION) -ge 3 \ | |
81 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 37 \) ] ; then \ | |
82 | echo "lttng-probe-net.o" ; fi;) | |
b283666f | 83 | obj-m += $(shell \ |
96528cca MJ |
84 | if [ $(VERSION) -ge 4 \ |
85 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ | |
b283666f PW |
86 | echo "lttng-probe-sock.o" ; fi;) |
87 | obj-m += $(shell \ | |
96528cca MJ |
88 | if [ $(VERSION) -ge 4 \ |
89 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ | |
b283666f PW |
90 | echo "lttng-probe-udp.o" ; fi;) |
91 | endif | |
92 | ||
93 | ifneq ($(CONFIG_SND_SOC),) | |
94 | obj-m += $(shell \ | |
95 | if [ $(VERSION) -ge 3 \ | |
96 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
97 | echo "lttng-probe-asoc.o" ; fi;) | |
98 | endif | |
99 | ||
100 | ifneq ($(CONFIG_EXT3_FS),) | |
7c68b363 AG |
101 | ext3_dep = $(srctree)/fs/ext3/*.h |
102 | ext3_dep_check = $(wildcard $(ext3_dep)) | |
103 | ext3 = $(shell \ | |
96528cca MJ |
104 | if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ |
105 | if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \ | |
7c68b363 AG |
106 | -z "$(ext3_dep_check)" ] ; then \ |
107 | echo "warn" ; \ | |
108 | exit ; \ | |
109 | fi; \ | |
110 | echo "lttng-probe-ext3.o" ; \ | |
111 | fi;) | |
112 | ifeq ($(ext3),warn) | |
113 | $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.) | |
114 | ext3 = | |
115 | endif | |
116 | obj-m += $(ext3) | |
b283666f PW |
117 | endif |
118 | ||
119 | ifneq ($(CONFIG_GPIOLIB),) | |
120 | obj-m += $(shell \ | |
121 | if [ $(VERSION) -ge 3 ] ; then \ | |
122 | echo "lttng-probe-gpio.o" ; fi;) | |
123 | endif | |
124 | ||
125 | ifneq ($(CONFIG_JBD2),) | |
126 | obj-m += lttng-probe-jbd2.o | |
127 | endif | |
128 | ||
129 | ifneq ($(CONFIG_JBD),) | |
130 | obj-m += $(shell \ | |
96528cca MJ |
131 | if [ $(VERSION) -ge 4 \ |
132 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ | |
b283666f PW |
133 | echo "lttng-probe-jbd.o" ; fi;) |
134 | endif | |
135 | ||
136 | ifneq ($(CONFIG_REGULATOR),) | |
137 | obj-m += $(shell \ | |
138 | if [ $(VERSION) -ge 3 \ | |
139 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
140 | echo "lttng-probe-regulator.o" ; fi;) | |
141 | endif | |
142 | ||
143 | ifneq ($(CONFIG_SCSI),) | |
144 | obj-m += $(shell \ | |
7c68b363 AG |
145 | if [ $(VERSION) -ge 3 \ |
146 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 35 \) ] ; then \ | |
b283666f PW |
147 | echo "lttng-probe-scsi.o" ; fi;) |
148 | endif | |
149 | ||
150 | vmscan = $(shell \ | |
7c68b363 AG |
151 | if [ $(VERSION) -ge 3 \ |
152 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \ | |
b283666f PW |
153 | echo "lttng-probe-vmscan.o" ; fi;) |
154 | ifneq ($(CONFIG_SWAP),) | |
155 | obj-m += $(vmscan) | |
156 | else | |
157 | ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR),) | |
158 | obj-m += $(vmscan) | |
159 | endif | |
160 | endif | |
161 | ||
7c68b363 AG |
162 | # lock probe does not work, so disabling it for now |
163 | #ifneq ($(CONFIG_LOCKDEP),) | |
164 | #obj-m += lttng-probe-lock.o | |
165 | #endif | |
166 | ||
b87700e3 AG |
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) -ge 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 | |
178 | endif | |
179 | obj-m += $(btrfs) | |
180 | endif | |
181 | ||
182 | obj-m += $(shell \ | |
183 | if [ $(VERSION) -ge 3 \ | |
184 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 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 | |
194 | obj-m += $(ext4) | |
195 | endif | |
196 | ||
197 | obj-m += $(shell \ | |
96528cca MJ |
198 | if [ $(VERSION) -ge 4 \ |
199 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \ | |
b87700e3 AG |
200 | echo "lttng-probe-printk.o" ; fi;) |
201 | ifneq ($(CONFIG_FRAME_WARN),0) | |
202 | CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200 | |
203 | endif | |
204 | ||
205 | obj-m += $(shell \ | |
725528de MD |
206 | if [ $(VERSION) -ge 4 \ |
207 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \ | |
b87700e3 AG |
208 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \ |
209 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \ | |
210 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \ | |
211 | echo "lttng-probe-random.o" ; fi;) | |
212 | ||
213 | obj-m += $(shell \ | |
725528de MD |
214 | if [ $(VERSION) -ge 4 \ |
215 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \ | |
b87700e3 AG |
216 | echo "lttng-probe-rcu.o" ; fi;) |
217 | ||
218 | ifneq ($(CONFIG_REGMAP),) | |
2f2b673a | 219 | regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h |
2f2b673a | 220 | ifneq ($(wildcard $(regmap_dep_4_1)),) |
89a073a2 | 221 | obj-m += lttng-probe-regmap.o |
17f1865d | 222 | else |
89a073a2 | 223 | $(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.) |
17f1865d | 224 | endif |
b87700e3 AG |
225 | endif |
226 | ||
227 | ifneq ($(CONFIG_PM_RUNTIME),) | |
228 | obj-m += $(shell \ | |
725528de MD |
229 | if [ $(VERSION) -ge 4 \ |
230 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \ | |
b87700e3 AG |
231 | echo "lttng-probe-rpm.o" ; fi;) |
232 | endif | |
233 | ||
234 | ifneq ($(CONFIG_SUNRPC),) | |
235 | obj-m += $(shell \ | |
725528de MD |
236 | if [ $(VERSION) -ge 4 \ |
237 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \ | |
b87700e3 AG |
238 | echo "lttng-probe-sunrpc.o" ; fi;) |
239 | endif | |
240 | ||
e09a6084 WF |
241 | ifneq ($(CONFIG_VIDEO_V4L2),) |
242 | obj-m += $(shell \ | |
725528de MD |
243 | if [ $(VERSION) -ge 4 \ |
244 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \ | |
e09a6084 WF |
245 | echo "lttng-probe-v4l2.o" ; fi;) |
246 | endif | |
247 | ||
b87700e3 AG |
248 | obj-m += lttng-probe-workqueue.o |
249 | ||
42d9070d | 250 | ifneq ($(CONFIG_KALLSYMS_ALL),) |
b87700e3 AG |
251 | obj-m += $(shell \ |
252 | if [ $(VERSION) -ge 3 \ | |
253 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \ | |
254 | echo "lttng-probe-writeback.o" ; fi;) | |
bf2ba318 MD |
255 | else |
256 | $(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.) | |
42d9070d | 257 | endif |
b87700e3 | 258 | |
b283666f | 259 | |
acd614cc | 260 | ifneq ($(CONFIG_KPROBES),) |
d6d808f3 | 261 | obj-m += lttng-kprobes.o |
acd614cc | 262 | endif |
d6d808f3 | 263 | |
7371f44c MD |
264 | |
265 | ifneq ($(CONFIG_KRETPROBES),) | |
266 | obj-m += lttng-kretprobes.o | |
267 | endif | |
268 | ||
e0a7a7c4 MD |
269 | ifneq ($(CONFIG_DYNAMIC_FTRACE),) |
270 | obj-m += lttng-ftrace.o | |
271 | endif | |
272 | ||
6d61b34d MD |
273 | endif |
274 | ||
89406ecd MD |
275 | obj-m += lttng-test.o |
276 | ||
6d61b34d MD |
277 | else |
278 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build | |
279 | PWD := $(shell pwd) | |
280 | CFLAGS = $(EXTCFLAGS) | |
281 | ||
282 | default: | |
283 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules | |
284 | ||
285 | modules_install: | |
286 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install | |
287 | /sbin/depmod -a | |
288 | ||
289 | clean: | |
290 | $(MAKE) -C $(KERNELDIR) M=$(PWD) clean | |
291 | ||
292 | endif |