xref: /optee_os/ta/ta.mk (revision 3c73419c320d477b84ae7a70da67568f924a437f)
1b0104773SPascal Brandinclude mk/cleanvars.mk
23bce5ba1SJerome 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)))
34fecbba79SJens Wiklanderincfiles-extra-host := lib/libutils/ext/include/compiler.h
35*3c73419cSJens Wiklanderincfiles-extra-host += lib/libutils/ext/include/util.h
36b0104773SPascal Brand
37b0104773SPascal Brand#
38b0104773SPascal Brand# Copy lib files and exported headers from each lib
39b0104773SPascal Brand#
40b0104773SPascal Brand
41b0104773SPascal Branddefine copy-file
42b0104773SPascal Brand$2/$$(notdir $1): $1
430047cb63SJerome Forissier	@set -e; \
440047cb63SJerome Forissier	mkdir -p $$(dir $$@) ; \
450047cb63SJerome Forissier	echo '  INSTALL $$@' ; \
46b0104773SPascal Brand	cp $$< $$@
47b0104773SPascal Brand
48b0104773SPascal Brandcleanfiles += $2/$$(notdir $1)
49b0104773SPascal Brandall: $2/$$(notdir $1)
50b0104773SPascal Brandendef
51b0104773SPascal Brand
52b0104773SPascal Brand# Copy the .a files
53b0104773SPascal Brand$(foreach f, $(libfiles), \
544334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib)))
55b0104773SPascal Brand
56b0104773SPascal Brand# Copy .mk files
572cb1e0d0SJens Wiklanderta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \
583bce5ba1SJerome Forissier	$(wildcard core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk) \
592cb1e0d0SJens Wiklander	$(wildcard ta/arch/$(ARCH)/link.mk) \
60b0104773SPascal Brand	ta/mk/ta_dev_kit.mk
613bce5ba1SJerome Forissier
62b0104773SPascal Brand$(foreach f, $(ta-mkfiles), \
634334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk)))
64b0104773SPascal Brand
65b0104773SPascal Brand# Copy the .h files for TAs
66b0104773SPascal Branddefine copy-incdir
67b0104773SPascal Brandsf := $(subst $1/, , $(shell find $1 -name "*.h"))
68b0104773SPascal Brand$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \
690047cb63SJerome Forissier	$$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h)))))))
70b0104773SPascal Brandendef
71b0104773SPascal Brand$(foreach d, $(incdirs$(sm)), \
724334e8d7SJerome Forissier	$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include)))
73b0104773SPascal Brand
74b0104773SPascal Brand# Copy the .h files needed by host
75b0104773SPascal Brand$(foreach d, $(incdirs-host), \
764334e8d7SJerome Forissier	$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include)))
77fecbba79SJens Wiklander$(foreach f, $(incfiles-extra-host), \
78fecbba79SJens Wiklander	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/host_include)))
79b0104773SPascal Brand
80b0104773SPascal Brand# Copy the src files
81b0104773SPascal Brandta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \
82b0104773SPascal Brand	$(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds)
83b0104773SPascal Brand$(foreach f, $(ta-srcfiles), \
844334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src)))
852cb1e0d0SJens Wiklander
862cb1e0d0SJens Wiklander# Copy the scripts
872cb1e0d0SJens Wiklanderta-scripts = $(wildcard ta/arch/$(ARCH)/fix_ta_binary)
882cb1e0d0SJens Wiklander$(foreach f, $(ta-scripts), \
894334e8d7SJerome Forissier	$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts)))
90