From: Mathieu Desnoyers Date: Thu, 16 Jul 2015 03:49:15 +0000 (-0400) Subject: Fix: allow LTTng to be built within kernel tree X-Git-Tag: v2.7.0-rc2~18 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e23314859553f39480537b31afdce9284ac91af2;p=lttng-modules.git Fix: allow LTTng to be built within kernel tree Signed-off-by: Mathieu Desnoyers --- 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