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/Makefile b/core/Makefile
index cd96630..a79d7b4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -15,9 +15,9 @@
 # <dest file> is relative to $(PRODUCT_OUT), so it should look like,
 # e.g., "system/etc/file.xml".
 $(foreach cf,$(PRODUCT_COPY_FILES), \
-  $(eval _w := $(subst :,$(space),$(cf))) \
-  $(eval _src := $(word 1,$(_w))) \
-  $(eval _dest := $(subst //,/,$(PRODUCT_OUT)/$(word 2,$(_w)))) \
+  $(eval _src := $(call word-colon,1,$(cf))) \
+  $(eval _dest := $(call \
+          append-path,$(PRODUCT_OUT),$(call word-colon,2,$(cf)))) \
   $(eval $(call copy-one-file,$(_src),$(_dest))) \
   $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_dest)) \
  )
@@ -243,7 +243,10 @@
 	$(ALL_GENERATED_SOURCES) \
 	$(ALL_DEFAULT_INSTALLED_MODULES))
 
-INSTALLED_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
+BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
+
+# We just build this directly to the install location.
+INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
 $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES)
 	$(call pretty,"Target ram disk: $@")
 	$(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | gzip > $@
@@ -575,7 +578,10 @@
 endef
 endif # TARGET_USERIMAGES_USE_EXT2
 
-INSTALLED_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
+BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
+
+# We just build this directly to the install location.
+INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
 $(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_MKUSERFS) \
                                    $(INTERNAL_USERDATAIMAGE_FILES)
 	$(build-userdataimage-target)