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