Only change behavior when actually embedded in make

The change to enable embedding in make change the default behavior to
produce an Android.mk file, change the ninja builddir, and add the
-soong suffix to the end of target names. These don't make sense if
we're not building inside make, so detect if we're running under make
by checking for a .soong.in_make file in the builddir.

Change-Id: I1a0f4c1becb327c769b8a130cafef11d83eb49f4
This commit is contained in:
Dan Willemsen
2015-12-11 13:51:06 -08:00
parent c7e4597461
commit 5ba07e8fe4
3 changed files with 30 additions and 3 deletions

View File

@@ -331,9 +331,14 @@ func (a *AndroidModuleBase) generateModuleTarget(ctx blueprint.ModuleContext) {
}
if len(deps) > 0 {
suffix := ""
if ctx.Config().(Config).EmbeddedInMake() {
suffix = "-soong"
}
ctx.Build(pctx, blueprint.BuildParams{
Rule: blueprint.Phony,
Outputs: []string{ctx.ModuleName() + "-soong"},
Outputs: []string{ctx.ModuleName() + suffix},
Implicits: deps,
Optional: true,
})
@@ -568,10 +573,15 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
}
})
suffix := ""
if ctx.Config().(Config).EmbeddedInMake() {
suffix = "-soong"
}
// Create a top-level checkbuild target that depends on all modules
ctx.Build(pctx, blueprint.BuildParams{
Rule: blueprint.Phony,
Outputs: []string{"checkbuild-soong"},
Outputs: []string{"checkbuild" + suffix},
Implicits: checkbuildDeps,
Optional: true,
})
@@ -583,7 +593,9 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
Rule: blueprint.Phony,
Outputs: []string{filepath.Join("mm", dir)},
Implicits: dirModules[dir],
Optional: true,
// HACK: checkbuild should be an optional build, but force it
// enabled for now in standalone builds
Optional: ctx.Config().(Config).EmbeddedInMake(),
})
}
}