1*b0104773SPascal Brandinclude mk/cleanvars.mk 2*b0104773SPascal Brand 3*b0104773SPascal Brand# Set current submodule (used for module specific flags compile result etc) 4*b0104773SPascal Brandsm := user_ta 5*b0104773SPascal Brandsm-$(sm) := y 6*b0104773SPascal Brand 7*b0104773SPascal Brandcppflags$(sm) += $(platform-cppflags) $(user_ta-platform-cppflags) 8*b0104773SPascal Brandcflags$(sm) += $(platform-cflags) $(user_ta-platform-cflags) 9*b0104773SPascal Brandaflags$(sm) += $(platform-aflags) $(user_ta-platform-aflags) 10*b0104773SPascal Brand 11*b0104773SPascal Brand# Config flags from mk/config.mk 12*b0104773SPascal Brandcppflags$(sm) += -DCFG_TEE_TA_LOG_LEVEL=$(CFG_TEE_TA_LOG_LEVEL) 13*b0104773SPascal Brandcppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG) 14*b0104773SPascal Brand 15*b0104773SPascal Brand 16*b0104773SPascal Brandbase-prefix := $(sm)- 17*b0104773SPascal Brand 18*b0104773SPascal Brandlibname = utils 19*b0104773SPascal Brandlibdir = lib/libutils 20*b0104773SPascal Brandinclude mk/lib.mk 21*b0104773SPascal Brand 22*b0104773SPascal Brandlibname = mpa 23*b0104773SPascal Brandlibdir = lib/libmpa 24*b0104773SPascal Brandinclude mk/lib.mk 25*b0104773SPascal Brand 26*b0104773SPascal Brandlibname = utee 27*b0104773SPascal Brandlibdir = lib/libutee 28*b0104773SPascal Brandinclude mk/lib.mk 29*b0104773SPascal Brand 30*b0104773SPascal Brandbase-prefix := 31*b0104773SPascal Brand 32*b0104773SPascal Brandincdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm))) 33*b0104773SPascal Brand 34*b0104773SPascal Brand# 35*b0104773SPascal Brand# Copy lib files and exported headers from each lib 36*b0104773SPascal Brand# 37*b0104773SPascal Brand 38*b0104773SPascal Branddefine copy-file 39*b0104773SPascal Brand$2/$$(notdir $1): $1 40*b0104773SPascal Brand @mkdir -p $$(dir $$@) 41*b0104773SPascal Brand cp $$< $$@ 42*b0104773SPascal Brand 43*b0104773SPascal Brandcleanfiles += $2/$$(notdir $1) 44*b0104773SPascal Brandall: $2/$$(notdir $1) 45*b0104773SPascal Brandendef 46*b0104773SPascal Brand 47*b0104773SPascal Brand# Copy the .a files 48*b0104773SPascal Brand$(foreach f, $(libfiles), \ 49*b0104773SPascal Brand $(eval $(call copy-file, $(f), $(out-dir)export-user_ta/lib))) 50*b0104773SPascal Brand 51*b0104773SPascal Brand# Copy .mk files 52*b0104773SPascal Brandta-mkfiles = mk/compile.mk mk/subdir.mk $(wildcard ta/arch/$(ARCH)/link.mk) \ 53*b0104773SPascal Brand ta/mk/ta_dev_kit.mk 54*b0104773SPascal Brand$(foreach f, $(ta-mkfiles), \ 55*b0104773SPascal Brand $(eval $(call copy-file, $(f), $(out-dir)export-user_ta/mk))) 56*b0104773SPascal Brand 57*b0104773SPascal Brand# Copy the .h files for TAs 58*b0104773SPascal Branddefine copy-incdir 59*b0104773SPascal Brandsf := $(subst $1/, , $(shell find $1 -name "*.h")) 60*b0104773SPascal Brand$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \ 61*b0104773SPascal Brand $$(subst /./,/,$2/$$(dir $$(h)))))) 62*b0104773SPascal Brandendef 63*b0104773SPascal Brand$(foreach d, $(incdirs$(sm)), \ 64*b0104773SPascal Brand $(eval $(call copy-incdir, $(d), $(out-dir)export-user_ta/include))) 65*b0104773SPascal Brand 66*b0104773SPascal Brand# Copy the .h files needed by host 67*b0104773SPascal Brand$(foreach d, $(incdirs-host), \ 68*b0104773SPascal Brand $(eval $(call copy-incdir, $(d), $(out-dir)export-user_ta/host_include))) 69*b0104773SPascal Brand 70*b0104773SPascal Brand# Copy the src files 71*b0104773SPascal Brandta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \ 72*b0104773SPascal Brand $(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds) 73*b0104773SPascal Brand$(foreach f, $(ta-srcfiles), \ 74*b0104773SPascal Brand $(eval $(call copy-file, $(f), $(out-dir)export-user_ta/src))) 75*b0104773SPascal Brand 76*b0104773SPascal Brand# Copy the scripts 77*b0104773SPascal Brandta-scripts = scripts/fixdep 78*b0104773SPascal Brand$(foreach f, $(ta-scripts), \ 79*b0104773SPascal Brand $(eval $(call copy-file, $(f), $(out-dir)export-user_ta/scripts))) 80