#!/bin/sh -xe

# Run this with "debug" option to compile Keystone with debug info
if [ -n "$1" ]
then
# compile with DEBUG option
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
else
# default compile
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="all" -G "Unix Makefiles" ..
fi

time make -j8
