1include mk/cleanvars.mk 2 3# Set current submodule (used for module specific flags compile result etc) 4sm := user_ta 5sm-$(sm) := y 6 7# Setup compiler for this sub module 8CROSS_PREFIX_$(sm) ?= $(CROSS_PREFIX) 9CROSS_COMPILE_$(sm) ?= $(CROSS_PREFIX_$(sm))- 10COMPILER_$(sm) ?= $(COMPILER) 11include mk/$(COMPILER_$(sm)).mk 12 13cppflags$(sm) += $(platform-cppflags) $(user_ta-platform-cppflags) 14cflags$(sm) += $(platform-cflags) $(user_ta-platform-cflags) 15aflags$(sm) += $(platform-aflags) $(user_ta-platform-aflags) 16 17# Config flags from mk/config.mk 18cppflags$(sm) += -DCFG_TRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL) 19cppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG) 20 21 22base-prefix := $(sm)- 23 24libname = utils 25libdir = lib/libutils 26include mk/lib.mk 27 28libname = mpa 29libdir = lib/libmpa 30include mk/lib.mk 31 32libname = utee 33libdir = lib/libutee 34include mk/lib.mk 35 36base-prefix := 37 38incdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm))) 39incfiles-extra-host := lib/libutils/ext/include/compiler.h 40incfiles-extra-host += lib/libutils/ext/include/util.h 41 42# 43# Copy lib files and exported headers from each lib 44# 45 46define copy-file 47$2/$$(notdir $1): $1 48 @set -e; \ 49 mkdir -p $$(dir $$@) ; \ 50 echo ' INSTALL $$@' ; \ 51 cp $$< $$@ 52 53cleanfiles += $2/$$(notdir $1) 54all: $2/$$(notdir $1) 55endef 56 57# Copy the .a files 58$(foreach f, $(libfiles), \ 59 $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib))) 60 61# Copy .mk files 62ta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \ 63 $(wildcard core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk) \ 64 $(wildcard ta/arch/$(ARCH)/link.mk) \ 65 ta/mk/ta_dev_kit.mk 66 67$(foreach f, $(ta-mkfiles), \ 68 $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk))) 69 70# Copy the .h files for TAs 71define copy-incdir 72sf := $(subst $1/, , $(shell find $1 -name "*.h")) 73$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \ 74 $$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h))))))) 75endef 76$(foreach d, $(incdirs$(sm)), \ 77 $(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include))) 78 79# Copy the .h files needed by host 80$(foreach d, $(incdirs-host), \ 81 $(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include))) 82$(foreach f, $(incfiles-extra-host), \ 83 $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/host_include))) 84 85# Copy the src files 86ta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \ 87 $(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds) 88$(foreach f, $(ta-srcfiles), \ 89 $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src))) 90 91# Copy the scripts 92ta-scripts = $(wildcard ta/arch/$(ARCH)/fix_ta_binary) 93$(foreach f, $(ta-scripts), \ 94 $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts))) 95