Support custom suffixes on Makefile outputs

This way Make can use different output files for different targets, and
switch between them without having to reparse all the makefiles.

Change-Id: I00001a09d79025772d966f443ab9f130e35f4720
diff --git a/common/androidmk.go b/common/androidmk.go
index a16a652..6a2ede0 100644
--- a/common/androidmk.go
+++ b/common/androidmk.go
@@ -26,6 +26,7 @@
 	"android/soong"
 
 	"github.com/google/blueprint"
+	"github.com/google/blueprint/proptools"
 )
 
 func init() {
@@ -54,11 +55,13 @@
 type androidMkSingleton struct{}
 
 func (c *androidMkSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
-	if !ctx.Config().(Config).EmbeddedInMake() {
+	config := ctx.Config().(Config)
+
+	if !config.EmbeddedInMake() {
 		return
 	}
 
-	ctx.SetNinjaBuildDir(pctx, filepath.Join(ctx.Config().(Config).buildDir, ".."))
+	ctx.SetNinjaBuildDir(pctx, filepath.Join(config.buildDir, ".."))
 
 	var androidMkModulesList []AndroidModule
 
@@ -70,7 +73,7 @@
 
 	sort.Sort(AndroidModulesByName{androidMkModulesList, ctx})
 
-	transMk := PathForOutput(ctx, "Android.mk")
+	transMk := PathForOutput(ctx, "Android"+proptools.String(config.ProductVariables.Make_suffix)+".mk")
 	if ctx.Failed() {
 		return
 	}
diff --git a/common/variable.go b/common/variable.go
index ae72761..7f8a6e6 100644
--- a/common/variable.go
+++ b/common/variable.go
@@ -52,6 +52,9 @@
 var zeroProductVariables variableProperties
 
 type productVariables struct {
+	// Suffix to add to generated Makefiles
+	Make_suffix *string `json:",omitempty"`
+
 	Platform_sdk_version *int `json:",omitempty"`
 
 	DeviceName        *string   `json:",omitempty"`