Support sanitizer builds inside make

Make expects libraries built with address sanitizer to be installed into
/data, and can't handle multiple variants of modules.

Change-Id: Ice575ff6f0788a88f296e7b3ee521a2b9771f55f
diff --git a/cc/cc.go b/cc/cc.go
index 1a8ba3b..f740ebc 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1482,7 +1482,7 @@
 	flags.Nocrt = Bool(library.Properties.Nocrt)
 
 	if !library.static() {
-		libName := ctx.ModuleName()
+		libName := ctx.ModuleName() + library.Properties.VariantName
 		// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
 		sharedFlag := "-Wl,-shared"
 		if flags.Clang || ctx.Host() {
@@ -1663,7 +1663,8 @@
 type libraryInstaller struct {
 	baseInstaller
 
-	linker *libraryLinker
+	linker   *libraryLinker
+	sanitize *sanitize
 }
 
 func (library *libraryInstaller) install(ctx ModuleContext, file common.Path) {
@@ -1672,6 +1673,10 @@
 	}
 }
 
+func (library *libraryInstaller) inData() bool {
+	return library.baseInstaller.inData() || library.sanitize.inData()
+}
+
 func NewLibrary(hod common.HostOrDeviceSupported, shared, static bool) *Module {
 	module := newModule(hod, common.MultilibBoth)
 
@@ -1688,7 +1693,8 @@
 			dir:   "lib",
 			dir64: "lib64",
 		},
-		linker: linker,
+		linker:   linker,
+		sanitize: module.sanitize,
 	}
 
 	return module