Update to new blueprint api for bootstrap.BinDir

And regenerate build.ninja.in

Change-Id: I35e8b0362799f94b33309d3944b411de5dbcf40a
diff --git a/build.ninja.in b/build.ninja.in
index 3bb9559..4632567 100644
--- a/build.ninja.in
+++ b/build.ninja.in
@@ -7,12 +7,18 @@
 #
 #     bootstrap [from Go package github.com/google/blueprint/bootstrap]
 #
-ninja_required_version = 1.1.0
+ninja_required_version = 1.6.0
+
+g.bootstrap.buildDir = @@BuildDir@@
+
+g.bootstrap.BinDir = ${g.bootstrap.buildDir}/.bootstrap/bin
 
 g.bootstrap.bootstrapCmd = @@Bootstrap@@
 
 g.bootstrap.bootstrapManifest = @@BootstrapManifest@@
 
+g.bootstrap.chooseStageCmd = ${g.bootstrap.buildDir}/.bootstrap/bin/choosestage
+
 g.bootstrap.goRoot = @@GoRoot@@
 
 g.bootstrap.goOS = @@GoOS@@
@@ -25,19 +31,23 @@
 
 g.bootstrap.gcCmd = ${g.bootstrap.goToolDir}/${g.bootstrap.goChar}g
 
-g.bootstrap.goTestMainCmd = .bootstrap/bin/gotestmain
+g.bootstrap.goTestMainCmd = ${g.bootstrap.buildDir}/.bootstrap/bin/gotestmain
 
 g.bootstrap.linkCmd = ${g.bootstrap.goToolDir}/${g.bootstrap.goChar}l
 
 g.bootstrap.srcDir = @@SrcDir@@
 
-builddir = .bootstrap
+builddir = ${g.bootstrap.buildDir}/.minibootstrap
 
 rule g.bootstrap.bootstrap
-    command = ${g.bootstrap.bootstrapCmd} -i ${in}
+    command = ${g.bootstrap.bootstrapCmd} -i ${in} -b ${g.bootstrap.buildDir}
     description = bootstrap ${in}
     generator = true
 
+rule g.bootstrap.chooseStage
+    command = ${g.bootstrap.chooseStageCmd} --current ${current} --bootstrap ${g.bootstrap.bootstrapManifest} -o ${out} ${in}
+    description = choosing next stage
+
 rule g.bootstrap.cp
     command = cp ${in} ${out}
     description = cp ${out}
@@ -59,159 +69,15 @@
     description = test ${pkg}
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  androidbp
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/soong/Android.bp:208:1
-
-build .bootstrap/androidbp/test/androidbp.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/androidbp.go $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/soong.go $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/module.go $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/androidbp_test.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg
-    pkgPath = androidbp
-default .bootstrap/androidbp/test/androidbp.a
-
-build .bootstrap/androidbp/test/test.go: g.bootstrap.gotestmain $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/androidbp_test.go | $
-        ${g.bootstrap.goTestMainCmd}
-    pkg = androidbp
-default .bootstrap/androidbp/test/test.go
-
-build .bootstrap/androidbp/test/test.a: g.bootstrap.gc $
-        .bootstrap/androidbp/test/test.go | $
-        .bootstrap/androidbp/test/androidbp.a
-    incFlags = -I .bootstrap/androidbp/test
-    pkgPath = main
-default .bootstrap/androidbp/test/test.a
-
-build .bootstrap/androidbp/test/test: g.bootstrap.link $
-        .bootstrap/androidbp/test/test.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/androidbp/test -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg
-default .bootstrap/androidbp/test/test
-
-build .bootstrap/androidbp/test/test.passed: g.bootstrap.test $
-        .bootstrap/androidbp/test/test
-    pkg = androidbp
-    pkgSrcDir = ${g.bootstrap.srcDir}/build/soong/androidbp/cmd
-default .bootstrap/androidbp/test/test.passed
-
-build .bootstrap/androidbp/obj/androidbp.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/androidbp.go $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/soong.go $
-        ${g.bootstrap.srcDir}/build/soong/androidbp/cmd/module.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a || $
-        .bootstrap/androidbp/test/test.passed
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg
-    pkgPath = androidbp
-default .bootstrap/androidbp/obj/androidbp.a
-
-build .bootstrap/androidbp/obj/a.out: g.bootstrap.link $
-        .bootstrap/androidbp/obj/androidbp.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg
-default .bootstrap/androidbp/obj/a.out
-
-build .bootstrap/bin/androidbp: g.bootstrap.cp .bootstrap/androidbp/obj/a.out
-default .bootstrap/bin/androidbp
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  androidmk
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/soong/Android.bp:181:1
-
-build .bootstrap/androidmk/obj/androidmk.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/cmd/androidmk/android.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/cmd/androidmk/androidmk.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/cmd/androidmk/values.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/androidmk-parser/pkg/android/soong/androidmk/parser.a $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a
-    incFlags = -I .bootstrap/androidmk-parser/pkg -I .bootstrap/blueprint-parser/pkg
-    pkgPath = androidmk
-default .bootstrap/androidmk/obj/androidmk.a
-
-build .bootstrap/androidmk/obj/a.out: g.bootstrap.link $
-        .bootstrap/androidmk/obj/androidmk.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/androidmk-parser/pkg -L .bootstrap/blueprint-parser/pkg
-default .bootstrap/androidmk/obj/a.out
-
-build .bootstrap/bin/androidmk: g.bootstrap.cp .bootstrap/androidmk/obj/a.out
-default .bootstrap/bin/androidmk
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  androidmk-parser
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:194:1
-
-build .bootstrap/androidmk-parser/test/android/soong/androidmk/parser.a: $
-        g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/make_strings.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/makething.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/parser.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/scope.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/make_strings_test.go $
-        | ${g.bootstrap.gcCmd}
-    pkgPath = android/soong/androidmk/parser
-default .bootstrap/androidmk-parser/test/android/soong/androidmk/parser.a
-
-build .bootstrap/androidmk-parser/test/test.go: g.bootstrap.gotestmain $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/make_strings_test.go $
-        | ${g.bootstrap.goTestMainCmd}
-    pkg = android/soong/androidmk/parser
-default .bootstrap/androidmk-parser/test/test.go
-
-build .bootstrap/androidmk-parser/test/test.a: g.bootstrap.gc $
-        .bootstrap/androidmk-parser/test/test.go | $
-        .bootstrap/androidmk-parser/test/android/soong/androidmk/parser.a
-    incFlags = -I .bootstrap/androidmk-parser/test
-    pkgPath = main
-default .bootstrap/androidmk-parser/test/test.a
-
-build .bootstrap/androidmk-parser/test/test: g.bootstrap.link $
-        .bootstrap/androidmk-parser/test/test.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/androidmk-parser/test
-default .bootstrap/androidmk-parser/test/test
-
-build .bootstrap/androidmk-parser/test/test.passed: g.bootstrap.test $
-        .bootstrap/androidmk-parser/test/test
-    pkg = android/soong/androidmk/parser
-    pkgSrcDir = ${g.bootstrap.srcDir}/build/soong/androidmk/parser
-default .bootstrap/androidmk-parser/test/test.passed
-
-build .bootstrap/androidmk-parser/pkg/android/soong/androidmk/parser.a: $
-        g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/make_strings.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/makething.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/parser.go $
-        ${g.bootstrap.srcDir}/build/soong/androidmk/parser/scope.go | $
-        ${g.bootstrap.gcCmd} || .bootstrap/androidmk-parser/test/test.passed
-    pkgPath = android/soong/androidmk/parser
-default .bootstrap/androidmk-parser/pkg/android/soong/androidmk/parser.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint
 # Variant:
 # Type:    bootstrap_go_package
 # Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: build/blueprint/Blueprints:1:1
 
