Implement lttng test module
[lttng-modules.git] / probes / Makefile
1 #
2 # Makefile for the LTT probes.
3 # Only build from the package top-level directory. Never use with make directly.
4
5 ifneq ($(KERNELRELEASE),)
6 ifneq ($(CONFIG_TRACEPOINTS),)
7
8 KERNELDIR = ${LTTNG_KERNELDIR}
9 MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST)))
10
11 include $(MAKEFILEDIR)/../Makefile.ABI.workarounds
12
13 ccflags-y += -I$(PWD)/probes
14 obj-m += lttng-types.o
15
16 obj-m += lttng-probe-sched.o
17 obj-m += lttng-probe-irq.o
18 obj-m += lttng-probe-timer.o
19 obj-m += lttng-probe-kmem.o
20 obj-m += lttng-probe-module.o
21 obj-m += lttng-probe-power.o
22
23 obj-m += lttng-probe-statedump.o
24
25 ifneq ($(CONFIG_KVM),)
26 obj-m += lttng-probe-kvm.o
27 ifneq ($(CONFIG_X86),)
28 kvm_dep_lapic = $(srctree)/arch/x86/kvm/lapic.h
29 ifneq ($(wildcard $(kvm_dep_lapic)),)
30 kvm_dep = $(srctree)/virt/kvm/iodev.h $(srctree)/include/kvm/iodev.h
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
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;)
42 else
43 $(warning File $(kvm_dep) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
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.)
47 endif
48 endif
49 endif
50
51 obj-m += $(shell \
52 if [ $(VERSION) -ge 3 \
53 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \
54 echo "lttng-probe-signal.o" ; fi;)
55
56 ifneq ($(CONFIG_BLOCK),)
57 ifneq ($(CONFIG_EVENT_TRACING),) # need blk_cmd_buf_len
58 obj-m += lttng-probe-block.o
59 endif
60 endif
61
62 ifneq ($(CONFIG_NET),)
63 obj-m += lttng-probe-napi.o
64 obj-m += lttng-probe-skb.o
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;)
69 obj-m += $(shell \
70 if [ $(VERSION) -ge 4 \
71 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
72 echo "lttng-probe-sock.o" ; fi;)
73 obj-m += $(shell \
74 if [ $(VERSION) -ge 4 \
75 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
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),)
87 ext3_dep = $(srctree)/fs/ext3/*.h
88 ext3_dep_check = $(wildcard $(ext3_dep))
89 ext3 = $(shell \
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 \
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)
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 \
117 if [ $(VERSION) -ge 4 \
118 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
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 \
131 if [ $(VERSION) -ge 3 \
132 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 35 \) ] ; then \
133 echo "lttng-probe-scsi.o" ; fi;)
134 endif
135
136 vmscan = $(shell \
137 if [ $(VERSION) -ge 3 \
138 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \
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
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
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 \
184 if [ $(VERSION) -ge 4 \
185 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
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 \
192 if [ $(VERSION) -ge 4 \
193 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
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 \
200 if [ $(VERSION) -ge 4 \
201 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
202 echo "lttng-probe-rcu.o" ; fi;)
203
204 ifneq ($(CONFIG_REGMAP),)
205 regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h
206 ifneq ($(wildcard $(regmap_dep_4_1)),)
207 obj-m += lttng-probe-regmap.o
208 else
209 $(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.)
210 endif
211 endif
212
213 ifneq ($(CONFIG_PM_RUNTIME),)
214 obj-m += $(shell \
215 if [ $(VERSION) -ge 4 \
216 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
217 echo "lttng-probe-rpm.o" ; fi;)
218 endif
219
220 ifneq ($(CONFIG_SUNRPC),)
221 obj-m += $(shell \
222 if [ $(VERSION) -ge 4 \
223 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
224 echo "lttng-probe-sunrpc.o" ; fi;)
225 endif
226
227 ifneq ($(CONFIG_VIDEO_V4L2),)
228 obj-m += $(shell \
229 if [ $(VERSION) -ge 4 \
230 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \
231 echo "lttng-probe-v4l2.o" ; fi;)
232 endif
233
234 obj-m += lttng-probe-workqueue.o
235
236 ifneq ($(CONFIG_KALLSYMS_ALL),)
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;)
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.)
243 endif
244
245
246 ifneq ($(CONFIG_KPROBES),)
247 obj-m += lttng-kprobes.o
248 endif
249
250
251 ifneq ($(CONFIG_KRETPROBES),)
252 obj-m += lttng-kretprobes.o
253 endif
254
255 ifneq ($(CONFIG_DYNAMIC_FTRACE),)
256 obj-m += lttng-ftrace.o
257 endif
258
259 endif
260
261 obj-m += lttng-test.o
262
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
This page took 0.040028 seconds and 5 git commands to generate.