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 |
| 40 | @mkdir -p $$(dir $$@) |
| 41 | cp $$< $$@ |
| 42 | |
| 43 | cleanfiles += $2/$$(notdir $1) |
| 44 | all: $2/$$(notdir $1) |
| 45 | endef |
| 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 |
| 52 | ta-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 |
| 58 | define copy-incdir |
| 59 | sf := $(subst $1/, , $(shell find $1 -name "*.h")) |
| 60 | $$(foreach h, $$(sf), $$(eval $$(call copy-file, $1/$$(h), \ |
| 61 | $$(subst /./,/,$2/$$(dir $$(h)))))) |
| 62 | endef |
| 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 |
| 71 | ta-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 | |
| 76 | # Copy the scripts |
| 77 | ta-scripts = scripts/fixdep |
| 78 | $(foreach f, $(ta-scripts), \ |
| 79 | $(eval $(call copy-file, $(f), $(out-dir)export-user_ta/scripts))) |