diff --git a/lib/mac/mathlib_i486.a b/lib/mac/mathlib_i486.a index 17f5246e..be75fd9f 100644 Binary files a/lib/mac/mathlib_i486.a and b/lib/mac/mathlib_i486.a differ diff --git a/lib/mac/tier1_i486.a b/lib/mac/tier1_i486.a index 11c297c4..d4ba40aa 100644 Binary files a/lib/mac/tier1_i486.a and b/lib/mac/tier1_i486.a differ diff --git a/linux_sdk/Makefile b/linux_sdk/Makefile index 9963177a..dd3dd73b 100644 --- a/linux_sdk/Makefile +++ b/linux_sdk/Makefile @@ -3,6 +3,8 @@ # # +OS := $(shell uname -s) + ############################################################################# # Developer configurable items ############################################################################# @@ -24,10 +26,17 @@ SRCDS_DIR = ~/srcds/orangebox GAME_DIR = $(SRCDS_DIR)/scratchmod # compiler options (gcc 3.4.1 or above is required - 4.1.2+ recommended) -CC = /usr/bin/gcc-4.2 -CPLUS = /usr/bin/g++-4.2 -CLINK = /usr/bin/gcc-4.2 -CPP_LIB = "libstdc++.a libgcc_eh.a" +ifeq "$(OS)" "Darwin" +CC = /usr/bin/clang +CPLUS = /usr/bin/clang++ +CLINK = /usr/bin/clang +CPP_LIB = +else +CC = /usr/bin/gcc +CPLUS = /usr/bin/g++ +CLINK = /usr/bin/gcc +CPP_LIB = $(SRCDS_DIR)/bin/libstdc++.so.6 $(SRCDS_DIR)/bin/libgcc_s.so.1 +endif # put any compiler flags you want passed here USER_CFLAGS = @@ -58,21 +67,37 @@ 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 -m32 -DEFINES = -D_LINUX -DLINUX -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 +SHLIBEXT = dylib +SHLIBLDFLAGS = -dynamiclib -mmacosx-version-min=10.5 +SHLIBSUFFIX = +else +DEFINES = -D_LINUX -DLINUX +SHLIBEXT = so +SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl +SHLIBSUFFIX = +endif + +DEFINES +=-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 -Wconversion -Wno-non-virtual-dtor -Wno-invalid-offsetof -SHLIBEXT = so +BASE_CFLAGS = -fno-strict-aliasing -Wall -Wsign-compare -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \ + -Wno-delete-non-virtual-dtor SHLIBCFLAGS = -fPIC -SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl # Flags passed to the c compiler CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -O3 $(BASE_CFLAGS) @@ -88,7 +113,7 @@ DBG_CFLAGS = "$(DEFINES) $(ARCH_CFLAGS) -g -ggdb $(BASE_CFLAGS) $(UNDEF)" # define list passed to make for the sub makefile BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG) \ BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SRC_DIR=$(SRC_DIR) \ - LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \ + LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS="$(SHLIBLDFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBSUFFIX=$(SHLIBSUFFIX) \ CLINK=$(CLINK) CFLAGS="$(CFLAGS)" DBG_CFLAGS=$(DBG_CFLAGS) LDFLAGS=$(LDFLAGS) \ DEFINES="$(DEFINES)" DBG_DEFINES=$(DBG_DEFINES) \ ARCH=$(ARCH) SRCDS_DIR=$(SRCDS_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \ @@ -111,9 +136,9 @@ check: if [ ! -e "$(LIB_DIR)/tier1_i486.a" ]; then $(MAKE) tier1;fi if [ ! -e "$(LIB_DIR)/mathlib_i486.a" ]; then $(MAKE) mathlib;fi if [ ! -e "$(LIB_DIR)/choreoobjects_i486.a" ]; then $(MAKE) choreo;fi - if [ ! -f "tier0_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/tier0_i486.so .; fi - if [ ! -f "vstdlib_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/vstdlib_i486.so .; fi - if [ ! -f "steam_api_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/steam_api_i486.so .; fi + if [ ! -f "libtier0$(SHLIBSUFFIX).$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libtier0$(SHLIBSUFFIX).$(SHLIBEXT) .; fi + if [ ! -f "libvstdlib$(SHLIBSUFFIX).$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libvstdlib$(SHLIBSUFFIX).$(SHLIBEXT) .; fi + if [ ! -f "libsteam_api.$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libsteam_api.$(SHLIBEXT) .; fi vcpm: check if [ ! -e "vcpm" ]; then $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES);fi diff --git a/mathlib/imagequant.cpp b/mathlib/imagequant.cpp index bdba52a6..b84d2c5c 100644 --- a/mathlib/imagequant.cpp +++ b/mathlib/imagequant.cpp @@ -6,6 +6,7 @@ // //=============================================================================// #include +#include #define N_EXTRAVALUES 1 #define N_DIMENSIONS (3+N_EXTRAVALUES) diff --git a/mathlib/quantize.cpp b/mathlib/quantize.cpp index dbaf15f2..2c8c12e5 100644 --- a/mathlib/quantize.cpp +++ b/mathlib/quantize.cpp @@ -21,6 +21,8 @@ #include +#include + static int current_ndims; static struct QuantizedValue *current_root; static int current_ssize; diff --git a/mathlib/sse.cpp b/mathlib/sse.cpp index d524d2b7..d39c24f8 100644 --- a/mathlib/sse.cpp +++ b/mathlib/sse.cpp @@ -172,7 +172,7 @@ float _SSE_RSqrtFast(float x) { Assert( s_bMathlibInitialized ); - float rroot; + float rroot = 0.0f; #ifdef _WIN32 _asm { diff --git a/public/tier0/fasttimer.h b/public/tier0/fasttimer.h index 0678ebd6..d59a93a5 100644 --- a/public/tier0/fasttimer.h +++ b/public/tier0/fasttimer.h @@ -233,8 +233,8 @@ private: unsigned m_nIters; CCycleCount m_Total; CCycleCount m_Peak; - bool m_fReport; - const tchar *m_pszName; +// bool m_fReport; +// const tchar *m_pszName; }; // -------------------------------------------------------------------------- // diff --git a/public/tier1/CommandBuffer.h b/public/tier1/CommandBuffer.h index 0a3c4433..da8a1c15 100644 --- a/public/tier1/CommandBuffer.h +++ b/public/tier1/CommandBuffer.h @@ -113,7 +113,7 @@ private: bool ParseArgV0( CUtlBuffer &buf, char *pArgv0, int nMaxLen, const char **pArgs ); char m_pArgSBuffer[ ARGS_BUFFER_LENGTH ]; - int m_nLastUsedArgSSize; +// int m_nLastUsedArgSSize; int m_nArgSBufferSize; CUtlFixedLinkedList< Command_t > m_Commands; int m_nCurrentTick; diff --git a/public/tier1/utlblockmemory.h b/public/tier1/utlblockmemory.h index 8d174466..7f08c40b 100644 --- a/public/tier1/utlblockmemory.h +++ b/public/tier1/utlblockmemory.h @@ -336,7 +336,6 @@ void CUtlBlockMemory::Purge( int numElements ) } int nBlockSize = NumElementsInBlock(); - 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. diff --git a/tier1/checksum_md5.cpp b/tier1/checksum_md5.cpp index d41f1de2..0c4aeefa 100644 --- a/tier1/checksum_md5.cpp +++ b/tier1/checksum_md5.cpp @@ -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 */ } //----------------------------------------------------------------------------- diff --git a/tier1/datamanager.cpp b/tier1/datamanager.cpp index 24935280..fd3ddf1a 100644 --- a/tier1/datamanager.cpp +++ b/tier1/datamanager.cpp @@ -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 ); } diff --git a/tier1/mempool.cpp b/tier1/mempool.cpp index 14663a39..18b9007a 100644 --- a/tier1/mempool.cpp +++ b/tier1/mempool.cpp @@ -4,6 +4,7 @@ // //===========================================================================// +#include "tier0/basetypes.h" #include "mempool.h" #include #ifdef __APPLE__ diff --git a/tier1/strtools.cpp b/tier1/strtools.cpp index 3188f209..76b6da44 100644 --- a/tier1/strtools.cpp +++ b/tier1/strtools.cpp @@ -226,7 +226,7 @@ char *V_strnlwr(char *s, size_t count) if ( !s ) return s; - while ( --count >= 0 ) + while ( count-- ) { if ( !*s ) break;