[C++] Honor "override" when setting global variable

Regression when compared to GNU make behaviour.

Test case:

 $ cat Makefile.override-failure
 $(info VAR: '$(VAR)')
 override VAR := test
 $(info VAR: '$(VAR)')
 override VAR := test-new
 $(info VAR: '$(VAR)')
 VAR := test-should-not-work
 $(info VAR: '$(VAR)')

 $ make -f Makefile.override-failure
 VAR: ''
 VAR: 'test'
 VAR: 'test-new'
 VAR: 'test-new'
 make: *** No targets.  Stop.

 $ ckati -c --warn -f Makefile.override-failure
 VAR: ''
 VAR: 'test'
 VAR: 'test'
 VAR: 'test'
 *** No targets.

Fixes https://github.com/google/kati/issues/50

Change-Id: I9c4185c30cfcf5602da7e0ac98b7e9c420788005
3 files changed
tree: 021c5e8704caa412e83558a91b1bf8f6cc3a039e
  1. .gitignore
  2. .travis.yml
  3. AUTHORS
  4. Android.bp
  5. CONTRIBUTING.md
  6. CONTRIBUTORS
  7. INTERNALS.md
  8. LICENSE
  9. Makefile
  10. Makefile.ckati
  11. Makefile.kati
  12. README.md
  13. affinity.cc
  14. affinity.h
  15. ast.go
  16. bootstrap.go
  17. buf.go
  18. buf_test.go
  19. cmd/
  20. command.cc
  21. command.h
  22. dep.cc
  23. dep.go
  24. dep.h
  25. depgraph.go
  26. doc.go
  27. eval.cc
  28. eval.go
  29. eval.h
  30. evalcmd.go
  31. exec.cc
  32. exec.go
  33. exec.h
  34. expr.cc
  35. expr.go
  36. expr.h
  37. expr_test.go
  38. file.cc
  39. file.h
  40. file_cache.cc
  41. file_cache.h
  42. fileutil.cc
  43. fileutil.go
  44. fileutil.h
  45. find.cc
  46. find.h
  47. find_test.cc
  48. flags.cc
  49. flags.go
  50. flags.h
  51. func.cc
  52. func.go
  53. func.h
  54. func_test.go
  55. io.cc
  56. io.h
  57. loc.h
  58. log.cc
  59. log.go
  60. log.h
  61. m2n
  62. main.cc
  63. make-c.sh
  64. make-c/
  65. ninja.cc
  66. ninja.go
  67. ninja.h
  68. ninja_test.cc
  69. ninja_test.go
  70. pack.sh
  71. parser.cc
  72. parser.go
  73. parser.h
  74. pathutil.go
  75. pathutil_test.go
  76. query.go
  77. regen.cc
  78. regen.h
  79. rule.cc
  80. rule.h
  81. rule_parser.go
  82. rule_parser_test.go
  83. runtest.rb
  84. serialize.go
  85. shellutil.go
  86. shellutil_test.go
  87. stats.cc
  88. stats.go
  89. stats.h
  90. stmt.cc
  91. stmt.h
  92. string_piece.cc
  93. string_piece.h
  94. string_piece_test.cc
  95. stringprintf.cc
  96. stringprintf.h
  97. strutil.cc
  98. strutil.go
  99. strutil.h
  100. strutil_bench.cc
  101. strutil_test.cc
  102. strutil_test.go
  103. symtab.cc
  104. symtab.go
  105. symtab.h
  106. testcase/
  107. testutil.h
  108. thread_local.h
  109. thread_pool.cc
  110. thread_pool.h
  111. timeutil.cc
  112. timeutil.h
  113. var.cc
  114. var.go
  115. var.h
  116. version.go
  117. version.h
  118. version_unknown.cc
  119. worker.go
README.md

kati

Build Status

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

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

How to use for Android

Now AOSP has kati and ninja, so all you have to do is

% export USE_NINJA=true

All Android's build commands (m, mmm, mmma, etc.) should just work.

How to use for Android (deprecated way)

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 (deprecated way)

“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