From 341bb2b785049a543fb3346545efc65a30778c92 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 25 Mar 2013 22:41:15 +0000 Subject: Cross compiling for OS X --- Makefile | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 93e1cfa3..f80c9dd7 100644 --- a/Makefile +++ b/Makefile @@ -413,6 +413,22 @@ ifeq ($(PLATFORM),darwin) OPTIMIZEVM += -arch x86_64 -mfpmath=sse endif + ifeq ($(CROSS_COMPILING),1) + ifeq ($(ARCH),ppc) + CC=powerpc-apple-darwin10-gcc + RANLIB=powerpc-apple-darwin10-ranlib + else + ifeq ($(ARCH),x86) + CC=i686-apple-darwin10-gcc + RANLIB=i686-apple-darwin10-ranlib + else + $(error Architecture $(ARCH) is not supported when cross compiling) + endif + endif + else + TOOLS_CFLAGS += -DMACOS_X + endif + BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe ifeq ($(USE_OPENAL),1) @@ -454,8 +470,6 @@ ifeq ($(PLATFORM),darwin) NOTSHLIBCFLAGS=-mdynamic-no-pic - TOOLS_CFLAGS += -DMACOS_X - else # ifeq darwin @@ -823,6 +837,14 @@ endif #NetBSD endif #IRIX endif #SunOS +ifndef CC + CC=gcc +endif + +ifndef RANLIB + RANLIB=gcc +endif + ifneq ($(HAVE_VM_COMPILED),true) BASE_CFLAGS += -DNO_VM_COMPILED BUILD_GAME_QVM=0 @@ -1864,7 +1886,7 @@ ifneq ($(strip $(LIBSDLMAIN)),) ifneq ($(strip $(LIBSDLMAINSRC)),) $(LIBSDLMAIN) : $(LIBSDLMAINSRC) cp $< $@ - ranlib $@ + $(RANLIB) $@ endif endif -- cgit