aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-12-29 00:04:41 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-12-29 00:04:41 +0000
commit85b16a6050111701725b7f6eb335da97cea23de1 (patch)
tree6cfe5acc5c1d998ecf16a8298a0c8200b1393ec0 /code
parent36fa51ec1544557d4ce722e1fadf97bbea7b4d5b (diff)
downloadioquake3-aero-85b16a6050111701725b7f6eb335da97cea23de1.tar.gz
ioquake3-aero-85b16a6050111701725b7f6eb335da97cea23de1.zip
* Support for MinGW cross compilation
git-svn-id: svn://svn.icculus.org/quake3/trunk@451 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/renderer/qgl.h2
-rw-r--r--code/tools/asm/Makefile1
-rw-r--r--code/tools/lcc/Makefile3
-rw-r--r--code/unix/Makefile112
-rw-r--r--code/win32/win_main.c4
5 files changed, 73 insertions, 49 deletions
diff --git a/code/renderer/qgl.h b/code/renderer/qgl.h
index c1a2b1d..75547a8 100644
--- a/code/renderer/qgl.h
+++ b/code/renderer/qgl.h
@@ -42,7 +42,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/code/tools/asm/Makefile b/code/tools/asm/Makefile
index 0d64f14..f03025c 100644
--- a/code/tools/asm/Makefile
+++ b/code/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/code/tools/lcc/Makefile b/code/tools/lcc/Makefile
index 03e152c..381b48e 100644
--- a/code/tools/lcc/Makefile
+++ b/code/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/code/unix/Makefile b/code/unix/Makefile
index e47a948..ecb6b12 100644
--- a/code/unix/Makefile
+++ b/code/unix/Makefile
@@ -11,18 +11,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
#############################################################################
@@ -35,6 +30,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/quake3"
endif
@@ -48,11 +68,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
@@ -84,8 +99,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
@@ -343,13 +358,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
@@ -357,8 +369,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
@@ -685,16 +695,27 @@ endif
ifneq ($(BUILD_CLIENT),1)
TARGETS := \
- $(subst $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/baseq3/ui$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/missionpack/ui$(ARCH).$(SHLIBEXT),,\
- $(subst $(B)/baseq3/vm/cgame.qvm,,\
- $(subst $(B)/baseq3/vm/ui.qvm,,\
- $(subst $(B)/missionpack/vm/cgame.qvm,,\
- $(subst $(B)/missionpack/vm/ui.qvm,,\
- $(subst $(B)/$(PLATFORM)quake3-smp$(BINEXT),,\
- $(subst $(B)/$(PLATFORM)quake3$(BINEXT),,$(TARGETS) ))))))))))
+ $(subst $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/baseq3/ui$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/missionpack/ui$(ARCH).$(SHLIBEXT),,\
+ $(subst $(B)/baseq3/vm/cgame.qvm,,\
+ $(subst $(B)/baseq3/vm/ui.qvm,,\
+ $(subst $(B)/missionpack/vm/cgame.qvm,,\
+ $(subst $(B)/missionpack/vm/ui.qvm,,\
+ $(subst $(B)/$(PLATFORM)quake3-smp$(BINEXT),,\
+ $(subst $(B)/$(PLATFORM)quake3$(BINEXT),,$(TARGETS) ))))))))))
+endif
+
+# Never build qvms when cross-compiling
+ifeq ($(CROSS_COMPILING),1)
+ TARGETS := \
+ $(subst $(B)/baseq3/vm/qagame.qvm,,\
+ $(subst $(B)/baseq3/vm/cgame.qvm,,\
+ $(subst $(B)/baseq3/vm/ui.qvm,,\
+ $(subst $(B)/missionpack/vm/qagame.qvm,,\
+ $(subst $(B)/missionpack/vm/cgame.qvm,,\
+ $(subst $(B)/missionpack/vm/ui.qvm,,$(TARGETS) ))))))
endif
ifdef DEFAULT_BASEDIR
@@ -769,9 +790,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 $@ $<
@@ -1287,16 +1313,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)
diff --git a/code/win32/win_main.c b/code/win32/win_main.c
index ea73fb5..9c97183 100644
--- a/code/win32/win_main.c
+++ b/code/win32/win_main.c
@@ -47,7 +47,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;
@@ -528,7 +528,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;
@@ -536,6 +535,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