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