diff --git a/Makefile b/Makefile index 799780bf79..120351728f 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -231,7 +225,7 @@ USE_RENDERER_DLOPEN=1 endif ifndef DEBUG_CFLAGS -DEBUG_CFLAGS=-g -O0 +DEBUG_CFLAGS=-ggdb -O0 endif ############################################################################# @@ -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 @@ -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) @@ -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 diff --git a/code/client/cl_curl.h b/code/client/cl_curl.h index c91bcf821c..1c0be55aef 100644 --- a/code/client/cl_curl.h +++ b/code/client/cl_curl.h @@ -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" diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 5ede69dd00..0c7142c331 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -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 @@ -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 diff --git a/code/client/qal.h b/code/client/qal.h index 5a25ec404a..a478eb5395 100644 --- a/code/client/qal.h +++ b/code/client/qal.h @@ -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 #include #else diff --git a/code/client/snd_mix.c b/code/client/snd_mix.c index 943c50fa8b..4418d22d3a 100644 --- a/code/client/snd_mix.c +++ b/code/client/snd_mix.c @@ -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 #endif diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index fa5a721afa..2a4fb0a24a 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -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 @@ -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" @@ -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, diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 77dfd295fd..3b4a8aeb4b 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -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 @@ -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]) diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c index 98555b9925..bcccda20c6 100644 --- a/code/qcommon/net_ip.c +++ b/code/qcommon/net_ip.c @@ -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; diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h index 3ed5357fd8..27ca856e55 100644 --- a/code/qcommon/q_platform.h +++ b/code/qcommon/q_platform.h @@ -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 @@ -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 diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 70f1e6c129..b965690baa 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -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 diff --git a/code/renderergl1/tr_shade.c b/code/renderergl1/tr_shade.c index 9bdf1e3953..d26cb1acae 100644 --- a/code/renderergl1/tr_shade.c +++ b/code/renderergl1/tr_shade.c @@ -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 #endif diff --git a/code/renderergl1/tr_shade_calc.c b/code/renderergl1/tr_shade_calc.c index ae33c7fbac..82f7c0cce9 100644 --- a/code/renderergl1/tr_shade_calc.c +++ b/code/renderergl1/tr_shade_calc.c @@ -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 #endif diff --git a/code/renderergl1/tr_surface.c b/code/renderergl1/tr_surface.c index 79852f051d..c4a1b2d9ea 100644 --- a/code/renderergl1/tr_surface.c +++ b/code/renderergl1/tr_surface.c @@ -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 #endif diff --git a/code/renderergl2/tr_shade.c b/code/renderergl2/tr_shade.c index b49e914647..eb8688e9b3 100644 --- a/code/renderergl2/tr_shade.c +++ b/code/renderergl2/tr_shade.c @@ -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 #endif diff --git a/code/renderergl2/tr_shade_calc.c b/code/renderergl2/tr_shade_calc.c index bb16bb0d00..dcb99945f5 100644 --- a/code/renderergl2/tr_shade_calc.c +++ b/code/renderergl2/tr_shade_calc.c @@ -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 #endif diff --git a/code/renderergl2/tr_surface.c b/code/renderergl2/tr_surface.c index 72cd610e2d..f43ea6f411 100644 --- a/code/renderergl2/tr_surface.c +++ b/code/renderergl2/tr_surface.c @@ -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 #endif diff --git a/code/sdl/sdl_input.c b/code/sdl/sdl_input.c index 2afa2c1674..90ad596c77 100644 --- a/code/sdl/sdl_input.c +++ b/code/sdl/sdl_input.c @@ -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 diff --git a/code/sys/sys_local.h b/code/sys/sys_local.h index f8bd5b46c8..96edd98ebc 100644 --- a/code/sys/sys_local.h +++ b/code/sys/sys_local.h @@ -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 diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c index 4f4c57837c..8bbc3a5a1a 100644 --- a/code/sys/sys_main.c +++ b/code/sys/sys_main.c @@ -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() @@ -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; diff --git a/code/sys/sys_osx.m b/code/sys/sys_osx.m index 30bf932214..b0ecf6a5fd 100644 --- a/code/sys/sys_osx.m +++ b/code/sys/sys_osx.m @@ -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 diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index cf980ebac0..0e9f99bf34 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -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/"); @@ -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; @@ -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 ]; diff --git a/code/tools/lcc/cpp/unix.c b/code/tools/lcc/cpp/unix.c index 75e5b6d3c7..bac841d8bd 100644 --- a/code/tools/lcc/cpp/unix.c +++ b/code/tools/lcc/cpp/unix.c @@ -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