1 include mk/cleanvars.mk
3 # Set current submodule (used for module specific flags compile result etc)
7 # Setup compiler for this sub module
8 COMPILER_$(sm) ?= $(COMPILER)
9 include mk/$(COMPILER_$(sm)).mk
11 # Expand platform flags here as $(sm) will change if we have several TA
12 # targets. Platform flags should not change after inclusion of ta/ta.mk.
13 cppflags$(sm) := $(platform-cppflags) $($(sm)-platform-cppflags)
14 cflags$(sm) := $(platform-cflags) $($(sm)-platform-cflags)
15 aflags$(sm) := $(platform-aflags) $($(sm)-platform-aflags)
17 cppflags$(sm) += -include $(conf-file)
19 # Config flags from mk/config.mk
20 cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL)
21 ifeq ($(CFG_TEE_TA_MALLOC_DEBUG),y)
22 cppflags$(sm) += -DENABLE_MDBG=1
49 incdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm)))
50 incfiles-extra-host := lib/libutils/ext/include/compiler.h
51 incfiles-extra-host += lib/libutils/ext/include/util.h
52 incfiles-extra-host += lib/libutils/ext/include/types_ext.h
53 incfiles-extra-host += $(conf-file)
54 incfiles-extra-host += $(conf-mk-file)
55 incfiles-extra-host += core/include/tee/tee_fs_key_manager.h
56 incfiles-extra-host += core/include/signed_hdr.h
59 # Copy lib files and exported headers from each lib
65 mkdir -p $$(dir $$@) ; \
66 $(cmd-echo-silent) ' INSTALL $$@' ; \
69 cleanfiles += $2/$$(notdir $1)
74 $(foreach f, $(libfiles), \
75 $(eval $(call copy-file, $(f), $(out-dir)/export-$(sm)/lib)))
78 ta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk mk/cleandirs.mk \
79 $(wildcard ta/arch/$(ARCH)/link.mk) \
82 $(foreach f, $(ta-mkfiles), \
83 $(eval $(call copy-file, $(f), $(out-dir)/export-$(sm)/mk)))
85 # Copy the .h files for TAs
87 sf := $(subst $1/, , $(shell find $1 -name "*.h"))
88 $$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \
89 $$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h)))))))
91 $(foreach d, $(incdirs$(sm)), \
92 $(eval $(call copy-incdir, $(d), $(out-dir)/export-$(sm)/include)))
94 # Copy the .h files needed by host
95 $(foreach d, $(incdirs-host), \
96 $(eval $(call copy-incdir, $(d), $(out-dir)/export-$(sm)/host_include)))
97 $(foreach f, $(incfiles-extra-host), \
98 $(eval $(call copy-file, $(f), $(out-dir)/export-$(sm)/host_include)))
101 ta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \
102 $(wildcard ta/arch/$(ARCH)/ta.ld.S)
103 $(foreach f, $(ta-srcfiles), \
104 $(eval $(call copy-file, $(f), $(out-dir)/export-$(sm)/src)))
107 ta-keys = keys/default_ta.pem
108 $(foreach f, $(ta-keys), \
109 $(eval $(call copy-file, $(f), $(out-dir)/export-$(sm)/keys)))
112 ta-scripts = $(wildcard scripts/sign.py)
113 $(foreach f, $(ta-scripts), \
114 $(eval $(call copy-file, $(f), $(out-dir)/export-$(sm)/scripts)))
117 conf-mk-file-export := $(out-dir)/export-$(sm)/mk/conf.mk
118 sm-$(conf-mk-file-export) := $(sm)
119 define mk-file-export
120 $(conf-mk-file-export): $(conf-mk-file)
121 @$$(cmd-echo-silent) ' GEN ' $$@
122 $(q)echo sm := $$(sm-$(conf-mk-file-export)) > $$@
123 $(q)echo sm-$$(sm-$(conf-mk-file-export)) := y >> $$@
124 $(q)echo CFG_TA_FLOAT_SUPPORT := $$(CFG_TA_FLOAT_SUPPORT) >> $$@
125 $(q)($$(foreach v, $$(ta-mk-file-export-vars-$$(sm-$(conf-mk-file-export))), \
126 echo $$(v) := $$($$(v));)) >> $$@
127 $(q)echo '$$(ta-mk-file-export-add-$$(sm-$(conf-mk-file-export)))' | sed 's/_nl_ */\n/g' >> $$@
129 $(eval $(mk-file-export))
131 cleanfiles := $(cleanfiles) $(conf-mk-file-export)
132 all: $(conf-mk-file-export)