forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.mk
120 lines (95 loc) · 2.76 KB
/
core.mk
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
include mk/cleanvars.mk
# Set current submodule (used for module specific flags compile result etc)
sm := core
sm-$(sm) := y
arch-dir := core/arch/$(ARCH)
platform-dir := $(arch-dir)/plat-$(PLATFORM)
include $(platform-dir)/conf.mk
include mk/config.mk
include core/arch/$(ARCH)/$(ARCH).mk
PLATFORM_$(PLATFORM) := y
PLATFORM_FLAVOR_$(PLATFORM_FLAVOR) := y
$(call cfg-depends-all,CFG_PAGED_USER_TA,CFG_WITH_PAGER CFG_WITH_USER_TA)
include core/crypto.mk
# Setup compiler for this sub module
COMPILER_$(sm) ?= $(COMPILER)
include mk/$(COMPILER_$(sm)).mk
cppflags$(sm) += -D__KERNEL__
cppflags$(sm) += -Icore/include
cppflags$(sm) += -include $(conf-file)
cppflags$(sm) += -I$(out-dir)/core/include
cppflags$(sm) += $(core-platform-cppflags)
cflags$(sm) += $(core-platform-cflags)
ifeq ($(CFG_CORE_SANITIZE_UNDEFINED),y)
cflags$(sm) += -fsanitize=undefined
endif
ifeq ($(CFG_CORE_SANITIZE_KADDRESS),y)
ifeq ($(CFG_ASAN_SHADOW_OFFSET),)
$(error error: CFG_CORE_SANITIZE_KADDRESS not supported by platform (flavor))
endif
cflags_kasan += -fsanitize=kernel-address \
-fasan-shadow-offset=$(CFG_ASAN_SHADOW_OFFSET)\
--param asan-stack=1 --param asan-globals=1 \
--param asan-instrumentation-with-call-threshold=0
cflags$(sm) += $(cflags_kasan)
endif
aflags$(sm) += $(core-platform-aflags)
cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL)
ifeq ($(CFG_TEE_CORE_MALLOC_DEBUG),y)
cppflags$(sm) += -DENABLE_MDBG=1
endif
ifneq ($(CFG_TEE_CORE_DEBUG),y)
cppflags$(sm) += -DNDEBUG
endif
cppflags$(sm) += -Ilib/libutee/include
# Tell all libraries and sub-directories (included below) that we have a
# configuration file
conf-file := $(out-dir)/include/generated/conf.h
conf-mk-file := $(out-dir)/conf.mk
conf-cmake-file := $(out-dir)/conf.cmake
$(conf-file): $(conf-mk-file)
cleanfiles += $(conf-file)
cleanfiles += $(conf-mk-file)
$(conf-file): FORCE
$(call check-conf-h)
$(conf-mk-file): FORCE
$(call check-conf-mk)
$(conf-cmake-file): FORCE
$(call check-conf-cmake)
#
# Do libraries
#
# Set a prefix to avoid conflicts with user TAs that will use the same
# source but with different flags below
base-prefix := $(sm)-
libname = utils
libdir = lib/libutils
include mk/lib.mk
libname = mpa
libdir = lib/libmpa
include mk/lib.mk
base-prefix :=
CFG_CRYPTOLIB_NAME ?= tomcrypt
CFG_CRYPTOLIB_DIR ?= core/lib/libtomcrypt
libname = $(CFG_CRYPTOLIB_NAME)
libdir = $(CFG_CRYPTOLIB_DIR)
include mk/lib.mk
ifeq ($(CFG_DT),y)
libname = fdt
libdir = core/lib/libfdt
include mk/lib.mk
endif
ifeq ($(CFG_ZLIB),y)
libname = zlib
libdir = core/lib/zlib
include mk/lib.mk
endif
#
# Do main source
#
subdirs = $(core-platform-subdirs) core
include mk/subdir.mk
include mk/compile.mk
include $(if $(wildcard $(platform-dir)/link.mk), \
$(platform-dir)/link.mk, \
core/arch/$(ARCH)/kernel/link.mk)