fix trouble with debug/release detection on Windows dynamic_link
[scilab.git] / scilab / modules / dynamic_link / macros / windows / dlwGenerateMakefile.sci
index 0add43d..a5c01d1 100644 (file)
@@ -185,12 +185,21 @@ function ilib_gen_Make_win32(name, ..
     end
 
     //update DEBUG_SCILAB_DYNAMIC_LINK to map with Scilab compilation mode
-    val = getenv("DEBUG_SCILAB_DYNAMIC_LINK","");
-    if val <> "YES" & val <> "NO" & isDebug() then
+    debugVal = getenv("DEBUG_SCILAB_DYNAMIC_LINK","");
+    val = debugVal;
+    if val <> "NO" & val <> "YES" then
+        if isDebug() then
+            val = "YES";
+        else
+            val = "NO";
+        end
+    end
+
+    if val == "YES" then
         setenv("DEBUG_SCILAB_DYNAMIC_LINK","YES");
         CFLAGS = CFLAGS + " -D_DEBUG";
     else
-        setenv("DEBUG_SCILAB_DYNAMIC_LINK","");
+        setenv("DEBUG_SCILAB_DYNAMIC_LINK","NO");
         CFLAGS = CFLAGS + " -DNDEBUG";
     end
 
@@ -280,7 +289,7 @@ function ilib_gen_Make_win32(name, ..
     end
 
     //restore DEBUG_SCILAB_DYNAMIC_LINK
-    setenv("DEBUG_SCILAB_DYNAMIC_LINK", val);
+    setenv("DEBUG_SCILAB_DYNAMIC_LINK", debugVal);
 
 endfunction
 //=============================================================================