*_OUT_INTERMEDIATE_LIBRARIES has been removed from Make

So LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES is no longer necessary. And just
export the object paths directly to make instead of copying into the
intermediate libraries directory.

Test: m
Change-Id: Iba1523aec642fc81e9bf61da3125f714e91cd557
diff --git a/cc/androidmk.go b/cc/androidmk.go
index bb82529..5daacb7 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -174,9 +174,10 @@
 func (object *objectLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
 	ret.Custom = func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
 		out := ret.OutputFile.Path()
+		varname := fmt.Sprintf("SOONG_%sOBJECT_%s%s", prefix, name, data.SubName)
 
-		fmt.Fprintln(w, "\n$("+prefix+"OUT_INTERMEDIATE_LIBRARIES)/"+name+data.SubName+objectExtension+":", out.String())
-		fmt.Fprintln(w, "\t$(copy-file-to-target)")
+		fmt.Fprintf(w, "\n%s := %s\n", varname, out.String())
+		fmt.Fprintln(w, ".KATI_READONLY: "+varname)
 	}
 }
 
@@ -277,11 +278,6 @@
 		fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path)
 		fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
 		fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
-
-		// Prevent make from installing the libraries to obj/lib (since we have
-		// dozens of libraries with the same name, they'll clobber each other
-		// and the real versions of the libraries from the platform).
-		fmt.Fprintln(w, "LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES := false")
 	})
 }
 
@@ -320,13 +316,6 @@
 
 func (c *ndkPrebuiltStlLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
 	ret.Class = "SHARED_LIBRARIES"
-
-	ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
-		// Prevent make from installing the libraries to obj/lib (since we have
-		// dozens of libraries with the same name, they'll clobber each other
-		// and the real versions of the libraries from the platform).
-		fmt.Fprintln(w, "LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES := false")
-	})
 }
 
 func (c *vendorPublicLibraryStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {