Fix build rules in tools

Prior to this CL tools/gen_all would fail if the output directory
passed is non-host-only (e.g., android_xxx).

Change-Id: I0f8aa6f4b4c4b566da8959cd637ba9152fca927f
diff --git a/Android.bp b/Android.bp
index 6d78dbe..1d67e6c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -4560,17 +4560,12 @@
     "src/tracing/test/test_shared_memory.cc",
     "src/tracing/test/tracing_integration_test.cc",
     "src/tracing/trace_writer_base.cc",
-    "tools/ftrace_proto_gen/ftrace_descriptor_gen.cc",
-    "tools/ftrace_proto_gen/ftrace_proto_gen.cc",
-    "tools/ftrace_proto_gen/ftrace_proto_gen_unittest.cc",
-    "tools/ftrace_proto_gen/proto_gen_utils.cc",
     "tools/sanitizers_unittests/sanitizers_unittest.cc",
   ],
   shared_libs: [
     "libbase",
     "liblog",
     "libprocinfo",
-    "libprotobuf-cpp-full",
     "libprotobuf-cpp-lite",
     "libunwindstack",
     "libz",
diff --git a/gn/perfetto.gni b/gn/perfetto.gni
index 4bf6252..78aa3a6 100644
--- a/gn/perfetto.gni
+++ b/gn/perfetto.gni
@@ -161,8 +161,7 @@
 
   # Misc host executable under tools/.
   enable_perfetto_tools =
-      (perfetto_build_standalone && current_toolchain == host_toolchain) ||
-      perfetto_build_with_android
+      perfetto_build_standalone || perfetto_build_with_android
 
   # Allows to build the UI (TypeScript/ HTML / WASM)
   enable_perfetto_ui = perfetto_build_standalone
diff --git a/gn/perfetto_unittests.gni b/gn/perfetto_unittests.gni
index e7c5a44..361b83c 100644
--- a/gn/perfetto_unittests.gni
+++ b/gn/perfetto_unittests.gni
@@ -22,13 +22,15 @@
   "src/tracing:unittests",
 ]
 
-if (enable_perfetto_tools) {
-  perfetto_unittests_targets += [
-    "tools/ftrace_proto_gen:unittests",
-    "tools/sanitizers_unittests",
-  ]
+if (enable_perfetto_tools && current_toolchain == host_toolchain) {
+  perfetto_unittests_targets += [ "tools/ftrace_proto_gen:unittests" ]
 }
 
+# TODO(primiano): sanitizers_unittests shouldn't really be under tools. It's
+# not a tool and it's intended to run on both host and targets to check that
+# sanitizers are actually working.
+perfetto_unittests_targets += [ "tools/sanitizers_unittests" ]
+
 if (enable_perfetto_ipc) {
   perfetto_unittests_targets += [ "src/ipc:unittests" ]
 }
diff --git a/tools/gen_all b/tools/gen_all
index 329a64d..96f972d 100755
--- a/tools/gen_all
+++ b/tools/gen_all
@@ -49,6 +49,7 @@
     call('gen_bazel')
     call('gen_android_bp')
     call('gen_merged_protos')
+    call('ninja', '-C', out, 'protoc')
     call('gen_binary_descriptors', '--protoc', protoc_path(out))
     call('gen_tracing_cpp_headers_from_protos', out)