AI 145618: am: CL 145333 Cloned from CL 144759 by 'g4 patch'.
  Original change by joeo@abreu on 2009/04/06 19:54:13.
  Implement SDK add-ons in the build system.
  - Add an option to use the standard javadoc doclet instead
  of droiddoc, since droiddocs non-sdk templates aren't
  ready for prime time.
  - Add the notion of a stubs for a library.  It's only
  implemented for java libraries, but when we do native
  libraries in the NDK or sdk-addons, it will work there too.
  Original author: joeo
  Merged from: //branches/cupcake/...

Automated import of CL 145618
diff --git a/core/product_config.mk b/core/product_config.mk
index e34ad02..525c9b9 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -49,6 +49,21 @@
  )
 endef
 
+###########################################################
+## List all of the files in a subdirectory in a format
+## suitable for PRODUCT_COPY_FILES and
+## PRODUCT_SDK_ADDON_COPY_FILES
+##
+## $(1): Glob to match file name
+## $(2): Source directory
+## $(3): Target base directory
+###########################################################
+
+define find-copy-subdir-files
+$(shell find $(2) -name "$(1)" | sed -E "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g")
+endef
+
+# ---------------------------------------------------------------
 
 # These are the valid values of TARGET_BUILD_VARIANT.  Also, if anything else is passed
 # as the variant in the PRODUCT-$TARGET_BUILD_PRODUCT-$TARGET_BUILD_VARIANT form,