Skip to content

Commit

Permalink
Fix Makefile for OSX
Browse files Browse the repository at this point in the history
Bump base SDK from 10.5 -> 10.7
Just use the builtin __APPLE__
  • Loading branch information
Victor Roemer authored and Victor Roemer committed Jun 12, 2016
1 parent a40588c commit 398dea3
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 49 deletions.
24 changes: 9 additions & 15 deletions Makefile
Expand Up @@ -3,18 +3,12 @@
#
# GNU Make required
#

COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g')

COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/ | sed -e 's/^arm.*/arm/')
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')

ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
endif
ifeq ($(COMPILE_PLATFORM),darwin)
# Apple does some things a little differently...
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
endif

ifndef BUILD_STANDALONE
Expand Down Expand Up @@ -231,7 +225,7 @@ USE_RENDERER_DLOPEN=1
endif

ifndef DEBUG_CFLAGS
DEBUG_CFLAGS=-g -O0
DEBUG_CFLAGS=-ggdb -O0
endif

#############################################################################
Expand Down Expand Up @@ -408,8 +402,7 @@ ifeq ($(PLATFORM),darwin)
RENDERER_LIBS=
OPTIMIZEVM=

BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes -mmacosx-version-min=10.5 \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050
BASE_CFLAGS += -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070

ifeq ($(ARCH),ppc)
BASE_CFLAGS += -arch ppc -faltivec
Expand Down Expand Up @@ -447,11 +440,9 @@ ifeq ($(PLATFORM),darwin)
$(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
BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe

ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
Expand All @@ -468,6 +459,9 @@ ifeq ($(PLATFORM),darwin)

BASE_CFLAGS += -D_THREAD_SAFE=1

# FIXME: It is not possible to build using system SDL2 framework
# 1. IF you try, this Makefile will still drop libSDL-2.0.0.dylib into the builddir
# 2. Debugger warns that you have 2- which one will be used is undefined
ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(SDLHDIR)/include
endif
Expand Down
2 changes: 1 addition & 1 deletion code/client/cl_curl.h
Expand Up @@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef WIN32
#define DEFAULT_CURL_LIB "libcurl-4.dll"
#define ALTERNATE_CURL_LIB "libcurl-3.dll"
#elif defined(MACOS_X)
#elif defined(__APPLE__)
#define DEFAULT_CURL_LIB "libcurl.dylib"
#else
#define DEFAULT_CURL_LIB "libcurl.so.4"
Expand Down
4 changes: 2 additions & 2 deletions code/client/cl_main.c
Expand Up @@ -3554,7 +3554,7 @@ void CL_Init( void ) {
#endif

cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0);
#ifdef MACOS_X
#ifdef __APPLE__
// In game video is REALLY slow in Mac OS X right now due to driver slowness
cl_inGameVideo = Cvar_Get ("r_inGameVideo", "0", CVAR_ARCHIVE);
#else
Expand All @@ -3571,7 +3571,7 @@ void CL_Init( void ) {
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE);
m_forward = Cvar_Get ("m_forward", "0.25", CVAR_ARCHIVE);
m_side = Cvar_Get ("m_side", "0.25", CVAR_ARCHIVE);
#ifdef MACOS_X
#ifdef __APPLE__
// Input is jittery on OS X w/o this
m_filter = Cvar_Get ("m_filter", "1", CVAR_ARCHIVE);
#else
Expand Down
3 changes: 2 additions & 1 deletion code/client/qal.h
Expand Up @@ -37,8 +37,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../AL/al.h"
#include "../AL/alc.h"
#else
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__APPLE__)
// MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme.
// OSX framework also needs this
#include <al.h>
#include <alc.h>
#else
Expand Down
2 changes: 1 addition & 1 deletion code/client/snd_mix.c
Expand Up @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#include "client.h"
#include "snd_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
6 changes: 3 additions & 3 deletions code/client/snd_openal.c
Expand Up @@ -582,7 +582,7 @@ typedef struct src_s
qboolean local; // Is this local (relative to the cam)
} src_t;

