2
0
Эх сурвалжийг харах

OSX: Switch to Clang as the default compiler.

Mike Pall 10 жил өмнө
parent
commit
f416cf6a64
1 өөрчлөгдсөн 28 нэмэгдсэн , 18 устгасан
  1. 28 18
      src/Makefile

+ 28 - 18
src/Makefile

@@ -24,11 +24,13 @@ NODOTABIVER= 51
 # removing the '#' in front of them. Make sure you force a full recompile
 # removing the '#' in front of them. Make sure you force a full recompile
 # with "make clean", followed by "make" if you change any options.
 # 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.
 # 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.
 # 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
 # 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
 # to slow down the C part by not omitting it. Debugging, tracebacks and
@@ -150,6 +152,29 @@ XCFLAGS=
 # You probably don't need to change anything below this line!
 # 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.
 # Flags and options for host and target.
 ##############################################################################
 ##############################################################################
@@ -263,24 +288,9 @@ ifneq (,$(LMULTILIB))
 endif
 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)
 TARGET_SYS?= $(HOST_SYS)
 ifeq (Windows,$(TARGET_SYS))
 ifeq (Windows,$(TARGET_SYS))
   TARGET_STRIP+= --strip-unneeded
   TARGET_STRIP+= --strip-unneeded