Skip to content

Commit 398dea3

Browse files
Victor RoemerVictor Roemer
authored andcommitted
Fix Makefile for OSX
Bump base SDK from 10.5 -> 10.7 Just use the builtin __APPLE__
1 parent a40588c commit 398dea3

File tree

22 files changed

+39
-49
lines changed

22 files changed

+39
-49
lines changed

Makefile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@
33
#
44
# GNU Make required
55
#
6-
7-
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g')
8-
9-
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/ | sed -e 's/^arm.*/arm/')
6+
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
7+
COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')
108

119
ifeq ($(COMPILE_PLATFORM),sunos)
1210
# Solaris uname and GNU uname differ
13-
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
14-
endif
15-
ifeq ($(COMPILE_PLATFORM),darwin)
16-
# Apple does some things a little differently...
17-
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
11+
COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
1812
endif
1913

2014
ifndef BUILD_STANDALONE
@@ -231,7 +225,7 @@ USE_RENDERER_DLOPEN=1
231225
endif
232226

233227
ifndef DEBUG_CFLAGS
234-
DEBUG_CFLAGS=-g -O0
228+
DEBUG_CFLAGS=-ggdb -O0
235229
endif
236230

237231
#############################################################################
@@ -408,8 +402,7 @@ ifeq ($(PLATFORM),darwin)
408402
RENDERER_LIBS=
409403
OPTIMIZEVM=
410404

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

414407
ifeq ($(ARCH),ppc)
415408
BASE_CFLAGS += -arch ppc -faltivec
@@ -447,11 +440,9 @@ ifeq ($(PLATFORM),darwin)
447440
$(error Architecture $(ARCH) is not supported when cross compiling)
448441
endif
449442
endif
450-
else
451-
TOOLS_CFLAGS += -DMACOS_X
452443
endif
453444

454-
BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe
445+
BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe
455446

456447
ifeq ($(USE_OPENAL),1)
457448
ifneq ($(USE_OPENAL_DLOPEN),1)
@@ -468,6 +459,9 @@ ifeq ($(PLATFORM),darwin)
468459

469460
BASE_CFLAGS += -D_THREAD_SAFE=1
470461

462+
# FIXME: It is not possible to build using system SDL2 framework
463+
# 1. IF you try, this Makefile will still drop libSDL-2.0.0.dylib into the builddir
464+
# 2. Debugger warns that you have 2- which one will be used is undefined
471465
ifeq ($(USE_LOCAL_HEADERS),1)
472466
BASE_CFLAGS += -I$(SDLHDIR)/include
473467
endif

code/client/cl_curl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3737
#ifdef WIN32
3838
#define DEFAULT_CURL_LIB "libcurl-4.dll"
3939
#define ALTERNATE_CURL_LIB "libcurl-3.dll"
40-
#elif defined(MACOS_X)
40+
#elif defined(__APPLE__)
4141
#define DEFAULT_CURL_LIB "libcurl.dylib"
4242
#else
4343
#define DEFAULT_CURL_LIB "libcurl.so.4"

code/client/cl_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,7 @@ void CL_Init( void ) {
35543554
#endif
35553555

35563556
cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0);
3557-
#ifdef MACOS_X
3557+
#ifdef __APPLE__
35583558
// In game video is REALLY slow in Mac OS X right now due to driver slowness
35593559
cl_inGameVideo = Cvar_Get ("r_inGameVideo", "0", CVAR_ARCHIVE);
35603560
#else
@@ -3571,7 +3571,7 @@ void CL_Init( void ) {
35713571
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE);
35723572
m_forward = Cvar_Get ("m_forward", "0.25", CVAR_ARCHIVE);
35733573
m_side = Cvar_Get ("m_side", "0.25", CVAR_ARCHIVE);
3574-
#ifdef MACOS_X
3574+
#ifdef __APPLE__
35753575
// Input is jittery on OS X w/o this
35763576
m_filter = Cvar_Get ("m_filter", "1", CVAR_ARCHIVE);
35773577
#else

