1 MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST)))
3 include $(MAKEFILEDIR)/../Makefile.ABI.workarounds
5 ccflags-y += -I$(PWD) -I$(PWD)/..
7 obj-$(CONFIG_LTTNG) += lttng-probe-sched.o
8 obj-$(CONFIG_LTTNG) += lttng-probe-irq.o
9 obj-$(CONFIG_LTTNG) += lttng-probe-timer.o
10 obj-$(CONFIG_LTTNG) += lttng-probe-kmem.o
11 obj-$(CONFIG_LTTNG) += lttng-probe-module.o
12 obj-$(CONFIG_LTTNG) += lttng-probe-power.o
13 obj-$(CONFIG_LTTNG) += lttng-probe-statedump.o
15 ifneq ($(CONFIG_KVM),)
16 obj-$(CONFIG_LTTNG) += lttng-probe-kvm.o
17 ifneq ($(CONFIG_X86),)
18 kvm_dep_lapic = $(srctree)/arch/x86/kvm/lapic.h
19 ifneq ($(wildcard $(kvm_dep_lapic)),)
20 kvm_dep = $(srctree)/virt/kvm/iodev.h $(srctree)/include/kvm/iodev.h
21 ifneq ($(wildcard $(kvm_dep)),)
22 CFLAGS_lttng-probe-kvm-x86.o += -I$(srctree)/virt/kvm
23 CFLAGS_lttng-probe-kvm-x86-mmu.o += -I$(srctree)/virt/kvm
24 obj-$(CONFIG_LTTNG) += $(shell \
25 if [ $(VERSION) -ge 3 \
26 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
27 echo "lttng-probe-kvm-x86.o" ; fi;)
28 obj-$(CONFIG_LTTNG) += $(shell \
29 if [ $(VERSION) -ge 3 \
30 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
31 echo "lttng-probe-kvm-x86-mmu.o" ; fi;)
33 $(warning File $(kvm_dep) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
34 endif # $(wildcard $(kvm_dep))
36 $(warning File $(kvm_dep_lapic) not found. Probe "kvm" x86-specific is disabled. Use full kernel source tree to enable it.)
37 endif # $(wildcard $(kvm_dep_lapic))
41 ifneq ($(CONFIG_X86),)
42 x86_irq_vectors_dep = $(srctree)/arch/x86/include/asm/trace/irq_vectors.h
44 ifneq ($(wildcard $(x86_irq_vectors_dep)),)
45 obj-$(CONFIG_LTTNG) += lttng-probe-x86-irq-vectors.o
46 endif # $(wildcard $(x86_irq_vectors_dep))
48 x86_exceptions_dep = $(srctree)/arch/x86/include/asm/trace/exceptions.h
50 ifneq ($(wildcard $(x86_exceptions_dep)),)
51 obj-$(CONFIG_LTTNG) += lttng-probe-x86-exceptions.o
52 endif # $(wildcard $(x86_exceptions_dep))
55 obj-$(CONFIG_LTTNG) += $(shell \
56 if [ $(VERSION) -ge 3 \
57 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \
58 echo "lttng-probe-signal.o" ; fi;)
60 ifneq ($(CONFIG_BLOCK),)
61 # need blk_cmd_buf_len
62 ifneq ($(CONFIG_EVENT_TRACING),)
63 obj-$(CONFIG_LTTNG) += lttng-probe-block.o
64 endif # CONFIG_EVENT_TRACING
67 ifneq ($(CONFIG_NET),)
68 obj-$(CONFIG_LTTNG) += lttng-probe-napi.o
69 obj-$(CONFIG_LTTNG) += lttng-probe-skb.o
70 obj-$(CONFIG_LTTNG) += $(shell \
71 if [ $(VERSION) -ge 3 \
72 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 37 \) ] ; then \
73 echo "lttng-probe-net.o" ; fi;)
74 obj-$(CONFIG_LTTNG) += $(shell \
75 if [ $(VERSION) -ge 4 \
76 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
77 echo "lttng-probe-sock.o" ; fi;)
78 obj-$(CONFIG_LTTNG) += $(shell \
79 if [ $(VERSION) -ge 4 \
80 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
81 echo "lttng-probe-udp.o" ; fi;)
84 ifneq ($(CONFIG_SND_SOC),)
85 obj-$(CONFIG_LTTNG) += $(shell \
86 if [ $(VERSION) -ge 3 \
87 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
88 echo "lttng-probe-asoc.o" ; fi;)
89 endif # CONFIG_SND_SOC
91 ifneq ($(CONFIG_EXT3_FS),)
92 ext3_dep = $(srctree)/fs/ext3/*.h
93 ext3_dep_check = $(wildcard $(ext3_dep))
95 if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
96 if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \
97 -z "$(ext3_dep_check)" ] ; then \
101 echo "lttng-probe-ext3.o" ; \
104 $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.)
107 obj-$(CONFIG_LTTNG) += $(ext3)
108 endif # CONFIG_EXT3_FS
110 ifneq ($(CONFIG_GPIOLIB),)
111 obj-$(CONFIG_LTTNG) += $(shell \
112 if [ $(VERSION) -ge 3 ] ; then \
113 echo "lttng-probe-gpio.o" ; fi;)
114 endif # CONFIG_GPIOLIB
116 ifneq ($(CONFIG_JBD2),)
117 obj-$(CONFIG_LTTNG) += lttng-probe-jbd2.o
120 ifneq ($(CONFIG_JBD),)
121 obj-$(CONFIG_LTTNG) += $(shell \
122 if [ $(VERSION) -ge 4 \
123 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
124 echo "lttng-probe-jbd.o" ; fi;)
127 ifneq ($(CONFIG_REGULATOR),)
128 obj-$(CONFIG_LTTNG) += $(shell \
129 if [ $(VERSION) -ge 3 \
130 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
131 echo "lttng-probe-regulator.o" ; fi;)
132 endif # CONFIG_REGULATOR
134 ifneq ($(CONFIG_SCSI),)
135 obj-$(CONFIG_LTTNG) += $(shell \
136 if [ $(VERSION) -ge 3 \
137 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 35 \) ] ; then \
138 echo "lttng-probe-scsi.o" ; fi;)
142 if [ $(VERSION) -ge 3 \
143 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \
144 echo "lttng-probe-vmscan.o" ; fi;)
146 ifneq ($(CONFIG_SWAP),)
147 obj-$(CONFIG_LTTNG) += $(vmscan)
149 ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR),)
150 obj-$(CONFIG_LTTNG) += $(vmscan)
151 endif # CONFIG_CGROUP_MEM_RES_CTLR
154 # lock probe does not work, so disabling it for now
155 #ifneq ($(CONFIG_LOCKDEP),)
156 # obj-$(CONFIG_LTTNG) += lttng-probe-lock.o
157 #endif # CONFIG_LOCKDEP
159 ifneq ($(CONFIG_BTRFS_FS),)
160 btrfs_dep = $(srctree)/fs/btrfs/*.h
162 if [ $(VERSION) -ge 3 \
163 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 39 \) ] ; then \
164 echo "lttng-probe-btrfs.o" ; fi;)
166 ifeq ($(wildcard $(btrfs_dep)),)
167 $(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.)
169 endif # $(wildcard $(btrfs_dep))
171 obj-$(CONFIG_LTTNG) += $(btrfs)
172 endif # CONFIG_BTRFS_FS
174 obj-$(CONFIG_LTTNG) += $(shell \
175 if [ $(VERSION) -ge 3 \
176 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \
177 echo "lttng-probe-compaction.o" ; fi;)
179 ifneq ($(CONFIG_EXT4_FS),)
180 ext4_dep = $(srctree)/fs/ext4/*.h
181 ext4 = lttng-probe-ext4.o
182 ifeq ($(wildcard $(ext4_dep)),)
183 $(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.)
185 endif # $(wildcard $(ext4_dep))
186 obj-$(CONFIG_LTTNG) += $(ext4)
187 endif # CONFIG_EXT4_FS
189 obj-$(CONFIG_LTTNG) += $(shell \
190 if [ $(VERSION) -ge 4 \
191 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
192 echo "lttng-probe-printk.o" ; fi;)
194 ifneq ($(CONFIG_FRAME_WARN),0)
195 CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
198 obj-$(CONFIG_LTTNG) += $(shell \
199 if [ $(VERSION) -ge 4 \
200 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
201 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
202 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
203 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \
204 echo "lttng-probe-random.o" ; fi;)
206 obj-$(CONFIG_LTTNG) += $(shell \
207 if [ $(VERSION) -ge 4 \
208 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
209 echo "lttng-probe-rcu.o" ; fi;)
211 ifneq ($(CONFIG_REGMAP),)
212 regmap_dep_4_1 = $(srctree)/drivers/base/regmap/trace.h
213 ifneq ($(wildcard $(regmap_dep_4_1)),)
214 obj-$(CONFIG_LTTNG) += lttng-probe-regmap.o
216 $(warning File $(regmap_dep_4_1) not found. Probe "regmap" is disabled. Need Linux 4.1+ kernel source tree to enable it.)
217 endif # $(wildcard $(regmap_dep_4_1)),
218 endif # CONFIG_REGMAP
220 ifneq ($(CONFIG_PM_RUNTIME),)
221 obj-$(CONFIG_LTTNG) += $(shell \
222 if [ $(VERSION) -ge 4 \
223 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 2 \) ] ; then \
224 echo "lttng-probe-rpm.o" ; fi;)
225 endif # CONFIG_PM_RUNTIME
227 ifneq ($(CONFIG_SUNRPC),)
228 obj-$(CONFIG_LTTNG) += $(shell \
229 if [ $(VERSION) -ge 4 \
230 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) ] ; then \
231 echo "lttng-probe-sunrpc.o" ; fi;)
232 endif # CONFIG_SUNRPC
234 ifneq ($(CONFIG_VIDEO_V4L2),)
235 obj-$(CONFIG_LTTNG) += $(shell \
236 if [ $(VERSION) -ge 4 \
237 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 14 \) ] ; then \
238 echo "lttng-probe-v4l2.o" ; fi;)
239 endif # CONFIG_VIDEO_V4L2
241 obj-$(CONFIG_LTTNG) += lttng-probe-workqueue.o
243 ifneq ($(CONFIG_KALLSYMS_ALL),)
244 obj-$(CONFIG_LTTNG) += $(shell \
245 if [ $(VERSION) -ge 3 \
246 -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \
247 echo "lttng-probe-writeback.o" ; fi;)
249 $(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.)
250 endif # CONFIG_KALLSYMS_ALL
252 ifneq ($(CONFIG_KPROBES),)
253 obj-$(CONFIG_LTTNG) += lttng-kprobes.o
254 endif # CONFIG_KPROBES
256 ifneq ($(CONFIG_KRETPROBES),)
257 obj-$(CONFIG_LTTNG) += lttng-kretprobes.o
258 endif # CONFIG_KRETPROBES
260 ifneq ($(CONFIG_DYNAMIC_FTRACE),)
261 obj-$(CONFIG_LTTNG) += lttng-ftrace.o
262 endif # CONFIG_DYNAMIC_FTRACE
264 obj-$(CONFIG_LTTNG) += lttng-test.o