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