summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-12-29 00:58:58 +0000
committerTim Angus <tim@ngus.net>2005-12-29 00:58:58 +0000
commitb128225d7083486ed1566de5a76e602baeecc8a5 (patch)
treed447b04f9b2ccd0ac21e74b256e33c322abc9725
parent4f03afa80f3c26996b750c69781c00b0e7c2058f (diff)
* Merged ioq3-r451 into trunk
-rwxr-xr-xcross-make-mingw.sh8
-rwxr-xr-xmisc/merge-ioq3-into-trem.sh1
-rw-r--r--src/client/snd_openal.c4
-rw-r--r--src/master/Makefile8
-rw-r--r--src/qcommon/q_platform.h26
-rw-r--r--src/renderer/qgl.h2
-rw-r--r--src/renderer/tr_bsp.c2
-rw-r--r--src/tools/asm/Makefile1
-rw-r--r--src/tools/lcc/Makefile3
-rw-r--r--src/unix/Makefile150
-rw-r--r--src/win32/win_main.c4
11 files changed, 152 insertions, 57 deletions
diff --git a/cross-make-mingw.sh b/cross-make-mingw.sh
new file mode 100755
index 00000000..bb9c23e9
--- /dev/null
+++ b/cross-make-mingw.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+PREFIX=/usr/local/cross-tools
+TARGET=i386-mingw32msvc
+PATH="$PREFIX/bin:$PREFIX/$TARGET/bin:$PATH"
+export PATH
+export PLATFORM=mingw32
+exec make $*
diff --git a/misc/merge-ioq3-into-trem.sh b/misc/merge-ioq3-into-trem.sh
index d6baaed7..416d6dcb 100755
--- a/misc/merge-ioq3-into-trem.sh
+++ b/misc/merge-ioq3-into-trem.sh
@@ -31,6 +31,7 @@ rm -f `find -iname "*.def"`
rm -f `find -iname "*.q3asm"`
rm -f `find -iname "*.mak"`
rm -f code/tools/lcc/makefile.nt
+rm -f code/win32/msvc/
# Remove Linux docs
rm -rf code/unix/LinuxSupport/
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c
index 2639d75d..6c795e2c 100644
--- a/src/client/snd_openal.c
+++ b/src/client/snd_openal.c
@@ -856,7 +856,7 @@ static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
src = S_AL_SrcAlloc( priority, entityNum, -1 );
if( src == -1 )
{
- Com_Printf( S_COLOR_RED "ERROR: Failed to allocate source "
+ Com_DPrintf( S_COLOR_YELLOW "WARNING: Failed to allocate source "
"for loop sfx %d on entity %d\n", sfx, entityNum );
return;
}
@@ -1587,7 +1587,7 @@ qboolean S_AL_Init( soundInterface_t *si )
// New console variables
s_alPrecache = Cvar_Get( "s_alPrecache", "1", CVAR_ARCHIVE );
s_alGain = Cvar_Get( "s_alGain", "0.4", CVAR_ARCHIVE );
- s_alSources = Cvar_Get( "s_alSources", "64", CVAR_ARCHIVE );
+ s_alSources = Cvar_Get( "s_alSources", "96", CVAR_ARCHIVE );
s_alDopplerFactor = Cvar_Get( "s_alDopplerFactor", "1.0", CVAR_ARCHIVE );
s_alDopplerSpeed = Cvar_Get( "s_alDopplerSpeed", "2200", CVAR_ARCHIVE );
s_alMinDistance = Cvar_Get( "s_alMinDistance", "80", CVAR_ARCHIVE );
diff --git a/src/master/Makefile b/src/master/Makefile
index 0e953bc3..df2deed4 100644
--- a/src/master/Makefile
+++ b/src/master/Makefile
@@ -1,7 +1,5 @@
-ARCH=$(shell uname -m | sed -e s/i.86/i386/)
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
-BD_DEBUG=debug-$(ARCH)$(PLATFORM)
-BD_RELEASE=release-$(ARCH)$(PLATFORM)
+BD_DEBUG=debug-$(PLATFORM)-$(ARCH)
+BD_RELEASE=release-$(PLATFORM)-$(ARCH)
ifeq ($(PLATFORM),mingw32)
BINEXT=.exe
@@ -49,4 +47,4 @@ makedirs:
@if [ ! -d $(BD_RELEASE) ];then $(MKDIR) $(BD_RELEASE);fi
@if [ ! -d $(BD_DEBUG) ];then $(MKDIR) $(BD_DEBUG);fi
-.PHONY: all clean
+.PHONY: all clean release debug makedirs
diff --git a/src/qcommon/q_platform.h b/src/qcommon/q_platform.h
index cb8e66ff..92e5be1a 100644
--- a/src/qcommon/q_platform.h
+++ b/src/qcommon/q_platform.h
@@ -193,6 +193,32 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
+//================================================================ NetBSD ===
+
+// This is very much like the FreeBSD one and can probably be merged
+#ifdef __NetBSD__
+
+#include <machine/endian.h>
+
+#define OS_STRING "netbsd"
+#define ID_INLINE inline
+#define PATH_SEP '/'
+
+#ifdef __i386__
+#define ARCH_STRING "i386"
+// Netbsd has alot of platforms
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define Q3_BIG_ENDIAN
+#else
+#define Q3_LITTLE_ENDIAN
+#endif
+
+#define DLL_EXT ".so"
+
+#endif
+
//================================================================= SUNOS ===
#ifdef __sun
diff --git a/src/renderer/qgl.h b/src/renderer/qgl.h
index b9d8d3a2..e1945f8b 100644
--- a/src/renderer/qgl.h
+++ b/src/renderer/qgl.h
@@ -43,7 +43,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
#include <windows.h>
-#include <gl/gl.h>
+#include <GL/gl.h>
#elif defined(MACOS_X)
diff --git a/src/renderer/tr_bsp.c b/src/renderer/tr_bsp.c
index 5cc03b04..eb57da8f 100644
--- a/src/renderer/tr_bsp.c
+++ b/src/renderer/tr_bsp.c
@@ -1215,7 +1215,7 @@ void R_MovePatchSurfacesToHunk(void) {
Com_Memcpy( hunkgrid->widthLodError, grid->widthLodError, grid->width * 4 );
hunkgrid->heightLodError = ri.Hunk_Alloc( grid->height * 4, h_low );
- Com_Memcpy( grid->heightLodError, grid->heightLodError, grid->height * 4 );
+ Com_Memcpy( hunkgrid->heightLodError, grid->heightLodError, grid->height * 4 );
R_FreeSurfaceGridMesh( grid );
diff --git a/src/tools/asm/Makefile b/src/tools/asm/Makefile
index 0d64f14d..f03025ca 100644
--- a/src/tools/asm/Makefile
+++ b/src/tools/asm/Makefile
@@ -1,6 +1,5 @@
# yeah, couldn't do more simple really
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
ifeq ($(PLATFORM),mingw32)
BINEXT=.exe
else
diff --git a/src/tools/lcc/Makefile b/src/tools/lcc/Makefile
index 03e152c2..381b48ee 100644
--- a/src/tools/lcc/Makefile
+++ b/src/tools/lcc/Makefile
@@ -1,4 +1,3 @@
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
TEMPDIR=/tmp
A=.a
O=.o
@@ -19,7 +18,7 @@ RANLIB=ranlib
DIFF=diff
RM=rm -f
RMDIR=rmdir
-BUILDDIR=build
+BUILDDIR=build-$(PLATFORM)-$(ARCH)
BD=$(BUILDDIR)/
ifeq ($(USE_CCACHE),1)
diff --git a/src/unix/Makefile b/src/unix/Makefile
index 6070a846..793f3c7e 100644
--- a/src/unix/Makefile
+++ b/src/unix/Makefile
@@ -12,18 +12,13 @@
# GNU Make required
#
-PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
-PLATFORM_RELEASE=$(shell uname -r)
+COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
-# Apple does some things a little differently...
-ifeq ($(PLATFORM),darwin)
- ARCH:= $(shell uname -p | sed -e s/i.86/i386/)
+ifeq ($(COMPILE_PLATFORM),darwin)
+ # Apple does some things a little differently...
+ COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/)
else
- ARCH:=$(shell uname -m | sed -e s/i.86/i386/)
-endif
-
-ifeq ($(ARCH),powerpc)
- ARCH:=ppc
+ COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
endif
#############################################################################
@@ -36,6 +31,31 @@ endif
#############################################################################
-include Makefile.local
+ifndef PLATFORM
+PLATFORM=$(COMPILE_PLATFORM)
+endif
+export PLATFORM
+
+ifndef ARCH
+ARCH=$(COMPILE_ARCH)
+endif
+
+ifeq ($(ARCH),powerpc)
+ ARCH=ppc
+endif
+export ARCH
+
+ifneq ($(PLATFORM),$(COMPILE_PLATFORM))
+ CROSS_COMPILING=1
+else
+ CROSS_COMPILING=0
+
+ ifneq ($(ARCH),$(COMPILE_ARCH))
+ CROSS_COMPILING=1
+ endif
+endif
+export CROSS_COMPILING
+
ifndef COPYDIR
COPYDIR="/usr/local/games/tremulous"
endif
@@ -49,11 +69,6 @@ ifndef GENERATE_DEPENDENCIES
GENERATE_DEPENDENCIES=1
endif
-# Used for building with mingw
-ifndef DXSDK_DIR
-DXSDK_DIR=C:/DXSDK
-endif
-
ifndef USE_CCACHE
USE_CCACHE=0
endif
@@ -85,8 +100,8 @@ endif
#############################################################################
-BD=debug$(ARCH)$(GLIBC)
-BR=release$(ARCH)$(GLIBC)
+BD=debug-$(PLATFORM)-$(ARCH)
+BR=release-$(PLATFORM)-$(ARCH)
CDIR=$(MOUNT_DIR)/client
SDIR=$(MOUNT_DIR)/server
RDIR=$(MOUNT_DIR)/renderer
@@ -161,8 +176,8 @@ ifeq ($(PLATFORM),linux)
OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -funroll-loops \
-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-fstrength-reduce
- # experimental x86_64 jit compiler! you need as
- #HAVE_VM_COMPILED = true
+ # experimental x86_64 jit compiler! you need GNU as
+ HAVE_VM_COMPILED = true
else
ifeq ($(ARCH),i386)
OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math \
@@ -331,13 +346,10 @@ else # ifeq darwin
ifeq ($(PLATFORM),mingw32)
- GLIBC=-mingw
CC=gcc
WINDRES=windres
- ifeq ($(ARCH),i386)
- ARCH=x86
- endif
+ ARCH=x86
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
@@ -345,8 +357,6 @@ ifeq ($(PLATFORM),mingw32)
BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1
endif
- DX_CFLAGS = -I$(DXSDK_DIR)/Include
-
GL_CFLAGS =
MINGW_CFLAGS = -DDONT_TYPEDEF_INT32
@@ -449,6 +459,44 @@ ifeq ($(PLATFORM),freebsd)
else # ifeq freebsd
#############################################################################
+# SETUP AND BUILD -- NETBSD
+#############################################################################
+
+ifeq ($(PLATFORM),netbsd)
+
+ ifeq ($(shell uname -m),i386)
+ ARCH=i386
+ endif
+
+ CC=gcc
+ LDFLAGS=-lm
+ SHLIBEXT=so
+ SHLIBCFLAGS=-fPIC
+ SHLIBLDFLAGS=-shared $(LDFLAGS)
+ THREAD_LDFLAGS=-lpthread
+
+ BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
+ DEBUG_CFLAGS=$(BASE_CFLAGS) -g
+
+ ifneq ($(ARCH),i386)
+ BASE_CFLAGS += -DNO_VM_COMPILED
+ endif
+
+ ifeq ($(ARCH),i386)
+ TARGETS=\
+ $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/base/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/$(PLATFORM)tremded
+ else
+ TARGETS=\
+ $(B)/$(PLATFORM)tremded
+
+ endif
+
+else # ifeq netbsd
+
+#############################################################################
# SETUP AND BUILD -- IRIX
#############################################################################
@@ -597,6 +645,7 @@ endif #Linux
endif #darwin
endif #mingw32
endif #FreeBSD
+endif #NetBSD
endif #IRIX
endif #SunOS
@@ -610,12 +659,20 @@ endif
ifneq ($(BUILD_CLIENT),1)
TARGETS := \
- $(subst $(B)/base/cgame$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/base/ui$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/base/vm/cgame.qvm,,\
- $(subst $(B)/base/vm/ui.qvm,,\
- $(subst $(B)/$(PLATFORM)tremulous-smp$(BINEXT),,\
- $(subst $(B)/$(PLATFORM)tremulous$(BINEXT),,$(TARGETS) ))))))
+ $(subst $(B)/base/cgame$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/base/ui$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/base/vm/cgame.qvm,,\
+ $(subst $(B)/base/vm/ui.qvm,,\
+ $(subst $(B)/$(PLATFORM)tremulous-smp$(BINEXT),,\
+ $(subst $(B)/$(PLATFORM)tremulous$(BINEXT),,$(TARGETS) ))))))
+endif
+
+# Never build qvms when cross-compiling
+ifeq ($(CROSS_COMPILING),1)
+ TARGETS := \
+ $(subst $(B)/base/vm/qagame.qvm,,\
+ $(subst $(B)/base/vm/cgame.qvm,,\
+ $(subst $(B)/base/vm/ui.qvm,,$(TARGETS) )))
endif
ifdef DEFAULT_BASEDIR
@@ -684,9 +741,14 @@ makedirs:
Q3LCC=../tools/q3lcc$(BINEXT)
Q3ASM=../tools/q3asm$(BINEXT)
+ifeq ($(CROSS_COMPILING),1)
+tools:
+ echo QVM tools not built when cross-compiling
+else
tools:
$(MAKE) -C ../tools/lcc install
$(MAKE) -C ../tools/asm install
+endif
DO_Q3LCC=$(Q3LCC) -o $@ $<
@@ -1202,16 +1264,16 @@ $(B)/client/matha.o : $(UDIR)/matha.s; $(DO_AS)
$(B)/client/ftola.o : $(UDIR)/ftola.s; $(DO_AS)
$(B)/client/snapvectora.o : $(UDIR)/snapvectora.s; $(DO_AS)
-$(B)/client/win_gamma.o : $(W32DIR)/win_gamma.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_glimp.o : $(W32DIR)/win_glimp.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_input.o : $(W32DIR)/win_input.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_main.o : $(W32DIR)/win_main.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_net.o : $(W32DIR)/win_net.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_qgl.o : $(W32DIR)/win_qgl.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_shared.o : $(W32DIR)/win_shared.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_snd.o : $(W32DIR)/win_snd.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_syscon.o : $(W32DIR)/win_syscon.c; $(DO_CC) $(DX_CFLAGS)
-$(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC) $(DX_CFLAGS)
+$(B)/client/win_gamma.o : $(W32DIR)/win_gamma.c; $(DO_CC)
+$(B)/client/win_glimp.o : $(W32DIR)/win_glimp.c; $(DO_CC)
+$(B)/client/win_input.o : $(W32DIR)/win_input.c; $(DO_CC)
+$(B)/client/win_main.o : $(W32DIR)/win_main.c; $(DO_CC)
+$(B)/client/win_net.o : $(W32DIR)/win_net.c; $(DO_CC)
+$(B)/client/win_qgl.o : $(W32DIR)/win_qgl.c; $(DO_CC)
+$(B)/client/win_shared.o : $(W32DIR)/win_shared.c; $(DO_CC)
+$(B)/client/win_snd.o : $(W32DIR)/win_snd.c; $(DO_CC)
+$(B)/client/win_syscon.o : $(W32DIR)/win_syscon.c; $(DO_CC)
+$(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC)
$(B)/client/win_resource.o : $(W32DIR)/winquake.rc; $(DO_WINDRES)
$(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC)
@@ -1551,8 +1613,10 @@ $(B)/base/qcommon/%.asm: $(CMDIR)/%.c
copyfiles: build_release
@if [ ! -d $(COPYDIR)/base ]; then echo "You need to set COPYDIR to where you installed Quake III!"; false; fi
$(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)tremulous$(BINEXT) $(COPYDIR)/tremulous
- #$(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)tremulous-smp$(BINEXT) $(COPYDIR)/tremulous-smp
- $(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)tremded$(BINEXT) $(COPYDIR)/tremded
+
+ @if [ -f $(BR)/$(PLATFORM)tremded$(BINEXT) ]; then \
+ $(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)tremded$(BINEXT) $(COPYDIR)/tremded
+ fi
-$(MKDIR) -p -m 0755 $(COPYDIR)/base
$(INSTALL) -s -m 0755 $(BR)/base/cgame$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/base/.
diff --git a/src/win32/win_main.c b/src/win32/win_main.c
index 61851c1a..73d0f485 100644
--- a/src/win32/win_main.c
+++ b/src/win32/win_main.c
@@ -48,7 +48,7 @@ static char sys_cmdline[MAX_STRING_CHARS];
#define ALT_SPANK
#ifdef ALT_SPANK
#include <stdio.h>
-#include <sys\stat.h>
+#include <sys/stat.h>
int fh = 0;
@@ -529,7 +529,6 @@ extern char *FS_BuildOSPath( const char *base, const char *game, const char *qp
// fqpath buffersize must be at least MAX_QPATH+1 bytes long
void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPoint)(long, ...),
long (QDECL *systemcalls)(long, ...) ) {
- static int lastWarning = 0;
HINSTANCE libHandle;
void (QDECL *dllEntry)( long (QDECL *syscallptr)(long, ...) );
char *basepath;
@@ -537,6 +536,7 @@ void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPo
char *gamedir;
char *fn;
#ifdef NDEBUG
+ static int lastWarning = 0;
int timestamp;
int ret;
#endif