Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | # SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
61baff6e | 2 | # SPDX-FileCopyrightText: 2010-2024 EfficiOS Inc. |
1c8284eb MD |
3 | |
4 | ifneq ($(KERNELRELEASE),) | |
1c8284eb | 5 | |
600da0c9 MJ |
6 | # This part of the Makefile is used when called by the kernel build system |
7 | # and defines the modules to be built. | |
8 | ||
9 | obj-$(CONFIG_LTTNG) += src/ | |
c340f071 | 10 | |
a8907e9a | 11 | else # KERNELRELEASE |
b37d476e | 12 | |
a8907e9a MJ |
13 | # This part of the Makefile is used when the 'make' command is runned in the |
14 | # base directory of the lttng-modules sources. It sets some environment and | |
15 | # calls the kernel build system to build the actual modules. | |
1c8284eb | 16 | |
a8907e9a MJ |
17 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build |
18 | PWD := $(shell pwd) | |
1c8284eb | 19 | |
c1551e57 MJ |
20 | # Experimental bitwise enum defaults to disabled. |
21 | CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM ?= n | |
22 | ||
23 | # Emulate Kconfig behavior of setting defines for config options. | |
24 | LKCPPFLAGS = $(KCPPFLAGS) | |
25 | ifeq ($(CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM),y) | |
26 | LKCPPFLAGS += -DCONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM=y | |
27 | endif | |
28 | ||
87d1b66f MJ |
29 | default: modules |
30 | ||
31 | modules: | |
c1551e57 MJ |
32 | $(MAKE) -C $(KERNELDIR) M=$(PWD)/src \ |
33 | CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ | |
34 | KCPPFLAGS='$(LKCPPFLAGS)' \ | |
35 | modules | |
1c8284eb | 36 | |
d504ea73 JG |
37 | syscalls_extractor: |
38 | $(MAKE) -C $(KERNELDIR) M=$(PWD)/src \ | |
39 | CONFIG_LTTNG_SYSCALLS_EXTRACTOR=m \ | |
40 | CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ | |
41 | KCPPFLAGS='$(LKCPPFLAGS)' \ | |
42 | modules | |
43 | ||
1c8284eb | 44 | modules_install: |
c1551e57 MJ |
45 | $(MAKE) -C $(KERNELDIR) M=$(PWD)/src \ |
46 | CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ | |
47 | KCPPFLAGS='$(LKCPPFLAGS)' \ | |
48 | modules_install | |
1c8284eb MD |
49 | |
50 | clean: | |
600da0c9 | 51 | $(MAKE) -C $(KERNELDIR) M=$(PWD)/src clean |
1c8284eb | 52 | |
4c239bd0 FD |
53 | # The following targets are used for development and debugging. They are not |
54 | # part of the build system. | |
23e6a44f | 55 | %.i: %.c |
c1551e57 MJ |
56 | $(MAKE) -C $(KERNELDIR) M=$(PWD) \ |
57 | CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ | |
58 | KCPPFLAGS='$(LKCPPFLAGS)' \ | |
59 | $@ | |
a8907e9a | 60 | |
4c239bd0 | 61 | %.o: %.c |
c1551e57 MJ |
62 | $(MAKE) -C $(KERNELDIR) M=$(PWD) \ |
63 | CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \ | |
64 | KCPPFLAGS='$(LKCPPFLAGS)' \ | |
65 | $@ | |
4c239bd0 | 66 | |
b4809588 | 67 | endif # KERNELRELEASE |