mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2024-12-23 01:59:43 +08:00
Rebuilt tier1 and mathlib for OS X using clang.
This commit is contained in:
parent
e0fe50f9f5
commit
664783e773
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
//=============================================================================//
|
||||
#include <quantize.h>
|
||||
#include <tier0/basetypes.h>
|
||||
|
||||
#define N_EXTRAVALUES 1
|
||||
#define N_DIMENSIONS (3+N_EXTRAVALUES)
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <tier0/basetypes.h>
|
||||
|
||||
static int current_ndims;
|
||||
static struct QuantizedValue *current_root;
|
||||
static int current_ssize;
|
||||
|
@ -172,7 +172,7 @@ float _SSE_RSqrtFast(float x)
|
||||
{
|
||||
Assert( s_bMathlibInitialized );
|
||||
|
||||
float rroot;
|
||||
float rroot = 0.0f;
|
||||
#ifdef _WIN32
|
||||
_asm
|
||||
{
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
@ -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;
|
||||
|
@ -336,7 +336,6 @@ void CUtlBlockMemory<T,I>::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.
|
||||
|
@ -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 */
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "tier0/basetypes.h"
|
||||
#include "mempool.h"
|
||||
#include <stdio.h>
|
||||
#ifdef __APPLE__
|
||||
|
@ -226,7 +226,7 @@ char *V_strnlwr(char *s, size_t count)
|
||||
if ( !s )
|
||||
return s;
|
||||
|
||||
while ( --count >= 0 )
|
||||
while ( count-- )
|
||||
{
|
||||
if ( !*s )
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user