Merge "Refactor sanitized library on-disk layout - Soong."
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 6d08ca8..33e7eb3 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -29,6 +29,7 @@
 	"LOCAL_C_INCLUDES":            localIncludeDirs,
 	"LOCAL_EXPORT_C_INCLUDE_DIRS": exportIncludeDirs,
 	"LOCAL_LDFLAGS":               ldflags,
+	"LOCAL_MODULE_CLASS":          prebuiltClass,
 	"LOCAL_MODULE_STEM":           stem,
 	"LOCAL_MODULE_HOST_OS":        hostOs,
 	"LOCAL_SRC_FILES":             srcFiles,
@@ -40,7 +41,9 @@
 	// skip functions
 	"LOCAL_ADDITIONAL_DEPENDENCIES": skip, // TODO: check for only .mk files?
 	"LOCAL_CPP_EXTENSION":           skip,
+	"LOCAL_MODULE_SUFFIX":           skip, // TODO
 	"LOCAL_PATH":                    skip, // Nothing to do, except maybe avoid the "./" in paths?
+	"LOCAL_PRELINK_MODULE":          skip, // Already phased out
 }
 
 // adds a group of properties all having the same type
@@ -54,7 +57,6 @@
 	addStandardProperties(bpparser.StringType,
 		map[string]string{
 			"LOCAL_MODULE":               "name",
-			"LOCAL_MODULE_CLASS":         "class",
 			"LOCAL_CXX_STL":              "stl",
 			"LOCAL_STRIP_MODULE":         "strip",
 			"LOCAL_MULTILIB":             "compile_multilib",
@@ -462,6 +464,17 @@
 	return err
 }
 
+func prebuiltClass(ctx variableAssignmentContext) error {
+	class := ctx.mkvalue.Value(nil)
+	if v, ok := prebuiltTypes[class]; ok {
+		ctx.file.scope.Set("BUILD_PREBUILT", v)
+	} else {
+		// reset to default
+		ctx.file.scope.Set("BUILD_PREBUILT", "prebuilt")
+	}
+	return nil
+}
+
 func ldflags(ctx variableAssignmentContext) error {
 	val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
 	if err != nil {
@@ -658,8 +671,13 @@
 	"BUILD_HOST_JAVA_LIBRARY":        "java_library_host",
 	"BUILD_HOST_DALVIK_JAVA_LIBRARY": "java_library_host_dalvik",
 	"BUILD_PACKAGE":                  "android_app",
+}
 
-	"BUILD_PREBUILT": "prebuilt",
+var prebuiltTypes = map[string]string{
+	"SHARED_LIBRARIES": "cc_prebuilt_library_shared",
+	"STATIC_LIBRARIES": "cc_prebuilt_library_static",
+	"EXECUTABLES":      "cc_prebuilt_binary",
+	"JAVA_LIBRARIES":   "prebuilt_java_library",
 }
 
 var soongModuleTypes = map[string]bool{}
@@ -675,6 +693,9 @@
 		globalScope.Set(k, v)
 		soongModuleTypes[v] = true
 	}
+	for _, v := range prebuiltTypes {
+		soongModuleTypes[v] = true
+	}
 
 	return globalScope
 }
diff --git a/cc/config/global.go b/cc/config/global.go
index 1ce1cce..50c7c98 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -132,7 +132,7 @@
 		if override := config.(android.Config).Getenv("LLVM_PREBUILTS_VERSION"); override != "" {
 			return override, nil
 		}
-		return "clang-3688880", nil
+		return "clang-3859424", nil
 	})
 	pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}")
 	pctx.StaticVariable("ClangBin", "${ClangPath}/bin")