Commit | Line | Data |
---|---|---|
1c8284eb MD |
1 | # |
2 | # Makefile for the LTT objects. | |
3 | # | |
4 | ||
5 | ifneq ($(KERNELRELEASE),) | |
1c8284eb | 6 | |
a8907e9a MJ |
7 | # This part of the Makefile is used when called by the kernel build system |
8 | # and defines the modules to be built. | |
9 | ||
10 | ifneq ($(CONFIG_TRACEPOINTS),) | |
11 | ||
12 | KERNELDIR = ${LTTNG_KERNELDIR} | |
13 | MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST))) | |
14 | ||
15 | lttng_check_linux_version = $(shell pwd)/include/linux/version.h | |
16 | lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h | |
17 | ||
18 | # | |
19 | # Check for stale version.h, which can be a leftover from an old Linux | |
20 | # kernel tree moved to a newer kernel version, only pruned by make | |
21 | # distclean. | |
22 | # | |
23 | ifneq ($(wildcard $(lttng_check_linux_version)),) | |
24 | ifneq ($(wildcard $(lttng_check_generated_linux_version)),) | |
25 | $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file) | |
26 | endif | |
27 | endif | |
28 | ||
29 | include $(MAKEFILEDIR)/Makefile.ABI.workarounds | |
30 | ||
31 | obj-$(CONFIG_LTTNG) += lttng-ring-buffer-client-discard.o | |
32 | obj-$(CONFIG_LTTNG) += lttng-ring-buffer-client-overwrite.o | |
33 | obj-$(CONFIG_LTTNG) += lttng-ring-buffer-metadata-client.o | |
34 | obj-$(CONFIG_LTTNG) += lttng-ring-buffer-client-mmap-discard.o | |
35 | obj-$(CONFIG_LTTNG) += lttng-ring-buffer-client-mmap-overwrite.o | |
36 | obj-$(CONFIG_LTTNG) += lttng-ring-buffer-metadata-mmap-client.o | |
37 | obj-$(CONFIG_LTTNG) += lttng-clock.o | |
38 | ||
39 | obj-$(CONFIG_LTTNG) += lttng-tracer.o | |
40 | ||
41 | lttng-tracer-objs := lttng-events.o lttng-abi.o \ | |
42 | lttng-probes.o lttng-context.o \ | |
43 | lttng-context-pid.o lttng-context-procname.o \ | |
44 | lttng-context-prio.o lttng-context-nice.o \ | |
45 | lttng-context-vpid.o lttng-context-tid.o \ | |
46 | lttng-context-vtid.o lttng-context-ppid.o \ | |
47 | lttng-context-vppid.o lttng-context-cpu-id.o \ | |
48 | lttng-context-interruptible.o \ | |
49 | lttng-context-need-reschedule.o lttng-calibrate.o \ | |
50 | lttng-context-hostname.o wrapper/random.o \ | |
51 | probes/lttng.o wrapper/trace-clock.o \ | |
52 | wrapper/page_alloc.o \ | |
53 | lttng-tracker-pid.o \ | |
54 | lttng-filter.o lttng-filter-interpreter.o \ | |
55 | lttng-filter-specialize.o \ | |
56 | lttng-filter-validator.o \ | |
57 | probes/lttng-probe-user.o | |
58 | ||
59 | obj-$(CONFIG_LTTNG) += lttng-statedump.o | |
60 | lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \ | |
61 | wrapper/fdtable.o | |
62 | ||
63 | ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),) | |
64 | lttng-tracer-objs += lttng-syscalls.o | |
65 | endif # CONFIG_HAVE_SYSCALL_TRACEPOINTS | |
66 | ||
67 | ifneq ($(CONFIG_PERF_EVENTS),) | |
68 | lttng-tracer-objs += $(shell \ | |
69 | if [ $(VERSION) -ge 3 \ | |
70 | -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \ | |
71 | echo "lttng-context-perf-counters.o" ; fi;) | |
72 | endif # CONFIG_PERF_EVENTS | |
73 | ||
74 | ifneq ($(CONFIG_PREEMPT_RT_FULL),) | |
75 | lttng-tracer-objs += lttng-context-migratable.o | |
76 | lttng-tracer-objs += lttng-context-preemptible.o | |
77 | endif # CONFIG_PREEMPT_RT_FULL | |
78 | ||
79 | ifneq ($(CONFIG_PREEMPT),) | |
80 | lttng-tracer-objs += lttng-context-preemptible.o | |
81 | endif | |
82 | ||
83 | lttng-tracer-objs += $(shell \ | |
84 | if [ $(VERSION) -ge 4 \ | |
85 | -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 15 -a $(SUBLEVEL) -ge 0 \) ] ; then \ | |
86 | echo "lttng-tracepoint.o" ; fi;) | |
87 | ||
88 | obj-$(CONFIG_LTTNG) += probes/ | |
89 | obj-$(CONFIG_LTTNG) += lib/ | |
90 | ||
91 | endif # CONFIG_TRACEPOINTS | |
c340f071 | 92 | |
a8907e9a | 93 | else # KERNELRELEASE |
b37d476e | 94 | |
a8907e9a MJ |
95 | # This part of the Makefile is used when the 'make' command is runned in the |
96 | # base directory of the lttng-modules sources. It sets some environment and | |
97 | # calls the kernel build system to build the actual modules. | |
1c8284eb | 98 | |
a8907e9a MJ |
99 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build |
100 | PWD := $(shell pwd) | |
101 | CFLAGS = $(EXTCFLAGS) | |
1c8284eb MD |
102 | |
103 | default: | |
6ccec973 | 104 | LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules |
1c8284eb MD |
105 | |
106 | modules_install: | |
72e6c528 | 107 | LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install |
1c8284eb MD |
108 | |
109 | clean: | |
72e6c528 | 110 | LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) clean |
1c8284eb | 111 | |
23e6a44f | 112 | %.i: %.c |
72e6c528 | 113 | LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) $@ |
a8907e9a | 114 | |
b4809588 | 115 | endif # KERNELRELEASE |