xref: /optee_os/core/core.mk (revision a31f13fbe554136fa2314c7daf1af9d8b0b0ad8d)
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
20PLATFORM_FLAVOR ?= default
21platform_$(PLATFORM) := y
22platform_flavor_$(PLATFORM_FLAVOR) := y
23cppflags$(sm)	+= -DPLATFORM_FLAVOR=PLATFORM_FLAVOR_ID_$(PLATFORM_FLAVOR)
24
25cppflags$(sm)	+= -Icore/include
26cppflags$(sm)	+= -include $(conf-file)
27cppflags$(sm)	+= -I$(out-dir)/core/include/generated
28cppflags$(sm)	+= $(core-platform-cppflags)
29cflags$(sm)	+= $(core-platform-cflags)
30aflags$(sm)	+= $(core-platform-aflags)
31
32cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL)
33ifeq ($(CFG_TEE_CORE_MALLOC_DEBUG),y)
34cppflags$(sm) += -DENABLE_MDBG=1
35endif
36
37cppflags$(sm)	+= -Ilib/libutee/include
38
39# Tell all libraries and sub-directories (included below) that we have a
40# configuration file
41
42conf-file := $(out-dir)/include/generated/conf.h
43conf-mk-file := $(out-dir)/conf.mk
44$(conf-file): $(conf-mk-file)
45
46cleanfiles += $(conf-file)
47cleanfiles += $(conf-mk-file)
48
49$(conf-file): FORCE
50	$(call check-conf-h)
51
52$(conf-mk-file):  FORCE
53	$(call check-conf-mk)
54
55#
56# Do libraries
57#
58
59# Set a prefix to avoid conflicts with user TAs that will use the same
60# source but with different flags below
61base-prefix := $(sm)-
62libname = utils
63libdir = lib/libutils
64include mk/lib.mk
65
66libname = mpa
67libdir = lib/libmpa
68include mk/lib.mk
69base-prefix :=
70
71libname = tomcrypt
72libdir = core/lib/libtomcrypt
73include mk/lib.mk
74
75#
76# Do main source
77#
78
79subdirs = $(core-platform-subdirs) core
80include mk/subdir.mk
81
82# Generate C file to embed public key for TA verification
83gen-srcs += core/ta_pub_key.c
84$(out-dir)/core/ta_pub_key.c: $(TA_SIGN_KEY)
85	@$(cmd-echo-silent) '  GEN     $@'
86	@$(q)mkdir -p $(out-dir)/core
87	@$(q)scripts/pem_to_pub_c.py --prefix ta_pub_key --key $< --out $@
88
89asm-defines-file := core/arch/$(ARCH)/kernel/asm-defines.c
90include mk/compile.mk
91
92include $(platform-dir)/link.mk
93