[C++] Update ninja file only when necessary

As this feature is incomplete, this is enabled only with
--regen flag.

I decided not to use ninja's "generator" feature because we
cannot create appropriate regeneration rules for globs in
Android. There are some directory names which are also used
as target names (e.g., "cts"). Ninja tries to build such
targets to check if regeneration is necessary.
4 files changed
tree: 87b42d0d55f80241d31e14329ad09d7d6fd000e9
  1. cmd/
  2. make-c/
  3. testcase/
  4. .gitignore
  5. ast.cc
  6. ast.go
  7. ast.h
  8. AUTHORS
  9. bootstrap.go
  10. buf.go
  11. buf_test.go
  12. command.cc
  13. command.h
  14. CONTRIBUTING.md
  15. CONTRIBUTORS
  16. dep.cc
  17. dep.go
  18. dep.h
  19. depgraph.go
  20. doc.go
  21. eval.cc
  22. eval.go
  23. eval.h
  24. evalcmd.go
  25. exec.cc
  26. exec.go
  27. exec.h
  28. expr.go
  29. expr_test.go
  30. file.cc
  31. file.h
  32. file_cache.cc
  33. file_cache.h
  34. fileutil.cc
  35. fileutil.go
  36. fileutil.h
  37. find.cc
  38. find.h
  39. flags.cc
  40. flags.go
  41. flags.h
  42. func.cc
  43. func.go
  44. func.h
  45. func_test.go
  46. LICENSE
  47. loc.h
  48. log.cc
  49. log.go
  50. log.h
  51. m2n
  52. main.cc
  53. make-c.sh
  54. Makefile
  55. Makefile.ckati
  56. Makefile.kati
  57. ninja.cc
  58. ninja.go
  59. ninja.h
  60. ninja_test.cc
  61. ninja_test.go
  62. pack.sh
  63. parser.cc
  64. parser.go
  65. parser.h
  66. pathutil.go
  67. query.go
  68. README.md
  69. rule.cc
  70. rule.h
  71. rule_parser.go
  72. rule_parser_test.go
  73. run_integration_test.rb
  74. runtest.rb
  75. serialize.go
  76. shellutil.go
  77. shellutil_test.go
  78. stats.cc
  79. stats.go
  80. stats.h
  81. string_piece.cc
  82. string_piece.h
  83. string_piece_test.cc
  84. stringprintf.cc
  85. stringprintf.h
  86. strutil.cc
  87. strutil.go
  88. strutil.h
  89. strutil_test.cc
  90. strutil_test.go
  91. symtab.cc
  92. symtab.go
  93. symtab.h
  94. timeutil.cc
  95. timeutil.h
  96. value.cc
  97. value.h
  98. var.cc
  99. var.go
  100. var.h
  101. version.go
  102. version.h
  103. worker.go
README.md

kati

kati is an experimental GNU make clone. The main goal of this tool is to speed-up incremental build of Android.

How to use for Android

Currently, kati does not offer a faster build by itself. It instead converts your Makefile to a ninja file.

Set up kati:

% cd ~/src
% git clone https://github.com/google/kati
% cd kati
% make

Build Android:

% cd <android-directory>
% source build/envsetup.sh
% lunch <your-choice>
% ~/src/kati/m2n --kati_stats  # Use --goma if you are a Googler.
% ./ninja.sh

You need ninja in your $PATH.

More usage examples

“make clean”

% ./ninja.sh -t clean

Note ./ninja.sh passes all parameters to ninja.

Build a specific target

For example, the following is equivalent to “make cts”:

% ./ninja.sh cts

Or, if you know the path you want, you can do:

% ./ninja.sh out/host/linux-x86/bin/adb

Specify the number of default jobs used by ninja

% ~/src/kati/m2n -j10
% ./ninja.sh

Or

% ./ninja.sh -j10

Note the latter kills the parallelism of goma.