Fix: Build ftrace probe on kernels prior to 4.12
[lttng-modules.git] / probes / Kbuild
index a4f6b32af172bedfba2b1a443b7b94d7d82b27bc..78bf3fb229380cfbb8d6b06e73ea46f67b946b71 100644 (file)
@@ -97,13 +97,15 @@ ifneq ($(CONFIG_EXT3_FS),)
   ext3_dep = $(srctree)/fs/ext3/*.h
   ext3_dep_check = $(wildcard $(ext3_dep))
   ext3 = $(shell \
-    if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
-      if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \
-        -z "$(ext3_dep_check)" ] ; then \
-        echo "warn" ; \
-        exit ; \
+    if [ $(VERSION) -lt 4 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -lt 3 \) ] ; then \
+      if [ $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 1 \) ] ; then \
+        if [ \( $(VERSION) -ge 4 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 4 \) \) -a \
+          -z "$(ext3_dep_check)" ] ; then \
+          echo "warn" ; \
+          exit ; \
+        fi; \
+        echo "lttng-probe-ext3.o" ; \
       fi; \
-      echo "lttng-probe-ext3.o" ; \
     fi;)
   ifeq ($(ext3),warn)
     $(warning Files $(ext3_dep) not found. Probe "ext3" is disabled. Use full kernel source tree to enable it.)
@@ -257,7 +259,22 @@ ifneq ($(CONFIG_KRETPROBES),)
 endif # CONFIG_KRETPROBES
 
 ifneq ($(CONFIG_DYNAMIC_FTRACE),)
-  obj-$(CONFIG_LTTNG) += lttng-ftrace.o
+  ftrace_dep = $(srctree)/kernel/trace/trace.h
+  ftrace_dep_check = $(wildcard $(ftrace_dep))
+  ftrace = $(shell \
+    if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \
+      if [ -z "$(ftrace_dep_check)" ] ; then \
+        echo "warn" ; \
+        exit ; \
+      fi; \
+    fi; \
+    echo "lttng-ftrace.o" ; \
+    )
+  ifeq ($(ftrace),warn)
+    $(warning Files $(ftrace_dep) not found. Probe "ftrace" is disabled. Use full kernel source tree to enable it.)
+    ftrace =
+  endif # $(ftrace),warn
+  obj-$(CONFIG_LTTNG) += $(ftrace)
 endif # CONFIG_DYNAMIC_FTRACE
 
 # vim:syntax=make
This page took 0.024015 seconds and 4 git commands to generate.