Simplify arch target handling

Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android.  Store Os+Arch as a single Target.

Change-Id: Iae677eff61a851b65a7192a47f2dc17c1abb4160
diff --git a/cc/stl.go b/cc/stl.go
index cdc887e..c5dbae3 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -52,7 +52,7 @@
 				ctx.ModuleErrorf("stl: %q is not a supported STL with sdk_version set", stl.Properties.Stl)
 				return ""
 			}
-		} else if ctx.HostType() == android.Windows {
+		} else if ctx.Os() == android.Windows {
 			switch stl.Properties.Stl {
 			case "libc++", "libc++_static", "libstdc++", "":
 				// libc++ is not supported on mingw
@@ -60,7 +60,7 @@
 			case "none":
 				return ""
 			default:
-				ctx.ModuleErrorf("stl: %q is not a supported STL", stl.Properties.Stl)
+				ctx.ModuleErrorf("stl: %q is not a supported STL for windows", stl.Properties.Stl)
 				return ""
 			}
 		} else {
@@ -133,9 +133,9 @@
 			flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
 			flags.LdFlags = append(flags.LdFlags, "-lpthread", "-lm")
 			if ctx.staticBinary() {
-				flags.LdFlags = append(flags.LdFlags, hostStaticGccLibs[ctx.HostType()]...)
+				flags.LdFlags = append(flags.LdFlags, hostStaticGccLibs[ctx.Os()]...)
 			} else {
-				flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs[ctx.HostType()]...)
+				flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs[ctx.Os()]...)
 			}
 		} else {
 			if ctx.Arch().ArchType == android.Arm {
@@ -167,9 +167,9 @@
 			flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
 			flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
 			if ctx.staticBinary() {
-				flags.LdFlags = append(flags.LdFlags, hostStaticGccLibs[ctx.HostType()]...)
+				flags.LdFlags = append(flags.LdFlags, hostStaticGccLibs[ctx.Os()]...)
 			} else {
-				flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs[ctx.HostType()]...)
+				flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs[ctx.Os()]...)
 			}
 		}
 	default:
@@ -179,10 +179,10 @@
 	return flags
 }
 
-var hostDynamicGccLibs, hostStaticGccLibs map[android.HostType][]string
+var hostDynamicGccLibs, hostStaticGccLibs map[android.OsType][]string
 
 func init() {
-	hostDynamicGccLibs = map[android.HostType][]string{
+	hostDynamicGccLibs = map[android.OsType][]string{
 		android.Linux:  []string{"-lgcc_s", "-lgcc", "-lc", "-lgcc_s", "-lgcc"},
 		android.Darwin: []string{"-lc", "-lSystem"},
 		android.Windows: []string{"-lmsvcr110", "-lmingw32", "-lgcc", "-lmoldname",
@@ -190,7 +190,7 @@
 			"-lkernel32", "-lmingw32", "-lgcc", "-lmoldname", "-lmingwex",
 			"-lmsvcrt"},
 	}
-	hostStaticGccLibs = map[android.HostType][]string{
+	hostStaticGccLibs = map[android.OsType][]string{
 		android.Linux:   []string{"-Wl,--start-group", "-lgcc", "-lgcc_eh", "-lc", "-Wl,--end-group"},
 		android.Darwin:  []string{"NO_STATIC_HOST_BINARIES_ON_DARWIN"},
 		android.Windows: []string{"NO_STATIC_HOST_BINARIES_ON_WINDOWS"},