From 2cbb0a8b22175da7a5b9b15f120f24def39c9abb Mon Sep 17 00:00:00 2001 From: zakk Date: Sat, 27 Aug 2005 02:24:00 +0000 Subject: Ludwig's 1st diff: Some 64bit fixes for x86_64. Also fixes Makefile build. git-svn-id: svn://svn.icculus.org/quake3/trunk@7 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/client/cl_cgame.c | 5 +- code/client/cl_cin.c | 9 ++++ code/client/cl_ui.c | 6 ++- code/game/g_main.c | 1 + code/game/q_shared.h | 2 + code/qcommon/cm_polylib.c | 4 +- code/qcommon/common.c | 3 +- code/qcommon/files.c | 2 +- code/qcommon/md4.c | 2 +- code/qcommon/vm.c | 33 ++++++++++-- code/qcommon/vm_interpreted.c | 2 +- code/renderer/tr_animation.c | 2 +- code/renderer/tr_bsp.c | 2 +- code/renderer/tr_main.c | 12 ++++- code/renderer/tr_model.c | 2 +- code/renderer/tr_shader.c | 1 + code/server/sv_client.c | 10 ++-- code/server/sv_game.c | 6 ++- code/splines/q_shared.h | 2 + code/ui/ui_shared.c | 8 +-- code/unix/Makefile | 114 +++++++++++++++++++++--------------------- code/unix/unix_main.c | 4 ++ code/unix/unix_shared.c | 2 +- 23 files changed, 150 insertions(+), 84 deletions(-) diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c index 56dc01c..19ac57e 100755 --- a/code/client/cl_cgame.c +++ b/code/client/cl_cgame.c @@ -623,7 +623,10 @@ int CL_CgameSystemCalls( int *args ) { Com_Memcpy( VMA(1), VMA(2), args[3] ); return 0; case CG_STRNCPY: - return (int)strncpy( VMA(1), VMA(2), args[3] ); +#warning 64bit broken! + strncpy( VMA(1), VMA(2), args[3] ); +// Com_Printf("%s:%d %s() *** return value of CG_STRNCPY not 64bit clean\n", __FILE__, __LINE__, __FUNCTION__); + return 0; case CG_SIN: return FloatAsInt( sin( VMF(1) ) ); case CG_COS: diff --git a/code/client/cl_cin.c b/code/client/cl_cin.c index f042d23..4f78965 100755 --- a/code/client/cl_cin.c +++ b/code/client/cl_cin.c @@ -1410,6 +1410,10 @@ e_status CIN_RunCinematic (int handle) if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return FMV_EOF; +#warning disabled CIN_RunCinematic +Com_Printf("XXX: %s disabled\n", __FUNCTION__); +return FMV_EOF; + if (cin.currentHandle != handle) { currentHandle = handle; cin.currentHandle = currentHandle; @@ -1489,6 +1493,11 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi Com_sprintf (name, sizeof(name), "%s", arg); } +#warning disabled CIN_PlayCinematic +Com_Printf("XXX: %s disabled, not playing %s\n", __FUNCTION__, name); +return -1; + + if (!(systemBits & CIN_system)) { for ( i = 0 ; i < MAX_VIDEO_HANDLES ; i++ ) { if (!strcmp(cinTable[i].fileName, name) ) { diff --git a/code/client/cl_ui.c b/code/client/cl_ui.c index 96cc07e..2c91991 100755 --- a/code/client/cl_ui.c +++ b/code/client/cl_ui.c @@ -1043,7 +1043,11 @@ int CL_UISystemCalls( int *args ) { return 0; case UI_STRNCPY: - return (int)strncpy( VMA(1), VMA(2), args[3] ); +#warning 64bit broken! +// Com_Printf("%s:%d %s() *** return value of UI_STRNCPY not 64bit clean\n", __FILE__, __LINE__, __FUNCTION__); +// Com_Printf("%s %d\n", VMA(2), args[3]); + strncpy( VMA(1), VMA(2), args[3] ); + return 0; case UI_SIN: return FloatAsInt( sin( VMF(1) ) ); diff --git a/code/game/g_main.c b/code/game/g_main.c index 821ab96..1d262be 100755 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -209,6 +209,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a G_ShutdownGame( arg0 ); return 0; case GAME_CLIENT_CONNECT: +#warning 64bit broken! return (int)ClientConnect( arg0, arg1, arg2 ); case GAME_CLIENT_THINK: ClientThink( arg0 ); diff --git a/code/game/q_shared.h b/code/game/q_shared.h index 1cae4b2..c440c3d 100755 --- a/code/game/q_shared.h +++ b/code/game/q_shared.h @@ -254,6 +254,8 @@ static inline float LittleFloat (const float l) { return FloatSwap(&l); } #define CPUSTRING "linux-i386" #elif defined __axp__ #define CPUSTRING "linux-alpha" +#elif defined __x86_64__ +#define CPUSTRING "linux-x86_64" #else #define CPUSTRING "linux-other" #endif diff --git a/code/qcommon/cm_polylib.c b/code/qcommon/cm_polylib.c index e96c713..e13eaa6 100755 --- a/code/qcommon/cm_polylib.c +++ b/code/qcommon/cm_polylib.c @@ -272,11 +272,11 @@ CopyWinding */ winding_t *CopyWinding (winding_t *w) { - int size; + unsigned long size; winding_t *c; c = AllocWinding (w->numpoints); - size = (int)((winding_t *)0)->p[w->numpoints]; + size = (long)((winding_t *)0)->p[w->numpoints]; Com_Memcpy (c, w, size); return c; } diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 7d8f823..7eadabb 100755 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -145,6 +145,7 @@ void QDECL Com_Printf( const char *fmt, ... ) { char msg[MAXPRINTMSG]; static qboolean opening_qconsole = qfalse; + va_start (argptr,fmt); Q_vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); @@ -1527,7 +1528,7 @@ void Com_InitHunkMemory( void ) { Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / (1024*1024) ); } // cacheline align - s_hunkData = (byte *) ( ( (int)s_hunkData + 31 ) & ~31 ); + s_hunkData = (byte *) ( ( (long)s_hunkData + 31 ) & ~31 ); Hunk_Clear(); Cmd_AddCommand( "meminfo", Com_Meminfo_f ); diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 0e21165..c0f990b 100755 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -2503,7 +2503,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) { sorted[i] = pakfiles[i]; } - qsort( sorted, numfiles, 4, paksort ); + qsort( sorted, numfiles, sizeof(char*), paksort ); for ( i = 0 ; i < numfiles ; i++ ) { pakfile = FS_BuildOSPath( path, dir, sorted[i] ); diff --git a/code/qcommon/md4.c b/code/qcommon/md4.c index 03fbcc2..e530b07 100755 --- a/code/qcommon/md4.c +++ b/code/qcommon/md4.c @@ -12,7 +12,7 @@ typedef unsigned char *POINTER; typedef unsigned short int UINT2; /* UINT4 defines a four byte word */ -typedef unsigned long int UINT4; +typedef unsigned int UINT4; /* MD4.H - header file for MD4C.C */ diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c index a6b1e3c..b509700 100755 --- a/code/qcommon/vm.c +++ b/code/qcommon/vm.c @@ -48,11 +48,14 @@ void VM_VmInfo_f( void ); void VM_VmProfile_f( void ); + +#if 0 // 64bit! // converts a VM pointer to a C pointer and // checks to make sure that the range is acceptable void *VM_VM2C( vmptr_t p, int length ) { return (void *)p; } +#endif void VM_Debug( int level ) { vm_debugLevel = level; @@ -151,6 +154,7 @@ int VM_SymbolToValue( vm_t *vm, const char *symbol ) { VM_SymbolForCompiledPointer ===================== */ +#if 0 // 64bit! const char *VM_SymbolForCompiledPointer( vm_t *vm, void *code ) { int i; @@ -172,6 +176,7 @@ const char *VM_SymbolForCompiledPointer( vm_t *vm, void *code ) { // now look up the bytecode instruction pointer return VM_ValueToSymbol( vm, i ); } +#endif @@ -445,6 +450,11 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *), Com_Error( ERR_FATAL, "VM_Create: bad parms" ); } +#if !defined(__i386__) && !defined(__ppc__) + if(interpret >= VMI_COMPILED) + interpret = VMI_BYTECODE; +#endif + remaining = Hunk_MemoryRemaining(); // see if we already have the VM @@ -669,9 +679,6 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) { vm_t *oldVM; int r; int i; - int args[16]; - va_list ap; - if ( !vm ) { Com_Error( ERR_FATAL, "VM_Call with NULL vm" ); @@ -688,6 +695,8 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) { // if we have a dll loaded, call it directly if ( vm->entryPoint ) { //rcg010207 - see dissertation at top of VM_DllSyscall() in this file. + int args[16]; + va_list ap; va_start(ap, callnum); for (i = 0; i < sizeof (args) / sizeof (args[i]); i++) { args[i] = va_arg(ap, int); @@ -698,10 +707,24 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) { args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15]); +#if defined(__ppc__) || defined(__i386__) } else if ( vm->compiled ) { r = VM_CallCompiled( vm, &callnum ); +#endif } else { - r = VM_CallInterpreted( vm, &callnum ); + struct { + int callnum; + int args[16]; + } a; + va_list ap; + + a.callnum = callnum; + va_start(ap, callnum); + for (i = 0; i < sizeof (a.args) / sizeof (a.args[0]); i++) { + a.args[i] = va_arg(ap, int); + } + va_end(ap); + r = VM_CallInterpreted( vm, &a.callnum ); } if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL @@ -820,7 +843,7 @@ void VM_LogSyscalls( int *args ) { f = fopen("syscalls.log", "w" ); } callnum++; - fprintf(f, "%i: %i (%i) = %i %i %i %i\n", callnum, args - (int *)currentVM->dataBase, + fprintf(f, "%i: %li (%i) = %i %i %i %i\n", callnum, args - (int *)currentVM->dataBase, args[0], args[1], args[2], args[3], args[4] ); } diff --git a/code/qcommon/vm_interpreted.c b/code/qcommon/vm_interpreted.c index 2c0087f..e2d69a7 100755 --- a/code/qcommon/vm_interpreted.c +++ b/code/qcommon/vm_interpreted.c @@ -479,7 +479,7 @@ nextInstruction2: src = (int *)&image[ r0&dataMask ]; dest = (int *)&image[ r1&dataMask ]; - if ( ( (int)src | (int)dest | count ) & 3 ) { + if ( ( (long)src | (long)dest | count ) & 3 ) { Com_Error( ERR_DROP, "OP_BLOCK_COPY not dword aligned" ); } count >>= 2; diff --git a/code/renderer/tr_animation.c b/code/renderer/tr_animation.c index fe06097..61b9057 100755 --- a/code/renderer/tr_animation.c +++ b/code/renderer/tr_animation.c @@ -87,7 +87,7 @@ void RB_SurfaceAnim( md4Surface_t *surface ) { } header = (md4Header_t *)((byte *)surface + surface->ofsHeader); - frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] ); + frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] ); frame = (md4Frame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.frame * frameSize ); diff --git a/code/renderer/tr_bsp.c b/code/renderer/tr_bsp.c index 1f5db42..f9d8829 100755 --- a/code/renderer/tr_bsp.c +++ b/code/renderer/tr_bsp.c @@ -328,7 +328,7 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, msurface_t *surf, int numIndexes = LittleLong( ds->numIndexes ); // create the srfSurfaceFace_t - sfaceSize = ( int ) &((srfSurfaceFace_t *)0)->points[numPoints]; + sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[numPoints]; ofsIndexes = sfaceSize; sfaceSize += sizeof( int ) * numIndexes; diff --git a/code/renderer/tr_main.c b/code/renderer/tr_main.c index 1c92579..54ae106 100755 --- a/code/renderer/tr_main.c +++ b/code/renderer/tr_main.c @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "tr_local.h" +#include // memcpy + trGlobals_t tr; static float s_flipMatrix[16] = { @@ -1003,7 +1005,13 @@ qsort replacement ================= */ -#define SWAP_DRAW_SURF(a,b) temp=((int *)a)[0];((int *)a)[0]=((int *)b)[0];((int *)b)[0]=temp; temp=((int *)a)[1];((int *)a)[1]=((int *)b)[1];((int *)b)[1]=temp; +static inline void SWAP_DRAW_SURF(drawSurf_t* a, drawSurf_t* b) +{ + drawSurf_t t; + memcpy(&t, a, sizeof(t)); + memcpy(a, b, sizeof(t)); + memcpy(b, &t, sizeof(t)); +} /* this parameter defines the cutoff between using quick sort and insertion sort for arrays; arrays with lengths shorter or equal to the @@ -1046,9 +1054,11 @@ void qsortFast ( int stkptr; /* stack for saving sub-array to be processed */ int temp; +#if 0 if ( sizeof(drawSurf_t) != 8 ) { ri.Error( ERR_DROP, "change SWAP_DRAW_SURF macro" ); } +#endif /* Note: the number of stack entries required is no more than 1 + log2(size), so 30 is sufficient for any array */ diff --git a/code/renderer/tr_model.c b/code/renderer/tr_model.c index f6fcac4..2b92917 100755 --- a/code/renderer/tr_model.c +++ b/code/renderer/tr_model.c @@ -418,7 +418,7 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) { // we don't need to swap tags in the renderer, they aren't used // swap all the frames - frameSize = (int)( &((md4Frame_t *)0)->bones[ md4->numBones ] ); + frameSize = (size_t)( &((md4Frame_t *)0)->bones[ md4->numBones ] ); for ( i = 0 ; i < md4->numFrames ; i++, frame++) { frame = (md4Frame_t *) ( (byte *)md4 + md4->ofsFrames + i * frameSize ); frame->radius = LittleFloat( frame->radius ); diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c index b554f34..4e4face 100755 --- a/code/renderer/tr_shader.c +++ b/code/renderer/tr_shader.c @@ -43,6 +43,7 @@ static char **shaderTextHashTable[MAX_SHADERTEXT_HASH]; return a hash value for the filename ================ */ +#warning TODO: check if long is ok here static long generateHashValue( const char *fname, const int size ) { int i; long hash; diff --git a/code/server/sv_client.c b/code/server/sv_client.c index 1756bab..0b17fe5 100755 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -239,7 +239,7 @@ void SV_DirectConnect( netadr_t from ) { int challenge; char *password; int startIndex; - char *denied; + int denied; int count; Com_DPrintf ("SVC_DirectConnect ()\n"); @@ -420,13 +420,13 @@ gotnewcl: Q_strncpyz( newcl->userinfo, userinfo, sizeof(newcl->userinfo) ); // get the game a chance to reject this connection or modify the userinfo - denied = (char *)VM_Call( gvm, GAME_CLIENT_CONNECT, clientNum, qtrue, qfalse ); // firstTime = qtrue + denied = VM_Call( gvm, GAME_CLIENT_CONNECT, clientNum, qtrue, qfalse ); // firstTime = qtrue if ( denied ) { // we can't just use VM_ArgPtr, because that is only valid inside a VM_Call - denied = VM_ExplicitArgPtr( gvm, (int)denied ); + char *str = VM_ExplicitArgPtr( gvm, denied ); - NET_OutOfBandPrint( NS_SERVER, from, "print\n%s\n", denied ); - Com_DPrintf ("Game rejected a connection: %s.\n", denied); + NET_OutOfBandPrint( NS_SERVER, from, "print\n%s\n", str ); + Com_DPrintf ("Game rejected a connection: %s.\n", str); return; } diff --git a/code/server/sv_game.c b/code/server/sv_game.c index f99466d..387b1a8 100755 --- a/code/server/sv_game.c +++ b/code/server/sv_game.c @@ -828,7 +828,11 @@ int SV_GameSystemCalls( int *args ) { return 0; case TRAP_STRNCPY: - return (int)strncpy( VMA(1), VMA(2), args[3] ); +#warning 64bit broken! +// Com_Printf("%s:%d %s() *** return value of TRAP_STRNCPY not 64bit clean\n", __FILE__, __LINE__, __FUNCTION__); +// Com_Printf("%s %d\n", VMA(2), args[3]); + strncpy( VMA(1), VMA(2), args[3] ); + return 0; case TRAP_SIN: return FloatAsInt( sin( VMF(1) ) ); diff --git a/code/splines/q_shared.h b/code/splines/q_shared.h index faaaa22..2fd3f2d 100755 --- a/code/splines/q_shared.h +++ b/code/splines/q_shared.h @@ -200,6 +200,8 @@ void Sys_PumpEvents( void ); #define CPUSTRING "linux-i386" #elif defined __axp__ #define CPUSTRING "linux-alpha" +#elif defined __x86_64__ +#define CPUSTRING "linux-x86_64" #else #define CPUSTRING "linux-other" #endif diff --git a/code/ui/ui_shared.c b/code/ui/ui_shared.c index 95d93d8..0856726 100755 --- a/code/ui/ui_shared.c +++ b/code/ui/ui_shared.c @@ -132,16 +132,16 @@ qboolean UI_OutOfMemory() { return a hash value for the string ================ */ -static long hashForString(const char *str) { +static unsigned hashForString(const char *str) { int i; - long hash; + unsigned hash; char letter; hash = 0; i = 0; while (str[i] != '\0') { letter = tolower(str[i]); - hash+=(long)(letter)*(i+119); + hash+=(unsigned)(letter)*(i+119); i++; } hash &= (HASH_TABLE_SIZE-1); @@ -162,7 +162,7 @@ static stringDef_t *strHandle[HASH_TABLE_SIZE]; const char *String_Alloc(const char *p) { int len; - long hash; + unsigned hash; stringDef_t *str, *last; static const char *staticNULL = ""; diff --git a/code/unix/Makefile b/code/unix/Makefile index 0595cd4..258d1ca 100755 --- a/code/unix/Makefile +++ b/code/unix/Makefile @@ -60,7 +60,7 @@ BLIBDIR=$(MOUNT_DIR)/botlib NDIR=$(MOUNT_DIR)/null UIDIR=$(MOUNT_DIR)/ui Q3UIDIR=$(MOUNT_DIR)/q3_ui -FTDIR=$(MOUNT_DIR)/ft2 +#FTDIR=$(MOUNT_DIR)/ft2 JPDIR=$(MOUNT_DIR)/jpeg-6 SPLNDIR=$(MOUNT_DIR)/splines @@ -80,6 +80,7 @@ DLL_ONLY=false # bk010215 - TODO - add all defaults / kill Ryan +LIB=lib ifeq ($(PLATFORM),linux) ifneq (,$(findstring libc6,$(shell if [ -e /lib/libc.so.6* ];then echo libc6;fi))) @@ -100,18 +101,27 @@ ifeq ($(PLATFORM),linux) RPMARCH=ppc VENDOR=unknown DLL_ONLY=true + else + ifneq (,$(findstring x86_64,$(shell uname -m))) + MESADIR=../Mesa/ + ARCH=x86_64 + RPMARCH=x86_64 + VENDOR=unknown + DLL_ONLY=false + LIB=lib64 else #default to i386 MESADIR=../Mesa/ ARCH=i386 RPMARCH=i386 VENDOR=unknown DLL_ONLY=false + endif endif endif # bk001205: no mo' -I/usr/include/glide, no FX # bk001205: no mo' -Dstricmp=strcasecmp, see q_shared.h - BASE_CFLAGS = -pipe -fsigned-char + BASE_CFLAGS = -pipe -Wall # rcg010216: DLL_ONLY for PPC ifeq ($(strip $(DLL_ONLY)),true) BASE_CFLAGS += -DDLL_ONLY @@ -125,9 +135,9 @@ ifeq ($(PLATFORM),linux) # bk001205 - took out -O to get assertions (NDEBUG) # bk001206 - MALLOC_CHECK in addition to ZONE_DEBUG # TTimo 03/30/2001 temporary took out -Werror for initial merge - DEBUG_CFLAGS = $(BASE_CFLAGS) -g -Wall -Werror + DEBUG_CFLAGS = $(BASE_CFLAGS) -g DEBUG_CFLAGS += -DNO_MOUSEGRAB - DEBUG_CFLAGS += -O + DEBUG_CFLAGS += -O0 # DEBUG_CFLAGS=$(BASE_CFLAGS) -g -Wall -O ifeq ($(ARCH),axp) CC=pgcc @@ -136,17 +146,21 @@ ifeq ($(PLATFORM),linux) ifeq ($(ARCH),ppc) NEWPGCC=/loki/global/ppc/bin/gcc CC=$(NEWPGCC) - RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce + RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce + endif + ifeq ($(ARCH),x86_64) + CC=gcc + CXX=g++ + RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce else #NEWPGCC=/usr/local/gcc-2.95.2/bin/gcc # bk001205 #NEWPGCC=/loki/global/x86/bin/gcc - NEWPGCC=/usr/bin/gcc - CC=$(shell if [ -f $(NEWPGCC) ]; then echo $(NEWPGCC); else echo pgcc; fi ) - CXX=/usr/bin/g++ + CC=gcc + CXX=g++ # TTimo: legacy RELEASE_CFLAGS # NOTE: the -fomit-frame-pointer option leads to an unstable binary on my test box if it was built on the main box # but building on the Mdk 7.2 baseline seems to work - RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce + RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce # TTimo: use this for building on P3 gcc 2.95.3 libc2.2 for all targets (experimental! -fomit-fram-pointer removed) # RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce endif @@ -163,7 +177,7 @@ ifeq ($(PLATFORM),linux) THREAD_LDFLAGS=-lpthread LDFLAGS=-ldl -lm - GLLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm + GLLDFLAGS=-L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm ifeq ($(ARCH),axp) TARGETS=\ @@ -240,7 +254,7 @@ THREAD_LDFLAGS=-lpthread LDFLAGS=-lm #GLLDFLAGS=-L/usr/X11R6/lib -L$(MESADIR)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm #GLLDFLAGS=-L/usr/X11/lib -lGL -lX11 -lXext -lm -GLLDFLAGS=-L/usr/X11R6/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm +GLLDFLAGS=-L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm ifeq ($(ARCH),axp) TARGETS=\ @@ -284,7 +298,7 @@ ARFLAGS=ar rv RANLIB=ranlib LDFLAGS=-ldl -lm -GLLDFLAGS=-L/usr/X11/lib -lGL -lX11 -lXext -lm +GLLDFLAGS=-L/usr/X11/$(LIB) -lGL -lX11 -lXext -lm TARGETS=$(B)/sgiquake3 \ $(B)/q3ded @@ -516,20 +530,6 @@ Q3OBJ = \ $(B)/client/unix_net.o \ $(B)/client/unix_shared.o \ \ - $(B)/client/ahoptim.o \ - $(B)/client/autohint.o \ - $(B)/client/ftbase.o \ - $(B)/client/ftdebug.o \ - $(B)/client/ftglyph.o \ - $(B)/client/ftinit.o \ - $(B)/client/ftmm.o \ - $(B)/client/ftsystem.o \ - $(B)/client/raster1.o \ - $(B)/client/sfnt.o \ - $(B)/client/sfobjs.o \ - $(B)/client/smooth.o \ - $(B)/client/truetype.o -# \ # $(B)/client/q_parse.o \ # $(B)/client/math_quaternion.o \ # $(B)/client/util_str.o \ @@ -544,6 +544,10 @@ Q3OBJ = \ Q3OBJ += $(B)/client/vm_x86.o endif + ifeq ($(ARCH),x86_64) + Q3OBJ += $(B)/client/vm_none.o + endif + ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) Q3OBJ += $(B)/client/vm_ppc.o @@ -555,6 +559,7 @@ Q3OBJ = \ #platform specific objects ifeq ($(PLATFORM),freebsd) Q3POBJ=\ + $(B)/client/linux_signals.o \ $(B)/client/linux_common.o \ $(B)/client/linux_qgl.o \ $(B)/client/linux_glimp.o \ @@ -575,6 +580,7 @@ ifeq ($(ARCH),axp) Q3POBJ= else Q3POBJ=\ + $(B)/client/linux_signals.o \ $(B)/client/linux_common.o \ $(B)/client/linux_qgl.o \ $(B)/client/linux_glimp.o \ @@ -584,6 +590,7 @@ else $(B)/client/matha.o \ Q3POBJ_SMP=\ + $(B)/client/linux_signals.o \ $(B)/client/linux_common.o \ $(B)/client/linux_qgl.o \ $(B)/client/linux_glimp_smp.o \ @@ -751,6 +758,7 @@ $(B)/client/irix_glimp.o : $(UDIR)/irix_glimp.c; $(DO_CC) $(B)/client/irix_glimp_smp.o : $(UDIR)/irix_glimp.c; $(DO_SMP_CC) $(B)/client/irix_snd.o : $(UDIR)/irix_snd.c; $(DO_CC) $(B)/client/irix_input.o : $(UDIR)/irix_input.c; $(DO_CC) +$(B)/client/linux_signals.o : $(UDIR)/linux_signals.c; $(DO_CC) $(B)/client/linux_common.o : $(UDIR)/linux_common.c; $(DO_CC) $(B)/client/linux_glimp.o : $(UDIR)/linux_glimp.c; $(DO_CC) $(GL_CFLAGS) $(B)/client/linux_glimp_smp.o : $(UDIR)/linux_glimp.c; $(DO_SMP_CC) $(GL_CFLAGS) @@ -767,6 +775,10 @@ $(B)/client/snapvector.o : $(UDIR)/snapvector.nasm; $(DO_NASM) $(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC) endif +ifeq ($(ARCH),x86_64) +$(B)/client/vm_none.o : $(CMDIR)/vm_none.c; $(DO_CC) +endif + ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) $(B)/client/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC) @@ -777,20 +789,6 @@ $(B)/client/unzip.o : $(CMDIR)/unzip.c; $(DO_CC) $(B)/client/vm.o : $(CMDIR)/vm.c; $(DO_CC) $(B)/client/vm_interpreted.o : $(CMDIR)/vm_interpreted.c; $(DO_CC) -$(B)/client/ahoptim.o : $(FTDIR)/ahoptim.c; $(DO_CC) -$(B)/client/autohint.o : $(FTDIR)/autohint.c; $(DO_CC) -$(B)/client/ftbase.o : $(FTDIR)/ftbase.c; $(DO_CC) -$(B)/client/ftdebug.o : $(FTDIR)/ftdebug.c; $(DO_CC) -$(B)/client/ftglyph.o : $(FTDIR)/ftglyph.c; $(DO_CC) -$(B)/client/ftinit.o : $(FTDIR)/ftinit.c; $(DO_CC) -$(B)/client/ftmm.o : $(FTDIR)/ftmm.c; $(DO_CC) -$(B)/client/ftsystem.o : $(FTDIR)/ftsystem.c; $(DO_CC) -$(B)/client/raster1.o : $(FTDIR)/raster1.c; $(DO_CC) -DFT_FLAT_COMPILE -$(B)/client/sfnt.o : $(FTDIR)/sfnt.c; $(DO_CC) -$(B)/client/sfobjs.o : $(FTDIR)/sfobjs.c; $(DO_CC) -$(B)/client/smooth.o : $(FTDIR)/smooth.c; $(DO_CC) -DFT_FLAT_COMPILE -$(B)/client/truetype.o : $(FTDIR)/truetype.c; $(DO_CC) - # TTimo: took out splines code #$(B)/client/q_parse.o : $(SPLNDIR)/q_parse.cpp; $(DO_CXX) #$(B)/client/math_quaternion.o : $(SPLNDIR)/math_quaternion.cpp; $(DO_CXX) @@ -908,6 +906,7 @@ Q3DOBJ = \ $(B)/ded/l_script.o \ $(B)/ded/l_struct.o \ \ + $(B)/ded/linux_signals.o \ $(B)/ded/linux_common.o \ $(B)/ded/unix_main.o \ $(B)/ded/unix_net.o \ @@ -921,6 +920,10 @@ ifeq ($(ARCH),i386) Q3DOBJ += $(B)/ded/vm_x86.o $(B)/ded/ftol.o $(B)/ded/snapvector.o endif +ifeq ($(ARCH),x86_64) + Q3DOBJ += $(B)/ded/vm_none.o +endif + ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) Q3DOBJ += $(B)/ded/vm_ppc.o @@ -984,7 +987,8 @@ $(B)/ded/l_precomp.o : $(BLIBDIR)/l_precomp.c; $(DO_BOT_CC) $(B)/ded/l_script.o : $(BLIBDIR)/l_script.c; $(DO_BOT_CC) $(B)/ded/l_struct.o : $(BLIBDIR)/l_struct.c; $(DO_BOT_CC) -$(B)/ded/linux_common.o : $(UDIR)/linux_common.c; $(DO_CC) +$(B)/ded/linux_signals.o : $(UDIR)/linux_signals.c; $(DO_DED_CC) +$(B)/ded/linux_common.o : $(UDIR)/linux_common.c; $(DO_DED_CC) $(B)/ded/unix_main.o : $(UDIR)/unix_main.c; $(DO_DED_CC) $(B)/ded/unix_net.o : $(UDIR)/unix_net.c; $(DO_DED_CC) $(B)/ded/unix_shared.o : $(UDIR)/unix_shared.c; $(DO_DED_CC) @@ -1001,6 +1005,10 @@ $(B)/ded/ftol.o : $(UDIR)/ftol.nasm; $(DO_NASM) $(B)/ded/snapvector.o : $(UDIR)/snapvector.nasm; $(DO_NASM) endif +ifeq ($(ARCH),x86_64) +$(B)/ded/vm_none.o : $(CMDIR)/vm_none.c; $(DO_DED_CC) +endif + ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) $(B)/ded/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_DED_CC) @@ -1410,7 +1418,7 @@ $(B)/baseq3/ui/ui_spskill.o : $(Q3UIDIR)/ui_spskill.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_startserver.o : $(Q3UIDIR)/ui_startserver.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_team.o : $(Q3UIDIR)/ui_team.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_teamorders.o : $(Q3UIDIR)/ui_teamorders.c; $(DO_SHLIB_CC) -$(B)/baseq3/ui/ui_syscalls.o : $(Q3UIDIR)/ui_syscalls.c; $(DO_SHLIB_CC) +$(B)/baseq3/ui/ui_syscalls.o : $(UIDIR)/ui_syscalls.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_video.o : $(Q3UIDIR)/ui_video.c; $(DO_SHLIB_CC) # bk001205 - these wre the only SHLIB compiles in 1.17 @@ -1613,20 +1621,6 @@ Q3SOBJ = \ $(B)/q3static/unix_net.o \ $(B)/q3static/unix_shared.o \ \ - $(B)/q3static/ahoptim.o \ - $(B)/q3static/autohint.o \ - $(B)/q3static/ftbase.o \ - $(B)/q3static/ftdebug.o \ - $(B)/q3static/ftglyph.o \ - $(B)/q3static/ftinit.o \ - $(B)/q3static/ftmm.o \ - $(B)/q3static/ftsystem.o \ - $(B)/q3static/raster1.o \ - $(B)/q3static/sfnt.o \ - $(B)/q3static/sfobjs.o \ - $(B)/q3static/smooth.o \ - $(B)/q3static/truetype.o \ - \ $(B)/q3static/linux_qgl.o \ $(B)/q3static/linux_glimp.o \ $(B)/q3static/linux_joystick.o \ @@ -1638,6 +1632,10 @@ ifeq ($(ARCH),i386) Q3SOBJ += $(B)/q3static/vm_x86.o endif +ifeq ($(ARCH),x86_64) + Q3SOBJ += $(B)/q3static/vm_none.o +endif + ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) Q3SOBJ += $(B)/q3static/vm_ppc.o @@ -1793,6 +1791,10 @@ ifeq ($(ARCH),i386) $(B)/q3static/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC) -DQ3_STATIC endif +ifeq ($(ARCH),x86_64) + $(B)/q3static/vm_none.o : $(CMDIR)/vm_none.c; $(DO_CC) -DQ3_STATIC +endif + ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) $(B)/q3static/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC) -DQ3_STATIC diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c index a0fd08a..b9c5449 100755 --- a/code/unix/unix_main.c +++ b/code/unix/unix_main.c @@ -349,6 +349,8 @@ void Sys_Init(void) #if defined __linux__ #if defined __i386__ Cvar_Set( "arch", "linux i386" ); +#elif defined __x86_64__ + Cvar_Set( "arch", "linux x86_64" ); #elif defined __alpha__ Cvar_Set( "arch", "linux alpha" ); #elif defined __sparc__ @@ -724,6 +726,8 @@ void *Sys_LoadDll( const char *name, char *fqpath , getcwd(curpath, sizeof(curpath)); #if defined __i386__ snprintf (fname, sizeof(fname), "%si386.so", name); +#elif defined __x86_64__ + snprintf (fname, sizeof(fname), "%sx86_64.so", name); #elif defined __powerpc__ //rcg010207 - PPC support. snprintf (fname, sizeof(fname), "%sppc.so", name); #elif defined __axp__ diff --git a/code/unix/unix_shared.c b/code/unix/unix_shared.c index 742cffe..beb69c4 100755 --- a/code/unix/unix_shared.c +++ b/code/unix/unix_shared.c @@ -139,7 +139,7 @@ int Sys_XTimeToSysTime (unsigned long xtime) #endif //#if 0 // bk001215 - see snapvector.nasm for replacement -#if (defined __APPLE__) // rcg010206 - using this for PPC builds... +#if !(defined __i386__) // rcg010206 - using this for PPC builds... long fastftol( float f ) { // bk001213 - from win32/win_shared.c //static int tmp; // __asm fld f -- cgit v1.2.3