From e23314859553f39480537b31afdce9284ac91af2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 15 Jul 2015 23:49:15 -0400 Subject: [PATCH] Fix: allow LTTng to be built within kernel tree Signed-off-by: Mathieu Desnoyers --- Makefile | 6 ++++-- Makefile.ABI.workarounds | 2 +- lib/Makefile | 5 +++-- probes/Makefile | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index f233e660..7c878f05 100644 --- a/Makefile +++ b/Makefile @@ -5,11 +5,13 @@ ifneq ($(KERNELRELEASE),) ifneq ($(CONFIG_TRACEPOINTS),) -KERNELDIR=${LTTNG_KERNELDIR} +KERNELDIR = ${LTTNG_KERNELDIR} +MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST))) 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 @@ -21,7 +23,7 @@ $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lt endif endif -include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds +include $(MAKEFILEDIR)/Makefile.ABI.workarounds obj-m += lttng-ring-buffer-client-discard.o obj-m += lttng-ring-buffer-client-overwrite.o diff --git a/Makefile.ABI.workarounds b/Makefile.ABI.workarounds index f00340c9..be9f1cb5 100644 --- a/Makefile.ABI.workarounds +++ b/Makefile.ABI.workarounds @@ -4,7 +4,7 @@ # the kernel EXTRAVERSION to figure it out. Translate this information # into a define visible from the C preprocessor. -DEB_API_VERSION=$(shell $(KBUILD_EXTMOD)/abi-debian-version.sh $(KERNELDIR)) +DEB_API_VERSION=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR)) ifneq ($(DEB_API_VERSION), 0) ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION) diff --git a/lib/Makefile b/lib/Makefile index 420c85a5..60744066 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,6 +1,7 @@ -KERNELDIR=${LTTNG_KERNELDIR} +KERNELDIR = ${LTTNG_KERNELDIR} +MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST))) -include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds +include $(MAKEFILEDIR)/../Makefile.ABI.workarounds obj-m += lttng-lib-ring-buffer.o diff --git a/probes/Makefile b/probes/Makefile index f0325c87..0314a5e2 100644 --- a/probes/Makefile +++ b/probes/Makefile @@ -5,9 +5,10 @@ ifneq ($(KERNELRELEASE),) ifneq ($(CONFIG_TRACEPOINTS),) -KERNELDIR=${LTTNG_KERNELDIR} +KERNELDIR = ${LTTNG_KERNELDIR} +MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST))) -include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds +include $(MAKEFILEDIR)/../Makefile.ABI.workarounds ccflags-y += -I$(PWD)/probes obj-m += lttng-types.o -- 2.34.1