martine/ninja — Issue #124: Print "entering directory" message to mimic make and pacify emacs' compilation-mode
Author: fischman
Created: 2011-10-17 23:31:36+00:00
State: open

Since ninja chdir's into the output directory & refers to source files using ../../ prefixes, emacs' compilation-mode (and in particular, next-error) stopped working. I originally solved the problem by having my ninja-wrapping shell-script emit an appropriate line, but this is more principled:

```
diff --git a/src/ninja.cc b/src/ninja.cc
index c70aa43..cb7d2fa 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -449,6 +449,7 @@ int main(int argc, char** argv) {
#endif
Fatal("chdir to '%s' - %s", working_dir, strerror(errno));
}
+ printf("ninja: Entering directory `%s'\n", working_dir);
}

bool rebuilt_manifest = false;
```

(note that wrapping the %s with `' is what make does and what emacs looks for, and that the first character there is a back-quote, not an apostrophe)