Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 1 | include mk/cleanvars.mk |
Jerome Forissier | 3bce5ba | 2014-12-16 19:23:24 +0100 | [diff] [blame] | 2 | include core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 3 | |
| 4 | # Set current submodule (used for module specific flags compile result etc) |
| 5 | sm := user_ta |
| 6 | sm-$(sm) := y |
| 7 | |
| 8 | cppflags$(sm) += $(platform-cppflags) $(user_ta-platform-cppflags) |
| 9 | cflags$(sm) += $(platform-cflags) $(user_ta-platform-cflags) |
| 10 | aflags$(sm) += $(platform-aflags) $(user_ta-platform-aflags) |
| 11 | |
| 12 | # Config flags from mk/config.mk |
Jens Wiklander | 4de4beb | 2014-10-20 11:26:38 +0200 | [diff] [blame] | 13 | cppflags$(sm) += -DCFG_TRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL) |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 14 | cppflags$(sm) += -DCFG_TEE_CORE_USER_MEM_DEBUG=$(CFG_TEE_CORE_USER_MEM_DEBUG) |
| 15 | |
| 16 | |
| 17 | base-prefix := $(sm)- |
| 18 | |
| 19 | libname = utils |
| 20 | libdir = lib/libutils |
| 21 | include mk/lib.mk |
| 22 | |
| 23 | libname = mpa |
| 24 | libdir = lib/libmpa |
| 25 | include mk/lib.mk |
| 26 | |
| 27 | libname = utee |
| 28 | libdir = lib/libutee |
| 29 | include mk/lib.mk |
| 30 | |
| 31 | base-prefix := |
| 32 | |
| 33 | incdirs-host := $(filter-out lib/libutils%, $(incdirs$(sm))) |
Jens Wiklander | fecbba7 | 2015-01-26 09:53:56 +0100 | [diff] [blame^] | 34 | incfiles-extra-host := lib/libutils/ext/include/compiler.h |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 35 | |
| 36 | # |
| 37 | # Copy lib files and exported headers from each lib |
| 38 | # |
| 39 | |
| 40 | define copy-file |
| 41 | $2/$$(notdir $1): $1 |
Jerome Forissier | 0047cb6 | 2014-09-01 13:41:48 +0200 | [diff] [blame] | 42 | @set -e; \ |
| 43 | mkdir -p $$(dir $$@) ; \ |
| 44 | echo ' INSTALL $$@' ; \ |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 45 | cp $$< $$@ |
| 46 | |
| 47 | cleanfiles += $2/$$(notdir $1) |
| 48 | all: $2/$$(notdir $1) |
| 49 | endef |
| 50 | |
| 51 | # Copy the .a files |
| 52 | $(foreach f, $(libfiles), \ |
Jerome Forissier | 4334e8d | 2014-09-08 10:53:42 +0200 | [diff] [blame] | 53 | $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/lib))) |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 54 | |
| 55 | # Copy .mk files |
Jens Wiklander | 2cb1e0d | 2014-08-15 11:35:17 +0200 | [diff] [blame] | 56 | ta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk \ |
Jerome Forissier | 3bce5ba | 2014-12-16 19:23:24 +0100 | [diff] [blame] | 57 | $(wildcard core/arch/$(ARCH)/plat-$(PLATFORM)/platform_flags.mk) \ |
Jens Wiklander | 2cb1e0d | 2014-08-15 11:35:17 +0200 | [diff] [blame] | 58 | $(wildcard ta/arch/$(ARCH)/link.mk) \ |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 59 | ta/mk/ta_dev_kit.mk |
Jerome Forissier | 3bce5ba | 2014-12-16 19:23:24 +0100 | [diff] [blame] | 60 | |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 61 | $(foreach f, $(ta-mkfiles), \ |
Jerome Forissier | 4334e8d | 2014-09-08 10:53:42 +0200 | [diff] [blame] | 62 | $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/mk))) |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 63 | |
| 64 | # Copy the .h files for TAs |
| 65 | define copy-incdir |
| 66 | sf := $(subst $1/, , $(shell find $1 -name "*.h")) |
| 67 | $$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \ |
Jerome Forissier | 0047cb6 | 2014-09-01 13:41:48 +0200 | [diff] [blame] | 68 | $$(patsubst %/,%,$$(subst /./,/,$2/$$(dir $$(h))))))) |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 69 | endef |
| 70 | $(foreach d, $(incdirs$(sm)), \ |
Jerome Forissier | 4334e8d | 2014-09-08 10:53:42 +0200 | [diff] [blame] | 71 | $(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/include))) |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 72 | |
| 73 | # Copy the .h files needed by host |
| 74 | $(foreach d, $(incdirs-host), \ |
Jerome Forissier | 4334e8d | 2014-09-08 10:53:42 +0200 | [diff] [blame] | 75 | $(eval $(call copy-incdir, $(d), $(out-dir)/export-user_ta/host_include))) |
Jens Wiklander | fecbba7 | 2015-01-26 09:53:56 +0100 | [diff] [blame^] | 76 | $(foreach f, $(incfiles-extra-host), \ |
| 77 | $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/host_include))) |
Pascal Brand | b010477 | 2014-06-12 15:56:20 +0200 | [diff] [blame] | 78 | |
| 79 | # Copy the src files |
| 80 | ta-srcfiles = ta/arch/$(ARCH)/user_ta_header.c \ |
| 81 | $(wildcard ta/arch/$(ARCH)/user_ta_elf_arm.lds) |
| 82 | $(foreach f, $(ta-srcfiles), \ |
Jerome Forissier | 4334e8d | 2014-09-08 10:53:42 +0200 | [diff] [blame] | 83 | $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/src))) |
Jens Wiklander | 2cb1e0d | 2014-08-15 11:35:17 +0200 | [diff] [blame] | 84 | |
| 85 | # Copy the scripts |
| 86 | ta-scripts = $(wildcard ta/arch/$(ARCH)/fix_ta_binary) |
| 87 | $(foreach f, $(ta-scripts), \ |
Jerome Forissier | 4334e8d | 2014-09-08 10:53:42 +0200 | [diff] [blame] | 88 | $(eval $(call copy-file, $(f), $(out-dir)/export-user_ta/scripts))) |