xref: /optee_os/ta/ta.mk (revision 3bce5ba118caf537ed5788eb46500eaadbe795ba)
1b0104773SPascal Brandinclude mk/cleanvars.mk
2*3bce5ba1SJerome Forissierinclude core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk
3b0104773SPascal Brand
4b0104773SPascal Brand# Set current submodule (used for module specific flags compile result etc)
5b0104773SPascal Brandsm := user_ta
6b0104773SPascal Brandsm-$(sm) := y
7b0104773SPascal Brand
8b0104773SPascal Brandcppflags$(sm)	+= $(platform-cppflags) $(user_ta-platform-cppflags)
9b0104773SPascal Brandcflags$(sm)	+= $(platform-cflags) $(user_ta-platform-cflags)
10b0104773SPascal Brandaflags$(sm)	+= $(platform-aflags) $(user_ta-platform-aflags)
11b0104773SPascal Brand
12b0104773SPascal Brand# Config flags from mk/config.mk
134de4bebcSJens Wiklandercppflags$(sm) += -DCFG_TRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL)
14b0104773SPascal Brandcppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG)
15b0104773SPascal Brand
16b0104773SPascal Brand
17b0104773SPascal Brandbase-prefix := $(sm)-
18b0104773SPascal Brand
19b0104773SPascal Brandlibname = utils
20b0104773SPascal Brandlibdir = lib/libutils
21b0104773SPascal Brandinclude mk/lib.mk
22b0104773SPascal Brand
23b0104773SPascal Brandlibname = mpa
24b0104773SPascal Brandlibdir = lib/libmpa
25b0104773SPascal Brandinclude mk/lib.mk
26b0104773SPascal Brand
27b0104773SPascal Brandlibname = utee
28b0104773SPascal Brandlibdir = lib/libutee
29b0104773SPascal Brandinclude mk/lib.mk
30b0104773SPascal Brand
31b0104773SPascal Brandbase-prefix :=
32b0104773SPascal Brand
33b0104773SPascal Brandincdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm)))
34b0104773SPascal Brand
35b0104773SPascal Brand#
36b0104773SPascal Brand# Copy lib files and exported headers from each lib
37b0104773SPascal Brand#
38b0104773SPascal Brand
39b0104773SPascal Branddefine copy-file
40b0104773SPascal Brand$2/$$(notdir $1): $1
410047cb63SJerome Forissier	@set -e; \
420047cb63SJerome Forissier	mkdir -p $$(dir $$@) ; \
430047cb63SJerome Forissier	echo '  INSTALL $$@' ; \
44b0104773SPascal Brand	cp $$< $$@
45b0104773SPascal Brand
46b0104773SPascal Brandcleanfiles += $2/$$(notdir $1)
47b0104773SPascal Brandall: $2/$$(notdir $1)
48b0104773SPascal Brandendef
49b0104773SPascal Brand
50b0104773SPascal Brand# Copy the .a files
51b0104773SPascal Brand$(foreach f, $(libfiles), \
524334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib)))
53b0104773SPascal Brand
54b0104773SPascal Brand# Copy .mk files
552cb1e0d0SJens Wiklanderta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \
56*3bce5ba1SJerome Forissier	$(wildcard core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk) \
572cb1e0d0SJens Wiklander	$(wildcard ta/arch/$(ARCH)/link.mk) \
58b0104773SPascal Brand	ta/mk/ta_dev_kit.mk
59*3bce5ba1SJerome Forissier
60b0104773SPascal Brand$(foreach f, $(ta-mkfiles), \
614334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk)))
62b0104773SPascal Brand
63b0104773SPascal Brand# Copy the .h files for TAs
64b0104773SPascal Branddefine copy-incdir
65b0104773SPascal Brandsf := $(subst $1/, , $(shell find $1 -name "*.h"))
66b0104773SPascal Brand$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \
670047cb63SJerome Forissier	$$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h)))))))
68b0104773SPascal Brandendef
69b0104773SPascal Brand$(foreach d, $(incdirs$(sm)), \
704334e8d7SJerome Forissier	$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include)))
71b0104773SPascal Brand
72b0104773SPascal Brand# Copy the .h files needed by host
73b0104773SPascal Brand$(foreach d, $(incdirs-host), \
744334e8d7SJerome Forissier	$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include)))
75b0104773SPascal Brand
76b0104773SPascal Brand# Copy the src files
77b0104773SPascal Brandta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \
78b0104773SPascal Brand	$(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds)
79b0104773SPascal Brand$(foreach f, $(ta-srcfiles), \
804334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src)))
812cb1e0d0SJens Wiklander
822cb1e0d0SJens Wiklander# Copy the scripts
832cb1e0d0SJens Wiklanderta-scripts = $(wildcard ta/arch/$(ARCH)/fix_ta_binary)
842cb1e0d0SJens Wiklander$(foreach f, $(ta-scripts), \
854334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts)))
86