xref: /optee_os/ta/ta.mk (revision 4de4bebcfbe3c5c1884a2ff2c66fa2aa5dede662)
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
7b0104773SPascal Brandcppflags$(sm)	+= $(platform-cppflags) $(user_ta-platform-cppflags)
8b0104773SPascal Brandcflags$(sm)	+= $(platform-cflags) $(user_ta-platform-cflags)
9b0104773SPascal Brandaflags$(sm)	+= $(platform-aflags) $(user_ta-platform-aflags)
10b0104773SPascal Brand
11b0104773SPascal Brand# Config flags from mk/config.mk
12*4de4bebcSJens Wiklandercppflags$(sm) += -DCFG_TRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL)
13b0104773SPascal Brandcppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG)
14b0104773SPascal Brand
15b0104773SPascal Brand
16b0104773SPascal Brandbase-prefix := $(sm)-
17b0104773SPascal Brand
18b0104773SPascal Brandlibname = utils
19b0104773SPascal Brandlibdir = lib/libutils
20b0104773SPascal Brandinclude mk/lib.mk
21b0104773SPascal Brand
22b0104773SPascal Brandlibname = mpa
23b0104773SPascal Brandlibdir = lib/libmpa
24b0104773SPascal Brandinclude mk/lib.mk
25b0104773SPascal Brand
26b0104773SPascal Brandlibname = utee
27b0104773SPascal Brandlibdir = lib/libutee
28b0104773SPascal Brandinclude mk/lib.mk
29b0104773SPascal Brand
30b0104773SPascal Brandbase-prefix :=
31b0104773SPascal Brand
32b0104773SPascal Brandincdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm)))
33b0104773SPascal Brand
34b0104773SPascal Brand#
35b0104773SPascal Brand# Copy lib files and exported headers from each lib
36b0104773SPascal Brand#
37b0104773SPascal Brand
38b0104773SPascal Branddefine copy-file
39b0104773SPascal Brand$2/$$(notdir $1): $1
400047cb63SJerome Forissier	@set -e; \
410047cb63SJerome Forissier	mkdir -p $$(dir $$@) ; \
420047cb63SJerome Forissier	echo '  INSTALL $$@' ; \
43b0104773SPascal Brand	cp $$< $$@
44b0104773SPascal Brand
45b0104773SPascal Brandcleanfiles += $2/$$(notdir $1)
46b0104773SPascal Brandall: $2/$$(notdir $1)
47b0104773SPascal Brandendef
48b0104773SPascal Brand
49b0104773SPascal Brand# Copy the .a files
50b0104773SPascal Brand$(foreach f, $(libfiles), \
514334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib)))
52b0104773SPascal Brand
53b0104773SPascal Brand# Copy .mk files
542cb1e0d0SJens Wiklanderta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \
552cb1e0d0SJens Wiklander	$(wildcard ta/arch/$(ARCH)/link.mk) \
56b0104773SPascal Brand	ta/mk/ta_dev_kit.mk
57b0104773SPascal Brand$(foreach f, $(ta-mkfiles), \
584334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk)))
59b0104773SPascal Brand
60b0104773SPascal Brand# Copy the .h files for TAs
61b0104773SPascal Branddefine copy-incdir
62b0104773SPascal Brandsf := $(subst $1/, , $(shell find $1 -name "*.h"))
63b0104773SPascal Brand$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \
640047cb63SJerome Forissier	$$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h)))))))
65b0104773SPascal Brandendef
66b0104773SPascal Brand$(foreach d, $(incdirs$(sm)), \
674334e8d7SJerome Forissier	$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include)))
68b0104773SPascal Brand
69b0104773SPascal Brand# Copy the .h files needed by host
70b0104773SPascal Brand$(foreach d, $(incdirs-host), \
714334e8d7SJerome Forissier	$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include)))
72b0104773SPascal Brand
73b0104773SPascal Brand# Copy the src files
74b0104773SPascal Brandta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \
75b0104773SPascal Brand	$(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds)
76b0104773SPascal Brand$(foreach f, $(ta-srcfiles), \
774334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src)))
782cb1e0d0SJens Wiklander
792cb1e0d0SJens Wiklander# Copy the scripts
802cb1e0d0SJens Wiklanderta-scripts = $(wildcard ta/arch/$(ARCH)/fix_ta_binary)
812cb1e0d0SJens Wiklander$(foreach f, $(ta-scripts), \
824334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts)))
83