Fix: lttng-test build failure for kernels < 3.0
[lttng-modules.git] / probes / Makefile
CommitLineData
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
5ifneq ($(KERNELRELEASE),)
6ifneq ($(CONFIG_TRACEPOINTS),)
7
e2331485
MD
8KERNELDIR = ${LTTNG_KERNELDIR}
9MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST)))
72e6c528 10
e2331485 11include $(MAKEFILEDIR)/../Makefile.ABI.workarounds
72e6c528 12
6d61b34d 13ccflags-y += -I$(PWD)/probes
40652b65 14obj-m += lttng-types.o
6d61b34d 15
6db3d13b 16obj-m += lttng-probe-sched.o
0d1d4002 17obj-m += lttng-probe-irq.o
e54456f5 18obj-m += lttng-probe-timer.o
b283666f
PW
19obj-m += lttng-probe-kmem.o
20obj-m += lttng-probe-module.o
21obj-m += lttng-probe-power.o
8c468a9b 22
c337ddc2
MD
23obj-m += lttng-probe-statedump.o
24
056f5922 25ifneq ($(CONFIG_KVM),)
0862130a 26obj-m += lttng-probe-kvm.o
b3c40230 27ifneq ($(CONFIG_X86),)
aed3f4cd
CA
28kvm_dep_lapic = $(srctree)/arch/x86/kvm/lapic.h
29ifneq ($(wildcard $(kvm_dep_lapic)),)
1de8b2e4 30kvm_dep = $(srctree)/virt/kvm/iodev.h $(srctree)/include/kvm/iodev.h
0862130a
MD
31ifneq ($(wildcard $(kvm_dep)),)
32CFLAGS_lttng-probe-kvm-x86.o += -I$(srctree)/virt/kvm
33CFLAGS_lttng-probe-kvm-x86-mmu.o += -I$(srctree)/virt/kvm
01ba366e
MD
34obj-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;)
38obj-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
42else
43$(warning File $(kvm_dep) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
aed3f4cd
CA
44endif
45else
46$(warning File $(kvm_dep_lapic) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
b3c40230 47endif
b3c40230 48endif
056f5922
MD
49endif
50
3a523f5b
MD
51obj-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
56ifneq ($(CONFIG_BLOCK),)
57ifneq ($(CONFIG_EVENT_TRACING),) # need blk_cmd_buf_len
7c68b363 58obj-m += lttng-probe-block.o
c9604bd3
MD
59endif
60endif
61
b283666f 62ifneq ($(CONFIG_NET),)
b283666f
PW
63obj-m += lttng-probe-napi.o
64obj-m += lttng-probe-skb.o
7c68b363
AG
65obj-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 69obj-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;)
73obj-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;)
77endif
78
79ifneq ($(CONFIG_SND_SOC),)
80obj-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;)
84endif
85
86ifneq ($(CONFIG_EXT3_FS),)
7c68b363
AG
87ext3_dep = $(srctree)/fs/ext3/*.h
88ext3_dep_check = $(wildcard $(ext3_dep))
89ext3 = $(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;)
98ifeq ($(ext3),warn)
99$(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.)
100ext3 =
101endif
102obj-m += $(ext3)
b283666f
PW
103endif
104
105ifneq ($(CONFIG_GPIOLIB),)
106obj-m += $(shell \
107 if [ $(VERSION) -ge 3 ] ; then \
108 echo "lttng-probe-gpio.o" ; fi;)
109endif
110
111ifneq ($(CONFIG_JBD2),)
112obj-m += lttng-probe-jbd2.o
113endif
114
115ifneq ($(CONFIG_JBD),)
116obj-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;)
120endif
121
122ifneq ($(CONFIG_REGULATOR),)
123obj-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;)
127endif
128
129ifneq ($(CONFIG_SCSI),)
130obj-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;)
134endif
135
136vmscan = $(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;)
140ifneq ($(CONFIG_SWAP),)
141 obj-m += $(vmscan)
142else
143ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR),)
144 obj-m += $(vmscan)
145endif
146endif
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
153ifneq ($(CONFIG_BTRFS_FS),)
154btrfs_dep = $(srctree)/fs/btrfs/*.h
155btrfs = $(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;)
159ifneq ($(btrfs),)
160ifeq ($(wildcard $(btrfs_dep)),)
161$(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.)
162btrfs =
163endif
164endif
165obj-m += $(btrfs)
166endif
167
168obj-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
173ifneq ($(CONFIG_EXT4_FS),)
174ext4_dep = $(srctree)/fs/ext4/*.h
175ext4 = lttng-probe-ext4.o
176ifeq ($(wildcard $(ext4_dep)),)
177$(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.)
178ext4 =
179endif
180obj-m += $(ext4)
181endif
182
183obj-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;)
187ifneq ($(CONFIG_FRAME_WARN),0)
188CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
189endif
190
191obj-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
199obj-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
204ifneq ($(CONFIG_REGMAP),)
2f2b673a 205regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h
2f2b673a 206ifneq ($(wildcard $(regmap_dep_4_1)),)
89a073a2 207obj-m += lttng-probe-regmap.o
17f1865d 208else
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 210endif
b87700e3
AG
211endif
212
213ifneq ($(CONFIG_PM_RUNTIME),)
214obj-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;)
218endif
219
220ifneq ($(CONFIG_SUNRPC),)
221obj-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;)
225endif
226
e09a6084
WF
227ifneq ($(CONFIG_VIDEO_V4L2),)
228obj-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;)
232endif
233
b87700e3
AG
234obj-m += lttng-probe-workqueue.o
235
42d9070d 236ifneq ($(CONFIG_KALLSYMS_ALL),)
b87700e3
AG
237obj-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
241else
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 243endif
b87700e3 244
b283666f 245
acd614cc 246ifneq ($(CONFIG_KPROBES),)
d6d808f3 247obj-m += lttng-kprobes.o
acd614cc 248endif
d6d808f3 249
7371f44c
MD
250
251ifneq ($(CONFIG_KRETPROBES),)
252obj-m += lttng-kretprobes.o
253endif
254
e0a7a7c4
MD
255ifneq ($(CONFIG_DYNAMIC_FTRACE),)
256obj-m += lttng-ftrace.o
257endif
258
6d61b34d
MD
259endif
260
aa3de24d
MD
261obj-m += lttng-test.o
262
6d61b34d
MD
263else
264 KERNELDIR ?= /lib/modules/$(shell uname -r)/build
265 PWD := $(shell pwd)
266 CFLAGS = $(EXTCFLAGS)
267
268default:
269 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
270
271modules_install:
272 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
273 /sbin/depmod -a
274
275clean:
276 $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
277
278endif
This page took 0.043594 seconds and 4 git commands to generate.