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