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 31aflags$(sm) += $(core-platform-aflags) 32 33cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL) 34ifeq ($(CFG_TEE_CORE_MALLOC_DEBUG),y) 35cppflags$(sm) += -DENABLE_MDBG=1 36endif 37ifneq ($(CFG_TEE_CORE_DEBUG),y) 38cppflags$(sm) += -DNDEBUG 39endif 40 41cppflags$(sm) += -Ilib/libutee/include 42 43# Tell all libraries and sub-directories (included below) that we have a 44# configuration file 45 46conf-file := $(out-dir)/include/generated/conf.h 47conf-mk-file := $(out-dir)/conf.mk 48$(conf-file): $(conf-mk-file) 49 50cleanfiles += $(conf-file) 51cleanfiles += $(conf-mk-file) 52 53$(conf-file): FORCE 54 $(call check-conf-h) 55 56$(conf-mk-file): FORCE 57 $(call check-conf-mk) 58 59# 60# Do libraries 61# 62 63# Set a prefix to avoid conflicts with user TAs that will use the same 64# source but with different flags below 65base-prefix := $(sm)- 66libname = utils 67libdir = lib/libutils 68include mk/lib.mk 69 70libname = mpa 71libdir = lib/libmpa 72include mk/lib.mk 73base-prefix := 74 75libname = tomcrypt 76libdir = core/lib/libtomcrypt 77include mk/lib.mk 78 79ifeq ($(CFG_DT),y) 80libname = fdt 81libdir = core/lib/libfdt 82include mk/lib.mk 83endif 84 85# 86# Do main source 87# 88 89subdirs = $(core-platform-subdirs) core 90include mk/subdir.mk 91 92asm-defines-file := core/arch/$(ARCH)/kernel/asm-defines.c 93include mk/compile.mk 94 95include $(platform-dir)/link.mk 96