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
This commit is contained in:
Dan Willemsen 2016-05-11 00:27:49 -07:00
parent ac6697420a
commit 174978cc58
2 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import (
"android/soong"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
func init() {
@ -54,11 +55,13 @@ func AndroidMkSingleton() blueprint.Singleton {
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 @@ func (c *androidMkSingleton) GenerateBuildActions(ctx blueprint.SingletonContext
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
}

View File

@ -52,6 +52,9 @@ type variableProperties struct {
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"`