martine/ninja — pull request #456 by rgeary1 (2012-11-09 13:02:52+00:00)
Title: Add "workingdir" as special global build variable, equivalent to -C

This is used by the Premake ninja generator in https://github.com/rgeary1/premake-dev-rgeary

Similar to the ninjadir variable, the workingdir variable sets the current working directory equivalent to specifying -C on the command line.

This is very useful in the following case. Suppose you have a master build script with all the edges (buildedges.ninja), and many build.ninja scripts in the code subdirectories. The build.ninja script sets default build edges & subninja's to the buildedges.ninja script. For the build.ninja script to run, it needs to change the working dir to the buildedges.ninja directory. So now the build script generator can insert a "workingdir" variable in the build script to embed this information.