Better way to package up the otatools-package.
With this, you can easily add more executables, jars or shared libraries
to the package. Also now it automatically takes care of
32-bit-v.s.-64-bit library issue.
Change-Id: I5afe00fadc978d0da229b192eca1a4b1c149764e
diff --git a/core/definitions.mk b/core/definitions.mk
index 2cdd3f5..e56e0db 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2080,6 +2080,17 @@
$(copy-file-to-target-strip-comments)
endef
+# Copy a list of files/directories to target location, with sub dir structure preserved.
+# For example $(HOST_OUT_EXECUTABLES)/aapt -> $(staging)/bin/aapt .
+# $(1): the source list of files/directories.
+# $(2): the path prefix to strip. In the above example it would be $(HOST_OUT).
+# $(3): the target location.
+define copy-files-with-structure
+$(foreach t,$(1),\
+ $(eval s := $(patsubst $(2)%,%,$(t)))\
+ $(hide) mkdir -p $(dir $(3)/$(s)); cp -Rf $(t) $(3)/$(s)$(newline))
+endef
+
###########################################################
## On some platforms (MacOS), after copying a static
## library, ranlib must be run to update an internal