| 1 | # Work-around for distro-specific public modules ABI breakages. |
| 2 | # Some distributions break the public module instrumentation ABI |
| 3 | # compared to upstream stable kernels without providing other mean than |
| 4 | # the kernel EXTRAVERSION to figure it out. Translate this information |
| 5 | # into a define visible from the C preprocessor. |
| 6 | |
| 7 | DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-debian-version.sh $(CURDIR)) |
| 8 | |
| 9 | ifneq ($(DEB_API_VERSION), 0) |
| 10 | ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION) |
| 11 | endif |
| 12 | |
| 13 | RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-rhel-version.sh $(CURDIR)) |
| 14 | |
| 15 | ifneq ($(RHEL_API_VERSION), 0) |
| 16 | ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION) |
| 17 | endif |
| 18 | |
| 19 | SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-sle-version.sh $(CURDIR)) |
| 20 | |
| 21 | ifneq ($(SLE_API_VERSION), 0) |
| 22 | ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION) |
| 23 | endif |
| 24 | |
| 25 | FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-fedora-version.sh $(CURDIR)) |
| 26 | |
| 27 | ifneq ($(FEDORA_REVISION_VERSION), 0) |
| 28 | ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION) |
| 29 | endif |
| 30 | |
| 31 | RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR)) |
| 32 | |
| 33 | ifneq ($(RT_PATCH_VERSION), 0) |
| 34 | ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION) |
| 35 | endif |
| 36 | |
| 37 | EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR)) |
| 38 | |
| 39 | ifneq ($(EXTRA_VERSION_NAME), 0) |
| 40 | ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"' |
| 41 | endif |
| 42 | |
| 43 | EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR)) |
| 44 | |
| 45 | ifneq ($(EXTRA_VERSION_GIT), 0) |
| 46 | ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"' |
| 47 | endif |
| 48 | |
| 49 | EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR)) |
| 50 | |
| 51 | # Starting with kernel 4.12, the ftrace header was moved to private headers |
| 52 | # and as such is not available when building against distro headers instead |
| 53 | # of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER |
| 54 | # so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled. |
| 55 | ifneq ($(CONFIG_DYNAMIC_FTRACE),) |
| 56 | ftrace_dep = $(srctree)/kernel/trace/trace.h |
| 57 | ftrace_dep_check = $(wildcard $(ftrace_dep)) |
| 58 | have_ftrace_header = $(shell \ |
| 59 | if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \ |
| 60 | if [ -z "$(ftrace_dep_check)" ] ; then \ |
| 61 | echo "no" ; \ |
| 62 | exit ; \ |
| 63 | fi; \ |
| 64 | fi; \ |
| 65 | echo "yes" ; \ |
| 66 | ) |
| 67 | ifeq ($(have_ftrace_header), no) |
| 68 | ccflags-y += -DLTTNG_FTRACE_MISSING_HEADER |
| 69 | endif |
| 70 | endif |