summaryrefslogtreecommitdiffstats
path: root/src/ninja.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-09-13 18:07:45 (GMT)
committerEvan Martin <martine@danga.com>2012-09-13 18:11:47 (GMT)
commitc57f8a4258998a185f961ce12fd7c905a3e86180 (patch)
tree8651047b7ac8387f50348b6c37d8c5d6dd8addd4 /src/ninja.cc
parentce825d2f6e2bb8a0fa0bb97fe961d5f194f8f6f8 (diff)
downloadNinja-c57f8a4258998a185f961ce12fd7c905a3e86180.zip
Ninja-c57f8a4258998a185f961ce12fd7c905a3e86180.tar.gz
Ninja-c57f8a4258998a185f961ce12fd7c905a3e86180.tar.bz2
windows: merge msvc-helper into ninja.exe itself
Now "ninja -t msvc ..." passes the "..." to the msvc helper main. This drastically simplifies bootstrap and makes ninja a single binary again.
Diffstat (limited to 'src/ninja.cc')
-rw-r--r--src/ninja.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index fb273be..089dbc1 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -42,6 +42,9 @@
#include "state.h"
#include "util.h"
+// Defined in msvc_helper_main-win32.cc.
+int MSVCHelperMain(int argc, char** argv);
+
namespace {
/// The version number of the current Ninja release. This will always
@@ -289,6 +292,16 @@ int ToolBrowse(Globals* globals, int argc, char* argv[]) {
}
#endif // _WIN32
+#if defined(WIN32)
+int ToolMSVC(Globals* globals, int argc, char* argv[]) {
+ // Reset getopt: push one argument onto the front of argv, reset optind.
+ argc++;
+ argv--;
+ optind = 0;
+ return MSVCHelperMain(argc, argv);
+}
+#endif
+
int ToolTargetsList(const vector<Node*>& nodes, int depth, int indent) {
for (vector<Node*>::const_iterator n = nodes.begin();
n != nodes.end();
@@ -524,6 +537,10 @@ int ChooseTool(const string& tool_name, const Tool** tool_out) {
{ "browse", "browse dependency graph in a web browser",
Tool::RUN_AFTER_LOAD, ToolBrowse },
#endif
+#if defined(WIN32)
+ { "msvc", "build helper for MSVC cl.exe",
+ Tool::RUN_AFTER_FLAGS, ToolMSVC },
+#endif
{ "clean", "clean built files",
Tool::RUN_AFTER_LOAD, ToolClean },
{ "commands", "list all commands required to rebuild given targets",