summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix')
-rw-r--r--src/unix/Makefile360
-rw-r--r--src/unix/ftola.s2
-rw-r--r--src/unix/linux_common.c347
3 files changed, 81 insertions, 628 deletions
diff --git a/src/unix/Makefile b/src/unix/Makefile
index 793f3c7e..db7802dd 100644
--- a/src/unix/Makefile
+++ b/src/unix/Makefile
@@ -21,6 +21,12 @@ else
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
endif
+BUILD_CLIENT =
+BUILD_CLIENT_SMP =
+BUILD_SERVER =
+BUILD_GAME_SO =
+BUILD_GAME_QVM =
+
#############################################################################
#
# If you require a different configuration from the defaults below, create a
@@ -90,14 +96,6 @@ ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
endif
-ifndef BUILD_CLIENT
-BUILD_CLIENT=1
-endif
-
-ifndef BUILD_SERVER
-BUILD_SERVER=1
-endif
-
#############################################################################
BD=debug-$(PLATFORM)-$(ARCH)
@@ -135,7 +133,6 @@ MKDIR=mkdir
ifeq ($(PLATFORM),linux)
- GLIBC=-glibc
CC=gcc
ifeq ($(ARCH),alpha)
@@ -227,23 +224,6 @@ ifeq ($(PLATFORM),linux)
LDFLAGS+=-m32
endif
- ifeq ($(ARCH),axp)
- TARGETS=\
- $(B)/$(PLATFORM)tremded
- else
- TARGETS=\
- $(B)/$(PLATFORM)tremulous \
- $(B)/$(PLATFORM)tremded \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/qagame.qvm \
- $(B)/base/vm/ui.qvm
-# $(B)/$(PLATFORM)tremulous-smp \
-
- endif
-
else # ifeq Linux
#############################################################################
@@ -251,7 +231,6 @@ else # ifeq Linux
#############################################################################
ifeq ($(PLATFORM),darwin)
- GLIBC=
CC=gcc
# !!! FIXME: calling conventions are still broken! See Bugzilla #2519
@@ -326,17 +305,6 @@ ifeq ($(PLATFORM),darwin)
endif
endif
- TARGETS=\
- $(B)/$(PLATFORM)tremulous \
- $(B)/$(PLATFORM)tremded \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/qagame.qvm \
- $(B)/base/vm/ui.qvm
- $(B)/$(PLATFORM)tremulous-smp \
-
else # ifeq darwin
@@ -382,14 +350,8 @@ ifeq ($(PLATFORM),mingw32)
LDFLAGS+=-m32
endif
- TARGETS=\
- $(B)/$(PLATFORM)tremulous$(BINEXT) \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/qagame.qvm \
- $(B)/base/vm/ui.qvm
+ BUILD_SERVER = 0
+ BUILD_CLIENT_SMP = 0
else # ifeq mingw32
@@ -399,8 +361,6 @@ else # ifeq mingw32
ifeq ($(PLATFORM),freebsd)
- GLIBC= #libc is irrelevant
-
ifneq (,$(findstring alpha,$(shell uname -m)))
ARCH=axp
else #default to i386
@@ -441,21 +401,6 @@ ifeq ($(PLATFORM),freebsd)
CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
- ifeq ($(ARCH),axp)
- TARGETS=\
- $(B)/$(PLATFORM)tremded
- else
- TARGETS=\
- $(B)/$(PLATFORM)tremulous \
- $(B)/$(PLATFORM)tremded \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/qagame.qvm \
- $(B)/base/vm/ui.qvm
- endif
-
else # ifeq freebsd
#############################################################################
@@ -482,17 +427,8 @@ ifeq ($(PLATFORM),netbsd)
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
+ BUILD_CLIENT = 0
+ BUILD_GAME_QVM = 0
else # ifeq netbsd
@@ -503,7 +439,6 @@ else # ifeq netbsd
ifeq ($(PLATFORM),irix)
ARCH=mips #default to MIPS
- GLIBC= #libc is irrelevant
CC=cc
BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 -mips3 \
@@ -518,9 +453,6 @@ ifeq ($(PLATFORM),irix)
LDFLAGS=-ldl -lm
CLIENT_LDFLAGS=-L/usr/X11/$(LIB) -lGL -lX11 -lXext -lm
- TARGETS=$(B)/$(PLATFORM)tremulous \
- $(B)/$(PLATFORM)tremded
-
else # ifeq IRIX
#############################################################################
@@ -529,7 +461,6 @@ else # ifeq IRIX
ifeq ($(PLATFORM),SunOS)
- GLIBC= #libc is irrelevant
CC=gcc
INSTALL=ginstall
MKDIR=gmkdir
@@ -560,9 +491,9 @@ ifeq ($(PLATFORM),SunOS)
OPTIMIZE = -O3 -ffast-math -funroll-loops
ifeq ($(ARCH),sparc)
- OPTIMIZE = -O0 -ffast-math -falign-loops=2 \
+ OPTIMIZE = -O3 -ffast-math -falign-loops=2 \
-falign-jumps=2 -falign-functions=2 -fstrength-reduce \
- -mtune=ultrasparc -mv8plus -munaligned-doubles \
+ -mtune=ultrasparc -mv8plus -mno-faster-structs \
-funroll-loops
BASE_CFLAGS += -DNO_VM_COMPILED
else
@@ -584,6 +515,8 @@ ifeq ($(PLATFORM),SunOS)
THREAD_LDFLAGS=-lpthread
LDFLAGS=-lsocket -lnsl -ldl -lm
+ BOTCFLAGS=-O0
+
ifeq ($(USE_SDL),1)
CLIENT_LDFLAGS=$(shell sdl-config --libs) -L/usr/X11/lib -lGLU -lX11 -lXext
else
@@ -596,31 +529,6 @@ ifeq ($(PLATFORM),SunOS)
LDFLAGS+=-m32
endif
- ifeq ($(ARCH),sparc)
- TARGETS=\
- $(B)/$(PLATFORM)tremulous \
- $(B)/$(PLATFORM)tremded \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/qagame.qvm \
- $(B)/base/vm/ui.qvm \
- $(B)/$(PLATFORM)tremulous-smp
- else
- TARGETS=\
- $(B)/$(PLATFORM)tremulous \
- $(B)/$(PLATFORM)tremded \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/qagame.qvm \
- $(B)/base/vm/ui.qvm \
- $(B)/$(PLATFORM)tremulous-smp
-
- endif
-
else # ifeq SunOS
#############################################################################
@@ -635,12 +543,6 @@ else # ifeq SunOS
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared
- TARGETS=\
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT) \
- $(B)/$(PLATFORM)tremded
-
endif #Linux
endif #darwin
endif #mingw32
@@ -649,30 +551,38 @@ endif #NetBSD
endif #IRIX
endif #SunOS
-ifeq ($(USE_CCACHE),1)
- CC := ccache $(CC)
+TARGETS =
+
+ifneq ($(BUILD_SERVER),0)
+ TARGETS += $(B)/tremded.$(ARCH)$(BINEXT)
endif
-ifneq ($(BUILD_SERVER),1)
- TARGETS := $(subst $(B)/$(PLATFORM)tremded,,$(TARGETS))
+ifneq ($(BUILD_CLIENT),0)
+ TARGETS += $(B)/tremulous.$(ARCH)$(BINEXT)
+ ifneq ($(BUILD_CLIENT_SMP),0)
+ TARGETS += $(B)/tremulous.$(ARCH)$(BINEXT)
+ endif
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) ))))))
+ifneq ($(BUILD_GAME_SO),0)
+ TARGETS += \
+ $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/base/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/base/ui$(ARCH).$(SHLIBEXT)
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) )))
+ifneq ($(BUILD_GAME_QVM),0)
+ ifneq ($(CROSS_COMPILING),1)
+ TARGETS += \
+ $(B)/base/vm/cgame.qvm \
+ $(B)/base/vm/qagame.qvm \
+ $(B)/base/vm/ui.qvm \
+ qvmdeps
+ endif
+endif
+
+ifeq ($(USE_CCACHE),1)
+ CC := ccache $(CC)
endif
ifdef DEFAULT_BASEDIR
@@ -691,7 +601,7 @@ endif
DO_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
DO_SMP_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $<
-DO_BOT_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DBOTLIB -o $@ -c $< # $(SHLIBCFLAGS) # bk001212
+DO_BOT_CC=$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) -DBOTLIB -o $@ -c $< # $(SHLIBCFLAGS) # bk001212
DO_DEBUG_CC=$(CC) $(NOTSHLIBCFLAGS) $(DEBUG_CFLAGS) -o $@ -c $<
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
DO_SHLIB_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
@@ -767,6 +677,7 @@ Q3OBJ = \
$(B)/client/cl_parse.o \
$(B)/client/cl_scrn.o \
$(B)/client/cl_ui.o \
+ $(B)/client/cl_avi.o \
\
$(B)/client/cm_load.o \
$(B)/client/cm_patch.o \
@@ -901,12 +812,21 @@ Q3OBJ = \
$(B)/client/tr_surface.o \
$(B)/client/tr_world.o \
-
ifeq ($(ARCH),i386)
Q3OBJ += $(B)/client/vm_x86.o
+ Q3OBJ += \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+ $(B)/client/ftola.o \
+ $(B)/client/snapvectora.o
endif
ifeq ($(ARCH),x86)
Q3OBJ += $(B)/client/vm_x86.o
+ Q3OBJ += \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+ $(B)/client/ftola.o \
+ $(B)/client/snapvectora.o
endif
ifeq ($(ARCH),x86_64)
Q3OBJ += $(B)/client/vm_x86_64.o
@@ -918,48 +838,9 @@ ifeq ($(ARCH),ppc)
endif
endif
-#platform specific objects
-ifeq ($(PLATFORM),freebsd)
-ifeq ($(ARCH),axp)
- Q3POBJ=
-else
- Q3POBJ=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
- $(B)/client/linux_qgl.o \
- $(B)/client/sdl_glimp.o \
- $(B)/client/linux_glimp.o \
- $(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o
- ifeq ($(ARCH),i386)
- Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
- Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
- endif
-
-endif # FreeBSD-axp
-else
-ifeq ($(PLATFORM),irix)
- Q3POBJ=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/irix_qgl.o \
- $(B)/client/irix_glimp.o \
- $(B)/client/irix_snd.o
-else
ifeq ($(PLATFORM),mingw32)
- Q3POBJ=\
- $(B)/client/linux_common.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o \
- $(B)/client/ftola.o \
- $(B)/client/snapvectora.o \
+ Q3OBJ += \
$(B)/client/win_gamma.o \
$(B)/client/win_glimp.o \
$(B)/client/win_input.o \
@@ -972,123 +853,38 @@ ifeq ($(PLATFORM),mingw32)
$(B)/client/win_wndproc.o \
$(B)/client/win_resource.o
else
-ifeq ($(PLATFORM),linux)
-ifeq ($(ARCH),axp)
- Q3POBJ=
-else
- Q3POBJ=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
- $(B)/client/linux_qgl.o \
- $(B)/client/linux_glimp.o \
- $(B)/client/sdl_glimp.o \
- $(B)/client/linux_joystick.o \
- $(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o \
-
- Q3POBJ_SMP=\
+ Q3OBJ += \
$(B)/client/unix_main.o \
$(B)/client/unix_net.o \
$(B)/client/unix_shared.o \
$(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
$(B)/client/linux_qgl.o \
- $(B)/client/linux_glimp_smp.o \
- $(B)/client/linux_joystick.o \
$(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o
+ $(B)/client/sdl_snd.o
- ifeq ($(ARCH),i386)
- Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
- Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
+ ifeq ($(PLATFORM),linux)
+ Q3OBJ += $(B)/client/linux_joystick.o
endif
-endif #Linux-axp
-
-else
-ifeq ($(PLATFORM),darwin)
- Q3POBJ=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
- $(B)/client/linux_qgl.o \
- $(B)/client/linux_glimp.o \
- $(B)/client/sdl_glimp.o \
- $(B)/client/linux_joystick.o \
- $(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
-
- Q3POBJ_SMP=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
- $(B)/client/linux_qgl.o \
- $(B)/client/sdl_glimp_smp.o \
- $(B)/client/linux_joystick.o \
- $(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
- ifeq ($(ARCH),i386)
- I386OBJS := \
- $(B)/client/ftola.o \
- $(B)/client/snapvectora.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o \
-
- Q3POBJ += $(I386OBJS)
- Q3POBJ_SMP += $(I386OBJS)
+ ifeq ($(USE_SDL),1)
+ ifneq ($(PLATFORM),darwin)
+ BUILD_CLIENT_SMP = 0
+ endif
endif
-else
-ifeq ($(PLATFORM),SunOS)
- Q3POBJ=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
- $(B)/client/linux_qgl.o \
+ Q3POBJ = \
$(B)/client/linux_glimp.o \
- $(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o
+ $(B)/client/sdl_glimp.o
- Q3POBJ_SMP=\
- $(B)/client/unix_main.o \
- $(B)/client/unix_net.o \
- $(B)/client/unix_shared.o \
- $(B)/client/linux_signals.o \
- $(B)/client/linux_common.o \
- $(B)/client/linux_qgl.o \
+ Q3POBJ_SMP = \
$(B)/client/linux_glimp_smp.o \
- $(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o
-
- ifeq ($(ARCH),i386)
- Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o $(B)/client/snd_mixa.o $(B)/client/matha.o
- Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
- endif
-
-endif #SunOS
-endif #Linux
-endif #darwin
-endif #mingw32
-endif #IRIX
-endif #FreeBSD
+ $(B)/client/sdl_glimp_smp.o
+endif
-$(B)/$(PLATFORM)tremulous$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
+$(B)/tremulous.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN)
-$(B)/$(PLATFORM)tremulous-smp$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
+$(B)/tremulous-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(CLIENT_LDFLAGS) \
$(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN)
@@ -1110,6 +906,7 @@ $(B)/client/cl_net_chan.o : $(CDIR)/cl_net_chan.c; $(DO_CC)
$(B)/client/cl_parse.o : $(CDIR)/cl_parse.c; $(DO_CC)
$(B)/client/cl_scrn.o : $(CDIR)/cl_scrn.c; $(DO_CC)
$(B)/client/cl_ui.o : $(CDIR)/cl_ui.c; $(DO_CC)
+$(B)/client/cl_avi.o : $(CDIR)/cl_avi.c; $(DO_CC)
$(B)/client/snd_adpcm.o : $(CDIR)/snd_adpcm.c; $(DO_CC)
$(B)/client/snd_dma.o : $(CDIR)/snd_dma.c; $(DO_CC)
$(B)/client/snd_mem.o : $(CDIR)/snd_mem.c; $(DO_CC)
@@ -1249,7 +1046,6 @@ $(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) $(GL_CFLAGS)
-$(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/sdl_glimp.o : $(UDIR)/sdl_glimp.c; $(DO_CC) $(GL_CFLAGS)
$(B)/client/linux_glimp_smp.o : $(UDIR)/linux_glimp.c; $(DO_SMP_CC) $(GL_CFLAGS)
@@ -1352,7 +1148,6 @@ Q3DOBJ = \
$(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 \
$(B)/ded/unix_shared.o \
@@ -1376,7 +1171,7 @@ ifeq ($(ARCH),ppc)
endif
endif
-$(B)/$(PLATFORM)tremded$(BINEXT): $(Q3DOBJ)
+$(B)/tremded.$(ARCH)$(BINEXT): $(Q3DOBJ)
$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
$(B)/ded/sv_bot.o : $(SDIR)/sv_bot.c; $(DO_DED_CC)
@@ -1434,7 +1229,6 @@ $(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_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)
@@ -1611,11 +1405,11 @@ $(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
+ @if [ ! -d $(COPYDIR)/baseq3 ]; then echo "You need to set COPYDIR to where you installed Trem!"; false; fi
+ $(INSTALL) -s -m 0755 $(BR)/tremulous.$(ARCH)$(BINEXT) $(COPYDIR)/tremulous.$(ARCH)$(BINEXT)
- @if [ -f $(BR)/$(PLATFORM)tremded$(BINEXT) ]; then \
- $(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)tremded$(BINEXT) $(COPYDIR)/tremded
+ @if [ -f $(BR)/tremded.$(ARCH)$(BINEXT) ]; then \
+ $(INSTALL) -s -m 0755 $(BR)/tremded.$(ARCH)$(BINEXT) $(COPYDIR)/tremded.$(ARCH)$(BINEXT); \
fi
-$(MKDIR) -p -m 0755 $(COPYDIR)/base
$(INSTALL) -s -m 0755 $(BR)/base/cgame$(ARCH).$(SHLIBEXT) \
@@ -1655,6 +1449,12 @@ installer: build_release
D_FILES=$(shell find . -name '*.d')
+$(B)/base/vm/vm.d: $(GOBJ) $(CGOBJ) $(UIOBJ)
+ -rm -f $@
+ find $(B)/base -iname '*.d' | xargs sed -e 's/\.o/\.asm/g' > $@
+
+qvmdeps: $(B)/base/vm/vm.d
+
ifneq ($(strip $(D_FILES)),)
include $(D_FILES)
endif
diff --git a/src/unix/ftola.s b/src/unix/ftola.s
index a84f6aae..2459021b 100644
--- a/src/unix/ftola.s
+++ b/src/unix/ftola.s
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "qasm.h"
-#ifdef id386
+#if id386
.data
diff --git a/src/unix/linux_common.c b/src/unix/linux_common.c
deleted file mode 100644
index d7f31189..00000000
--- a/src/unix/linux_common.c
+++ /dev/null
@@ -1,347 +0,0 @@
-#if 0 // not used anymore
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-/**
- * GAS syntax equivalents of the MSVC asm memory calls in common.c
- *
- * The following changes have been made to the asm:
- * 1. Registers are loaded by the inline asm arguments when possible
- * 2. Labels have been changed to local label format (0,1,etc.) to allow inlining
- *
- * HISTORY:
- * AH - Created on 08 Dec 2000
- */
-
-#include <unistd.h> // AH - for size_t
-#include <string.h>
-
-// bk001207 - we need something under Linux, too. Mac?
-#if 1 // defined(C_ONLY) // bk010102 - dedicated?
-void Com_Memcpy (void* dest, const void* src, const size_t count) {
- memcpy(dest, src, count);
-}
-
-void Com_Memset (void* dest, const int val, const size_t count) {
- memset(dest, val, count);
-}
-
-#else
-
-typedef enum {
- PRE_READ, // prefetch assuming that buffer is used for reading only
- PRE_WRITE, // prefetch assuming that buffer is used for writing only
- PRE_READ_WRITE // prefetch assuming that buffer is used for both reading and writing
-} e_prefetch;
-
-void Com_Prefetch (const void *s, const unsigned int bytes, e_prefetch type);
-
-void _copyDWord (unsigned int* dest, const unsigned int constant, const unsigned int count) {
- // MMX version not used on standard Pentium MMX
- // because the dword version is faster (with
- // proper destination prefetching)
- __asm__ __volatile__ (" \
- //mov eax,constant // eax = val \
- //mov edx,dest // dest \
- //mov ecx,count \
- movd %%eax, %%mm0 \
- punpckldq %%mm0, %%mm0 \
-\
- // ensure that destination is qword aligned \
-\
- testl $7, %%edx // qword padding?\
- jz 0f \
- movl %%eax, (%%edx) \
- decl %%ecx \
- addl $4, %%edx \
-\
-0: movl %%ecx, %%ebx \
- andl $0xfffffff0, %%ecx \
- jz 2f \
- jmp 1f \
- .align 16 \
-\
- // funny ordering here to avoid commands \
- // that cross 32-byte boundaries (the \
- // [edx+0] version has a special 3-byte opcode... \
-1: movq %%mm0, 8(%%edx) \
- movq %%mm0, 16(%%edx) \
- movq %%mm0, 24(%%edx) \
- movq %%mm0, 32(%%edx) \
- movq %%mm0, 40(%%edx) \
- movq %%mm0, 48(%%edx) \
- movq %%mm0, 56(%%edx) \
- movq %%mm0, (%%edx)\
- addl $64, %%edx \
- subl $16, %%ecx \
- jnz 1b \
-2: \
- movl %%ebx, %%ecx // ebx = cnt \
- andl $0xfffffff0, %%ecx // ecx = cnt&~15 \
- subl %%ecx, %%ebx \
- jz 6f \
- cmpl $8, %%ebx \
- jl 3f \
-\
- movq %%mm0, (%%edx) \
- movq %%mm0, 8(%%edx) \
- movq %%mm0, 16(%%edx) \
- movq %%mm0, 24(%%edx) \
- addl $32, %%edx \
- subl $8, %%ebx \
- jz 6f \
-\
-3: cmpl $4, %%ebx \
- jl 4f \
- \
- movq %%mm0, (%%edx) \
- movq %%mm0, 8(%%edx) \
- addl $16, %%edx \
- subl $4, %%ebx \
-\
-4: cmpl $2, %%ebx \
- jl 5f \
- movq %%mm0, (%%edx) \
- addl $8, %%edx \
- subl $2, %%ebx \
-\
-5: cmpl $1, %%ebx \
- jl 6f \
- movl %%eax, (%%edx) \
-6: \
- emms \
- "
- : : "a" (constant), "c" (count), "d" (dest)
- : "%ebx", "%edi", "%esi", "cc", "memory");
-}
-
-// optimized memory copy routine that handles all alignment
-// cases and block sizes efficiently
-void Com_Memcpy (void* dest, const void* src, const size_t count) {
- Com_Prefetch (src, count, PRE_READ);
- __asm__ __volatile__ (" \
- pushl %%edi \
- pushl %%esi \
- //mov ecx,count \
- cmpl $0, %%ecx // count = 0 check (just to be on the safe side) \
- je 6f \
- //mov edx,dest \
- movl %0, %%ebx \
- cmpl $32, %%ecx // padding only? \
- jl 1f \
-\
- movl %%ecx, %%edi \
- andl $0xfffffe00, %%edi // edi = count&~31 \
- subl $32, %%edi \
-\
- .align 16 \
-0: \
- movl (%%ebx, %%edi, 1), %%eax \
- movl 4(%%ebx, %%edi, 1), %%esi \
- movl %%eax, (%%edx, %%edi, 1) \
- movl %%esi, 4(%%edx, %%edi, 1) \
- movl 8(%%ebx, %%edi, 1), %%eax \
- movl 12(%%ebx, %%edi, 1), %%esi \
- movl %%eax, 8(%%edx, %%edi, 1) \
- movl %%esi, 12(%%edx, %%edi, 1) \
- movl 16(%%ebx, %%edi, 1), %%eax \
- movl 20(%%ebx, %%edi, 1), %%esi \
- movl %%eax, 16(%%edx, %%edi, 1) \
- movl %%esi, 20(%%edx, %%edi, 1) \
- movl 24(%%ebx, %%edi, 1), %%eax \
- movl 28(%%ebx, %%edi, 1), %%esi \
- movl %%eax, 24(%%edx, %%edi, 1) \
- movl %%esi, 28(%%edx, %%edi, 1) \
- subl $32, %%edi \
- jge 0b \
- \
- movl %%ecx, %%edi \
- andl $0xfffffe00, %%edi \
- addl %%edi, %%ebx // increase src pointer \
- addl %%edi, %%edx // increase dst pointer \
- andl $31, %%ecx // new count \
- jz 6f // if count = 0, get outta here \
-\
-1: \
- cmpl $16, %%ecx \
- jl 2f \
- movl (%%ebx), %%eax \
- movl %%eax, (%%edx) \
- movl 4(%%ebx), %%eax \
- movl %%eax, 4(%%edx) \
- movl 8(%%ebx), %%eax \
- movl %%eax, 8(%%edx) \
- movl 12(%%ebx), %%eax \
- movl %%eax, 12(%%edx) \
- subl $16, %%ecx \
- addl $16, %%ebx \
- addl $16, %%edx \
-2: \
- cmpl $8, %%ecx \
- jl 3f \
- movl (%%ebx), %%eax \
- movl %%eax, (%%edx) \
- movl 4(%%ebx), %%eax \
- subl $8, %%ecx \
- movl %%eax, 4(%%edx) \
- addl $8, %%ebx \
- addl $8, %%edx \
-3: \
- cmpl $4, %%ecx \
- jl 4f \
- movl (%%ebx), %%eax // here 4-7 bytes \
- addl $4, %%ebx \
- subl $4, %%ecx \
- movl %%eax, (%%edx) \
- addl $4, %%edx \
-4: // 0-3 remaining bytes \
- cmpl $2, %%ecx \
- jl 5f \
- movw (%%ebx), %%ax // two bytes \
- cmpl $3, %%ecx // less than 3? \
- movw %%ax, (%%edx) \
- jl 6f \
- movb 2(%%ebx), %%al // last byte \
- movb %%al, 2(%%edx) \
- jmp 6f \
-5: \
- cmpl $1, %%ecx \
- jl 6f \
- movb (%%ebx), %%al \
- movb %%al, (%%edx) \
-6: \
- popl %%esi \
- popl %%edi \
- "
- : : "m" (src), "d" (dest), "c" (count)
- : "%eax", "%ebx", "%edi", "%esi", "cc", "memory");
-}
-
-void Com_Memset (void* dest, const int val, const size_t count)
-{
- unsigned int fillval;
-
- if (count < 8)
- {
- __asm__ __volatile__ (" \
- //mov edx,dest \
- //mov eax, val \
- movb %%al, %%ah \
- movl %%eax, %%ebx \
- andl $0xffff, %%ebx \
- shll $16, %%eax \
- addl %%ebx, %%eax // eax now contains pattern \
- //mov ecx,count \
- cmpl $4, %%ecx \
- jl 0f \
- movl %%eax, (%%edx) // copy first dword \
- addl $4, %%edx \
- subl $4, %%ecx \
- 0: cmpl $2, %%ecx \
- jl 1f \
- movw %%ax, (%%edx) // copy 2 bytes \
- addl $2, %%edx \
- subl $2, %%ecx \
- 1: cmpl $0, %%ecx \
- je 2f \
- movb %%al, (%%edx) // copy single byte \
- 2: \
- "
- : : "d" (dest), "a" (val), "c" (count)
- : "%ebx", "%edi", "%esi", "cc", "memory");
-
- return;
- }
-
- fillval = val;
-
- fillval = fillval|(fillval<<8);
- fillval = fillval|(fillval<<16); // fill dword with 8-bit pattern
-
- _copyDWord ((unsigned int*)(dest),fillval, count/4);
-
- __asm__ __volatile__ (" // padding of 0-3 bytes \
- //mov ecx,count \
- movl %%ecx, %%eax \
- andl $3, %%ecx \
- jz 1f \
- andl $0xffffff00, %%eax \
- //mov ebx,dest \
- addl %%eax, %%edx \
- movl %0, %%eax \
- cmpl $2, %%ecx \
- jl 0f \
- movw %%ax, (%%edx) \
- cmpl $2, %%ecx \
- je 1f \
- movb %%al, 2(%%edx) \
- jmp 1f \
-0: \
- cmpl $0, %%ecx\
- je 1f\
- movb %%al, (%%edx)\
-1: \
- "
- : : "m" (fillval), "c" (count), "d" (dest)
- : "%eax", "%ebx", "%edi", "%esi", "cc", "memory");
-}
-
-void Com_Prefetch (const void *s, const unsigned int bytes, e_prefetch type)
-{
- // write buffer prefetching is performed only if
- // the processor benefits from it. Read and read/write
- // prefetching is always performed.
-
- switch (type)
- {
- case PRE_WRITE : break;
- case PRE_READ:
- case PRE_READ_WRITE:
-
- __asm__ __volatile__ ("\
- //mov ebx,s\
- //mov ecx,bytes\
- cmpl $4096, %%ecx // clamp to 4kB\
- jle 0f\
- movl $4096, %%ecx\
- 0:\
- addl $0x1f, %%ecx\
- shrl $5, %%ecx // number of cache lines\
- jz 2f\
- jmp 1f\
-\
- .align 16\
- 1: testb %%al, (%%edx)\
- addl $32, %%edx\
- decl %%ecx\
- jnz 1b\
- 2:\
- "
- : : "d" (s), "c" (bytes)
- : "%eax", "%ebx", "%edi", "%esi", "memory", "cc");
-
- break;
- }
-}
-
-#endif
-#endif