-build .bootstrap/blueprint/test/github.com/google/blueprint.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/blueprint/context.go $
+build $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a $
+        : g.bootstrap.gc ${g.bootstrap.srcDir}/build/blueprint/context.go $
         ${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $
         ${g.bootstrap.srcDir}/build/blueprint/mangle.go $
         ${g.bootstrap.srcDir}/build/blueprint/module_ctx.go $
@@ -228,14 +94,16 @@
         ${g.bootstrap.srcDir}/build/blueprint/splice_modules_test.go $
         ${g.bootstrap.srcDir}/build/blueprint/unpack_test.go | $
         ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg
     pkgPath = github.com/google/blueprint
-default .bootstrap/blueprint/test/github.com/google/blueprint.a
+default $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a
 
-build .bootstrap/blueprint/test/test.go: g.bootstrap.gotestmain $
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.go: $
+        g.bootstrap.gotestmain $
         ${g.bootstrap.srcDir}/build/blueprint/context_test.go $
         ${g.bootstrap.srcDir}/build/blueprint/ninja_strings_test.go $
         ${g.bootstrap.srcDir}/build/blueprint/ninja_writer_test.go $
@@ -243,28 +111,31 @@
         ${g.bootstrap.srcDir}/build/blueprint/unpack_test.go | $
         ${g.bootstrap.goTestMainCmd}
     pkg = github.com/google/blueprint
-default .bootstrap/blueprint/test/test.go
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.go
 
-build .bootstrap/blueprint/test/test.a: g.bootstrap.gc $
-        .bootstrap/blueprint/test/test.go | $
-        .bootstrap/blueprint/test/github.com/google/blueprint.a
-    incFlags = -I .bootstrap/blueprint/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.a: g.bootstrap.gc $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.go | $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint/test
     pkgPath = main
-default .bootstrap/blueprint/test/test.a
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.a
 
-build .bootstrap/blueprint/test/test: g.bootstrap.link $
-        .bootstrap/blueprint/test/test.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint/test -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-proptools/pkg
-default .bootstrap/blueprint/test/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test: g.bootstrap.link $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.a | $
+        ${g.bootstrap.linkCmd}
+    libDirFlags = -L ${g.bootstrap.buildDir}/.bootstrap/blueprint/test -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test
 
-build .bootstrap/blueprint/test/test.passed: g.bootstrap.test $
-        .bootstrap/blueprint/test/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.passed: $
+        g.bootstrap.test $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test
     pkg = github.com/google/blueprint
     pkgSrcDir = ${g.bootstrap.srcDir}/build/blueprint
-default .bootstrap/blueprint/test/test.passed
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.passed
 
-build .bootstrap/blueprint/pkg/github.com/google/blueprint.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/blueprint/context.go $
+build $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a $
+        : g.bootstrap.gc ${g.bootstrap.srcDir}/build/blueprint/context.go $
         ${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $
         ${g.bootstrap.srcDir}/build/blueprint/mangle.go $
         ${g.bootstrap.srcDir}/build/blueprint/module_ctx.go $
@@ -275,13 +146,14 @@
         ${g.bootstrap.srcDir}/build/blueprint/scope.go $
         ${g.bootstrap.srcDir}/build/blueprint/singleton_ctx.go $
         ${g.bootstrap.srcDir}/build/blueprint/unpack.go | ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        || .bootstrap/blueprint/test/test.passed
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
+        || ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.passed
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg
     pkgPath = github.com/google/blueprint
-default .bootstrap/blueprint/pkg/github.com/google/blueprint.a
+default $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint-bootstrap
@@ -291,7 +163,7 @@
 # Defined: build/blueprint/Blueprints:70:1
 
 build $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
         : g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/bootstrap/bootstrap.go $
         ${g.bootstrap.srcDir}/build/blueprint/bootstrap/cleanup.go $
@@ -300,16 +172,16 @@
         ${g.bootstrap.srcDir}/build/blueprint/bootstrap/doc.go $
         ${g.bootstrap.srcDir}/build/blueprint/bootstrap/writedocs.go | $
         ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg
     pkgPath = github.com/google/blueprint/bootstrap
 default $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint-bootstrap-bpdoc
@@ -319,18 +191,18 @@
 # Defined: build/blueprint/Blueprints:89:1
 
 build $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
         : g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/bootstrap/bpdoc/bpdoc.go | $
         ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg
     pkgPath = github.com/google/blueprint/bootstrap/bpdoc
 default $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint-deptools
@@ -339,13 +211,14 @@
 # Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: build/blueprint/Blueprints:46:1
 
-build .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
+build $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
         : g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/deptools/depfile.go | $
         ${g.bootstrap.gcCmd}
     pkgPath = github.com/google/blueprint/deptools
 default $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint-parser
@@ -354,8 +227,10 @@
 # Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: build/blueprint/Blueprints:31:1
 
-build .bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a: $
-        g.bootstrap.gc ${g.bootstrap.srcDir}/build/blueprint/parser/modify.go $
+build $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a $
+        : g.bootstrap.gc $
+        ${g.bootstrap.srcDir}/build/blueprint/parser/modify.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/parser.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/printer.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/sort.go $
@@ -363,41 +238,51 @@
         ${g.bootstrap.srcDir}/build/blueprint/parser/printer_test.go | $
         ${g.bootstrap.gcCmd}
     pkgPath = github.com/google/blueprint/parser
-default .bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a
+default $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a
 
-build .bootstrap/blueprint-parser/test/test.go: g.bootstrap.gotestmain $
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.go: $
+        g.bootstrap.gotestmain $
         ${g.bootstrap.srcDir}/build/blueprint/parser/parser_test.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/printer_test.go | $
         ${g.bootstrap.goTestMainCmd}
     pkg = github.com/google/blueprint/parser
-default .bootstrap/blueprint-parser/test/test.go
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.go
 
-build .bootstrap/blueprint-parser/test/test.a: g.bootstrap.gc $
-        .bootstrap/blueprint-parser/test/test.go | $
-        .bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a
-    incFlags = -I .bootstrap/blueprint-parser/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.a: $
+        g.bootstrap.gc $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.go | $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test
     pkgPath = main
-default .bootstrap/blueprint-parser/test/test.a
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.a
 
-build .bootstrap/blueprint-parser/test/test: g.bootstrap.link $
-        .bootstrap/blueprint-parser/test/test.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-parser/test
-default .bootstrap/blueprint-parser/test/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test: $
+        g.bootstrap.link $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.a | $
+        ${g.bootstrap.linkCmd}
+    libDirFlags = -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test
 
-build .bootstrap/blueprint-parser/test/test.passed: g.bootstrap.test $
-        .bootstrap/blueprint-parser/test/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.passed: $
+        g.bootstrap.test $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test
     pkg = github.com/google/blueprint/parser
     pkgSrcDir = ${g.bootstrap.srcDir}/build/blueprint/parser
-default .bootstrap/blueprint-parser/test/test.passed
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.passed
 
-build .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a: $
-        g.bootstrap.gc ${g.bootstrap.srcDir}/build/blueprint/parser/modify.go $
+build $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
+        : g.bootstrap.gc $
+        ${g.bootstrap.srcDir}/build/blueprint/parser/modify.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/parser.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/printer.go $
         ${g.bootstrap.srcDir}/build/blueprint/parser/sort.go | $
-        ${g.bootstrap.gcCmd} || .bootstrap/blueprint-parser/test/test.passed
+        ${g.bootstrap.gcCmd} || $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/test.passed
     pkgPath = github.com/google/blueprint/parser
-default .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a
+default $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint-pathtools
@@ -407,7 +292,7 @@
 # Defined: build/blueprint/Blueprints:52:1
 
 build $
-        .bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a $
         : g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/pathtools/lists.go $
         ${g.bootstrap.srcDir}/build/blueprint/pathtools/glob.go $
@@ -415,42 +300,48 @@
         ${g.bootstrap.gcCmd}
     pkgPath = github.com/google/blueprint/pathtools
 default $
-        .bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a
 
-build .bootstrap/blueprint-pathtools/test/test.go: g.bootstrap.gotestmain $
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.go: $
+        g.bootstrap.gotestmain $
         ${g.bootstrap.srcDir}/build/blueprint/pathtools/glob_test.go | $
         ${g.bootstrap.goTestMainCmd}
     pkg = github.com/google/blueprint/pathtools
-default .bootstrap/blueprint-pathtools/test/test.go
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.go
 
-build .bootstrap/blueprint-pathtools/test/test.a: g.bootstrap.gc $
-        .bootstrap/blueprint-pathtools/test/test.go | $
-        .bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a
-    incFlags = -I .bootstrap/blueprint-pathtools/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.a: $
+        g.bootstrap.gc $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.go | $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test
     pkgPath = main
-default .bootstrap/blueprint-pathtools/test/test.a
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.a
 
-build .bootstrap/blueprint-pathtools/test/test: g.bootstrap.link $
-        .bootstrap/blueprint-pathtools/test/test.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-pathtools/test
-default .bootstrap/blueprint-pathtools/test/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test: $
+        g.bootstrap.link $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.a | $
+        ${g.bootstrap.linkCmd}
+    libDirFlags = -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test
+default ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test
 
-build .bootstrap/blueprint-pathtools/test/test.passed: g.bootstrap.test $
-        .bootstrap/blueprint-pathtools/test/test
+build ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.passed: $
+        g.bootstrap.test $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test
     pkg = github.com/google/blueprint/pathtools
     pkgSrcDir = ${g.bootstrap.srcDir}/build/blueprint/pathtools
-default .bootstrap/blueprint-pathtools/test/test.passed
+default $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.passed
 
 build $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
         : g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/pathtools/lists.go $
         ${g.bootstrap.srcDir}/build/blueprint/pathtools/glob.go | $
         ${g.bootstrap.gcCmd} || $
-        .bootstrap/blueprint-pathtools/test/test.passed
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/test.passed
     pkgPath = github.com/google/blueprint/pathtools
 default $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  blueprint-proptools
@@ -460,499 +351,140 @@
 # Defined: build/blueprint/Blueprints:64:1
 
 build $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
         : g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/proptools/proptools.go | $
         ${g.bootstrap.gcCmd}
     pkgPath = github.com/google/blueprint/proptools
 default $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  bpfmt
+# Module:  choosestage
 # Variant:
-# Type:    bootstrap_go_binary
+# Type:    bootstrap_core_go_binary
 # Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/blueprint/Blueprints:110:1
+# Defined: build/blueprint/Blueprints:127:1
 
-build .bootstrap/bpfmt/obj/bpfmt.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/blueprint/bpfmt/bpfmt.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg
-    pkgPath = bpfmt
-default .bootstrap/bpfmt/obj/bpfmt.a
+build ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/choosestage.a: $
+        g.bootstrap.gc $
+        ${g.bootstrap.srcDir}/build/blueprint/choosestage/choosestage.go | $
+        ${g.bootstrap.gcCmd}
+    pkgPath = choosestage
+default ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/choosestage.a
 
-build .bootstrap/bpfmt/obj/a.out: g.bootstrap.link $
-        .bootstrap/bpfmt/obj/bpfmt.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-parser/pkg
-default .bootstrap/bpfmt/obj/a.out
-
-build .bootstrap/bin/bpfmt: g.bootstrap.cp .bootstrap/bpfmt/obj/a.out
-default .bootstrap/bin/bpfmt
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  bpmodify
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/blueprint/Blueprints:116:1
-
-build .bootstrap/bpmodify/obj/bpmodify.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/blueprint/bpmodify/bpmodify.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg
-    pkgPath = bpmodify
-default .bootstrap/bpmodify/obj/bpmodify.a
-
-build .bootstrap/bpmodify/obj/a.out: g.bootstrap.link $
-        .bootstrap/bpmodify/obj/bpmodify.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-parser/pkg
-default .bootstrap/bpmodify/obj/a.out
-
-build .bootstrap/bin/bpmodify: g.bootstrap.cp .bootstrap/bpmodify/obj/a.out
-default .bootstrap/bin/bpmodify
+build ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/a.out: $
+        g.bootstrap.link $
+        ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/choosestage.a | $
+        ${g.bootstrap.linkCmd}
+default ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/a.out
+build ${g.bootstrap.BinDir}/choosestage: g.bootstrap.cp $
+        ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/a.out
+default ${g.bootstrap.BinDir}/choosestage
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  gotestmain
 # Variant:
-# Type:    bootstrap_go_binary
+# Type:    bootstrap_core_go_binary
 # Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:122:1
 
-build .bootstrap/gotestmain/obj/gotestmain.a: g.bootstrap.gc $
+build ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/gotestmain.a: $
+        g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/gotestmain/gotestmain.go | $
         ${g.bootstrap.gcCmd}
     pkgPath = gotestmain
-default .bootstrap/gotestmain/obj/gotestmain.a
+default ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/gotestmain.a
 
-build .bootstrap/gotestmain/obj/a.out: g.bootstrap.link $
-        .bootstrap/gotestmain/obj/gotestmain.a | ${g.bootstrap.linkCmd}
-default .bootstrap/gotestmain/obj/a.out
-build .bootstrap/bin/gotestmain: g.bootstrap.cp $
-        .bootstrap/gotestmain/obj/a.out
-default .bootstrap/bin/gotestmain
+build ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/a.out: $
+        g.bootstrap.link $
+        ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/gotestmain.a | $
+        ${g.bootstrap.linkCmd}
+default ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/a.out
+build ${g.bootstrap.BinDir}/gotestmain: g.bootstrap.cp $
+        ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/a.out
+default ${g.bootstrap.BinDir}/gotestmain
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Module:  minibp
 # Variant:
-# Type:    bootstrap_go_binary
+# Type:    bootstrap_core_go_binary
 # Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:101:1
 
-build .bootstrap/minibp/obj/minibp.a: g.bootstrap.gc $
+build ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/minibp.a: g.bootstrap.gc $
         ${g.bootstrap.srcDir}/build/blueprint/bootstrap/minibp/main.go | $
         ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a
+    incFlags = -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg -I ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap/pkg
     pkgPath = minibp
-default .bootstrap/minibp/obj/minibp.a
+default ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/minibp.a
 
-build .bootstrap/minibp/obj/a.out: g.bootstrap.link $
-        .bootstrap/minibp/obj/minibp.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg -L .bootstrap/blueprint-deptools/pkg -L .bootstrap/blueprint-bootstrap-bpdoc/pkg -L .bootstrap/blueprint-bootstrap/pkg
-default .bootstrap/minibp/obj/a.out
+build ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/a.out: g.bootstrap.link $
+        ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/minibp.a | $
+        ${g.bootstrap.linkCmd}
+    libDirFlags = -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-proptools/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap-bpdoc/pkg -L ${g.bootstrap.buildDir}/.bootstrap/blueprint-bootstrap/pkg
+default ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/a.out
 
-build .bootstrap/bin/minibp: g.bootstrap.cp .bootstrap/minibp/obj/a.out
-default .bootstrap/bin/minibp
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:73:1
-
-build .bootstrap/soong/pkg/android/soong.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/doc.go $
-        ${g.bootstrap.srcDir}/build/soong/register.go | ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg
-    pkgPath = android/soong
-default .bootstrap/soong/pkg/android/soong.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-art
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: art/build/Android.bp:13:1
-
-build .bootstrap/soong-art/pkg/android/soong/art.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/art/build/art.go | ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a $
-        .bootstrap/soong-common/pkg/android/soong/common.a $
-        .bootstrap/soong-genrule/pkg/android/soong/genrule.a $
-        .bootstrap/soong-cc/pkg/android/soong/cc.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/soong/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg -I .bootstrap/soong-cc/pkg
-    pkgPath = android/soong/art
-default .bootstrap/soong-art/pkg/android/soong/art.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-cc
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:107:1
-
-build .bootstrap/soong-cc/test/android/soong/cc.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/cc/builder.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/cc.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/clang.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/gen.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/toolchain.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/util.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/arm_device.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/arm64_device.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/x86_darwin_host.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/x86_linux_host.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/cc_test.go | ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a $
-        .bootstrap/soong-common/pkg/android/soong/common.a $
-        .bootstrap/soong-genrule/pkg/android/soong/genrule.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/soong/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg
-    pkgPath = android/soong/cc
-default .bootstrap/soong-cc/test/android/soong/cc.a
-
-build .bootstrap/soong-cc/test/test.go: g.bootstrap.gotestmain $
-        ${g.bootstrap.srcDir}/build/soong/cc/cc_test.go | $
-        ${g.bootstrap.goTestMainCmd}
-    pkg = android/soong/cc
-default .bootstrap/soong-cc/test/test.go
-
-build .bootstrap/soong-cc/test/test.a: g.bootstrap.gc $
-        .bootstrap/soong-cc/test/test.go | $
-        .bootstrap/soong-cc/test/android/soong/cc.a
-    incFlags = -I .bootstrap/soong-cc/test
-    pkgPath = main
-default .bootstrap/soong-cc/test/test.a
-
-build .bootstrap/soong-cc/test/test: g.bootstrap.link $
-        .bootstrap/soong-cc/test/test.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/soong-cc/test -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg -L .bootstrap/soong/pkg -L .bootstrap/blueprint-deptools/pkg -L .bootstrap/blueprint-bootstrap-bpdoc/pkg -L .bootstrap/blueprint-bootstrap/pkg -L .bootstrap/soong-env/pkg -L .bootstrap/soong-glob/pkg -L .bootstrap/soong-common/pkg -L .bootstrap/soong-genrule/pkg
-default .bootstrap/soong-cc/test/test
-
-build .bootstrap/soong-cc/test/test.passed: g.bootstrap.test $
-        .bootstrap/soong-cc/test/test
-    pkg = android/soong/cc
-    pkgSrcDir = ${g.bootstrap.srcDir}/build/soong/cc
-default .bootstrap/soong-cc/test/test.passed
-
-build .bootstrap/soong-cc/pkg/android/soong/cc.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/cc/builder.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/cc.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/clang.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/gen.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/toolchain.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/util.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/arm_device.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/arm64_device.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/x86_darwin_host.go $
-        ${g.bootstrap.srcDir}/build/soong/cc/x86_linux_host.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a $
-        .bootstrap/soong-common/pkg/android/soong/common.a $
-        .bootstrap/soong-genrule/pkg/android/soong/genrule.a || $
-        .bootstrap/soong-cc/test/test.passed
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/soong/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg
-    pkgPath = android/soong/cc
-default .bootstrap/soong-cc/pkg/android/soong/cc.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-common
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:85:1
-
-build .bootstrap/soong-common/pkg/android/soong/common.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/common/arch.go $
-        ${g.bootstrap.srcDir}/build/soong/common/config.go $
-        ${g.bootstrap.srcDir}/build/soong/common/defs.go $
-        ${g.bootstrap.srcDir}/build/soong/common/env.go $
-        ${g.bootstrap.srcDir}/build/soong/common/glob.go $
-        ${g.bootstrap.srcDir}/build/soong/common/module.go $
-        ${g.bootstrap.srcDir}/build/soong/common/paths.go $
-        ${g.bootstrap.srcDir}/build/soong/common/util.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg
-    pkgPath = android/soong/common
-default .bootstrap/soong-common/pkg/android/soong/common.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-env
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:42:1
-
-build .bootstrap/soong-env/pkg/android/soong/env.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/env/env.go | ${g.bootstrap.gcCmd}
-    pkgPath = android/soong/env
-default .bootstrap/soong-env/pkg/android/soong/env.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-genrule
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:136:1
-
-build .bootstrap/soong-genrule/pkg/android/soong/genrule.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/genrule/genrule.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a $
-        .bootstrap/soong-common/pkg/android/soong/common.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/soong/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg
-    pkgPath = android/soong/genrule
-default .bootstrap/soong-genrule/pkg/android/soong/genrule.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-glob
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:61:1
-
-build .bootstrap/soong-glob/pkg/android/soong/glob.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/glob/glob.go | ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a
-    incFlags = -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-pathtools/pkg
-    pkgPath = android/soong/glob
-default .bootstrap/soong-glob/pkg/android/soong/glob.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong-java
-# Variant:
-# Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
-# Defined: build/soong/Android.bp:157:1
-
-build .bootstrap/soong-java/pkg/android/soong/java.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/java/app_builder.go $
-        ${g.bootstrap.srcDir}/build/soong/java/app.go $
-        ${g.bootstrap.srcDir}/build/soong/java/builder.go $
-        ${g.bootstrap.srcDir}/build/soong/java/gen.go $
-        ${g.bootstrap.srcDir}/build/soong/java/java.go $
-        ${g.bootstrap.srcDir}/build/soong/java/resources.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a $
-        .bootstrap/soong-common/pkg/android/soong/common.a $
-        .bootstrap/soong-genrule/pkg/android/soong/genrule.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/soong/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg
-    pkgPath = android/soong/java
-default .bootstrap/soong-java/pkg/android/soong/java.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong_build
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/soong/Android.bp:13:1
-
-build .bootstrap/soong_build/obj/soong_build.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/cmd/soong_build/main.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
-        .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-bootstrap-bpdoc/pkg/github.com/google/blueprint/bootstrap/bpdoc.a $
-        .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
-        .bootstrap/soong/pkg/android/soong.a $
-        .bootstrap/soong-env/pkg/android/soong/env.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a $
-        .bootstrap/soong-common/pkg/android/soong/common.a $
-        .bootstrap/soong-genrule/pkg/android/soong/genrule.a $
-        .bootstrap/soong-cc/pkg/android/soong/cc.a $
-        .bootstrap/soong-art/pkg/android/soong/art.a $
-        .bootstrap/soong-java/pkg/android/soong/java.a
-    incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap-bpdoc/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg -I .bootstrap/soong-cc/pkg -I .bootstrap/soong-art/pkg -I .bootstrap/soong-java/pkg
-    pkgPath = soong_build
-default .bootstrap/soong_build/obj/soong_build.a
-
-build .bootstrap/soong_build/obj/a.out: g.bootstrap.link $
-        .bootstrap/soong_build/obj/soong_build.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg -L .bootstrap/blueprint-deptools/pkg -L .bootstrap/blueprint-bootstrap-bpdoc/pkg -L .bootstrap/blueprint-bootstrap/pkg -L .bootstrap/soong/pkg -L .bootstrap/soong-env/pkg -L .bootstrap/soong-glob/pkg -L .bootstrap/soong-common/pkg -L .bootstrap/soong-genrule/pkg -L .bootstrap/soong-cc/pkg -L .bootstrap/soong-art/pkg -L .bootstrap/soong-java/pkg
-default .bootstrap/soong_build/obj/a.out
-
-build .bootstrap/bin/soong_build: g.bootstrap.cp $
-        .bootstrap/soong_build/obj/a.out
-default .bootstrap/bin/soong_build
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong_env
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/soong/Android.bp:32:1
-
-build .bootstrap/soong_env/obj/soong_env.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/cmd/soong_env/soong_env.go | $
-        ${g.bootstrap.gcCmd} .bootstrap/soong-env/pkg/android/soong/env.a
-    incFlags = -I .bootstrap/soong-env/pkg
-    pkgPath = soong_env
-default .bootstrap/soong_env/obj/soong_env.a
-
-build .bootstrap/soong_env/obj/a.out: g.bootstrap.link $
-        .bootstrap/soong_env/obj/soong_env.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/soong-env/pkg
-default .bootstrap/soong_env/obj/a.out
-
-build .bootstrap/bin/soong_env: g.bootstrap.cp .bootstrap/soong_env/obj/a.out
-default .bootstrap/bin/soong_env
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong_glob
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/soong/Android.bp:51:1
-
-build .bootstrap/soong_glob/obj/soong_glob.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/cmd/soong_glob/soong_glob.go | $
-        ${g.bootstrap.gcCmd} $
-        .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
-        .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
-        .bootstrap/soong-glob/pkg/android/soong/glob.a
-    incFlags = -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/soong-glob/pkg
-    pkgPath = soong_glob
-default .bootstrap/soong_glob/obj/soong_glob.a
-
-build .bootstrap/soong_glob/obj/a.out: g.bootstrap.link $
-        .bootstrap/soong_glob/obj/soong_glob.a | ${g.bootstrap.linkCmd}
-    libDirFlags = -L .bootstrap/blueprint-deptools/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/soong-glob/pkg
-default .bootstrap/soong_glob/obj/a.out
-
-build .bootstrap/bin/soong_glob: g.bootstrap.cp $
-        .bootstrap/soong_glob/obj/a.out
-default .bootstrap/bin/soong_glob
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module:  soong_jar
-# Variant:
-# Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
-# Defined: build/soong/Android.bp:150:1
-
-build .bootstrap/soong_jar/obj/soong_jar.a: g.bootstrap.gc $
-        ${g.bootstrap.srcDir}/build/soong/cmd/soong_jar/soong_jar.go | $
-        ${g.bootstrap.gcCmd}
-    pkgPath = soong_jar
-default .bootstrap/soong_jar/obj/soong_jar.a
-
-build .bootstrap/soong_jar/obj/a.out: g.bootstrap.link $
-        .bootstrap/soong_jar/obj/soong_jar.a | ${g.bootstrap.linkCmd}
-default .bootstrap/soong_jar/obj/a.out
-build .bootstrap/bin/soong_jar: g.bootstrap.cp .bootstrap/soong_jar/obj/a.out
-default .bootstrap/bin/soong_jar
+build ${g.bootstrap.BinDir}/minibp: g.bootstrap.cp $
+        ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/a.out
+default ${g.bootstrap.BinDir}/minibp
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Singleton: bootstrap
 # Factory:   github.com/google/blueprint/bootstrap.func·008
 
-rule s.bootstrap.bigbpDocs
-    command = .bootstrap/bin/soong_build  -t --docs ${out} ${g.bootstrap.srcDir}/Android.bp
-    description = soong_build docs ${out}
-
-rule s.bootstrap.bigbp
-    command = .bootstrap/bin/soong_build  -t -d .bootstrap/main.ninja.in.d -m ${g.bootstrap.bootstrapManifest} -o ${out} ${in}
-    depfile = .bootstrap/main.ninja.in.d
-    description = soong_build ${out}
+rule s.bootstrap.primarybp
+    command = ${g.bootstrap.BinDir}/minibp --build-primary ${runTests} -m ${g.bootstrap.bootstrapManifest} --timestamp ${timestamp} --timestampdep ${timestampdep} -b ${g.bootstrap.buildDir} -d ${outfile}.d -o ${outfile} ${in}
+    depfile = ${outfile}.d
+    description = minibp ${outfile}
 
 rule s.bootstrap.minibp
-    command = .bootstrap/bin/minibp ${runTests} -c ${checkFile} -m ${g.bootstrap.bootstrapManifest} -d ${out}.d -o ${out} ${in}
+    command = ${g.bootstrap.BinDir}/minibp ${runTests} -m ${g.bootstrap.bootstrapManifest} -b ${g.bootstrap.buildDir} -d ${out}.d -o ${out} ${in}
     depfile = ${out}.d
     description = minibp ${out}
     generator = true
 
-build .bootstrap/docs/soong_build.html: s.bootstrap.bigbpDocs | $
-        .bootstrap/bin/soong_build
-default .bootstrap/docs/soong_build.html
-build .bootstrap/main.ninja.in: s.bootstrap.bigbp $
-        ${g.bootstrap.srcDir}/Android.bp | .bootstrap/bin/androidbp $
-        .bootstrap/bin/androidmk .bootstrap/bin/bpfmt .bootstrap/bin/bpmodify $
-        .bootstrap/bin/gotestmain .bootstrap/bin/minibp $
-        .bootstrap/bin/soong_build .bootstrap/bin/soong_env $
-        .bootstrap/bin/soong_glob .bootstrap/bin/soong_jar $
-        .bootstrap/docs/soong_build.html
-default .bootstrap/main.ninja.in
-build .bootstrap/notAFile: phony
-default .bootstrap/notAFile
-build build.ninja: g.bootstrap.bootstrap .bootstrap/main.ninja.in | $
-        ${g.bootstrap.bootstrapCmd} .bootstrap/notAFile $
-        .bootstrap/bootstrap.ninja.in
-default build.ninja
-build .bootstrap/bootstrap.ninja.in: s.bootstrap.minibp $
-        ${g.bootstrap.srcDir}/Android.bp | .bootstrap/bin/minibp
-    checkFile = ${g.bootstrap.bootstrapManifest}
+build ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in $
+        ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in.timestamp: $
+        s.bootstrap.primarybp ${g.bootstrap.srcDir}/Android.bp | $
+        ${g.bootstrap.BinDir}/choosestage ${g.bootstrap.BinDir}/gotestmain $
+        ${g.bootstrap.BinDir}/minibp ${g.bootstrap.srcDir}/Android.bp $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a $
+        ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a
+    outfile = ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in
     runTests = -t
-default .bootstrap/bootstrap.ninja.in
+    timestamp = ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in.timestamp
+    timestampdep = ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in.timestamp.d
+default ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in $
+        ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in.timestamp
+
+build ${g.bootstrap.buildDir}/.bootstrap/bootstrap.ninja.in: $
+        s.bootstrap.minibp ${g.bootstrap.srcDir}/Android.bp | $
+        ${g.bootstrap.bootstrapManifest} ${g.bootstrap.BinDir}/minibp
+    runTests = -t
+default ${g.bootstrap.buildDir}/.bootstrap/bootstrap.ninja.in
+
+build ${g.bootstrap.buildDir}/.bootstrap/notAFile: phony
+default ${g.bootstrap.buildDir}/.bootstrap/notAFile
+build ${g.bootstrap.buildDir}/.bootstrap/build.ninja.in: $
+        g.bootstrap.chooseStage $
+        ${g.bootstrap.buildDir}/.bootstrap/bootstrap.ninja.in $
+        ${g.bootstrap.buildDir}/.bootstrap/primary.ninja.in | $
+        ${g.bootstrap.chooseStageCmd} ${g.bootstrap.bootstrapManifest} $
+        ${g.bootstrap.buildDir}/.bootstrap/notAFile
+    current = ${g.bootstrap.buildDir}/.bootstrap/bootstrap.ninja.in
+default ${g.bootstrap.buildDir}/.bootstrap/build.ninja.in
+
+build ${g.bootstrap.buildDir}/build.ninja: g.bootstrap.bootstrap $
+        ${g.bootstrap.buildDir}/.bootstrap/build.ninja.in | $
+        ${g.bootstrap.bootstrapCmd}
+default ${g.bootstrap.buildDir}/build.ninja
 
diff --git a/common/defs.go b/common/defs.go
index f5b02fe..0001ce1 100644
--- a/common/defs.go
+++ b/common/defs.go
@@ -18,7 +18,7 @@
 	"path/filepath"
 
 	"github.com/google/blueprint"
-	"github.com/google/blueprint/bootstrap"
+	_ "github.com/google/blueprint/bootstrap"
 )
 
 var (
@@ -29,7 +29,7 @@
 
 	srcDir = pctx.VariableConfigMethod("srcDir", Config.SrcDir)
 
-	androidbpCmd = filepath.Join(bootstrap.BinDir, "androidbp")
+	androidbpCmd = filepath.Join("${bootstrap.BinDir}", "androidbp")
 	androidbp    = pctx.StaticRule("androidbp",
 		blueprint.RuleParams{
 			Command:     androidbpCmd + " ${srcDir}/Android.bp $in $out",
@@ -71,3 +71,7 @@
 		},
 		"fromPath")
 )
+
+func init() {
+	pctx.Import("github.com/google/blueprint/bootstrap")
+}
diff --git a/common/glob.go b/common/glob.go
index 5a01cf5..152be94 100644
--- a/common/glob.go
+++ b/common/glob.go
@@ -19,7 +19,6 @@
 	"path/filepath"
 
 	"github.com/google/blueprint"
-	"github.com/google/blueprint/bootstrap"
 
 	"android/soong/glob"
 )
