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 14PLATFORM_$(PLATFORM) := y 15PLATFORM_FLAVOR_$(PLATFORM_FLAVOR) := y 16 17# Setup compiler for this sub module 18COMPILER_$(sm) ?= $(COMPILER) 19include mk/$(COMPILER_$(sm)).mk 20 21cppflags$(sm) += -D__KERNEL__ 22 23cppflags$(sm) += -Icore/include 24cppflags$(sm) += -include $(conf-file) 25cppflags$(sm) += -I$(out-dir)/core/include/generated 26cppflags$(sm) += $(core-platform-cppflags) 27cflags$(sm) += $(core-platform-cflags) 28ifeq ($(CFG_CORE_SANITIZE_UNDEFINED),y) 29cflags$(sm) += -fsanitize=undefined 30endif 31ifeq ($(CFG_CORE_SANITIZE_KADDRESS),y) 32ifeq ($(CFG_ASAN_SHADOW_OFFSET),) 33$(error error: CFG_CORE_SANITIZE_KADDRESS not supported by platform (flavor)) 34endif 35cflags_kasan += -fsanitize=kernel-address \ 36 -fasan-shadow-offset=$(CFG_ASAN_SHADOW_OFFSET)\ 37 --param asan-stack=1 --param asan-globals=1 \ 38 --param asan-instrumentation-with-call-threshold=0 39cflags$(sm) += $(cflags_kasan) 40endif 41aflags$(sm) += $(core-platform-aflags) 42 43cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL) 44ifeq ($(CFG_TEE_CORE_MALLOC_DEBUG),y) 45cppflags$(sm) += -DENABLE_MDBG=1 46endif 47ifneq ($(CFG_TEE_CORE_DEBUG),y) 48cppflags$(sm) += -DNDEBUG 49endif 50 51cppflags$(sm) += -Ilib/libutee/include 52 53# Tell all libraries and sub-directories (included below) that we have a 54# configuration file 55 56conf-file := $(out-dir)/include/generated/conf.h 57conf-mk-file := $(out-dir)/conf.mk 58$(conf-file): $(conf-mk-file) 59 60cleanfiles += $(conf-file) 61cleanfiles += $(conf-mk-file) 62 63$(conf-file): FORCE 64 $(call check-conf-h) 65 66$(conf-mk-file): FORCE 67 $(call check-conf-mk) 68 69# 70# Do libraries 71# 72 73# Set a prefix to avoid conflicts with user TAs that will use the same 74# source but with different flags below 75base-prefix := $(sm)- 76libname = utils 77libdir = lib/libutils 78include mk/lib.mk 79 80libname = mpa 81libdir = lib/libmpa 82include mk/lib.mk 83base-prefix := 84 85libname = tomcrypt 86libdir = core/lib/libtomcrypt 87include mk/lib.mk 88 89ifeq ($(CFG_DT),y) 90libname = fdt 91libdir = core/lib/libfdt 92include mk/lib.mk 93endif 94 95# 96# Do main source 97# 98 99subdirs = $(core-platform-subdirs) core 100include mk/subdir.mk 101 102asm-defines-file := core/arch/$(ARCH)/kernel/asm-defines.c 103include mk/compile.mk 104 105include $(platform-dir)/link.mk 106