build: support target sysroot

This allows two things:

  - We can do a cross-compile with clang 😁
  - We can do a cross-compiler with gcc against a different sysroot

This also fixes up the cross-compilation for gcc as it correctly sets
the `target_*` variables in the target block.

Change-Id: Ic1ff2d5732dc6ef3aded24c87669c7620ab4f0b2
diff --git a/tools/gen_amalgamated b/tools/gen_amalgamated
index 9113a5e..e7892b5 100755
--- a/tools/gen_amalgamated
+++ b/tools/gen_amalgamated
@@ -548,10 +548,10 @@
   if args.check:
     output = os.path.join(tempfile.mkdtemp(), 'perfetto_amalgamated')
 
+  out = gn_utils.prepare_out_directory(args.gn_args, 'tmp.gen_amalgamated')
+  if not args.quiet:
+    print('Building project...')
   try:
-    if not args.quiet:
-      print('Building project...')
-    out = gn_utils.prepare_out_directory(args.gn_args, 'tmp.gen_amalgamated')
     desc = gn_utils.load_build_description(out)
 
     # We need to build everything first so that the necessary header