2 # Makefile for the LTT probes.
3 # Only build from the package top-level directory. Never use with make directly.
5 ifneq ($(KERNELRELEASE
),)
6 ifneq ($(CONFIG_TRACEPOINTS
),)
8 KERNELDIR
= ${LTTNG_KERNELDIR}
9 MAKEFILEDIR
= $(shell dirname
$(lastword
$(MAKEFILE_LIST
)))
11 include $(MAKEFILEDIR
)/..
/Makefile.ABI.workarounds
13 ccflags-y
+= -I
$(PWD
)/probes
14 obj-m
+= lttng-types.o
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
23 obj-m
+= lttng-probe-statedump.o
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
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
;)
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
;)
43 $(warning File
$(kvm_dep
) not found. Probe
"kvm" x86-specific is disabled. Use full kernel source tree to enable it.
)
46 $(warning File
$(kvm_dep_lapic
) not found. Probe
"kvm" x86-specific is disabled. Use full kernel source tree to enable it.
)
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
;)
56 ifneq ($(CONFIG_BLOCK
),)
57 ifneq ($(CONFIG_EVENT_TRACING
),) # need blk_cmd_buf_len
58 obj-m
+= lttng-probe-block.o
62 ifneq ($(CONFIG_NET
),)
63 obj-m
+= lttng-probe-napi.o
64 obj-m
+= lttng-probe-skb.o
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
;)
70 if
[ $(VERSION
) -ge
4 \
71 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
1 \
) ] ; then \
72 echo
"lttng-probe-sock.o" ; fi
;)
74 if
[ $(VERSION
) -ge
4 \
75 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
1 \
) ] ; then \
76 echo
"lttng-probe-udp.o" ; fi
;)
79 ifneq ($(CONFIG_SND_SOC
),)
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
;)
86 ifneq ($(CONFIG_EXT3_FS
),)
87 ext3_dep
= $(srctree
)/fs
/ext3
/*.h
88 ext3_dep_check
= $(wildcard $(ext3_dep
))
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 \
96 echo
"lttng-probe-ext3.o" ; \
99 $(warning Files
$(ext3_dep
) not found. Probe
"ext3" is disabled. Use full kernel source tree to enable it.
)
105 ifneq ($(CONFIG_GPIOLIB
),)
107 if
[ $(VERSION
) -ge
3 ] ; then \
108 echo
"lttng-probe-gpio.o" ; fi
;)
111 ifneq ($(CONFIG_JBD2
),)
112 obj-m
+= lttng-probe-jbd2.o
115 ifneq ($(CONFIG_JBD
),)
117 if
[ $(VERSION
) -ge
4 \
118 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
1 \
) ] ; then \
119 echo
"lttng-probe-jbd.o" ; fi
;)
122 ifneq ($(CONFIG_REGULATOR
),)
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
;)
129 ifneq ($(CONFIG_SCSI
),)
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
;)
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
),)
143 ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR
),)
148 # lock probe does not work, so disabling it for now
149 #ifneq ($(CONFIG_LOCKDEP),)
150 #obj-m += lttng-probe-lock.o
153 ifneq ($(CONFIG_BTRFS_FS
),)
154 btrfs_dep
= $(srctree
)/fs
/btrfs
/*.h
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
;)
160 ifeq ($(wildcard $(btrfs_dep
)),)
161 $(warning Files
$(btrfs_dep
) not found. Probe
"btrfs" is disabled. Use full kernel source tree to enable it.
)
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
;)
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.
)
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
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
;)
200 if
[ $(VERSION
) -ge
4 \
201 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
2 \
) ] ; then \
202 echo
"lttng-probe-rcu.o" ; fi
;)
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
209 $(warning File
$(regmap_dep_4_1
) not found. Probe
"regmap" is disabled. Need Linux
4.1+ kernel source tree to enable it.
)
213 ifneq ($(CONFIG_PM_RUNTIME
),)
215 if
[ $(VERSION
) -ge
4 \
216 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
2 \
) ] ; then \
217 echo
"lttng-probe-rpm.o" ; fi
;)
220 ifneq ($(CONFIG_SUNRPC
),)
222 if
[ $(VERSION
) -ge
4 \
223 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
4 \
) ] ; then \
224 echo
"lttng-probe-sunrpc.o" ; fi
;)
227 ifneq ($(CONFIG_VIDEO_V4L2
),)
229 if
[ $(VERSION
) -ge
4 \
230 -o \
( $(VERSION
) -eq
3 -a
$(PATCHLEVEL
) -ge
14 \
) ] ; then \
231 echo
"lttng-probe-v4l2.o" ; fi
;)
234 obj-m
+= lttng-probe-workqueue.o
236 ifneq ($(CONFIG_KALLSYMS_ALL
),)
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
;)
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.
)
246 ifneq ($(CONFIG_KPROBES
),)
247 obj-m
+= lttng-kprobes.o
251 ifneq ($(CONFIG_KRETPROBES
),)
252 obj-m
+= lttng-kretprobes.o
255 ifneq ($(CONFIG_DYNAMIC_FTRACE
),)
256 obj-m
+= lttng-ftrace.o
261 obj-m
+= lttng-test.o
264 KERNELDIR ?
= /lib
/modules
/$(shell uname
-r
)/build
266 CFLAGS
= $(EXTCFLAGS
)
269 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) modules
272 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) modules_install
276 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) clean