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