#ifdef MACOS_X
#ifdef __APPLE__
#define MAX_SRC 64
#else
#define MAX_SRC 128
Expand Down Expand Up @@ -2208,7 +2208,7 @@ static cvar_t *s_alCapture;

#ifdef _WIN32
#define ALDRIVER_DEFAULT "OpenAL32.dll"
#elif defined(MACOS_X)
#elif defined(__APPLE__)
#define ALDRIVER_DEFAULT "/System/Library/Frameworks/OpenAL.framework/OpenAL"
#elif defined(__OpenBSD__)
#define ALDRIVER_DEFAULT "libopenal.so"
Expand Down Expand Up @@ -2642,7 +2642,7 @@ qboolean S_AL_Init( soundInterface_t *si )
#endif
else
{
#ifdef MACOS_X
#ifdef __APPLE__
// !!! FIXME: Apple has a 1.1-compliant OpenAL, which includes
// !!! FIXME: capture support, but they don't list it in the
// !!! FIXME: extension string. We need to check the version string,
Expand Down
4 changes: 2 additions & 2 deletions code/qcommon/files.c
Expand Up @@ -246,7 +246,7 @@ static char fs_gamedir[MAX_OSPATH]; // this will be a single file name with no
static cvar_t *fs_debug;
static cvar_t *fs_homepath;

#ifdef MACOS_X
#ifdef __APPLE__
// Also search the .app bundle for .pk3 files
static cvar_t *fs_apppath;
#endif
Expand Down Expand Up @@ -3319,7 +3319,7 @@ static void FS_Startup( const char *gameName )
}
// fs_homepath is somewhat particular to *nix systems, only add if relevant

#ifdef MACOS_X
#ifdef __APPLE__
fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT|CVAR_PROTECTED );
// Make MacOSX also include the base path included with the .app bundle
if (fs_apppath->string[0])
Expand Down
2 changes: 1 addition & 1 deletion code/qcommon/net_ip.c
Expand Up @@ -1268,7 +1268,7 @@ static void NET_AddLocalAddress(char *ifname, struct sockaddr *addr, struct sock
}
}

#if defined(__linux__) || defined(MACOSX) || defined(__BSD__)
#if defined(__linux__) || defined(__APPLE__) || defined(__BSD__)
static void NET_GetLocalAddress(void)
{
struct ifaddrs *ifap, *search;
Expand Down
9 changes: 2 additions & 7 deletions code/qcommon/q_platform.h
Expand Up @@ -46,7 +46,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define idppc 1
#if defined(__VEC__)
#define idppc_altivec 1
#ifdef MACOS_X // Apple's GCC does this differently than the FSF.
#ifdef __APPLE__ // Apple's GCC does this differently than the FSF.
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
#else
Expand Down Expand Up @@ -139,12 +139,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

//============================================================== MAC OS X ===

#if defined(MACOS_X) || defined(__APPLE_CC__)

// make sure this is defined, just for sanity's sake...
#ifndef MACOS_X
#define MACOS_X
#endif
#if defined(__APPLE__) || defined(__APPLE_CC__)

#define OS_STRING "macosx"
#define ID_INLINE inline
Expand Down
2 changes: 1 addition & 1 deletion code/qcommon/qcommon.h
Expand Up @@ -1108,7 +1108,7 @@ void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath(void);
char *Sys_SteamPath(void);

#ifdef MACOS_X
#ifdef __APPLE__
char *Sys_DefaultAppPath(void);
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl1/tr_shade.c
Expand Up @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_shade.c

#include "tr_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl1/tr_shade_calc.c
Expand Up @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_shade_calc.c

#include "tr_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl1/tr_surface.c
Expand Up @@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// tr_surf.c
#include "tr_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl2/tr_shade.c
Expand Up @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_shade.c

#include "tr_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl2/tr_shade_calc.c
Expand Up @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_shade_calc.c

#include "tr_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl2/tr_surface.c
Expand Up @@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// tr_surf.c
#include "tr_local.h"
#if idppc_altivec && !defined(MACOS_X)
#if idppc_altivec && !defined(__APPLE__)
#include <altivec.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/sdl/sdl_input.c
Expand Up @@ -247,7 +247,7 @@ static keyNum_t IN_TranslateSDLToQ3Key( SDL_Keysym *keysym, qboolean down )
case SDLK_LCTRL:
case SDLK_RCTRL: key = K_CTRL; break;

#ifdef MACOS_X
#ifdef __APPLE__
case SDLK_RGUI:
case SDLK_LGUI: key = K_COMMAND; break;
#else
Expand Down
2 changes: 1 addition & 1 deletion code/sys/sys_local.h
Expand Up @@ -44,7 +44,7 @@ unsigned int CON_LogSize( void );
unsigned int CON_LogWrite( const char *in );
unsigned int CON_LogRead( char *out, unsigned int outSize );

#ifdef MACOS_X
#ifdef __APPLE__
char *Sys_StripAppBundle( char *pwd );
#endif

Expand Down
4 changes: 2 additions & 2 deletions code/sys/sys_main.c
Expand Up @@ -565,7 +565,7 @@ void Sys_ParseArgs( int argc, char **argv )
}