code/client/qal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3737
#include "../AL/al.h"
3838
#include "../AL/alc.h"
3939
#else
40-
#ifdef _MSC_VER
40+
#if defined(_MSC_VER) || defined(__APPLE__)
4141
// MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme.
42+
// OSX framework also needs this
4243
#include <al.h>
4344
#include <alc.h>
4445
#else

code/client/snd_mix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

2424
#include "client.h"
2525
#include "snd_local.h"
26-
#if idppc_altivec && !defined(MACOS_X)
26+
#if idppc_altivec && !defined(__APPLE__)
2727
#include <altivec.h>
2828
#endif
2929

code/client/snd_openal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ typedef struct src_s
582582
qboolean local; // Is this local (relative to the cam)
583583
} src_t;
584584

585-
#ifdef MACOS_X
585+
#ifdef __APPLE__
586586
#define MAX_SRC 64
587587
#else
588588
#define MAX_SRC 128
@@ -2208,7 +2208,7 @@ static cvar_t *s_alCapture;
22082208

22092209
#ifdef _WIN32
22102210
#define ALDRIVER_DEFAULT "OpenAL32.dll"
2211-
#elif defined(MACOS_X)
2211+
#elif defined(__APPLE__)
22122212
#define ALDRIVER_DEFAULT "/System/Library/Frameworks/OpenAL.framework/OpenAL"
22132213
#elif defined(__OpenBSD__)
22142214
#define ALDRIVER_DEFAULT "libopenal.so"
@@ -2642,7 +2642,7 @@ qboolean S_AL_Init( soundInterface_t *si )
26422642
#endif
26432643
else
26442644
{
2645-
#ifdef MACOS_X
2645+
#ifdef __APPLE__
26462646
// !!! FIXME: Apple has a 1.1-compliant OpenAL, which includes
26472647
// !!! FIXME: capture support, but they don't list it in the
26482648
// !!! FIXME: extension string. We need to check the version string,

code/qcommon/files.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static char fs_gamedir[MAX_OSPATH]; // this will be a single file name with no
246246
static cvar_t *fs_debug;
247247
static cvar_t *fs_homepath;
248248

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

3322-
#ifdef MACOS_X
3322+
#ifdef __APPLE__
33233323
fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT|CVAR_PROTECTED );
33243324
// Make MacOSX also include the base path included with the .app bundle
33253325
if (fs_apppath->string[0])

code/qcommon/net_ip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ static void NET_AddLocalAddress(char *ifname, struct sockaddr *addr, struct sock
12681268
}
12691269
}
12701270

1271-
#if defined(__linux__) || defined(MACOSX) || defined(__BSD__)
1271+
#if defined(__linux__) || defined(__APPLE__) || defined(__BSD__)
12721272
static void NET_GetLocalAddress(void)
12731273
{
12741274
struct ifaddrs *ifap, *search;

code/qcommon/q_platform.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
4646
#define idppc 1
4747
#if defined(__VEC__)
4848
#define idppc_altivec 1
49-
#ifdef MACOS_X // Apple's GCC does this differently than the FSF.
49+
#ifdef __APPLE__ // Apple's GCC does this differently than the FSF.
5050
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
5151
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
5252
#else
@@ -139,12 +139,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
139139

140140
//============================================================== MAC OS X ===
141141

142-
#if defined(MACOS_X) || defined(__APPLE_CC__)
143-
144-
// make sure this is defined, just for sanity's sake...
145-
#ifndef MACOS_X
146-
#define MACOS_X
147-
#endif
142+
#if defined(__APPLE__) || defined(__APPLE_CC__)
148143

149144
#define OS_STRING "macosx"
150145
#define ID_INLINE inline

code/qcommon/qcommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ void Sys_SetDefaultInstallPath(const char *path);
11081108
char *Sys_DefaultInstallPath(void);
11091109
char *Sys_SteamPath(void);
11101110

1111-
#ifdef MACOS_X
1111+
#ifdef __APPLE__
11121112
char *Sys_DefaultAppPath(void);
11131113
#endif
11141114

0 commit comments

Comments
 (0)