Commit | Line | Data |
---|---|---|
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 | |
5 | ifneq ($(KERNELRELEASE),) | |
6 | ifneq ($(CONFIG_TRACEPOINTS),) | |
7 | ||
8 | ccflags-y += -I$(PWD)/probes | |
40652b65 | 9 | obj-m += lttng-types.o |
6d61b34d | 10 | |
cd4bd11f | 11 | obj-m += lttng-probe-lttng.o |
6db3d13b | 12 | obj-m += lttng-probe-sched.o |
0d1d4002 | 13 | obj-m += lttng-probe-irq.o |
e54456f5 | 14 | obj-m += lttng-probe-timer.o |
b283666f PW |
15 | obj-m += lttng-probe-kmem.o |
16 | obj-m += lttng-probe-module.o | |
17 | obj-m += lttng-probe-power.o | |
8c468a9b | 18 | |
c337ddc2 MD |
19 | obj-m += lttng-probe-statedump.o |
20 | ||
056f5922 MD |
21 | ifneq ($(CONFIG_KVM),) |
22 | obj-m += lttng-probe-kvm.o | |
23 | endif | |
24 | ||
3a523f5b MD |
25 | obj-m += $(shell \ |
26 | if [ $(VERSION) -ge 3 \ | |
7c68b363 | 27 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \ |
3a523f5b MD |
28 | echo "lttng-probe-signal.o" ; fi;) |
29 | ||
c9604bd3 MD |
30 | ifneq ($(CONFIG_BLOCK),) |
31 | ifneq ($(CONFIG_EVENT_TRACING),) # need blk_cmd_buf_len | |
7c68b363 | 32 | obj-m += lttng-probe-block.o |
c9604bd3 MD |
33 | endif |
34 | endif | |
35 | ||
b283666f | 36 | ifneq ($(CONFIG_NET),) |
b283666f PW |
37 | obj-m += lttng-probe-napi.o |
38 | obj-m += lttng-probe-skb.o | |
7c68b363 AG |
39 | obj-m += $(shell \ |
40 | if [ $(VERSION) -ge 3 \ | |
41 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 37 \) ] ; then \ | |
42 | echo "lttng-probe-net.o" ; fi;) | |
b283666f PW |
43 | obj-m += $(shell \ |
44 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \ | |
45 | echo "lttng-probe-sock.o" ; fi;) | |
46 | obj-m += $(shell \ | |
47 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \ | |
48 | echo "lttng-probe-udp.o" ; fi;) | |
49 | endif | |
50 | ||
51 | ifneq ($(CONFIG_SND_SOC),) | |
52 | obj-m += $(shell \ | |
53 | if [ $(VERSION) -ge 3 \ | |
54 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
55 | echo "lttng-probe-asoc.o" ; fi;) | |
56 | endif | |
57 | ||
58 | ifneq ($(CONFIG_EXT3_FS),) | |
7c68b363 AG |
59 | ext3_dep = $(srctree)/fs/ext3/*.h |
60 | ext3_dep_check = $(wildcard $(ext3_dep)) | |
61 | ext3 = $(shell \ | |
b283666f | 62 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \ |
7c68b363 AG |
63 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 4 -a \ |
64 | -z "$(ext3_dep_check)" ] ; then \ | |
65 | echo "warn" ; \ | |
66 | exit ; \ | |
67 | fi; \ | |
68 | echo "lttng-probe-ext3.o" ; \ | |
69 | fi;) | |
70 | ifeq ($(ext3),warn) | |
71 | $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.) | |
72 | ext3 = | |
73 | endif | |
74 | obj-m += $(ext3) | |
b283666f PW |
75 | endif |
76 | ||
77 | ifneq ($(CONFIG_GPIOLIB),) | |
78 | obj-m += $(shell \ | |
79 | if [ $(VERSION) -ge 3 ] ; then \ | |
80 | echo "lttng-probe-gpio.o" ; fi;) | |
81 | endif | |
82 | ||
83 | ifneq ($(CONFIG_JBD2),) | |
84 | obj-m += lttng-probe-jbd2.o | |
85 | endif | |
86 | ||
87 | ifneq ($(CONFIG_JBD),) | |
88 | obj-m += $(shell \ | |
89 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 1 ] ; then \ | |
90 | echo "lttng-probe-jbd.o" ; fi;) | |
91 | endif | |
92 | ||
93 | ifneq ($(CONFIG_REGULATOR),) | |
94 | obj-m += $(shell \ | |
95 | if [ $(VERSION) -ge 3 \ | |
96 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
97 | echo "lttng-probe-regulator.o" ; fi;) | |
98 | endif | |
99 | ||
100 | ifneq ($(CONFIG_SCSI),) | |
101 | obj-m += $(shell \ | |
7c68b363 AG |
102 | if [ $(VERSION) -ge 3 \ |
103 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 35 \) ] ; then \ | |
b283666f PW |
104 | echo "lttng-probe-scsi.o" ; fi;) |
105 | endif | |
106 | ||
107 | vmscan = $(shell \ | |
7c68b363 AG |
108 | if [ $(VERSION) -ge 3 \ |
109 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \ | |
b283666f PW |
110 | echo "lttng-probe-vmscan.o" ; fi;) |
111 | ifneq ($(CONFIG_SWAP),) | |
112 | obj-m += $(vmscan) | |
113 | else | |
114 | ifneq ($(CONFIG_CGROUP_MEM_RES_CTLR),) | |
115 | obj-m += $(vmscan) | |
116 | endif | |
117 | endif | |
118 | ||
7c68b363 AG |
119 | # lock probe does not work, so disabling it for now |
120 | #ifneq ($(CONFIG_LOCKDEP),) | |
121 | #obj-m += lttng-probe-lock.o | |
122 | #endif | |
123 | ||
b87700e3 AG |
124 | ifneq ($(CONFIG_BTRFS_FS),) |
125 | btrfs_dep = $(srctree)/fs/btrfs/*.h | |
126 | btrfs = $(shell \ | |
127 | if [ $(VERSION) -ge 3 \ | |
128 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 39 \) ] ; then \ | |
129 | echo "lttng-probe-btrfs.o" ; fi;) | |
130 | ifneq ($(btrfs),) | |
131 | ifeq ($(wildcard $(btrfs_dep)),) | |
132 | $(warning Files $(btrfs_dep) not found. Probe "btrfs" is disabled. Use full kernel source tree to enable it.) | |
133 | btrfs = | |
134 | endif | |
135 | endif | |
136 | obj-m += $(btrfs) | |
137 | endif | |
138 | ||
139 | obj-m += $(shell \ | |
140 | if [ $(VERSION) -ge 3 \ | |
141 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 38 \) ] ; then \ | |
142 | echo "lttng-probe-compaction.o" ; fi;) | |
143 | ||
144 | ifneq ($(CONFIG_EXT4_FS),) | |
145 | ext4_dep = $(srctree)/fs/ext4/*.h | |
146 | ext4 = lttng-probe-ext4.o | |
147 | ifeq ($(wildcard $(ext4_dep)),) | |
148 | $(warning Files $(ext4_dep) not found. Probe "ext4" is disabled. Use full kernel source tree to enable it.) | |
149 | ext4 = | |
150 | endif | |
151 | obj-m += $(ext4) | |
152 | endif | |
153 | ||
154 | obj-m += $(shell \ | |
155 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 4 ] ; then \ | |
156 | echo "lttng-probe-printk.o" ; fi;) | |
157 | ifneq ($(CONFIG_FRAME_WARN),0) | |
158 | CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200 | |
159 | endif | |
160 | ||
161 | obj-m += $(shell \ | |
162 | if [ \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \ | |
163 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \ | |
164 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \ | |
165 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \ | |
166 | echo "lttng-probe-random.o" ; fi;) | |
167 | ||
168 | obj-m += $(shell \ | |
169 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 2 ] ; then \ | |
170 | echo "lttng-probe-rcu.o" ; fi;) | |
171 | ||
172 | ifneq ($(CONFIG_REGMAP),) | |
173 | obj-m += $(shell \ | |
174 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 2 ] ; then \ | |
175 | echo "lttng-probe-regmap.o" ; fi;) | |
176 | endif | |
177 | ||
178 | ifneq ($(CONFIG_PM_RUNTIME),) | |
179 | obj-m += $(shell \ | |
180 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 2 ] ; then \ | |
181 | echo "lttng-probe-rpm.o" ; fi;) | |
182 | endif | |
183 | ||
184 | ifneq ($(CONFIG_SUNRPC),) | |
185 | obj-m += $(shell \ | |
186 | if [ $(VERSION) -ge 3 -a $(PATCHLEVEL) -ge 4 ] ; then \ | |
187 | echo "lttng-probe-sunrpc.o" ; fi;) | |
188 | endif | |
189 | ||
190 | obj-m += lttng-probe-workqueue.o | |
191 | ||
42d9070d | 192 | ifneq ($(CONFIG_KALLSYMS_ALL),) |
b87700e3 AG |
193 | obj-m += $(shell \ |
194 | if [ $(VERSION) -ge 3 \ | |
195 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 36 \) ] ; then \ | |
196 | echo "lttng-probe-writeback.o" ; fi;) | |
42d9070d | 197 | endif |
b87700e3 | 198 | |
b283666f | 199 | |
acd614cc | 200 | ifneq ($(CONFIG_KPROBES),) |
d6d808f3 | 201 | obj-m += lttng-kprobes.o |
acd614cc | 202 | endif |
d6d808f3 | 203 | |
7371f44c MD |
204 | |
205 | ifneq ($(CONFIG_KRETPROBES),) | |
206 | obj-m += lttng-kretprobes.o | |
207 | endif | |
208 | ||
e0a7a7c4 MD |
209 | ifneq ($(CONFIG_DYNAMIC_FTRACE),) |
210 | obj-m += lttng-ftrace.o | |
211 | endif | |
212 | ||
6d61b34d MD |
213 | endif |
214 | ||
215 | else | |
216 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build | |
217 | PWD := $(shell pwd) | |
218 | CFLAGS = $(EXTCFLAGS) | |
219 | ||
220 | default: | |
221 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules | |
222 | ||
223 | modules_install: | |
224 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install | |
225 | /sbin/depmod -a | |
226 | ||
227 | clean: | |
228 | $(MAKE) -C $(KERNELDIR) M=$(PWD) clean | |
229 | ||
230 | endif |