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 | ||
e2331485 MD |
8 | KERNELDIR = ${LTTNG_KERNELDIR} |
9 | MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST))) | |
72e6c528 | 10 | |
e2331485 | 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),) |
aed3f4cd 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.) | |
aed3f4cd 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 | ||
3a523f5b MD |
51 | obj-m += $(shell \ |
52 | if [ $(VERSION) -ge 3 \ | |
7c68b363 | 53 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \ |
3a523f5b MD |
54 | echo "lttng-probe-signal.o" ; fi;) |
55 | ||
c9604bd3 MD |
56 | ifneq ($(CONFIG_BLOCK),) |
57 | ifneq ($(CONFIG_EVENT_TRACING),) # need blk_cmd_buf_len | |
7c68b363 | 58 | obj-m += lttng-probe-block.o |
c9604bd3 MD |
59 | endif |
60 | endif | |
61 | ||
b283666f | 62 | ifneq ($(CONFIG_NET),) |
b283666f PW |
63 | obj-m += lttng-probe-napi.o |
64 | obj-m += lttng-probe-skb.o | |
7c68b363 AG |
65 | obj-m += $(shell \ |
66 | if [ $(VERSION) -ge 3 \ | |
67 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 37 \) ] ; then \ | |
68 | echo "lttng-probe-net.o" ; fi;) | |
b283666f | 69 | obj-m += $(shell \ |
96528cca MJ |
70 | if [ $(VERSION) -ge 4 \ |
71 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ | |
b283666f PW |
72 | echo "lttng-probe-sock.o" ; fi;) |
73 | obj-m += $(shell \ | |
96528cca MJ |
74 | if [ $(VERSION) -ge 4 \ |
75 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ | |
b283666f PW |
76 | echo "lttng-probe-udp.o" ; fi;) |
77 | endif | |
78 | ||
79 | ifneq ($(CONFIG_SND_SOC),) | |
80 | obj-m += $(shell \ | |
81 | if [ $(VERSION) -ge 3 \ | |
82 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
83 | echo "lttng-probe-asoc.o" ; fi;) | |
84 | endif | |
85 | ||
86 | ifneq ($(CONFIG_EXT3_FS),) | |
7c68b363 AG |
87 | ext3_dep = $(srctree)/fs/ext3/*.h |
88 | ext3_dep_check = $(wildcard $(ext3_dep)) | |
89 | ext3 = $(shell \ | |
96528cca MJ |
90 | if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ |
91 | if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \ | |
7c68b363 AG |
92 | -z "$(ext3_dep_check)" ] ; then \ |
93 | echo "warn" ; \ | |
94 | exit ; \ | |
95 | fi; \ | |
96 | echo "lttng-probe-ext3.o" ; \ | |
97 | fi;) | |
98 | ifeq ($(ext3),warn) | |
99 | $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.) | |
100 | ext3 = | |
101 | endif | |
102 | obj-m += $(ext3) | |
b283666f PW |
103 | endif |
104 | ||
105 | ifneq ($(CONFIG_GPIOLIB),) | |
106 | obj-m += $(shell \ | |
107 | if [ $(VERSION) -ge 3 ] ; then \ | |
108 | echo "lttng-probe-gpio.o" ; fi;) | |
109 | endif | |
110 | ||
111 | ifneq ($(CONFIG_JBD2),) | |
112 | obj-m += lttng-probe-jbd2.o | |
113 | endif | |
114 | ||
115 | ifneq ($(CONFIG_JBD),) | |
116 | obj-m += $(shell \ | |
96528cca MJ |
117 | if [ $(VERSION) -ge 4 \ |
118 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \ | |
b283666f PW |
119 | echo "lttng-probe-jbd.o" ; fi;) |
120 | endif | |
121 | ||
122 | ifneq ($(CONFIG_REGULATOR),) | |
123 | obj-m += $(shell \ | |
124 | if [ $(VERSION) -ge 3 \ | |
125 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
126 | echo "lttng-probe-regulator.o" ; fi;) | |
127 | endif | |
128 | ||
129 | ifneq ($(CONFIG_SCSI),) | |
130 | obj-m += $(shell \ | |
7c68b363 AG |
131 | if [ $(VERSION) -ge 3 \ |
132 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 35 \) ] ; then \ | |
b283666f PW |
133 | echo "lttng-probe-scsi.o" ; fi;) |
134 | endif | |
135 | ||
136 | vmscan = $(shell \ | |
7c68b363 AG |
137 | if [ $(VERSION) -ge 3 \ |
138 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \ | |
b283666f PW |
139 | echo "lttng-probe-vmscan.o" ; fi;) |
140 | ifneq ($(CONFIG_SWAP),) | |
141 | obj-m += $(vmscan) | |
142 | else | |
143 | ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR),) | |
144 | obj-m += $(vmscan) | |
145 | endif | |
146 | endif | |
147 | ||
7c68b363 AG |
148 | # lock probe does not work, so disabling it for now |
149 | #ifneq ($(CONFIG_LOCKDEP),) | |
150 | #obj-m += lttng-probe-lock.o | |
151 | #endif | |
152 | ||
b87700e3 AG |
153 | ifneq ($(CONFIG_BTRFS_FS),) |
154 | btrfs_dep = $(srctree)/fs/btrfs/*.h | |
155 | btrfs = $(shell \ | |
156 | if [ $(VERSION) -ge 3 \ | |
157 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 39 \) ] ; then \ | |
158 | echo "lttng-probe-btrfs.o" ; fi;) | |
159 | ifneq ($(btrfs),) | |
160 | ifeq ($(wildcard $(btrfs_dep)),) | |
161 | $(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.) | |
162 | btrfs = | |
163 | endif | |
164 | endif | |
165 | obj-m += $(btrfs) | |
166 | endif | |
167 | ||
168 | obj-m += $(shell \ | |
169 | if [ $(VERSION) -ge 3 \ | |
170 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
171 | echo "lttng-probe-compaction.o" ; fi;) | |
172 | ||
173 | ifneq ($(CONFIG_EXT4_FS),) | |
174 | ext4_dep = $(srctree)/fs/ext4/*.h | |
175 | ext4 = lttng-probe-ext4.o | |
176 | ifeq ($(wildcard $(ext4_dep)),) | |
177 | $(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.) | |
178 | ext4 = | |
179 | endif | |
180 | obj-m += $(ext4) | |
181 | endif | |
182 | ||
183 | obj-m += $(shell \ | |
96528cca MJ |
184 | if [ $(VERSION) -ge 4 \ |
185 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \ | |
b87700e3 AG |
186 | echo "lttng-probe-printk.o" ; fi;) |
187 | ifneq ($(CONFIG_FRAME_WARN),0) | |
188 | CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200 | |
189 | endif | |
190 | ||
191 | obj-m += $(shell \ | |
725528de MD |
192 | if [ $(VERSION) -ge 4 \ |
193 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \ | |
b87700e3 AG |
194 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \ |
195 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \ | |
196 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \ | |
197 | echo "lttng-probe-random.o" ; fi;) | |
198 | ||
199 | obj-m += $(shell \ | |
725528de MD |
200 | if [ $(VERSION) -ge 4 \ |
201 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \ | |
b87700e3 AG |
202 | echo "lttng-probe-rcu.o" ; fi;) |
203 | ||
204 | ifneq ($(CONFIG_REGMAP),) | |
2f2b673a | 205 | regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h |
2f2b673a | 206 | ifneq ($(wildcard $(regmap_dep_4_1)),) |
89a073a2 | 207 | obj-m += lttng-probe-regmap.o |
17f1865d | 208 | else |
89a073a2 | 209 | $(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.) |
17f1865d | 210 | endif |
b87700e3 AG |
211 | endif |
212 | ||
213 | ifneq ($(CONFIG_PM_RUNTIME),) | |
214 | obj-m += $(shell \ | |
725528de MD |
215 | if [ $(VERSION) -ge 4 \ |
216 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \ | |
b87700e3 AG |
217 | echo "lttng-probe-rpm.o" ; fi;) |
218 | endif | |
219 | ||
220 | ifneq ($(CONFIG_SUNRPC),) | |
221 | obj-m += $(shell \ | |
725528de MD |
222 | if [ $(VERSION) -ge 4 \ |
223 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \ | |
b87700e3 AG |
224 | echo "lttng-probe-sunrpc.o" ; fi;) |
225 | endif | |
226 | ||
e09a6084 WF |
227 | ifneq ($(CONFIG_VIDEO_V4L2),) |
228 | obj-m += $(shell \ | |
725528de MD |
229 | if [ $(VERSION) -ge 4 \ |
230 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \ | |
e09a6084 WF |
231 | echo "lttng-probe-v4l2.o" ; fi;) |
232 | endif | |
233 | ||
b87700e3 AG |
234 | obj-m += lttng-probe-workqueue.o |
235 | ||
42d9070d | 236 | ifneq ($(CONFIG_KALLSYMS_ALL),) |
b87700e3 AG |
237 | obj-m += $(shell \ |
238 | if [ $(VERSION) -ge 3 \ | |
239 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \ | |
240 | echo "lttng-probe-writeback.o" ; fi;) | |
bf2ba318 MD |
241 | else |
242 | $(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 | 243 | endif |
b87700e3 | 244 | |
b283666f | 245 | |
acd614cc | 246 | ifneq ($(CONFIG_KPROBES),) |
d6d808f3 | 247 | obj-m += lttng-kprobes.o |
acd614cc | 248 | endif |
d6d808f3 | 249 | |
7371f44c MD |
250 | |
251 | ifneq ($(CONFIG_KRETPROBES),) | |
252 | obj-m += lttng-kretprobes.o | |
253 | endif | |
254 | ||
e0a7a7c4 MD |
255 | ifneq ($(CONFIG_DYNAMIC_FTRACE),) |
256 | obj-m += lttng-ftrace.o | |
257 | endif | |
258 | ||
6d61b34d MD |
259 | endif |
260 | ||
aa3de24d MD |
261 | obj-m += lttng-test.o |
262 | ||
6d61b34d MD |
263 | else |
264 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build | |
265 | PWD := $(shell pwd) | |
266 | CFLAGS = $(EXTCFLAGS) | |
267 | ||
268 | default: | |
269 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules | |
270 | ||
271 | modules_install: | |
272 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install | |
273 | /sbin/depmod -a | |
274 | ||
275 | clean: | |
276 | $(MAKE) -C $(KERNELDIR) M=$(PWD) clean | |
277 | ||
278 | endif |