xref: /optee_os/core/core.mk (revision ca70d0b5c51b923005299a31d2a4811b0efe7ecf)
1include mk/cleanvars.mk
2
3# Set current submodule (used for module specific flags compile result etc)
4sm := core
5sm-$(sm) := y
6
7arch-dir	:= core/arch/$(ARCH)
8platform-dir	:= $(arch-dir)/plat-$(PLATFORM)
9include mk/checkconf.mk
10include $(platform-dir)/conf.mk
11include mk/config.mk
12include core/arch/$(ARCH)/$(ARCH).mk
13
14# Setup compiler for this sub module
15COMPILER_$(sm)		?= $(COMPILER)
16include mk/$(COMPILER_$(sm)).mk
17
18cppflags$(sm)	+= -D__KERNEL__
19
20cppflags$(sm)	+= -Icore/include
21cppflags$(sm)	+= -include $(conf-file)
22cppflags$(sm)	+= -I$(out-dir)/core/include/generated
23cppflags$(sm)	+= $(core-platform-cppflags)
24cflags$(sm)	+= $(core-platform-cflags)
25ifeq ($(CFG_CORE_SANITIZE_UNDEFINED),y)
26cflags$(sm)	+= -fsanitize=undefined
27endif
28aflags$(sm)	+= $(core-platform-aflags)
29
30cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL)
31ifeq ($(CFG_TEE_CORE_MALLOC_DEBUG),y)
32cppflags$(sm) += -DENABLE_MDBG=1
33endif
34ifneq ($(CFG_TEE_CORE_DEBUG),y)
35cppflags$(sm)  += -DNDEBUG
36endif
37
38cppflags$(sm)	+= -Ilib/libutee/include
39
40# Tell all libraries and sub-directories (included below) that we have a
41# configuration file
42
43conf-file := $(out-dir)/include/generated/conf.h
44conf-mk-file := $(out-dir)/conf.mk
45$(conf-file): $(conf-mk-file)
46
47cleanfiles += $(conf-file)
48cleanfiles += $(conf-mk-file)
49
50$(conf-file): FORCE
51	$(call check-conf-h)
52
53$(conf-mk-file):  FORCE
54	$(call check-conf-mk)
55
56#
57# Do libraries
58#
59
60# Set a prefix to avoid conflicts with user TAs that will use the same
61# source but with different flags below
62base-prefix := $(sm)-
63libname = utils
64libdir = lib/libutils
65include mk/lib.mk
66
67libname = mpa
68libdir = lib/libmpa
69include mk/lib.mk
70base-prefix :=
71
72libname = tomcrypt
73libdir = core/lib/libtomcrypt
74include mk/lib.mk
75
76ifeq ($(CFG_DT),y)
77libname = fdt
78libdir = core/lib/libfdt
79include mk/lib.mk
80endif
81
82#
83# Do main source
84#
85
86subdirs = $(core-platform-subdirs) core
87include mk/subdir.mk
88
89asm-defines-file := core/arch/$(ARCH)/kernel/asm-defines.c
90include mk/compile.mk
91
92include $(platform-dir)/link.mk
93