Have all targets in build.ninja

We should pass --gen_all_targets to have targets which are not declared
as .PHONY.  However, this triggers some nasty behavior inherited from
make, where targets can get variables from things that depend on them.
--gen_all_targets will traverse the targets starting at random points in
the dependency tree, and any variables set higher in the tree will not
be visible.  To work around this, keep --gen_all_phony_targets, which
will start traversing at the phony targets first.  This will enter the
tree traversal at points we know don't use inherited variables, like
checkbuild or the PARSE_TIME_MAKE_GOALS, and will reach all the
dependencies that use inherited variables in the right order.
--gen_all_targets will then fill in any remaining targets that were not
in the main dependency tree, and hopefully none of them use any
inherited variables.

Bug: 24384320
Change-Id: I1ff07b7ef26e9481baae678e7fe0933b6d05f2a7
diff --git a/core/ninja.mk b/core/ninja.mk
index 885726b..699712e 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -136,7 +136,7 @@
 .INTERMEDIATE: kati.intermediate
 kati.intermediate: $(KATI) $(MAKEPARALLEL)
 	@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
-	+$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo --use_find_emulator -f build/core/main.mk $(KATI_TARGETS) --gen_all_phony_targets BUILDING_WITH_NINJA=true
+	+$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo --use_find_emulator -f build/core/main.mk $(KATI_TARGETS) --gen_all_phony_targets --gen_all_targets BUILDING_WITH_NINJA=true
 
 KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
 KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)