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