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