@@ -40,7 +39,7 @@
 // in a build failure with a "missing and no known rule to make it" error.
 
 var (
-	globCmd = filepath.Join(bootstrap.BinDir, "soong_glob")
+	globCmd = filepath.Join("${bootstrap.BinDir}", "soong_glob")
 
 	// globRule rule traverses directories to produce a list of files that match $glob
 	// and writes it to $out if it has changed, and writes the directories to $out.d
diff --git a/java/builder.go b/java/builder.go
index d4b900d..4eda6adf 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -25,7 +25,7 @@
 	"android/soong/common"
 
 	"github.com/google/blueprint"
-	"github.com/google/blueprint/bootstrap"
+	_ "github.com/google/blueprint/bootstrap"
 )
 
 var (
@@ -84,9 +84,10 @@
 )
 
 func init() {
+	pctx.Import("github.com/google/blueprint/bootstrap")
 	pctx.StaticVariable("commonJdkFlags", "-source 1.7 -target 1.7 -Xmaxerrs 9999999")
 	pctx.StaticVariable("javacCmd", "javac -J-Xmx1024M $commonJdkFlags")
-	pctx.StaticVariable("jarCmd", filepath.Join(bootstrap.BinDir, "soong_jar"))
+	pctx.StaticVariable("jarCmd", filepath.Join("${bootstrap.BinDir}", "soong_jar"))
 	pctx.VariableFunc("dxCmd", func(c interface{}) (string, error) {
 		return c.(common.Config).HostBinTool("dx")
 	})