added cygwin targets to the script and made cross-win* targets explicit
diff --git a/COMPILE b/COMPILE
index da07a17..3163419 100644
--- a/COMPILE
+++ b/COMPILE
@@ -45,20 +45,29 @@
if you want 64-bit binaries) are required.
- To cross-compile Windows 32-bit binary, simply run
- $ ./compile.sh win32
+ $ ./compile.sh cross-win32
- To cross-compile Windows 64-bit binary, simply run
- $ ./compile.sh win64
+ $ ./compile.sh cross-win64
Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine.
-(4) By default, gcc is used as compiler. If you want to use "clang" instead, compile
+(4) To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
+
+ - To compile Windows 32-bit binary under Cygwin, simply run
+ $ ./compile.sh cygwin-mingw32
+
+ - To compile Windows 64-bit binary under Cygwin, simply run
+ $ ./compile.sh cygwin-mingw64
+
+
+(5) By default, gcc is used as compiler. If you want to use "clang" instead, compile
the code with:
$ ./compile.sh clang
-(5) So far Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for the bindings
+(6) So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for the bindings
under directory bindings/, and refer to README file of corresponding languages.
diff --git a/compile.sh b/compile.sh
index 08ffb84..580be80 100755
--- a/compile.sh
+++ b/compile.sh
@@ -3,11 +3,23 @@
# Capstone Disassembler Engine
# By Nguyen Anh Quynh <aquynh@gmail.com>, 2013>
+function build {
+ CROSS= make clean
+
+ if [ ${CC}x != x ]; then
+ make CC=$CC
+ else
+ make
+ fi
+}
+
case "$1" in
- "" ) make clean; make;;
- "nix32" ) make clean; CFLAGS=-m32 LDFLAGS=-m32 make;;
- "clang" ) make clean; make CC=clang;;
- "win32" ) make clean; make CROSS=i686-w64-mingw32- windows;;
- "win64" ) make clean; make CROSS=x86_64-w64-mingw32- windows;;
- * ) echo "Usage: compile.sh [nix32|clang|win32|win64]"; exit 1;;
+ "" ) build;;
+ "nix32" ) CFLAGS=-m32 LDFLAGS=-m32 build;;
+ "clang" ) CC=clang build;;
+ "cross-win32" ) CROSS=i686-w64-mingw32- build;;
+ "cross-win64" ) CROSS=x86_64-w64-mingw32- build;;
+ "cygwin-mingw32" ) CROSS=i686-pc-mingw32- build;;
+ "cygwin-mingw64" ) CROSS=x86_64-w64-mingw32- build;;
+ * ) echo "Usage: compile.sh [nix32|clang|cross-win32|cross-win64|cygwin-mingw32|cygwin-mingw64]"; exit 1;;
esac