1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Added OS X static libs for the future.

This commit is contained in:
Scott Ehlert 2012-05-21 18:30:56 -05:00
parent f2185a5cfb
commit 75fdf22c20
13 changed files with 42 additions and 22 deletions

BIN
lib/mac/interfaces_i486.a Normal file

Binary file not shown.

BIN
lib/mac/mathlib_i486.a Normal file

Binary file not shown.

BIN
lib/mac/tier1_i486.a Normal file

Binary file not shown.

View File

@ -3,6 +3,8 @@
#
#
OS := $(shell uname -s)
#############################################################################
# Developer configurable items
#############################################################################
@ -24,9 +26,15 @@ SRCDS_DIR = ~/srcds/orangebox
GAME_DIR = $(SRCDS_DIR)/scratchmod
# compiler options (gcc 3.4.1 or above is required - 4.1.2+ recommended)
ifeq "$(OS)" "Darwin"
CC = /usr/bin/clang
CPLUS = /usr/bin/clang++
CLINK = /usr/bin/clang
else
CC = /usr/bin/gcc
CPLUS = /usr/bin/g++
CLINK = /usr/bin/gcc
endif
CPP_LIB = "libstdc++.a libgcc_eh.a"
# put any compiler flags you want passed here
@ -48,6 +56,7 @@ DEBUG = false
#############################################################################
# Things below here shouldn't need to be altered
#############################################################################
OS := $(shell uname -s)
MAKE = make
AR = "ar rvs"
@ -58,18 +67,29 @@ BUILD_OBJ_DIR = $(BUILD_DIR)/obj
# the location of the source code
SRC_DIR = ..
# the location of the Linux static libraries
# the location of the static libraries
ifeq "$(OS)" "Darwin"
LIB_DIR = $(SRC_DIR)/lib/mac
else
LIB_DIR = $(SRC_DIR)/lib/linux
endif
# the CPU target for the build, must be i486 for now
ARCH = i486
ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -msse -m32
ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -msse -msse2 -m32
DEFINES = -D_LINUX -DLINUX -DCOMPILER_GCC -DPOSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \
-D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp
ifeq "$(OS)" "Darwin"
DEFINES = -D_OSX -DOSX
else
DEFINES = -D_LINUX -DLINUX
endif
DEFINES += -DCOMPILER_GCC -DPOSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \
-D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-non-virtual-dtor -Wno-invalid-offsetof
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof
SHLIBEXT = so
SHLIBCFLAGS = -fPIC
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl

View File

@ -218,7 +218,7 @@ extern const int32 ALIGN16 g_SIMD_EveryOtherMask[]; // 0, ~0, 0, ~0
template<class T>
inline T *AlignPointer(void * ptr)
{
unsigned temp = ptr;
unsigned temp = (unsigned)ptr;
temp = ALIGN_VALUE(temp, sizeof(T));
return (T *)temp;
}

View File

@ -31,7 +31,11 @@
#include <wchar.h>
#endif
#include <string.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "tier0/valve_on.h"
#include "commonmacros.h"

View File

@ -32,7 +32,11 @@
#include "wchartypes.h"
#include "tier0/valve_off.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <limits.h>
#include <float.h>
#include <stdlib.h>
@ -334,13 +338,6 @@ typedef unsigned int uint;
#define FLOAT32_MIN FLT_MIN
#define FLOAT64_MIN DBL_MIN
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
// So if being debugged, use INT3 which is precise.
#ifdef OSX
#define DebuggerBreak() if ( Plat_IsInDebugSession() ) __asm { int 3 } else { raise(SIGTRAP); }
#else
#endif
//-----------------------------------------------------------------------------
// Long is evil because it's treated differently by different compilers
// Preventing its use is nasty however. This #define, which should be

View File

@ -336,9 +336,10 @@ public:
void Set(void *);
private:
uint32 m_index;
#if defined(POSIX)
pthread_key_t m_index;
#else
uint32 m_index;
#endif
};
@ -890,7 +891,7 @@ template <> struct CAutoLockTypeDeducer<sizeof(CAlignedThreadFastMutex)> { typed
CAutoLockT< type > UNIQUE_ID( static_cast<const type &>( mutex ) )
#define AUTO_LOCK( mutex ) \
AUTO_LOCK_( CAutoLockTypeDeducer<sizeof(mutex)>::Type_t, mutex )
AUTO_LOCK_( typeof(CAutoLockTypeDeducer<sizeof(mutex)>::Type_t), mutex )
#define AUTO_LOCK_FM( mutex ) \

View File

@ -749,9 +749,9 @@ public:
inline CVProfNode::CVProfNode( const tchar * pszName, int detailLevel, CVProfNode *pParent, const tchar *pBudgetGroupName, int budgetFlags )
: m_pszName( pszName ),
m_nRecursions( 0 ),
m_nCurFrameCalls( 0 ),
m_nPrevFrameCalls( 0 ),
m_nRecursions( 0 ),
m_pParent( pParent ),
m_pChild( NULL ),
m_pSibling( NULL ),

View File

@ -336,7 +336,7 @@ void CUtlBlockMemory<T,I>::Purge( int numElements )
}
int nBlockSize = NumElementsInBlock();
int nBlocksOld = m_nBlocks;
// int nBlocksOld = m_nBlocks;
int nBlocks = ( numElements + nBlockSize - 1 ) / nBlockSize;
// If the number of blocks is the same as the allocated number of blocks, we are done.

View File

@ -232,7 +232,7 @@ void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5Context_t *ctx)
MD5Transform(ctx->buf, (unsigned int *) ctx->in);
//byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, MD5_DIGEST_LENGTH);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
memset(ctx, 0, sizeof(MD5Context_t)); /* In case it's sensitive */
}
//-----------------------------------------------------------------------------

View File

@ -122,8 +122,6 @@ unsigned int CDataManagerBase::FlushAll()
unsigned int CDataManagerBase::Purge( unsigned int nBytesToPurge )
{
unsigned int nTargetSize = MemUsed_Inline() - nBytesToPurge;
if ( nTargetSize < 0 )
nTargetSize = 0;
unsigned int nImpliedCapacity = MemTotal_Inline() - nTargetSize;
return EnsureCapacity( nImpliedCapacity );
}

View File

@ -228,7 +228,7 @@ char *V_strnlwr(char *s, size_t count)
if ( !s )
return s;
while ( --count >= 0 )
while ( count-- )
{
if ( !*s )
break;