diff --git a/doc/install.html b/doc/install.html
index b5df697b..68f49d18 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -114,30 +114,30 @@ operating systems, CPUs and compilers:
x86 (32 bit) |
-GCC 4.x GCC 3.4 |
-GCC 4.x GCC 3.4 |
-GCC 4.x GCC 3.4 |
+GCC 4.x+ GCC 3.4 |
+GCC 4.x+ GCC 3.4 |
+XCode 5.0+ Clang |
MSVC, MSVC/EE WinSDK MinGW, Cygwin |
x64 (64 bit) |
-GCC 4.x |
+GCC 4.x+ |
ORBIS (PS4) |
-GCC 4.x |
+XCode 5.0+ Clang |
MSVC + SDK v7.0 WinSDK v7.0 Durango (Xbox One) |
ARMv5+ ARM9E+ |
GCC 4.2+ |
GCC 4.2+ PSP2 (PS VITA) |
-GCC 4.2+ |
+XCode 5.0+ Clang |
|
ARM64 |
GCC 4.8+ |
|
-Clang 3.5+ |
+XCode 6.0+ Clang 3.5+ |
|
@@ -442,8 +442,7 @@ NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86"
make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
-You can cross-compile for iOS 3.0+ (iPhone/iPad) using the » iOS SDK.
-The environment variables need to match the iOS SDK version:
+You can cross-compile for iOS 3.0+ (iPhone/iPad) using the » iOS SDK:
Note: the JIT compiler is disabled for iOS, because regular iOS Apps
@@ -453,13 +452,11 @@ much slower than the JIT compiler. Please complain to Apple, not me.
Or use Android. :-p
-IXCODE=`xcode-select -print-path`
-ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer
-ISDKVER=iPhoneOS6.0.sdk
-ISDKP=$ISDK/usr/bin/
-ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
-make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
- TARGET_SYS=iOS
+ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
+ICC=$(xcrun --sdk iphoneos --find clang)
+ISDKF="-arch armv7 -isysroot $ISDKP"
+make HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" \
+ TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
Cross-compiling for consoles
diff --git a/src/Makefile b/src/Makefile
index 532da6e9..9845f6a0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -24,11 +24,13 @@ NODOTABIVER= 51
# removing the '#' in front of them. Make sure you force a full recompile
# with "make clean", followed by "make" if you change any options.
#
+DEFAULT_CC = gcc
+#
# LuaJIT builds as a native 32 or 64 bit binary by default.
-CC= gcc
+CC= $(DEFAULT_CC)
#
# Use this if you want to force a 32 bit build on a 64 bit multilib OS.
-#CC= gcc -m32
+#CC= $(DEFAULT_CC) -m32
#
# Since the assembler part does NOT maintain a frame pointer, it's pointless
# to slow down the C part by not omitting it. Debugging, tracebacks and
@@ -147,6 +149,29 @@ XCFLAGS=
# You probably don't need to change anything below this line!
##############################################################################
+##############################################################################
+# Host system detection.
+##############################################################################
+
+ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
+ HOST_SYS= Windows
+ HOST_RM= del
+else
+ HOST_SYS:= $(shell uname -s)
+ ifneq (,$(findstring MINGW,$(HOST_SYS)))
+ HOST_SYS= Windows
+ HOST_MSYS= mingw
+ endif
+ ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
+ HOST_SYS= Windows
+ HOST_MSYS= cygwin
+ endif
+ # Use Clang for OSX host.
+ ifeq (Darwin,$(HOST_SYS))
+ DEFAULT_CC= clang
+ endif
+endif
+
##############################################################################
# Flags and options for host and target.
##############################################################################
@@ -268,24 +293,9 @@ ifneq (,$(LMULTILIB))
endif
##############################################################################
-# System detection.
+# Target system detection.
##############################################################################
-ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
- HOST_SYS= Windows
- HOST_RM= del
-else
- HOST_SYS:= $(shell uname -s)
- ifneq (,$(findstring MINGW,$(HOST_SYS)))
- HOST_SYS= Windows
- HOST_MSYS= mingw
- endif
- ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
- HOST_SYS= Windows
- HOST_MSYS= cygwin
- endif
-endif
-
TARGET_SYS?= $(HOST_SYS)
ifeq (Windows,$(TARGET_SYS))
TARGET_STRIP+= --strip-unneeded