From 398dea397c7d035f0a95cfce555550c276c21a26 Mon Sep 17 00:00:00 2001 From: Victor Roemer Date: Sun, 12 Jun 2016 17:06:54 -0400 Subject: [PATCH] Fix Makefile for OSX Bump base SDK from 10.5 -> 10.7 Just use the builtin __APPLE__ --- Makefile | 24 +++++++++--------------- code/client/cl_curl.h | 2 +- code/client/cl_main.c | 4 ++-- code/client/qal.h | 3 ++- code/client/snd_mix.c | 2 +- code/client/snd_openal.c | 6 +++--- code/qcommon/files.c | 4 ++-- code/qcommon/net_ip.c | 2 +- code/qcommon/q_platform.h | 9 ++------- code/qcommon/qcommon.h | 2 +- code/renderergl1/tr_shade.c | 2 +- code/renderergl1/tr_shade_calc.c | 2 +- code/renderergl1/tr_surface.c | 2 +- code/renderergl2/tr_shade.c | 2 +- code/renderergl2/tr_shade_calc.c | 2 +- code/renderergl2/tr_surface.c | 2 +- code/sdl/sdl_input.c | 2 +- code/sys/sys_local.h | 2 +- code/sys/sys_main.c | 4 ++-- code/sys/sys_osx.m | 2 +- code/sys/sys_unix.c | 6 +++--- code/tools/lcc/cpp/unix.c | 2 +- 22 files changed, 39 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 799780bf..12035172 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 c91bcf82..1c0be55a 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 5ede69dd..0c7142c3 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 5a25ec40..a478eb53 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 943c50fa..4418d22d 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 fa5a721a..2a4fb0a2 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 77dfd295..3b4a8aeb 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 98555b99..bcccda20 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 3ed5357f..27ca856e 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 70f1e6c1..b965690b 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 9bdf1e39..d26cb1ac 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 ae33c7fb..82f7c0cc 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 79852f05..c4a1b2d9 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 b49e9146..eb8688e9 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 bb16bb0d..dcb99945 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 72cd610e..f43ea6f4 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 2afa2c16..90ad596c 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 f8bd5b46..96edd98e 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 4f4c5783..8bbc3a5a 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 30bf9322..b0ecf6a5 100644 --- a/code/sys/sys_osx.m +++ b/code/sys/sys_osx.m @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#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 cf980eba..0e9f99bf 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 75e5b6d3..bac841d8 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