[lttng-dev] [PATCH lttng-modules] Fix: Use kbuild env instead of a custom var KERNELDIR

Michael Jeanson mjeanson at efficios.com
Mon Feb 8 16:33:17 EST 2016


We currently use the custom variables KERNELDIR and LTTNG_KERNELDIR
to pass the kernel source tree directory to helper scripts. We should
instead use the built-in Kbuild variable CURDIR which is available in
all sub makefiles and always points to the kernel sources.

Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 Makefile                 | 9 ++++-----
 Makefile.ABI.workarounds | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 64d5885..6a8c5c7 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,6 @@ ifneq ($(KERNELRELEASE),)
 
   ifneq ($(CONFIG_TRACEPOINTS),)
 
-    KERNELDIR = ${LTTNG_KERNELDIR}
     MAKEFILEDIR = $(shell dirname $(lastword $(MAKEFILE_LIST)))
 
     lttng_check_linux_version = $(shell pwd)/include/linux/version.h
@@ -101,15 +100,15 @@ PWD := $(shell pwd)
 CFLAGS = $(EXTCFLAGS)
 
 default:
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m modules
 
 modules_install:
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
 
 clean:
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
 
 %.i: %.c
-	LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) $@
+	$(MAKE) -C $(KERNELDIR) M=$(PWD) $@
 
 endif # KERNELRELEASE
diff --git a/Makefile.ABI.workarounds b/Makefile.ABI.workarounds
index e8cf520..f766bc9 100644
--- a/Makefile.ABI.workarounds
+++ b/Makefile.ABI.workarounds
@@ -4,13 +4,13 @@
 # the kernel EXTRAVERSION to figure it out. Translate this information
 # into a define visible from the C preprocessor.
 
-DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
+DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(CURDIR))
 
 ifneq ($(DEB_API_VERSION), 0)
   ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
 endif
 
-RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(KERNELDIR))
+RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(CURDIR))
 
 ifneq ($(RT_PATCH_VERSION), 0)
   ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
-- 
2.7.0




More information about the lttng-dev mailing list