Check whether the make command matches the OS shell

Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/f324690a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/f324690a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/f324690a

Branch: refs/heads/master
Commit: f324690a7d9a810e3c1bd93aec7ae982de2b227f
Parents: c5387af
Author: Nick Wellnhofer <wellnho...@aevum.de>
Authored: Wed Jun 1 21:50:25 2016 +0200
Committer: Nick Wellnhofer <wellnho...@aevum.de>
Committed: Thu Jun 2 00:04:27 2016 +0200

----------------------------------------------------------------------
 src/Charmonizer/Core/Make.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/f324690a/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Core/Make.c b/src/Charmonizer/Core/Make.c
index 1c1d728..8e8699b 100644
--- a/src/Charmonizer/Core/Make.c
+++ b/src/Charmonizer/Core/Make.c
@@ -80,6 +80,8 @@ S_write_rule(chaz_MakeRule *rule, FILE *out);
 
 void
 chaz_Make_init(const char *make_command) {
+    chaz_Make.shell_type = chaz_OS_shell_type();
+
     if (make_command) {
         if (!chaz_Make_detect(make_command, NULL)) {
             chaz_Util_warn("Make utility '%s' doesn't appear to work");
@@ -95,11 +97,6 @@ chaz_Make_init(const char *make_command) {
             printf("Detected make utility '%s'\n", chaz_Make.make_command);
         }
     }
-
-    if (chaz_Make.shell_type == 0) {
-        // Assume POSIX.
-        chaz_Make.shell_type = CHAZ_OS_POSIX;
-    }
 }
 
 void
@@ -149,12 +146,14 @@ chaz_Make_audition(const char *make) {
         size_t len;
         char *content = chaz_Util_slurp_file("_charm_foo", &len);
         if (NULL != strstr(content, "foo\\bar")) {
-            chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
-            succeeded = 1;
+            if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
+                succeeded = 1;
+            }
         }
         else if (NULL != strstr(content, "foo^bar")) {
-            chaz_Make.shell_type = CHAZ_OS_POSIX;
-            succeeded = 1;
+            if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
+                succeeded = 1;
+            }
         }
         free(content);
     }

Reply via email to