1b0104773SPascal Brandinclude mk/cleanvars.mk 2b0104773SPascal Brand 3b0104773SPascal Brand# Set current submodule (used for module specific flags compile result etc) 4b0104773SPascal Brandsm := core 5b0104773SPascal Brandsm-$(sm) := y 6b0104773SPascal Brand 74334e8d7SJerome Forissierarch-dir := core/arch/$(ARCH) 84334e8d7SJerome Forissierplatform-dir := $(arch-dir)/plat-$(PLATFORM) 94334e8d7SJerome Forissierinclude $(platform-dir)/conf.mk 10739804b5SJens Wiklanderinclude mk/config.mk 110de9a5fbSJens Wiklanderinclude core/arch/$(ARCH)/$(ARCH).mk 12b0104773SPascal Brand 139fc53171SJerome ForissierPLATFORM_$(PLATFORM) := y 149fc53171SJerome ForissierPLATFORM_FLAVOR_$(PLATFORM_FLAVOR) := y 159fc53171SJerome Forissier 16878b4097SJens Wiklander$(call cfg-depends-all,CFG_PAGED_USER_TA,CFG_WITH_PAGER CFG_WITH_USER_TA) 173d3ad63dSJens Wiklanderinclude core/crypto.mk 18a884c935SJens Wiklander 191b4eb4f5SJens Wiklander# Setup compiler for this sub module 201b4eb4f5SJens WiklanderCOMPILER_$(sm) ?= $(COMPILER) 211b4eb4f5SJens Wiklanderinclude mk/$(COMPILER_$(sm)).mk 221b4eb4f5SJens Wiklander 2345082335SJens Wiklandercppflags$(sm) += -D__KERNEL__ 2445082335SJens Wiklander 25a3911433SJerome Forissiercppflags$(sm) += -Icore/include 26b5569a68SPascal Brandcppflags$(sm) += -include $(conf-file) 2789fe7c3cSJerome Forissiercppflags$(sm) += -I$(out-dir)/core/include 28739804b5SJens Wiklandercppflags$(sm) += $(core-platform-cppflags) 29739804b5SJens Wiklandercflags$(sm) += $(core-platform-cflags) 30be715239SJens Wiklanderifeq ($(CFG_CORE_SANITIZE_UNDEFINED),y) 31be715239SJens Wiklandercflags$(sm) += -fsanitize=undefined 32be715239SJens Wiklanderendif 331d171f95SJens Wiklanderifeq ($(CFG_CORE_SANITIZE_KADDRESS),y) 341d171f95SJens Wiklanderifeq ($(CFG_ASAN_SHADOW_OFFSET),) 351d171f95SJens Wiklander$(error error: CFG_CORE_SANITIZE_KADDRESS not supported by platform (flavor)) 361d171f95SJens Wiklanderendif 371d171f95SJens Wiklandercflags_kasan += -fsanitize=kernel-address \ 381d171f95SJens Wiklander -fasan-shadow-offset=$(CFG_ASAN_SHADOW_OFFSET)\ 391d171f95SJens Wiklander --param asan-stack=1 --param asan-globals=1 \ 401d171f95SJens Wiklander --param asan-instrumentation-with-call-threshold=0 411d171f95SJens Wiklandercflags$(sm) += $(cflags_kasan) 421d171f95SJens Wiklanderendif 43739804b5SJens Wiklanderaflags$(sm) += $(core-platform-aflags) 44b0104773SPascal Brand 458a1e7b89SJerome Forissiercppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL) 46156fe685SPascal Brandifeq ($(CFG_TEE_CORE_MALLOC_DEBUG),y) 47156fe685SPascal Brandcppflags$(sm) += -DENABLE_MDBG=1 48156fe685SPascal Brandendif 4999eee037SEtienne Carriereifneq ($(CFG_TEE_CORE_DEBUG),y) 5099eee037SEtienne Carrierecppflags$(sm) += -DNDEBUG 5199eee037SEtienne Carriereendif 52b0104773SPascal Brand 53b0104773SPascal Brandcppflags$(sm) += -Ilib/libutee/include 54b0104773SPascal Brand 55fe52b1f5SJerome Forissier# Tell all libraries and sub-directories (included below) that we have a 56fe52b1f5SJerome Forissier# configuration file 57fe52b1f5SJerome Forissier 58b5569a68SPascal Brandconf-file := $(out-dir)/include/generated/conf.h 59b5569a68SPascal Brandconf-mk-file := $(out-dir)/conf.mk 60b924c494SJens Wiklanderconf-cmake-file := $(out-dir)/conf.cmake 61dde0e235Setienne carriere$(conf-file): $(conf-mk-file) 62dde0e235Setienne carriere 63fe52b1f5SJerome Forissiercleanfiles += $(conf-file) 64dde0e235Setienne carrierecleanfiles += $(conf-mk-file) 65fe52b1f5SJerome Forissier 66fe52b1f5SJerome Forissier$(conf-file): FORCE 67fe52b1f5SJerome Forissier $(call check-conf-h) 68fe52b1f5SJerome Forissier 69dde0e235Setienne carriere$(conf-mk-file): FORCE 703354f9b2SJerome Forissier $(call check-conf-mk) 71dde0e235Setienne carriere 72b924c494SJens Wiklander$(conf-cmake-file): FORCE 73b924c494SJens Wiklander $(call check-conf-cmake) 74b924c494SJens Wiklander 75b0104773SPascal Brand# 76b0104773SPascal Brand# Do libraries 77b0104773SPascal Brand# 78b0104773SPascal Brand 79b0104773SPascal Brand# Set a prefix to avoid conflicts with user TAs that will use the same 80b0104773SPascal Brand# source but with different flags below 81b0104773SPascal Brandbase-prefix := $(sm)- 82b0104773SPascal Brandlibname = utils 83b0104773SPascal Brandlibdir = lib/libutils 84b0104773SPascal Brandinclude mk/lib.mk 85b0104773SPascal Brand 86e789ada3SJens WiklanderCFG_CRYPTOLIB_NAME ?= tomcrypt 87e789ada3SJens WiklanderCFG_CRYPTOLIB_DIR ?= core/lib/libtomcrypt 8818dd462bSJens Wiklander# CFG_CRYPTOLIB_NAME must not be changed beyond this line 8918dd462bSJens WiklanderCFG_CRYPTOLIB_NAME_$(CFG_CRYPTOLIB_NAME) := y 90e789ada3SJens Wiklander 91*fcd21d9eSJens Wiklanderifeq ($(CFG_CRYPTOLIB_NAME),tomcrypt) 92e789ada3SJens WiklanderCFG_CORE_MBEDTLS_MPI ?= y 93*fcd21d9eSJens Wiklanderifeq ($(CFG_CORE_MBEDTLS_MPI),y) 94e789ada3SJens Wiklander# We're compiling mbedtls too, but with a limited configuration which only 95e789ada3SJens Wiklander# provides the MPI routines 96e789ada3SJens Wiklanderlibname = mbedtls 97e789ada3SJens Wiklanderlibdir = lib/libmbedtls 98e789ada3SJens Wiklanderinclude mk/lib.mk 99e789ada3SJens Wiklanderelse 100b0104773SPascal Brandlibname = mpa 101b0104773SPascal Brandlibdir = lib/libmpa 102b0104773SPascal Brandinclude mk/lib.mk 103e789ada3SJens Wiklanderendif 104*fcd21d9eSJens Wiklanderendif #tomcrypt 105e789ada3SJens Wiklander 106fa788ef9SJens Wiklanderifeq ($(firstword $(subst /, ,$(CFG_CRYPTOLIB_DIR))),core) 107fa788ef9SJens Wiklander# If a library can be compiled for both core and user space a base-prefix 108fa788ef9SJens Wiklander# is needed in order to avoid conflicts in the output. However, if the 109fa788ef9SJens Wiklander# library resides under core then it can't be compiled to user space. 110b0104773SPascal Brandbase-prefix := 111fa788ef9SJens Wiklanderendif 112b0104773SPascal Brand 113d2d2d58bSdeebee-v2libname = $(CFG_CRYPTOLIB_NAME) 114d2d2d58bSdeebee-v2libdir = $(CFG_CRYPTOLIB_DIR) 115b0104773SPascal Brandinclude mk/lib.mk 116b0104773SPascal Brand 117fa788ef9SJens Wiklanderbase-prefix := 118fa788ef9SJens Wiklander 119b908c675SJens Wiklanderifeq ($(CFG_DT),y) 120b908c675SJens Wiklanderlibname = fdt 121b908c675SJens Wiklanderlibdir = core/lib/libfdt 122b908c675SJens Wiklanderinclude mk/lib.mk 123b908c675SJens Wiklanderendif 124b908c675SJens Wiklander 125b3be2f66SJerome Forissierifeq ($(CFG_ZLIB),y) 126b3be2f66SJerome Forissierlibname = zlib 127b3be2f66SJerome Forissierlibdir = core/lib/zlib 128b3be2f66SJerome Forissierinclude mk/lib.mk 129b3be2f66SJerome Forissierendif 130b3be2f66SJerome Forissier 131b0104773SPascal Brand# 132b0104773SPascal Brand# Do main source 133b0104773SPascal Brand# 134bc420748SJens Wiklander 135b0104773SPascal Brandsubdirs = $(core-platform-subdirs) core 136b0104773SPascal Brandinclude mk/subdir.mk 137bc420748SJens Wiklander 138b0104773SPascal Brandinclude mk/compile.mk 139d5a887c8SJens Wiklander 14071315c30SAndrew F. Davisinclude $(if $(wildcard $(platform-dir)/link.mk), \ 14171315c30SAndrew F. Davis $(platform-dir)/link.mk, \ 14271315c30SAndrew F. Davis core/arch/$(ARCH)/kernel/link.mk) 143