#ifndef DEFAULT_BASEDIR
# ifdef MACOS_X
# ifdef __APPLE__
# define DEFAULT_BASEDIR Sys_StripAppBundle(Sys_BinaryPath())
# else
# define DEFAULT_BASEDIR Sys_BinaryPath()
Expand Down Expand Up @@ -646,7 +646,7 @@ int main( int argc, char **argv )
// Set the initial time base
Sys_Milliseconds( );

#ifdef MACOS_X
#ifdef __APPLE__
// This is passed if we are launched by double-clicking
if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 )
argc = 1;
Expand Down
2 changes: 1 addition & 1 deletion code/sys/sys_osx.m
Expand Up @@ -20,7 +20,7 @@
===========================================================================
*/

#ifndef MACOS_X
#ifndef __APPLE__
#error This file is for Mac OS X only. You probably should not compile it.
#endif

Expand Down
6 changes: 3 additions & 3 deletions code/sys/sys_unix.c
Expand Up @@ -61,7 +61,7 @@ char *Sys_DefaultHomePath(void)
if( ( p = getenv( "HOME" ) ) != NULL )
{
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
#ifdef MACOS_X
#ifdef __APPLE__
Q_strcat(homePath, sizeof(homePath),
"Library/Application Support/");

Expand Down Expand Up @@ -94,7 +94,7 @@ char *Sys_SteamPath( void )

if( ( p = getenv( "HOME" ) ) != NULL )
{
#ifdef MACOS_X
#ifdef __APPLE__
char *steamPathEnd = "/Library/Application Support/Steam/SteamApps/common/" STEAMPATH_NAME;
#else
char *steamPathEnd = "/.steam/steam/SteamApps/common/" STEAMPATH_NAME;
Expand Down Expand Up @@ -577,7 +577,7 @@ void Sys_ErrorDialog( const char *error )
close( f );
}

#ifndef MACOS_X
#ifndef __APPLE__
static char execBuffer[ 1024 ];
static char *execBufferPointer;
static char *execArgv[ 16 ];
Expand Down
2 changes: 1 addition & 1 deletion code/tools/lcc/cpp/unix.c
Expand Up @@ -106,7 +106,7 @@ char *basepath( char *fname )
all and others do a terrible job (like calling malloc) */
// -- ouch, that hurts -- ln
/* always use the system memmove() on Mac OS X. --ryan. */
#if !defined(MACOS_X) && !defined(_MSC_VER)
#if !defined(__APPLE__) && !defined(_MSC_VER)
#ifdef memmove
#undef memmove
#endif
Expand Down

0 comments on commit 398dea3

Please sign in to comment.