tools: Use soong_ui instead of make

Switch to soong_ui to dump make variables, which ensures a consistent
parser for the product makefiles, and may provide other benefits, like
sandboxed executions.

Use soong_ui rather than the legacy make startup wrapper, which just
calls soong_ui. This allows us to automatically set the parallelism if
-j is omitted, so remove the default here and let soong_ui choose an
appropriate value for your machine.

Test: art/tools/golem/build-target.sh --machine-type=android-armv8
Test: art/tools/golem/build-target.sh --machine-type=android-armv8 --golem=art-opt-cc
Change-Id: I39c838b7198658534f6cadc64159f59b3ffdd38c
diff --git a/tools/golem/build-target.sh b/tools/golem/build-target.sh
index 8d8e2bb..4ca2722 100755
--- a/tools/golem/build-target.sh
+++ b/tools/golem/build-target.sh
@@ -147,12 +147,8 @@
   [[ -n $target_product ]] && extras+=" TARGET_PRODUCT=$target_product"
   [[ -n $target_build_variant ]] && extras+=" TARGET_BUILD_VARIANT=$target_build_variant"
 
-  # call dumpvar-$name from the makefile system.
-  (\cd "$(gettop)";
-  CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
-    command make --no-print-directory -f build/core/config.mk \
-    $extras \
-    dumpvar-$varname)
+  # call dumpvar from the build system.
+  (\cd "$(gettop)"; env $extras build/soong/soong_ui.bash --dumpvar-mode $varname)
 }
 
 # Defaults from command-line.
@@ -160,7 +156,7 @@
 mode=""  # blank or 'golem' if --golem was specified.
 golem_target="" # --golem=$golem_target
 config="" # --machine-type=$config
-j_arg="-j8"
+j_arg=""
 showcommands=""
 simulate=""
 make_tarball=""
@@ -353,7 +349,7 @@
 #  and maybe calls lunch).
 #
 
-execute make "${j_arg}" "${make_target}"
+execute build/soong/soong_ui.bash --make-mode "${j_arg}" "${make_target}"
 
 if $strip_symbols; then
   # Further reduce size by stripping symbols.