summaryrefslogtreecommitdiffstats
path: root/src/ninja.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-02-04 05:36:01 (GMT)
committerEvan Martin <martine@danga.com>2011-02-04 05:36:01 (GMT)
commit231206b0b512d8850976fba3f9f16fc7c3872ebc (patch)
tree63288c48e7c13234f11f3dfda36d25eed6dec703 /src/ninja.cc
parente5b4647a0f17a83314f2c8d534b1172d2300acae (diff)
downloadNinja-231206b0b512d8850976fba3f9f16fc7c3872ebc.zip
Ninja-231206b0b512d8850976fba3f9f16fc7c3872ebc.tar.gz
Ninja-231206b0b512d8850976fba3f9f16fc7c3872ebc.tar.bz2
use builddir for log file
Diffstat (limited to 'src/ninja.cc')
-rw-r--r--src/ninja.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index 6e441b6..0547013 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -204,13 +204,16 @@ int main(int argc, char** argv) {
build_log.SetConfig(&config);
state.build_log_ = &build_log;
+ const string build_dir = state.bindings_.LookupVariable("builddir");
const char* kLogPath = ".ninja_log";
- if (!build_log.Load(kLogPath, &err)) {
- fprintf(stderr, "error loading build log: %s\n", err.c_str());
+ string log_path = build_dir.empty() ? kLogPath : build_dir + "/" + kLogPath;
+ if (!build_log.Load(log_path.c_str(), &err)) {
+ fprintf(stderr, "error loading build log %s: %s\n",
+ log_path.c_str(), err.c_str());
return 1;
}
- if (!build_log.OpenForWrite(kLogPath, &err)) {
+ if (!build_log.OpenForWrite(log_path.c_str(), &err)) {
fprintf(stderr, "error opening build log: %s\n", err.c_str());
return 1;
}