-obj-m += ltt-ring-buffer-client-discard.o
-obj-m += ltt-ring-buffer-client-overwrite.o
-obj-m += ltt-ring-buffer-metadata-client.o
-obj-m += ltt-ring-buffer-client-mmap-discard.o
-obj-m += ltt-ring-buffer-client-mmap-overwrite.o
-obj-m += ltt-ring-buffer-metadata-mmap-client.o
-
-obj-m += ltt-relay.o
-ltt-relay-objs := ltt-events.o ltt-debugfs-abi.o \
- ltt-probes.o ltt-context.o \
- lttng-context-pid.o lttng-context-comm.o \
+KERNELDIR=${LTTNG_KERNELDIR}
+
+lttng_check_linux_version = $(shell pwd)/include/linux/version.h
+lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h
+
+#
+# Check for stale version.h, which can be a leftover from an old Linux
+# kernel tree moved to a newer kernel version, only pruned by make
+# distclean.
+#
+ifneq ($(wildcard $(lttng_check_linux_version)),)
+ifneq ($(wildcard $(lttng_check_generated_linux_version)),)
+$(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)
+endif
+endif
+
+include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds
+
+obj-m += lttng-ring-buffer-client-discard.o
+obj-m += lttng-ring-buffer-client-overwrite.o
+obj-m += lttng-ring-buffer-metadata-client.o
+obj-m += lttng-ring-buffer-client-mmap-discard.o
+obj-m += lttng-ring-buffer-client-mmap-overwrite.o
+obj-m += lttng-ring-buffer-metadata-mmap-client.o
+
+obj-m += lttng-tracer.o
+lttng-tracer-objs := lttng-events.o lttng-abi.o \
+ lttng-probes.o lttng-context.o \
+ lttng-context-pid.o lttng-context-procname.o \