Remove work-around for signed tracepoint module tainting (kernel 3.15+)
[lttng-modules.git] / Kbuild.common
CommitLineData
6c27a5cc
MJ
1# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
2
72e6c528
MD
3# Work-around for distro-specific public modules ABI breakages.
4# Some distributions break the public module instrumentation ABI
5# compared to upstream stable kernels without providing other mean than
6# the kernel EXTRAVERSION to figure it out. Translate this information
7# into a define visible from the C preprocessor.
8
6c27a5cc 9DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-debian-version.sh $(CURDIR))
72e6c528
MD
10
11ifneq ($(DEB_API_VERSION), 0)
a8907e9a 12 ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
72e6c528 13endif
b4c8e4d3 14
6c27a5cc 15RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-rhel-version.sh $(CURDIR))
c94ac1ac
MJ
16
17ifneq ($(RHEL_API_VERSION), 0)
18 ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
19endif
20
6c27a5cc 21SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-sle-version.sh $(CURDIR))
ce66b486
MJ
22
23ifneq ($(SLE_API_VERSION), 0)
24 ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
25endif
26
6c27a5cc 27FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-fedora-version.sh $(CURDIR))
e4838da1
LG
28
29ifneq ($(FEDORA_REVISION_VERSION), 0)
30 ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
31endif
32
6c27a5cc 33RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/rt-patch-version.sh $(CURDIR))
b4c8e4d3
MJ
34
35ifneq ($(RT_PATCH_VERSION), 0)
36 ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
37endif
f61d99f9 38
6c27a5cc 39EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
101215b7
MJ
40
41ifneq ($(EXTRA_VERSION_NAME), 0)
42 ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"'
43endif
44
6c27a5cc 45EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
101215b7
MJ
46
47ifneq ($(EXTRA_VERSION_GIT), 0)
48 ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"'
49endif
50
6c27a5cc 51EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
101215b7 52
f61d99f9
MJ
53# Starting with kernel 4.12, the ftrace header was moved to private headers
54# and as such is not available when building against distro headers instead
55# of the full kernel sources. In the situation, define LTTNG_FTRACE_MISSING_HEADER
56# so we can enable the compat code even if CONFIG_DYNAMIC_FTRACE is enabled.
57ifneq ($(CONFIG_DYNAMIC_FTRACE),)
58 ftrace_dep = $(srctree)/kernel/trace/trace.h
59 ftrace_dep_check = $(wildcard $(ftrace_dep))
60 have_ftrace_header = $(shell \
61 if [ $(VERSION) -ge 5 -o \( $(VERSION) -eq 4 -a $(PATCHLEVEL) -ge 12 \) ] ; then \
62 if [ -z "$(ftrace_dep_check)" ] ; then \
63 echo "no" ; \
64 exit ; \
65 fi; \
66 fi; \
67 echo "yes" ; \
68 )
69 ifeq ($(have_ftrace_header), no)
70 ccflags-y += -DLTTNG_FTRACE_MISSING_HEADER
71 endif
72endif
e6213a91 73
a6cf40a4
MJ
74mnt_ns_dep = $(srctree)/fs/mount.h
75ifeq ($(wildcard $(mnt_ns_dep)),)
76 ccflags-y += -DLTTNG_MNT_NS_MISSING_HEADER
77endif
78
e6213a91 79# vim:syntax=make
This page took 0.04612 seconds and 4 git commands to generate.