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