1b0104773SPascal Brandinclude mk/cleanvars.mk 2b0104773SPascal Brand 3b0104773SPascal Brand# Set current submodule (used for module specific flags compile result etc) 4b0104773SPascal Brandsm := user_ta 5b0104773SPascal Brandsm-$(sm) := y 6b0104773SPascal Brand 71b4eb4f5SJens Wiklander# Setup compiler for this sub module 8*b6106707SJerome ForissierCROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE) 91b4eb4f5SJens WiklanderCOMPILER_$(sm) ?= $(COMPILER) 101b4eb4f5SJens Wiklanderinclude mk/$(COMPILER_$(sm)).mk 111b4eb4f5SJens Wiklander 12b0104773SPascal Brandcppflags$(sm) += $(platform-cppflags) $(user_ta-platform-cppflags) 13b0104773SPascal Brandcflags$(sm) += $(platform-cflags) $(user_ta-platform-cflags) 14b0104773SPascal Brandaflags$(sm) += $(platform-aflags) $(user_ta-platform-aflags) 15b0104773SPascal Brand 16b0104773SPascal Brand# Config flags from mk/config.mk 174de4bebcSJens Wiklandercppflags$(sm) += -DCFG_TRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL) 18b0104773SPascal Brandcppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG) 19b0104773SPascal Brand 20b0104773SPascal Brand 21b0104773SPascal Brandbase-prefix := $(sm)- 22b0104773SPascal Brand 23b0104773SPascal Brandlibname = utils 24b0104773SPascal Brandlibdir = lib/libutils 25b0104773SPascal Brandinclude mk/lib.mk 26b0104773SPascal Brand 27b0104773SPascal Brandlibname = mpa 28b0104773SPascal Brandlibdir = lib/libmpa 29b0104773SPascal Brandinclude mk/lib.mk 30b0104773SPascal Brand 31b0104773SPascal Brandlibname = utee 32b0104773SPascal Brandlibdir = lib/libutee 33b0104773SPascal Brandinclude mk/lib.mk 34b0104773SPascal Brand 35b0104773SPascal Brandbase-prefix := 36b0104773SPascal Brand 37b0104773SPascal Brandincdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm))) 38fecbba79SJens Wiklanderincfiles-extra-host := lib/libutils/ext/include/compiler.h 393c73419cSJens Wiklanderincfiles-extra-host += lib/libutils/ext/include/util.h 40b0104773SPascal Brand 41b0104773SPascal Brand# 42b0104773SPascal Brand# Copy lib files and exported headers from each lib 43b0104773SPascal Brand# 44b0104773SPascal Brand 45b0104773SPascal Branddefine copy-file 46b0104773SPascal Brand$2/$$(notdir $1): $1 470047cb63SJerome Forissier @set -e; \ 480047cb63SJerome Forissier mkdir -p $$(dir $$@) ; \ 490047cb63SJerome Forissier echo ' INSTALL $$@' ; \ 50b0104773SPascal Brand cp $$< $$@ 51b0104773SPascal Brand 52b0104773SPascal Brandcleanfiles += $2/$$(notdir $1) 53b0104773SPascal Brandall: $2/$$(notdir $1) 54b0104773SPascal Brandendef 55b0104773SPascal Brand 56b0104773SPascal Brand# Copy the .a files 57b0104773SPascal Brand$(foreach f, $(libfiles), \ 584334e8d7SJerome Forissier $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib))) 59b0104773SPascal Brand 60b0104773SPascal Brand# Copy .mk files 612cb1e0d0SJens Wiklanderta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \ 623bce5ba1SJerome Forissier $(wildcard core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk) \ 632cb1e0d0SJens Wiklander $(wildcard ta/arch/$(ARCH)/link.mk) \ 64b0104773SPascal Brand ta/mk/ta_dev_kit.mk 653bce5ba1SJerome Forissier 66b0104773SPascal Brand$(foreach f, $(ta-mkfiles), \ 674334e8d7SJerome Forissier $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk))) 68b0104773SPascal Brand 69b0104773SPascal Brand# Copy the .h files for TAs 70b0104773SPascal Branddefine copy-incdir 71b0104773SPascal Brandsf := $(subst $1/, , $(shell find $1 -name "*.h")) 72b0104773SPascal Brand$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \ 730047cb63SJerome Forissier $$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h))))))) 74b0104773SPascal Brandendef 75b0104773SPascal Brand$(foreach d, $(incdirs$(sm)), \ 764334e8d7SJerome Forissier $(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include))) 77b0104773SPascal Brand 78b0104773SPascal Brand# Copy the .h files needed by host 79b0104773SPascal Brand$(foreach d, $(incdirs-host), \ 804334e8d7SJerome Forissier $(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include))) 81fecbba79SJens Wiklander$(foreach f, $(incfiles-extra-host), \ 82fecbba79SJens Wiklander $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/host_include))) 83b0104773SPascal Brand 84b0104773SPascal Brand# Copy the src files 85b0104773SPascal Brandta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \ 86b0104773SPascal Brand $(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds) 87b0104773SPascal Brand$(foreach f, $(ta-srcfiles), \ 884334e8d7SJerome Forissier $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src))) 892cb1e0d0SJens Wiklander 902cb1e0d0SJens Wiklander# Copy the scripts 912cb1e0d0SJens Wiklanderta-scripts = $(wildcard ta/arch/$(ARCH)/fix_ta_binary) 922cb1e0d0SJens Wiklander$(foreach f, $(ta-scripts), \ 934334e8d7SJerome Forissier $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts))) 94