aboutsummaryrefslogtreecommitdiff
path: root/main.cc
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-05 15:01:46 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-08 16:42:05 +0900
commit34556cc6d82dfc1b4f8c2c482817e48b1aa7a2ba (patch)
treea680bf690741c89fefd3d12573f1e066c809f957 /main.cc
parent171dc82adb5ba0e7aaae03b2809113ba094d0f2f (diff)
[C++] Do not find first Makefile when -f is specified
Diffstat (limited to 'main.cc')
-rw-r--r--main.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/main.cc b/main.cc
index 5918601..3273b3a 100644
--- a/main.cc
+++ b/main.cc
@@ -47,18 +47,6 @@ static void Init() {
InitFuncTable();
InitDepNodePool();
InitParser();
-
- if (g_flags.makefile == NULL) {
- if (Exists("GNUmakefile")) {
- g_flags.makefile = "GNUmakefile";
-#if !defined(__APPLE__)
- } else if (Exists("makefile")) {
- g_flags.makefile = "makefile";
-#endif
- } else if (Exists("Makefile")) {
- g_flags.makefile = "Makefile";
- }
- }
}
static void Quit() {
@@ -225,6 +213,20 @@ static int Run(const vector<Symbol>& targets,
return 0;
}
+static void FindFirstMakefie() {
+ if (g_flags.makefile != NULL)
+ return;
+ if (Exists("GNUmakefile")) {
+ g_flags.makefile = "GNUmakefile";
+#if !defined(__APPLE__)
+ } else if (Exists("makefile")) {
+ g_flags.makefile = "makefile";
+#endif
+ } else if (Exists("Makefile")) {
+ g_flags.makefile = "Makefile";
+ }
+}
+
int main(int argc, char* argv[]) {
Init();
string orig_args;
@@ -234,6 +236,7 @@ int main(int argc, char* argv[]) {
orig_args += argv[i];
}
g_flags.Parse(argc, argv);
+ FindFirstMakefie();
if (g_flags.makefile == NULL)
ERROR("*** No targets specified and no makefile found.");
// This depends on command line flags.