1 # SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 ifneq ($(KERNELRELEASE
),)
5 # This part of the Makefile is used when called by the kernel build system
6 # and defines the modules to be built.
8 ifdef CONFIG_LOCALVERSION
# Check if dot-config is included.
9 ifeq ($(CONFIG_TRACEPOINTS
),)
10 $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration
)
11 endif # CONFIG_TRACEPOINTS
12 endif # ifdef CONFIG_LOCALVERSION
14 TOP_LTTNG_MODULES_DIR
:= $(shell dirname
$(lastword
$(MAKEFILE_LIST
)))
16 lttng_check_linux_version
= $(shell pwd
)/include/linux
/version.h
17 lttng_check_generated_linux_version
= $(shell pwd
)/include/generated
/uapi
/linux
/version.h
20 # Check for stale version.h, which can be a leftover from an old Linux
21 # kernel tree moved to a newer kernel version, only pruned by make
24 ifneq ($(wildcard $(lttng_check_linux_version
)),)
25 ifneq ($(wildcard $(lttng_check_generated_linux_version
)),)
26 $(error Duplicate version.h files found in
$(lttng_check_linux_version
) and
$(lttng_check_generated_linux_version
). Consider running make
distclean on your kernel
, or removing the stale
$(lttng_check_linux_version
) file
)
30 obj-
$(CONFIG_LTTNG
) += src
/
31 obj-
$(CONFIG_LTTNG
) += tests
/
35 # This part of the Makefile is used when the 'make' command is runned in the
36 # base directory of the lttng-modules sources. It sets some environment and
37 # calls the kernel build system to build the actual modules.
39 KERNELDIR ?
= /lib
/modules
/$(shell uname
-r
)/build
46 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) CONFIG_LTTNG
=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST
=m modules
49 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) CONFIG_LTTNG
=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST
=m modules_install
52 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) clean
55 $(MAKE
) -C
$(KERNELDIR
) M
=$(PWD
) CONFIG_LTTNG
=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST
=m
$@