Skip to content

Commit 398dea3

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

22 files changed

+39
-49
lines changed

Makefile

+9-15
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

+1-1
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

+2-2
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

+2-1
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

+1-1
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

+3-3
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

+2-2
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

+1-1
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

+2-7
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

+1-1
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

code/renderergl1/tr_shade.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222
// tr_shade.c
2323

2424
#include "tr_local.h"
25-
#if idppc_altivec && !defined(MACOS_X)
25+
#if idppc_altivec && !defined(__APPLE__)
2626
#include <altivec.h>
2727
#endif
2828

code/renderergl1/tr_shade_calc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222
// tr_shade_calc.c
2323

2424
#include "tr_local.h"
25-
#if idppc_altivec && !defined(MACOS_X)
25+
#if idppc_altivec && !defined(__APPLE__)
2626
#include <altivec.h>
2727
#endif
2828

code/renderergl1/tr_surface.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2121
*/
2222
// tr_surf.c
2323
#include "tr_local.h"
24-
#if idppc_altivec && !defined(MACOS_X)
24+
#if idppc_altivec && !defined(__APPLE__)
2525
#include <altivec.h>
2626
#endif
2727

code/renderergl2/tr_shade.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222
// tr_shade.c
2323

2424
#include "tr_local.h"
25-
#if idppc_altivec && !defined(MACOS_X)
25+
#if idppc_altivec && !defined(__APPLE__)
2626
#include <altivec.h>
2727
#endif
2828

code/renderergl2/tr_shade_calc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222
// tr_shade_calc.c
2323

2424
#include "tr_local.h"
25-
#if idppc_altivec && !defined(MACOS_X)
25+
#if idppc_altivec && !defined(__APPLE__)
2626
#include <altivec.h>
2727
#endif
2828

code/renderergl2/tr_surface.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2121
*/
2222
// tr_surf.c
2323
#include "tr_local.h"
24-
#if idppc_altivec && !defined(MACOS_X)
24+
#if idppc_altivec && !defined(__APPLE__)
2525
#include <altivec.h>
2626
#endif
2727

code/sdl/sdl_input.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static keyNum_t IN_TranslateSDLToQ3Key( SDL_Keysym *keysym, qboolean down )
247247
case SDLK_LCTRL:
248248
case SDLK_RCTRL: key = K_CTRL; break;
249249

250-
#ifdef MACOS_X
250+
#ifdef __APPLE__
251251
case SDLK_RGUI:
252252
case SDLK_LGUI: key = K_COMMAND; break;
253253
#else

code/sys/sys_local.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ unsigned int CON_LogSize( void );
4444
unsigned int CON_LogWrite( const char *in );
4545
unsigned int CON_LogRead( char *out, unsigned int outSize );
4646

47-
#ifdef MACOS_X
47+
#ifdef __APPLE__
4848
char *Sys_StripAppBundle( char *pwd );
4949
#endif
5050

code/sys/sys_main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void Sys_ParseArgs( int argc, char **argv )
565565
}
566566

567567
#ifndef DEFAULT_BASEDIR
568-
# ifdef MACOS_X
568+
# ifdef __APPLE__
569569
# define DEFAULT_BASEDIR Sys_StripAppBundle(Sys_BinaryPath())
570570
# else
571571
# define DEFAULT_BASEDIR Sys_BinaryPath()
@@ -646,7 +646,7 @@ int main( int argc, char **argv )
646646
// Set the initial time base
647647
Sys_Milliseconds( );
648648

649-
#ifdef MACOS_X
649+
#ifdef __APPLE__
650650
// This is passed if we are launched by double-clicking
651651
if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 )
652652
argc = 1;

code/sys/sys_osx.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
===========================================================================
2121
*/
2222

23-
#ifndef MACOS_X
23+
#ifndef __APPLE__
2424
#error This file is for Mac OS X only. You probably should not compile it.
2525
#endif
2626

code/sys/sys_unix.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ char *Sys_DefaultHomePath(void)
6161
if( ( p = getenv( "HOME" ) ) != NULL )
6262
{
6363
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
64-
#ifdef MACOS_X
64+
#ifdef __APPLE__
6565
Q_strcat(homePath, sizeof(homePath),
6666
"Library/Application Support/");
6767

@@ -94,7 +94,7 @@ char *Sys_SteamPath( void )
9494

9595
if( ( p = getenv( "HOME" ) ) != NULL )
9696
{
97-
#ifdef MACOS_X
97+
#ifdef __APPLE__
9898
char *steamPathEnd = "/Library/Application Support/Steam/SteamApps/common/" STEAMPATH_NAME;
9999
#else
100100
char *steamPathEnd = "/.steam/steam/SteamApps/common/" STEAMPATH_NAME;
@@ -577,7 +577,7 @@ void Sys_ErrorDialog( const char *error )
577577
close( f );
578578
}
579579

580-
#ifndef MACOS_X
580+
#ifndef __APPLE__
581581
static char execBuffer[ 1024 ];
582582
static char *execBufferPointer;
583583
static char *execArgv[ 16 ];

code/tools/lcc/cpp/unix.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ char *basepath( char *fname )
106106
all and others do a terrible job (like calling malloc) */
107107
// -- ouch, that hurts -- ln
108108
/* always use the system memmove() on Mac OS X. --ryan. */
109-
#if !defined(MACOS_X) && !defined(_MSC_VER)
109+
#if !defined(__APPLE__) && !defined(_MSC_VER)
110110
#ifdef memmove
111111
#undef memmove
112112
#endif

0 commit comments

Comments
 (0)