forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathta.mk
115 lines (90 loc) · 3.22 KB
/
ta.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
include mk/cleanvars.mk
# Set current submodule (used for module specific flags compile result etc)
sm := user_ta
sm-$(sm) := y
# Setup compiler for this sub module
CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE)
COMPILER_$(sm) ?= $(COMPILER)
include mk/$(COMPILER_$(sm)).mk
include ta/arch/$(ARCH)/$(ARCH).mk
cppflags$(sm) += $(platform-cppflags) $(user_ta-platform-cppflags)
cflags$(sm) += $(platform-cflags) $(user_ta-platform-cflags)
aflags$(sm) += $(platform-aflags) $(user_ta-platform-aflags)
# Config flags from mk/config.mk
cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL)
cppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG)
base-prefix := $(sm)-
libname = utils
libdir = lib/libutils
include mk/lib.mk
libname = mpa
libdir = lib/libmpa
include mk/lib.mk
libname = utee
libdir = lib/libutee
include mk/lib.mk
base-prefix :=
incdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm)))
incfiles-extra-host := lib/libutils/ext/include/compiler.h
incfiles-extra-host += lib/libutils/ext/include/util.h
incfiles-extra-host += $(out-dir)/core/include/generated/conf.h
incfiles-extra-host += $(out-dir)/core/conf.mk
incfiles-extra-host += core/include/tee/tee_fs_key_manager.h
incfiles-extra-host += core/include/signed_hdr.h
#
# Copy lib files and exported headers from each lib
#
define copy-file
$2/$$(notdir $1): $1
@set -e; \
mkdir -p $$(dir $$@) ; \
$(cmd-echo-silent) ' INSTALL $$@' ; \
cp $$< $$@
cleanfiles += $2/$$(notdir $1)
all: $2/$$(notdir $1)
endef
# Copy the .a files
$(foreach f, $(libfiles), \
$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib)))
# Copy .mk files
ta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \
$(wildcard core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk) \
$(wildcard ta/arch/$(ARCH)/link.mk) \
ta/mk/ta_dev_kit.mk
$(foreach f, $(ta-mkfiles), \
$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk)))
# Special treatment for ta/arch/$(ARCH)/$(ARCH).mk
arch-arch-mk := $(out-dir)/export-user_ta/mk/arch.mk
$(arch-arch-mk): ta/arch/$(ARCH)/$(ARCH).mk
@set -e; \
mkdir -p $(dir $@) ; \
$(cmd-echo-silent) ' INSTALL $@' ; \
cp $< $@
cleanfiles += $(arch-arch-mk)
all: $(arch-arch-mk)
# Copy the .h files for TAs
define copy-incdir
sf := $(subst $1/, , $(shell find $1 -name "*.h"))
$$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \
$$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h)))))))
endef
$(foreach d, $(incdirs$(sm)), \
$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include)))
# Copy the .h files needed by host
$(foreach d, $(incdirs-host), \
$(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include)))
$(foreach f, $(incfiles-extra-host), \
$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/host_include)))
# Copy the src files
ta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \
$(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds)
$(foreach f, $(ta-srcfiles), \
$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src)))
# Copy keys
ta-keys = keys/default_ta.pem
$(foreach f, $(ta-keys), \
$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/keys)))
# Copy the scripts
ta-scripts = $(wildcard scripts/sign.py)
$(foreach f, $(ta-scripts), \
$(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts)))