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