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 12include mk/config.mk 13 14# Setup compiler for this sub module 15CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE) 16COMPILER_$(sm) ?= $(COMPILER) 17include mk/$(COMPILER_$(sm)).mk 18 19cppflags$(sm) += -D__KERNEL__ 20 21PLATFORM_FLAVOR ?= default 22platform_$(PLATFORM) := y 23platform_flavor_$(PLATFORM_FLAVOR) := y 24cppflags$(sm) += -DPLATFORM_FLAVOR=PLATFORM_FLAVOR_ID_$(PLATFORM_FLAVOR) 25 26cppflags$(sm) += -Icore/include 27cppflags$(sm) += -include $(conf-file) 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 89include mk/compile.mk 90include $(platform-dir)/link.mk 91 92 93