Fix: discover Debian API
[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
72e6c528
MD
8KERNELDIR=${LTTNG_KERNELDIR}
9
10include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds
11
6d61b34d 12ccflags-y += -I$(PWD)/probes
40652b65 13obj-m += lttng-types.o
6d61b34d 14
6db3d13b 15obj-m += lttng-probe-sched.o
0d1d4002 16obj-m += lttng-probe-irq.o
e54456f5 17obj-m += lttng-probe-timer.o
b283666f
PW
18obj-m += lttng-probe-kmem.o
19obj-m += lttng-probe-module.o
20obj-m += lttng-probe-power.o
8c468a9b 21
c337ddc2
MD
22obj-m += lttng-probe-statedump.o
23
056f5922 24ifneq ($(CONFIG_KVM),)
0862130a 25obj-m += lttng-probe-kvm.o
b3c40230
MG
26ifneq ($(CONFIG_X86),)
27kvm_dep = $(srctree)/virt/kvm/iodev.h
0862130a
MD
28ifneq ($(wildcard $(kvm_dep)),)
29CFLAGS_lttng-probe-kvm-x86.o += -I$(srctree)/virt/kvm
30CFLAGS_lttng-probe-kvm-x86-mmu.o += -I$(srctree)/virt/kvm
01ba366e
MD
31obj-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;)
35obj-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
39else
40$(warning File $(kvm_dep) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
b3c40230 41endif
b3c40230 42endif
056f5922
MD
43endif
44
3a523f5b
MD
45obj-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
50ifneq ($(CONFIG_BLOCK),)
51ifneq ($(CONFIG_EVENT_TRACING),) # need blk_cmd_buf_len
7c68b363 52obj-m += lttng-probe-block.o
c9604bd3
MD
53endif
54endif
55
b283666f 56ifneq ($(CONFIG_NET),)
b283666f
PW
57obj-m += lttng-probe-napi.o
58obj-m += lttng-probe-skb.o
7c68b363
AG
59obj-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
63obj-m += $(shell \
64 if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \
65 echo "lttng-probe-sock.o" ; fi;)
66obj-m += $(shell \
67 if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \
68 echo "lttng-probe-udp.o" ; fi;)
69endif
70
71ifneq ($(CONFIG_SND_SOC),)
72obj-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;)
76endif
77
78ifneq ($(CONFIG_EXT3_FS),)
7c68b363
AG
79ext3_dep = $(srctree)/fs/ext3/*.h
80ext3_dep_check = $(wildcard $(ext3_dep))
81ext3 = $(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;)
90ifeq ($(ext3),warn)
91$(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.)
92ext3 =
93endif
94obj-m += $(ext3)
b283666f
PW
95endif
96
97ifneq ($(CONFIG_GPIOLIB),)
98obj-m += $(shell \
99 if [ $(VERSION) -ge 3 ] ; then \
100 echo "lttng-probe-gpio.o" ; fi;)
101endif
102
103ifneq ($(CONFIG_JBD2),)
104obj-m += lttng-probe-jbd2.o
105endif
106
107ifneq ($(CONFIG_JBD),)
108obj-m += $(shell \
109 if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \
110 echo "lttng-probe-jbd.o" ; fi;)
111endif
112
113ifneq ($(CONFIG_REGULATOR),)
114obj-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;)
118endif
119
120ifneq ($(CONFIG_SCSI),)
121obj-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;)
125endif
126
127vmscan = $(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;)
131ifneq ($(CONFIG_SWAP),)
132 obj-m += $(vmscan)
133else
134ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR),)
135 obj-m += $(vmscan)
136endif
137endif
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
144ifneq ($(CONFIG_BTRFS_FS),)
145btrfs_dep = $(srctree)/fs/btrfs/*.h
146btrfs = $(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;)
150ifneq ($(btrfs),)
151ifeq ($(wildcard $(btrfs_dep)),)
152$(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.)
153btrfs =
154endif
155endif
156obj-m += $(btrfs)
157endif
158
159obj-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
164ifneq ($(CONFIG_EXT4_FS),)
165ext4_dep = $(srctree)/fs/ext4/*.h
166ext4 = lttng-probe-ext4.o
167ifeq ($(wildcard $(ext4_dep)),)
168$(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.)
169ext4 =
170endif
171obj-m += $(ext4)
172endif
173
174obj-m += $(shell \
175 if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 4 ] ; then \
176 echo "lttng-probe-printk.o" ; fi;)
177ifneq ($(CONFIG_FRAME_WARN),0)
178CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
179endif
180
181obj-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
189obj-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
194ifneq ($(CONFIG_REGMAP),)
195obj-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;)
199endif
200
201ifneq ($(CONFIG_PM_RUNTIME),)
202obj-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;)
206endif
207
208ifneq ($(CONFIG_SUNRPC),)
209obj-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;)
213endif
214
e09a6084
WF
215ifneq ($(CONFIG_VIDEO_V4L2),)
216obj-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;)
220endif
221
b87700e3
AG
222obj-m += lttng-probe-workqueue.o
223
42d9070d 224ifneq ($(CONFIG_KALLSYMS_ALL),)
b87700e3
AG
225obj-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
229else
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 231endif
b87700e3 232
b283666f 233
acd614cc 234ifneq ($(CONFIG_KPROBES),)
d6d808f3 235obj-m += lttng-kprobes.o
acd614cc 236endif
d6d808f3 237
7371f44c
MD
238
239ifneq ($(CONFIG_KRETPROBES),)
240obj-m += lttng-kretprobes.o
241endif
242
e0a7a7c4
MD
243ifneq ($(CONFIG_DYNAMIC_FTRACE),)
244obj-m += lttng-ftrace.o
245endif
246
6d61b34d
MD
247endif
248
249else
250 KERNELDIR ?= /lib/modules/$(shell uname -r)/build
251 PWD := $(shell pwd)
252 CFLAGS = $(EXTCFLAGS)
253
254default:
255 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
256
257modules_install:
258 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
259 /sbin/depmod -a
260
261clean:
262 $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
263
264endif
This page took 0.042841 seconds and 4 git commands to generate.