[lttng-dev] [lttng-modules PATCH] makefile: check kernel version and config token

Gerlando Falauto gerlando.falauto at keymile.com
Wed Dec 21 08:30:23 EST 2011


a) When kernel is not compatible (version < 2.6.39), don't try to
   compile but display a warning instead
b) When configuration token CONFIG_TRACEPOINTS is not enabled,
   display a warning

Signed-off-by: Gerlando Falauto <gerlando.falauto at keymile.com>
---
 Makefile |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 5ac13d7..a7eb624 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,15 @@
 ifneq ($(KERNELRELEASE),)
 ifneq ($(CONFIG_TRACEPOINTS),)
 
+COMPATIBLE_KERNEL=$(shell \
+	if [ $(VERSION) -ge 3 \
+		-o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 39 \) ] ; then \
+		echo "y" ; fi;)
+
+ifeq ($(COMPATIBLE_KERNEL),)
+$(warning Trying to compile lttng-modules against kernel $(KERNELRELEASE). Minimum required version is 2.6.39. Skipping.)
+else
+
 obj-m += ltt-ring-buffer-client-discard.o
 obj-m += ltt-ring-buffer-client-overwrite.o
 obj-m += ltt-ring-buffer-metadata-client.o
@@ -35,6 +44,10 @@ endif
 obj-m += probes/
 obj-m += lib/
 
+endif # COMPATIBLE_KERNEL
+
+else
+$(warning CONFIG_TRACEPOINTS is not enabled, LTTng modules will not be compiled!)
 endif
 
 else
-- 
1.7.1




More information about the lttng-dev mailing list