-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathMakefile
73 lines (56 loc) · 1.94 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
# SPDX-FileCopyrightText: 2010-2024 EfficiOS Inc.
ifneq ($(KERNELRELEASE),)
# This part of the Makefile is used when called by the kernel build system
# and defines the modules to be built.
obj-$(CONFIG_LTTNG) += src/
else # KERNELRELEASE
# This part of the Makefile is used when the 'make' command is runned in the
# base directory of the lttng-modules sources. It sets some environment and
# calls the kernel build system to build the actual modules.
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
# Experimental bitwise enum defaults to disabled.
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM ?= n
# Emulate Kconfig behavior of setting defines for config options.
LKCPPFLAGS = $(KCPPFLAGS)
ifeq ($(CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM),y)
LKCPPFLAGS += -DCONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM=y
endif
# Work-around for crtsavres.o missing $(objtree) prefix on powerpc
ifeq ($(ARCH),powerpc)
MO ?= $(KERNELDIR)
MO_OPT = MO=$(MO)
endif
default: modules
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD)/src \
CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \
KCPPFLAGS='$(LKCPPFLAGS)' $(MO_OPT) \
modules
syscalls_extractor:
$(MAKE) -C $(KERNELDIR) M=$(PWD)/src \
CONFIG_LTTNG_SYSCALLS_EXTRACTOR=m \
CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \
KCPPFLAGS='$(LKCPPFLAGS)' \
modules
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD)/src \
CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \
KCPPFLAGS='$(LKCPPFLAGS)' \
modules_install
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD)/src clean
# The following targets are used for development and debugging. They are not
# part of the build system.
%.i: %.c
$(MAKE) -C $(KERNELDIR) M=$(PWD) \
CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \
KCPPFLAGS='$(LKCPPFLAGS)' \
$@
%.o: %.c
$(MAKE) -C $(KERNELDIR) M=$(PWD) \
CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m \
KCPPFLAGS='$(LKCPPFLAGS)' \
$@
endif # KERNELRELEASE