From 4b9e85bcd70fdd264ac40dc010370c8fb7e816a2 Mon Sep 17 00:00:00 2001
From: Leonardo de Moura <leonardo@microsoft.com>
Date: Wed, 21 Nov 2012 21:20:55 -0800
Subject: [PATCH] improving mk_make

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
---
 scripts/mk_util.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/scripts/mk_util.py b/scripts/mk_util.py
index 36652a855..34ec94626 100644
--- a/scripts/mk_util.py
+++ b/scripts/mk_util.py
@@ -73,6 +73,9 @@ PREFIX='/usr'
 GMP=False
 JAVA_HOME=None
 
+def unix_path2dos(path):
+    return string.join(path.split('/'), '\\')
+
 def which(program):
     import os
     def is_exe(fpath):
@@ -331,16 +334,16 @@ def display_help(exit_code):
     print "  --staticlib                   build Z3 static library."
     if not IS_WINDOWS:
         print "  -g, --gmp                     use GMP."
+    print ""
+    print "Some influential environment variables:"
     if not IS_WINDOWS:
-        print ""
-        print "Some influential environment variables:"
         print "  CXX        C++ compiler"
         print "  CC         C compiler"
         print "  LDFLAGS    Linker flags, e.g., -L<lib dir> if you have libraries in a non-standard directory"
         print "  CPPFLAGS   Preprocessor flags, e.g., -I<include dir> if you have header files in a non-standard directory"
         print "  CXXFLAGS   C++ compiler flags"
-        print "  JAVA       Java virtual machine (only relevant if -j or --java option is provided)"
-        print "  JAVAC      Java compiler (only relevant if -j or --java option is provided)"
+    print "  JAVA       Java virtual machine (only relevant if -j or --java option is provided)"
+    print "  JAVAC      Java compiler (only relevant if -j or --java option is provided)"
     exit(exit_code)
 
 # Parse configuration option for mk_make script
@@ -922,8 +925,11 @@ class JavaDLLComponent(Component):
             dllfile = '%s$(SO_EXT)' % self.dll_name
             out.write('%s: %s/Z3Native.java %s$(SO_EXT)\n' % (dllfile, self.to_src_dir, get_component('api_dll').dll_name))
             out.write('\tcd %s; %s Z3Native.java\n' % (self.to_src_dir, JAVAC))
-            out.write('\tmv %s/*.class .\n' % self.to_src_dir)
-            out.write('\t$(CC) $(CXXFLAGS) $(CXX_OUT_FLAG)Z3Native$(OBJ_EXT) -I%s/include -I%s %s/Z3Native.c\n' % (JAVA_HOME, get_component('api').to_src_dir, self.to_src_dir))
+            if IS_WINDOWS:
+                out.write('\tmove %s\\*.class .\n' % unix_path2dos(self.to_src_dir))
+            else:
+                out.write('\tmv %s/*.class .\n' % self.to_src_dir)
+            out.write('\t$(CC) $(CXXFLAGS) $(CXX_OUT_FLAG)Z3Native$(OBJ_EXT) -I"%s/include" -I%s %s/Z3Native.c\n' % (JAVA_HOME, get_component('api').to_src_dir, self.to_src_dir))
             out.write('\t$(CC) $(SLINK_OUT_FLAG)%s $(SLINK_FLAGS) -L. Z3Native$(OBJ_EXT) -lz3\n' % dllfile)
             out.write('%s: %s\n\n' % (self.name, dllfile))