mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-10 11:59:58 -05:00
Quack 3: Arena
This commit is contained in:
committed by
GitHub
parent
0bf99969fd
commit
40035fa235
478
solaris/Makefile.OLD
Normal file
478
solaris/Makefile.OLD
Normal file
@ -0,0 +1,478 @@
|
||||
#
|
||||
# Quake2 Makefile for Solaris
|
||||
#
|
||||
# Jan '98 by Zoid <zoid@idsoftware.com>
|
||||
#
|
||||
|
||||
ifneq (,$(findstring i86pc,$(shell uname -m)))
|
||||
ARCH=i386
|
||||
else
|
||||
ARCH=sparc
|
||||
endif
|
||||
|
||||
MOUNT_DIR=/chest/Quake2/code
|
||||
|
||||
BUILD_DEBUG_DIR=debug$(ARCH)
|
||||
BUILD_RELEASE_DIR=release$(ARCH)
|
||||
CLIENT_DIR=$(MOUNT_DIR)/client
|
||||
SERVER_DIR=$(MOUNT_DIR)/server
|
||||
COMMON_DIR=$(MOUNT_DIR)/qcommon
|
||||
SOLARIS_DIR=$(MOUNT_DIR)/solaris
|
||||
GAME_DIR=$(MOUNT_DIR)/game
|
||||
XATRIX_DIR=$(MOUNT_DIR)/xatrix
|
||||
CTF_DIR=$(MOUNT_DIR)/game
|
||||
NULL_DIR=$(MOUNT_DIR)/null
|
||||
|
||||
ARCH=i386
|
||||
|
||||
CC=gcc
|
||||
BASE_CFLAGS=-Dstricmp=strcasecmp
|
||||
RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -fomit-frame-pointer -fno-strength-reduce -funroll-loops -fexpensive-optimizations
|
||||
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
|
||||
LDFLAGS=-ldl -lm -lnsl -lsocket
|
||||
|
||||
SHLIBEXT=so
|
||||
|
||||
SHLIBCFLAGS=-fPIC
|
||||
SHLIBLDFLAGS=-G
|
||||
|
||||
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
|
||||
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||
|
||||
#############################################################################
|
||||
# SETUP AND BUILD
|
||||
#############################################################################
|
||||
|
||||
TARGETS=$(BUILDDIR)/quake2 $(BUILDDIR)/game$(ARCH).$(SHLIBEXT)
|
||||
|
||||
build_debug:
|
||||
@-mkdir $(BUILD_DEBUG_DIR) \
|
||||
$(BUILD_DEBUG_DIR)/client \
|
||||
$(BUILD_DEBUG_DIR)/game
|
||||
$(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
build_release:
|
||||
@-mkdir $(BUILD_RELEASE_DIR) \
|
||||
$(BUILD_RELEASE_DIR)/client \
|
||||
$(BUILD_RELEASE_DIR)/game
|
||||
$(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS)"
|
||||
|
||||
all: build_debug build_release
|
||||
|
||||
targets: $(TARGETS)
|
||||
|
||||
#############################################################################
|
||||
# CLIENT/SERVER
|
||||
#############################################################################
|
||||
|
||||
QUAKE2_OBJS = \
|
||||
$(BUILDDIR)/client/cl_cin.o \
|
||||
$(BUILDDIR)/client/cl_ents.o \
|
||||
$(BUILDDIR)/client/cl_fx.o \
|
||||
$(BUILDDIR)/client/cl_input.o \
|
||||
$(BUILDDIR)/client/cl_inv.o \
|
||||
$(BUILDDIR)/client/cl_main.o \
|
||||
$(BUILDDIR)/client/cl_parse.o \
|
||||
$(BUILDDIR)/client/cl_pred.o \
|
||||
$(BUILDDIR)/client/cl_tent.o \
|
||||
$(BUILDDIR)/client/cl_scrn.o \
|
||||
$(BUILDDIR)/client/cl_view.o \
|
||||
$(BUILDDIR)/client/console.o \
|
||||
$(BUILDDIR)/client/keys.o \
|
||||
$(BUILDDIR)/client/menu.o \
|
||||
$(BUILDDIR)/client/qmenu.o \
|
||||
$(BUILDDIR)/client/m_flash.o \
|
||||
\
|
||||
$(BUILDDIR)/client/cmd.o \
|
||||
$(BUILDDIR)/client/cmodel.o \
|
||||
$(BUILDDIR)/client/common.o \
|
||||
$(BUILDDIR)/client/cvar.o \
|
||||
$(BUILDDIR)/client/files.o \
|
||||
$(BUILDDIR)/client/md4.o \
|
||||
$(BUILDDIR)/client/net_chan.o \
|
||||
\
|
||||
$(BUILDDIR)/client/sv_ccmds.o \
|
||||
$(BUILDDIR)/client/sv_ents.o \
|
||||
$(BUILDDIR)/client/sv_game.o \
|
||||
$(BUILDDIR)/client/sv_init.o \
|
||||
$(BUILDDIR)/client/sv_main.o \
|
||||
$(BUILDDIR)/client/sv_send.o \
|
||||
$(BUILDDIR)/client/sv_user.o \
|
||||
$(BUILDDIR)/client/sv_world.o \
|
||||
\
|
||||
$(BUILDDIR)/client/snd_dma.o \
|
||||
$(BUILDDIR)/client/snd_mem.o \
|
||||
$(BUILDDIR)/client/snd_mix.o \
|
||||
\
|
||||
$(BUILDDIR)/client/cd_null.o \
|
||||
$(BUILDDIR)/client/q_shsolaris.o \
|
||||
$(BUILDDIR)/client/vid_null.o \
|
||||
$(BUILDDIR)/client/ref_null.o \
|
||||
$(BUILDDIR)/client/in_null.o \
|
||||
$(BUILDDIR)/client/snddma_null.o \
|
||||
$(BUILDDIR)/client/sys_solaris.o \
|
||||
$(BUILDDIR)/client/glob.o \
|
||||
$(BUILDDIR)/client/net_udp.o \
|
||||
\
|
||||
$(BUILDDIR)/client/q_shared.o \
|
||||
$(BUILDDIR)/client/pmove.o
|
||||
|
||||
$(BUILDDIR)/quake2 : $(QUAKE2_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(LDFLAGS)
|
||||
|
||||
$(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_ents.o : $(CLIENT_DIR)/cl_ents.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_fx.o : $(CLIENT_DIR)/cl_fx.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_input.o : $(CLIENT_DIR)/cl_input.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_inv.o : $(CLIENT_DIR)/cl_inv.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_main.o : $(CLIENT_DIR)/cl_main.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_parse.o : $(CLIENT_DIR)/cl_parse.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_pred.o : $(CLIENT_DIR)/cl_pred.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_tent.o : $(CLIENT_DIR)/cl_tent.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_scrn.o : $(CLIENT_DIR)/cl_scrn.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_view.o : $(CLIENT_DIR)/cl_view.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/console.o : $(CLIENT_DIR)/console.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/keys.o : $(CLIENT_DIR)/keys.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/menu.o : $(CLIENT_DIR)/menu.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/qmenu.o : $(CLIENT_DIR)/qmenu.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/m_flash.o : $(GAME_DIR)/m_flash.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cmd.o : $(COMMON_DIR)/cmd.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cmodel.o : $(COMMON_DIR)/cmodel.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/common.o : $(COMMON_DIR)/common.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cvar.o : $(COMMON_DIR)/cvar.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/files.o : $(COMMON_DIR)/files.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/md4.o : $(COMMON_DIR)/md4.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/net_chan.o : $(COMMON_DIR)/net_chan.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/q_shared.o : $(GAME_DIR)/q_shared.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/pmove.o : $(COMMON_DIR)/pmove.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_ccmds.o : $(SERVER_DIR)/sv_ccmds.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_ents.o : $(SERVER_DIR)/sv_ents.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_game.o : $(SERVER_DIR)/sv_game.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_init.o : $(SERVER_DIR)/sv_init.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_main.o : $(SERVER_DIR)/sv_main.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_send.o : $(SERVER_DIR)/sv_send.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_user.o : $(SERVER_DIR)/sv_user.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_world.o : $(SERVER_DIR)/sv_world.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cd_null.o : $(NULL_DIR)/cd_null.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/q_shsolaris.o : $(SOLARIS_DIR)/q_shsolaris.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/vid_null.o : $(NULL_DIR)/vid_null.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/ref_null.o : $(NULL_DIR)/ref_null.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/snddma_null.o : $(NULL_DIR)/snddma_null.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/snd_dma.o : $(CLIENT_DIR)/snd_dma.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/snd_mem.o : $(CLIENT_DIR)/snd_mem.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/snd_mix.o : $(CLIENT_DIR)/snd_mix.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/in_null.o : $(NULL_DIR)/in_null.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sys_solaris.o : $(SOLARIS_DIR)/sys_solaris.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/glob.o : $(SOLARIS_DIR)/glob.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/net_udp.o : $(SOLARIS_DIR)/net_udp.c
|
||||
$(DO_CC)
|
||||
|
||||
#############################################################################
|
||||
# GAME
|
||||
#############################################################################
|
||||
|
||||
GAME_OBJS = \
|
||||
$(BUILDDIR)/game/g_ai.o \
|
||||
$(BUILDDIR)/game/p_client.o \
|
||||
$(BUILDDIR)/game/g_cmds.o \
|
||||
$(BUILDDIR)/game/g_svcmds.o \
|
||||
$(BUILDDIR)/game/g_combat.o \
|
||||
$(BUILDDIR)/game/g_func.o \
|
||||
$(BUILDDIR)/game/g_items.o \
|
||||
$(BUILDDIR)/game/g_main.o \
|
||||
$(BUILDDIR)/game/g_misc.o \
|
||||
$(BUILDDIR)/game/g_monster.o \
|
||||
$(BUILDDIR)/game/g_phys.o \
|
||||
$(BUILDDIR)/game/g_save.o \
|
||||
$(BUILDDIR)/game/g_spawn.o \
|
||||
$(BUILDDIR)/game/g_target.o \
|
||||
$(BUILDDIR)/game/g_trigger.o \
|
||||
$(BUILDDIR)/game/g_turret.o \
|
||||
$(BUILDDIR)/game/g_utils.o \
|
||||
$(BUILDDIR)/game/g_weapon.o \
|
||||
$(BUILDDIR)/game/m_actor.o \
|
||||
$(BUILDDIR)/game/m_berserk.o \
|
||||
$(BUILDDIR)/game/m_boss2.o \
|
||||
$(BUILDDIR)/game/m_boss3.o \
|
||||
$(BUILDDIR)/game/m_boss31.o \
|
||||
$(BUILDDIR)/game/m_boss32.o \
|
||||
$(BUILDDIR)/game/m_brain.o \
|
||||
$(BUILDDIR)/game/m_chick.o \
|
||||
$(BUILDDIR)/game/m_flipper.o \
|
||||
$(BUILDDIR)/game/m_float.o \
|
||||
$(BUILDDIR)/game/m_flyer.o \
|
||||
$(BUILDDIR)/game/m_gladiator.o \
|
||||
$(BUILDDIR)/game/m_gunner.o \
|
||||
$(BUILDDIR)/game/m_hover.o \
|
||||
$(BUILDDIR)/game/m_infantry.o \
|
||||
$(BUILDDIR)/game/m_insane.o \
|
||||
$(BUILDDIR)/game/m_medic.o \
|
||||
$(BUILDDIR)/game/m_move.o \
|
||||
$(BUILDDIR)/game/m_mutant.o \
|
||||
$(BUILDDIR)/game/m_parasite.o \
|
||||
$(BUILDDIR)/game/m_soldier.o \
|
||||
$(BUILDDIR)/game/m_supertank.o \
|
||||
$(BUILDDIR)/game/m_tank.o \
|
||||
$(BUILDDIR)/game/p_hud.o \
|
||||
$(BUILDDIR)/game/p_trail.o \
|
||||
$(BUILDDIR)/game/p_view.o \
|
||||
$(BUILDDIR)/game/p_weapon.o \
|
||||
$(BUILDDIR)/game/q_shared.o \
|
||||
$(BUILDDIR)/game/m_flash.o \
|
||||
$(BUILDDIR)/game/g_so.o
|
||||
|
||||
$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
|
||||
|
||||
$(BUILDDIR)/game/g_ai.o : $(GAME_DIR)/g_ai.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_client.o : $(GAME_DIR)/p_client.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_cmds.o : $(GAME_DIR)/g_cmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_svcmds.o : $(GAME_DIR)/g_svcmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_combat.o : $(GAME_DIR)/g_combat.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_func.o : $(GAME_DIR)/g_func.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_items.o : $(GAME_DIR)/g_items.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_main.o : $(GAME_DIR)/g_main.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_misc.o : $(GAME_DIR)/g_misc.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_monster.o : $(GAME_DIR)/g_monster.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_phys.o : $(GAME_DIR)/g_phys.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_save.o : $(GAME_DIR)/g_save.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_spawn.o : $(GAME_DIR)/g_spawn.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_target.o : $(GAME_DIR)/g_target.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_trigger.o : $(GAME_DIR)/g_trigger.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_turret.o : $(GAME_DIR)/g_turret.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_utils.o : $(GAME_DIR)/g_utils.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_weapon.o : $(GAME_DIR)/g_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_actor.o : $(GAME_DIR)/m_actor.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_berserk.o : $(GAME_DIR)/m_berserk.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss2.o : $(GAME_DIR)/m_boss2.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss3.o : $(GAME_DIR)/m_boss3.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss31.o : $(GAME_DIR)/m_boss31.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss32.o : $(GAME_DIR)/m_boss32.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_brain.o : $(GAME_DIR)/m_brain.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_chick.o : $(GAME_DIR)/m_chick.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_flipper.o : $(GAME_DIR)/m_flipper.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_float.o : $(GAME_DIR)/m_float.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_flyer.o : $(GAME_DIR)/m_flyer.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_gladiator.o : $(GAME_DIR)/m_gladiator.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_gunner.o : $(GAME_DIR)/m_gunner.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_hover.o : $(GAME_DIR)/m_hover.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_infantry.o : $(GAME_DIR)/m_infantry.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_insane.o : $(GAME_DIR)/m_insane.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_medic.o : $(GAME_DIR)/m_medic.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_move.o : $(GAME_DIR)/m_move.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_mutant.o : $(GAME_DIR)/m_mutant.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_parasite.o : $(GAME_DIR)/m_parasite.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_soldier.o : $(GAME_DIR)/m_soldier.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_supertank.o : $(GAME_DIR)/m_supertank.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_tank.o : $(GAME_DIR)/m_tank.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_hud.o : $(GAME_DIR)/p_hud.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_trail.o : $(GAME_DIR)/p_trail.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_view.o : $(GAME_DIR)/p_view.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_weapon.o : $(GAME_DIR)/p_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/q_shared.o : $(GAME_DIR)/q_shared.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_flash.o : $(GAME_DIR)/m_flash.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_so.o : $(SOLARIS_DIR)/g_so.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
#############################################################################
|
||||
# MISC
|
||||
#############################################################################
|
||||
|
||||
clean: clean-debug clean-release
|
||||
|
||||
clean-debug:
|
||||
$(MAKE) clean2 BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
clean-release:
|
||||
$(MAKE) clean2 BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
clean2:
|
||||
-rm -f $(QUAKE2_OBJS) \
|
||||
$(GAME_OBJS) \
|
||||
$(REF_SOFT_OBJS) \
|
||||
$(REF_SOFT_SVGA_OBJS) \
|
||||
$(REF_SOFT_X11_OBJS) \
|
||||
$(REF_GL_OBJS)
|
||||
|
719
solaris/Makefile.Solaris
Normal file
719
solaris/Makefile.Solaris
Normal file
@ -0,0 +1,719 @@
|
||||
#
|
||||
# Quake2 Makefile for Solaris
|
||||
#
|
||||
# Nov '97 by Zoid <zoid@idsoftware.com>
|
||||
#
|
||||
# ELF only
|
||||
#
|
||||
|
||||
ifneq (,$(findstring i86pc,$(shell uname -m)))
|
||||
ARCH=i386
|
||||
else
|
||||
ARCH=sparc
|
||||
endif
|
||||
|
||||
MOUNT_DIR=/chest/Quake2/code
|
||||
|
||||
BUILD_DEBUG_DIR=debug$(ARCH)
|
||||
BUILD_RELEASE_DIR=release$(ARCH)
|
||||
CLIENT_DIR=$(MOUNT_DIR)/client
|
||||
SERVER_DIR=$(MOUNT_DIR)/server
|
||||
COMMON_DIR=$(MOUNT_DIR)/qcommon
|
||||
SOLARIS_DIR=$(MOUNT_DIR)/solaris
|
||||
GAME_DIR=$(MOUNT_DIR)/game
|
||||
CTF_DIR=$(MOUNT_DIR)/ctf
|
||||
XATRIX_DIR=$(MOUNT_DIR)/xatrix
|
||||
NULL_DIR=$(MOUNT_DIR)/null
|
||||
|
||||
CC=gcc
|
||||
BASE_CFLAGS=-Dstricmp=strcasecmp -DC_ONLY -DDEDICATED_ONLY
|
||||
RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
|
||||
-fomit-frame-pointer -fexpensive-optimizations
|
||||
|
||||
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
|
||||
LDFLAGS=-ldl -lm -lsocket -lnsl
|
||||
|
||||
SHLIBEXT=so
|
||||
|
||||
SHLIBCFLAGS=-fPIC
|
||||
SHLIBLDFLAGS=-shared
|
||||
|
||||
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
|
||||
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||
|
||||
#############################################################################
|
||||
# SETUP AND BUILD
|
||||
#############################################################################
|
||||
|
||||
TARGETS=$(BUILDDIR)/q2ded \
|
||||
$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) \
|
||||
$(BUILDDIR)/ctf/game$(ARCH).$(SHLIBEXT) \
|
||||
$(BUILDDIR)/xatrix/game$(ARCH).$(SHLIBEXT)
|
||||
|
||||
build_debug:
|
||||
@-mkdir $(BUILD_DEBUG_DIR) \
|
||||
$(BUILD_DEBUG_DIR)/client \
|
||||
$(BUILD_DEBUG_DIR)/game \
|
||||
$(BUILD_DEBUG_DIR)/ctf \
|
||||
$(BUILD_DEBUG_DIR)/xatrix
|
||||
$(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
build_release:
|
||||
@-mkdir $(BUILD_RELEASE_DIR) \
|
||||
$(BUILD_RELEASE_DIR)/client \
|
||||
$(BUILD_RELEASE_DIR)/game \
|
||||
$(BUILD_RELEASE_DIR)/ctf \
|
||||
$(BUILD_RELEASE_DIR)/xatrix
|
||||
$(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS)"
|
||||
|
||||
all: build_debug build_release
|
||||
|
||||
targets: $(TARGETS)
|
||||
|
||||
#############################################################################
|
||||
# CLIENT/SERVER
|
||||
#############################################################################
|
||||
|
||||
QUAKE2_OBJS = \
|
||||
\
|
||||
$(BUILDDIR)/client/cmd.o \
|
||||
$(BUILDDIR)/client/cmodel.o \
|
||||
$(BUILDDIR)/client/common.o \
|
||||
$(BUILDDIR)/client/crc.o \
|
||||
$(BUILDDIR)/client/cvar.o \
|
||||
$(BUILDDIR)/client/files.o \
|
||||
$(BUILDDIR)/client/md4.o \
|
||||
$(BUILDDIR)/client/net_chan.o \
|
||||
\
|
||||
$(BUILDDIR)/client/sv_ccmds.o \
|
||||
$(BUILDDIR)/client/sv_ents.o \
|
||||
$(BUILDDIR)/client/sv_game.o \
|
||||
$(BUILDDIR)/client/sv_init.o \
|
||||
$(BUILDDIR)/client/sv_main.o \
|
||||
$(BUILDDIR)/client/sv_send.o \
|
||||
$(BUILDDIR)/client/sv_user.o \
|
||||
$(BUILDDIR)/client/sv_world.o \
|
||||
\
|
||||
$(BUILDDIR)/client/q_shsolaris.o \
|
||||
$(BUILDDIR)/client/sys_solaris.o \
|
||||
$(BUILDDIR)/client/glob.o \
|
||||
$(BUILDDIR)/client/net_udp.o \
|
||||
\
|
||||
$(BUILDDIR)/client/q_shared.o \
|
||||
$(BUILDDIR)/client/pmove.o \
|
||||
\
|
||||
$(BUILDDIR)/client/cl_null.o \
|
||||
$(BUILDDIR)/client/cd_null.o
|
||||
|
||||
$(BUILDDIR)/q2ded : $(QUAKE2_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(LDFLAGS)
|
||||
|
||||
$(BUILDDIR)/client/cmd.o : $(COMMON_DIR)/cmd.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cmodel.o : $(COMMON_DIR)/cmodel.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/common.o : $(COMMON_DIR)/common.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/crc.o : $(COMMON_DIR)/crc.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cvar.o : $(COMMON_DIR)/cvar.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/files.o : $(COMMON_DIR)/files.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/md4.o : $(COMMON_DIR)/md4.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/net_chan.o : $(COMMON_DIR)/net_chan.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/q_shared.o : $(GAME_DIR)/q_shared.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/pmove.o : $(COMMON_DIR)/pmove.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_ccmds.o : $(SERVER_DIR)/sv_ccmds.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_ents.o : $(SERVER_DIR)/sv_ents.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_game.o : $(SERVER_DIR)/sv_game.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_init.o : $(SERVER_DIR)/sv_init.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_main.o : $(SERVER_DIR)/sv_main.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_send.o : $(SERVER_DIR)/sv_send.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_user.o : $(SERVER_DIR)/sv_user.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sv_world.o : $(SERVER_DIR)/sv_world.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/q_shsolaris.o : $(SOLARIS_DIR)/q_shsolaris.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/sys_solaris.o : $(SOLARIS_DIR)/sys_solaris.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/glob.o : $(SOLARIS_DIR)/glob.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/net_udp.o : $(SOLARIS_DIR)/net_udp.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cd_null.o : $(NULL_DIR)/cd_null.c
|
||||
$(DO_CC)
|
||||
|
||||
$(BUILDDIR)/client/cl_null.o : $(NULL_DIR)/cl_null.c
|
||||
$(DO_CC)
|
||||
|
||||
#############################################################################
|
||||
# GAME
|
||||
#############################################################################
|
||||
|
||||
GAME_OBJS = \
|
||||
$(BUILDDIR)/game/g_ai.o \
|
||||
$(BUILDDIR)/game/p_client.o \
|
||||
$(BUILDDIR)/game/g_cmds.o \
|
||||
$(BUILDDIR)/game/g_svcmds.o \
|
||||
$(BUILDDIR)/game/g_combat.o \
|
||||
$(BUILDDIR)/game/g_func.o \
|
||||
$(BUILDDIR)/game/g_items.o \
|
||||
$(BUILDDIR)/game/g_main.o \
|
||||
$(BUILDDIR)/game/g_misc.o \
|
||||
$(BUILDDIR)/game/g_monster.o \
|
||||
$(BUILDDIR)/game/g_phys.o \
|
||||
$(BUILDDIR)/game/g_save.o \
|
||||
$(BUILDDIR)/game/g_spawn.o \
|
||||
$(BUILDDIR)/game/g_target.o \
|
||||
$(BUILDDIR)/game/g_trigger.o \
|
||||
$(BUILDDIR)/game/g_turret.o \
|
||||
$(BUILDDIR)/game/g_utils.o \
|
||||
$(BUILDDIR)/game/g_weapon.o \
|
||||
$(BUILDDIR)/game/m_actor.o \
|
||||
$(BUILDDIR)/game/m_berserk.o \
|
||||
$(BUILDDIR)/game/m_boss2.o \
|
||||
$(BUILDDIR)/game/m_boss3.o \
|
||||
$(BUILDDIR)/game/m_boss31.o \
|
||||
$(BUILDDIR)/game/m_boss32.o \
|
||||
$(BUILDDIR)/game/m_brain.o \
|
||||
$(BUILDDIR)/game/m_chick.o \
|
||||
$(BUILDDIR)/game/m_flipper.o \
|
||||
$(BUILDDIR)/game/m_float.o \
|
||||
$(BUILDDIR)/game/m_flyer.o \
|
||||
$(BUILDDIR)/game/m_gladiator.o \
|
||||
$(BUILDDIR)/game/m_gunner.o \
|
||||
$(BUILDDIR)/game/m_hover.o \
|
||||
$(BUILDDIR)/game/m_infantry.o \
|
||||
$(BUILDDIR)/game/m_insane.o \
|
||||
$(BUILDDIR)/game/m_medic.o \
|
||||
$(BUILDDIR)/game/m_move.o \
|
||||
$(BUILDDIR)/game/m_mutant.o \
|
||||
$(BUILDDIR)/game/m_parasite.o \
|
||||
$(BUILDDIR)/game/m_soldier.o \
|
||||
$(BUILDDIR)/game/m_supertank.o \
|
||||
$(BUILDDIR)/game/m_tank.o \
|
||||
$(BUILDDIR)/game/p_hud.o \
|
||||
$(BUILDDIR)/game/p_trail.o \
|
||||
$(BUILDDIR)/game/p_view.o \
|
||||
$(BUILDDIR)/game/p_weapon.o \
|
||||
$(BUILDDIR)/game/q_shared.o \
|
||||
$(BUILDDIR)/game/m_flash.o
|
||||
|
||||
$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
|
||||
|
||||
$(BUILDDIR)/game/g_ai.o : $(GAME_DIR)/g_ai.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_client.o : $(GAME_DIR)/p_client.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_cmds.o : $(GAME_DIR)/g_cmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_svcmds.o : $(GAME_DIR)/g_svcmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_combat.o : $(GAME_DIR)/g_combat.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_func.o : $(GAME_DIR)/g_func.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_items.o : $(GAME_DIR)/g_items.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_main.o : $(GAME_DIR)/g_main.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_misc.o : $(GAME_DIR)/g_misc.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_monster.o : $(GAME_DIR)/g_monster.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_phys.o : $(GAME_DIR)/g_phys.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_save.o : $(GAME_DIR)/g_save.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_spawn.o : $(GAME_DIR)/g_spawn.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_target.o : $(GAME_DIR)/g_target.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_trigger.o : $(GAME_DIR)/g_trigger.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_turret.o : $(GAME_DIR)/g_turret.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_utils.o : $(GAME_DIR)/g_utils.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/g_weapon.o : $(GAME_DIR)/g_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_actor.o : $(GAME_DIR)/m_actor.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_berserk.o : $(GAME_DIR)/m_berserk.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss2.o : $(GAME_DIR)/m_boss2.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss3.o : $(GAME_DIR)/m_boss3.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss31.o : $(GAME_DIR)/m_boss31.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_boss32.o : $(GAME_DIR)/m_boss32.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_brain.o : $(GAME_DIR)/m_brain.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_chick.o : $(GAME_DIR)/m_chick.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_flipper.o : $(GAME_DIR)/m_flipper.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_float.o : $(GAME_DIR)/m_float.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_flyer.o : $(GAME_DIR)/m_flyer.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_gladiator.o : $(GAME_DIR)/m_gladiator.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_gunner.o : $(GAME_DIR)/m_gunner.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_hover.o : $(GAME_DIR)/m_hover.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_infantry.o : $(GAME_DIR)/m_infantry.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_insane.o : $(GAME_DIR)/m_insane.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_medic.o : $(GAME_DIR)/m_medic.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_move.o : $(GAME_DIR)/m_move.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_mutant.o : $(GAME_DIR)/m_mutant.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_parasite.o : $(GAME_DIR)/m_parasite.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_soldier.o : $(GAME_DIR)/m_soldier.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_supertank.o : $(GAME_DIR)/m_supertank.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_tank.o : $(GAME_DIR)/m_tank.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_hud.o : $(GAME_DIR)/p_hud.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_trail.o : $(GAME_DIR)/p_trail.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_view.o : $(GAME_DIR)/p_view.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/p_weapon.o : $(GAME_DIR)/p_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/q_shared.o : $(GAME_DIR)/q_shared.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/game/m_flash.o : $(GAME_DIR)/m_flash.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
#############################################################################
|
||||
# CTF
|
||||
#############################################################################
|
||||
|
||||
CTF_OBJS = \
|
||||
$(BUILDDIR)/ctf/g_ai.o \
|
||||
$(BUILDDIR)/ctf/g_chase.o \
|
||||
$(BUILDDIR)/ctf/g_cmds.o \
|
||||
$(BUILDDIR)/ctf/g_combat.o \
|
||||
$(BUILDDIR)/ctf/g_ctf.o \
|
||||
$(BUILDDIR)/ctf/g_func.o \
|
||||
$(BUILDDIR)/ctf/g_items.o \
|
||||
$(BUILDDIR)/ctf/g_main.o \
|
||||
$(BUILDDIR)/ctf/g_misc.o \
|
||||
$(BUILDDIR)/ctf/g_monster.o \
|
||||
$(BUILDDIR)/ctf/g_phys.o \
|
||||
$(BUILDDIR)/ctf/g_save.o \
|
||||
$(BUILDDIR)/ctf/g_spawn.o \
|
||||
$(BUILDDIR)/ctf/g_svcmds.o \
|
||||
$(BUILDDIR)/ctf/g_target.o \
|
||||
$(BUILDDIR)/ctf/g_trigger.o \
|
||||
$(BUILDDIR)/ctf/g_utils.o \
|
||||
$(BUILDDIR)/ctf/g_weapon.o \
|
||||
$(BUILDDIR)/ctf/m_move.o \
|
||||
$(BUILDDIR)/ctf/p_client.o \
|
||||
$(BUILDDIR)/ctf/p_hud.o \
|
||||
$(BUILDDIR)/ctf/p_menu.o \
|
||||
$(BUILDDIR)/ctf/p_trail.o \
|
||||
$(BUILDDIR)/ctf/p_view.o \
|
||||
$(BUILDDIR)/ctf/p_weapon.o \
|
||||
$(BUILDDIR)/ctf/q_shared.o
|
||||
|
||||
$(BUILDDIR)/ctf/game$(ARCH).$(SHLIBEXT) : $(CTF_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CTF_OBJS)
|
||||
|
||||
$(BUILDDIR)/ctf/g_ai.o : $(CTF_DIR)/g_ai.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_chase.o : $(CTF_DIR)/g_chase.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_cmds.o : $(CTF_DIR)/g_cmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_combat.o : $(CTF_DIR)/g_combat.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_ctf.o : $(CTF_DIR)/g_ctf.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_func.o : $(CTF_DIR)/g_func.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_items.o : $(CTF_DIR)/g_items.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_main.o : $(CTF_DIR)/g_main.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_misc.o : $(CTF_DIR)/g_misc.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_monster.o : $(CTF_DIR)/g_monster.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_phys.o : $(CTF_DIR)/g_phys.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_save.o : $(CTF_DIR)/g_save.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_spawn.o : $(CTF_DIR)/g_spawn.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_svcmds.o : $(CTF_DIR)/g_svcmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_target.o : $(CTF_DIR)/g_target.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_trigger.o : $(CTF_DIR)/g_trigger.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_utils.o : $(CTF_DIR)/g_utils.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/g_weapon.o : $(CTF_DIR)/g_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/m_move.o : $(CTF_DIR)/m_move.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/p_client.o : $(CTF_DIR)/p_client.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/p_hud.o : $(CTF_DIR)/p_hud.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/p_menu.o : $(CTF_DIR)/p_menu.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/p_trail.o : $(CTF_DIR)/p_trail.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/p_view.o : $(CTF_DIR)/p_view.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/p_weapon.o : $(CTF_DIR)/p_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/ctf/q_shared.o : $(CTF_DIR)/q_shared.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
#############################################################################
|
||||
# XATRIX
|
||||
#############################################################################
|
||||
|
||||
XATRIX_OBJS = \
|
||||
$(BUILDDIR)/xatrix/g_ai.o \
|
||||
$(BUILDDIR)/xatrix/g_cmds.o \
|
||||
$(BUILDDIR)/xatrix/g_combat.o \
|
||||
$(BUILDDIR)/xatrix/g_func.o \
|
||||
$(BUILDDIR)/xatrix/g_items.o \
|
||||
$(BUILDDIR)/xatrix/g_main.o \
|
||||
$(BUILDDIR)/xatrix/g_misc.o \
|
||||
$(BUILDDIR)/xatrix/g_monster.o \
|
||||
$(BUILDDIR)/xatrix/g_phys.o \
|
||||
$(BUILDDIR)/xatrix/g_save.o \
|
||||
$(BUILDDIR)/xatrix/g_spawn.o \
|
||||
$(BUILDDIR)/xatrix/g_svcmds.o \
|
||||
$(BUILDDIR)/xatrix/g_target.o \
|
||||
$(BUILDDIR)/xatrix/g_trigger.o \
|
||||
$(BUILDDIR)/xatrix/g_turret.o \
|
||||
$(BUILDDIR)/xatrix/g_utils.o \
|
||||
$(BUILDDIR)/xatrix/g_weapon.o \
|
||||
$(BUILDDIR)/xatrix/m_actor.o \
|
||||
$(BUILDDIR)/xatrix/m_berserk.o \
|
||||
$(BUILDDIR)/xatrix/m_boss2.o \
|
||||
$(BUILDDIR)/xatrix/m_boss3.o \
|
||||
$(BUILDDIR)/xatrix/m_boss31.o \
|
||||
$(BUILDDIR)/xatrix/m_boss32.o \
|
||||
$(BUILDDIR)/xatrix/m_boss5.o \
|
||||
$(BUILDDIR)/xatrix/m_brain.o \
|
||||
$(BUILDDIR)/xatrix/m_chick.o \
|
||||
$(BUILDDIR)/xatrix/m_fixbot.o \
|
||||
$(BUILDDIR)/xatrix/m_flash.o \
|
||||
$(BUILDDIR)/xatrix/m_flipper.o \
|
||||
$(BUILDDIR)/xatrix/m_float.o \
|
||||
$(BUILDDIR)/xatrix/m_flyer.o \
|
||||
$(BUILDDIR)/xatrix/m_gekk.o \
|
||||
$(BUILDDIR)/xatrix/m_gladb.o \
|
||||
$(BUILDDIR)/xatrix/m_gladiator.o \
|
||||
$(BUILDDIR)/xatrix/m_gunner.o \
|
||||
$(BUILDDIR)/xatrix/m_hover.o \
|
||||
$(BUILDDIR)/xatrix/m_infantry.o \
|
||||
$(BUILDDIR)/xatrix/m_insane.o \
|
||||
$(BUILDDIR)/xatrix/m_medic.o \
|
||||
$(BUILDDIR)/xatrix/m_move.o \
|
||||
$(BUILDDIR)/xatrix/m_mutant.o \
|
||||
$(BUILDDIR)/xatrix/m_parasite.o \
|
||||
$(BUILDDIR)/xatrix/m_soldier.o \
|
||||
$(BUILDDIR)/xatrix/m_supertank.o \
|
||||
$(BUILDDIR)/xatrix/m_tank.o \
|
||||
$(BUILDDIR)/xatrix/p_client.o \
|
||||
$(BUILDDIR)/xatrix/p_hud.o \
|
||||
$(BUILDDIR)/xatrix/p_trail.o \
|
||||
$(BUILDDIR)/xatrix/p_view.o \
|
||||
$(BUILDDIR)/xatrix/p_weapon.o \
|
||||
$(BUILDDIR)/xatrix/q_shared.o
|
||||
|
||||
$(BUILDDIR)/xatrix/game$(ARCH).$(SHLIBEXT) : $(XATRIX_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(XATRIX_OBJS)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_ai.o : $(XATRIX_DIR)/g_ai.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_cmds.o : $(XATRIX_DIR)/g_cmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_combat.o : $(XATRIX_DIR)/g_combat.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_func.o : $(XATRIX_DIR)/g_func.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_items.o : $(XATRIX_DIR)/g_items.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_main.o : $(XATRIX_DIR)/g_main.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_misc.o : $(XATRIX_DIR)/g_misc.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_monster.o : $(XATRIX_DIR)/g_monster.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_phys.o : $(XATRIX_DIR)/g_phys.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_save.o : $(XATRIX_DIR)/g_save.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_spawn.o : $(XATRIX_DIR)/g_spawn.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_svcmds.o : $(XATRIX_DIR)/g_svcmds.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_target.o : $(XATRIX_DIR)/g_target.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_trigger.o : $(XATRIX_DIR)/g_trigger.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_turret.o : $(XATRIX_DIR)/g_turret.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_utils.o : $(XATRIX_DIR)/g_utils.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/g_weapon.o : $(XATRIX_DIR)/g_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_actor.o : $(XATRIX_DIR)/m_actor.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_berserk.o : $(XATRIX_DIR)/m_berserk.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_boss2.o : $(XATRIX_DIR)/m_boss2.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_boss3.o : $(XATRIX_DIR)/m_boss3.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_boss31.o : $(XATRIX_DIR)/m_boss31.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_boss32.o : $(XATRIX_DIR)/m_boss32.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_boss5.o : $(XATRIX_DIR)/m_boss5.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_brain.o : $(XATRIX_DIR)/m_brain.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_chick.o : $(XATRIX_DIR)/m_chick.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_fixbot.o : $(XATRIX_DIR)/m_fixbot.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_flash.o : $(XATRIX_DIR)/m_flash.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_flipper.o : $(XATRIX_DIR)/m_flipper.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_float.o : $(XATRIX_DIR)/m_float.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_flyer.o : $(XATRIX_DIR)/m_flyer.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_gekk.o : $(XATRIX_DIR)/m_gekk.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_gladb.o : $(XATRIX_DIR)/m_gladb.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_gladiator.o : $(XATRIX_DIR)/m_gladiator.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_gunner.o : $(XATRIX_DIR)/m_gunner.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_hover.o : $(XATRIX_DIR)/m_hover.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_infantry.o : $(XATRIX_DIR)/m_infantry.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_insane.o : $(XATRIX_DIR)/m_insane.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_medic.o : $(XATRIX_DIR)/m_medic.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_move.o : $(XATRIX_DIR)/m_move.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_mutant.o : $(XATRIX_DIR)/m_mutant.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_parasite.o : $(XATRIX_DIR)/m_parasite.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_soldier.o : $(XATRIX_DIR)/m_soldier.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_supertank.o : $(XATRIX_DIR)/m_supertank.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/m_tank.o : $(XATRIX_DIR)/m_tank.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/p_client.o : $(XATRIX_DIR)/p_client.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/p_hud.o : $(XATRIX_DIR)/p_hud.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/p_trail.o : $(XATRIX_DIR)/p_trail.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/p_view.o : $(XATRIX_DIR)/p_view.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/p_weapon.o : $(XATRIX_DIR)/p_weapon.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
$(BUILDDIR)/xatrix/q_shared.o : $(XATRIX_DIR)/q_shared.c
|
||||
$(DO_SHLIB_CC)
|
||||
|
||||
#############################################################################
|
||||
# MISC
|
||||
#############################################################################
|
||||
|
||||
clean: clean-debug clean-release
|
||||
|
||||
clean-debug:
|
||||
$(MAKE) clean2 BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
clean-release:
|
||||
$(MAKE) clean2 BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(DEBUG_CFLAGS)"
|
||||
|
||||
clean2:
|
||||
-rm -f $(QUAKE2_OBJS) $(GAME_OBJS) $(CTF_OBJS) $(XATRIX_OBJS)
|
3
solaris/g_so.c
Normal file
3
solaris/g_so.c
Normal file
@ -0,0 +1,3 @@
|
||||
int main(int argc, char *argv)
|
||||
{
|
||||
}
|
164
solaris/glob.c
Normal file
164
solaris/glob.c
Normal file
@ -0,0 +1,164 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../linux/glob.h"
|
||||
|
||||
/* Like glob_match, but match PATTERN against any final segment of TEXT. */
|
||||
static int glob_match_after_star(char *pattern, char *text)
|
||||
{
|
||||
register char *p = pattern, *t = text;
|
||||
register char c, c1;
|
||||
|
||||
while ((c = *p++) == '?' || c == '*')
|
||||
if (c == '?' && *t++ == '\0')
|
||||
return 0;
|
||||
|
||||
if (c == '\0')
|
||||
return 1;
|
||||
|
||||
if (c == '\\')
|
||||
c1 = *p;
|
||||
else
|
||||
c1 = c;
|
||||
|
||||
while (1) {
|
||||
if ((c == '[' || *t == c1) && glob_match(p - 1, t))
|
||||
return 1;
|
||||
if (*t++ == '\0')
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return nonzero if PATTERN has any special globbing chars in it. */
|
||||
static int glob_pattern_p(char *pattern)
|
||||
{
|
||||
register char *p = pattern;
|
||||
register char c;
|
||||
int open = 0;
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
switch (c) {
|
||||
case '?':
|
||||
case '*':
|
||||
return 1;
|
||||
|
||||
case '[': /* Only accept an open brace if there is a close */
|
||||
open++; /* brace to match it. Bracket expressions must be */
|
||||
continue; /* complete, according to Posix.2 */
|
||||
case ']':
|
||||
if (open)
|
||||
return 1;
|
||||
continue;
|
||||
|
||||
case '\\':
|
||||
if (*p++ == '\0')
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Match the pattern PATTERN against the string TEXT;
|
||||
return 1 if it matches, 0 otherwise.
|
||||
|
||||
A match means the entire string TEXT is used up in matching.
|
||||
|
||||
In the pattern string, `*' matches any sequence of characters,
|
||||
`?' matches any character, [SET] matches any character in the specified set,
|
||||
[!SET] matches any character not in the specified set.
|
||||
|
||||
A set is composed of characters or ranges; a range looks like
|
||||
character hyphen character (as in 0-9 or A-Z).
|
||||
[0-9a-zA-Z_] is the set of characters allowed in C identifiers.
|
||||
Any other character in the pattern must be matched exactly.
|
||||
|
||||
To suppress the special syntactic significance of any of `[]*?!-\',
|
||||
and match the character exactly, precede it with a `\'.
|
||||
*/
|
||||
|
||||
int glob_match(char *pattern, char *text)
|
||||
{
|
||||
register char *p = pattern, *t = text;
|
||||
register char c;
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
switch (c) {
|
||||
case '?':
|
||||
if (*t == '\0')
|
||||
return 0;
|
||||
else
|
||||
++t;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (*p++ != *t++)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
return glob_match_after_star(p, t);
|
||||
|
||||
case '[':
|
||||
{
|
||||
register char c1 = *t++;
|
||||
int invert;
|
||||
|
||||
if (!c1)
|
||||
return (0);
|
||||
|
||||
invert = ((*p == '!') || (*p == '^'));
|
||||
if (invert)
|
||||
p++;
|
||||
|
||||
c = *p++;
|
||||
while (1) {
|
||||
register char cstart = c, cend = c;
|
||||
|
||||
if (c == '\\') {
|
||||
cstart = *p++;
|
||||
cend = cstart;
|
||||
}
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
|
||||
c = *p++;
|
||||
if (c == '-' && *p != ']') {
|
||||
cend = *p++;
|
||||
if (cend == '\\')
|
||||
cend = *p++;
|
||||
if (cend == '\0')
|
||||
return 0;
|
||||
c = *p++;
|
||||
}
|
||||
if (c1 >= cstart && c1 <= cend)
|
||||
goto match;
|
||||
if (c == ']')
|
||||
break;
|
||||
}
|
||||
if (!invert)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
match:
|
||||
/* Skip the rest of the [...] construct that already matched. */
|
||||
while (c != ']') {
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
c = *p++;
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
else if (c == '\\')
|
||||
++p;
|
||||
}
|
||||
if (invert)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
if (c != *t++)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return *t == '\0';
|
||||
}
|
||||
|
1
solaris/glob.h
Normal file
1
solaris/glob.h
Normal file
@ -0,0 +1 @@
|
||||
int glob_match(char *pattern, char *text);
|
537
solaris/net_udp.c
Normal file
537
solaris/net_udp.c
Normal file
@ -0,0 +1,537 @@
|
||||
// net_wins.c
|
||||
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/filio.h>
|
||||
|
||||
#ifdef NeXT
|
||||
#include <libc.h>
|
||||
#endif
|
||||
|
||||
netadr_t net_local_adr;
|
||||
|
||||
#define LOOPBACK 0x7f000001
|
||||
|
||||
#define MAX_LOOPBACK 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte data[MAX_MSGLEN];
|
||||
int datalen;
|
||||
} loopmsg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
loopmsg_t msgs[MAX_LOOPBACK];
|
||||
int get, send;
|
||||
} loopback_t;
|
||||
|
||||
loopback_t loopbacks[2];
|
||||
int ip_sockets[2];
|
||||
int ipx_sockets[2];
|
||||
|
||||
int NET_Socket (char *net_interface, int port);
|
||||
char *NET_ErrorString (void);
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void NetadrToSockadr (netadr_t *a, struct sockaddr_in *s)
|
||||
{
|
||||
memset (s, 0, sizeof(*s));
|
||||
|
||||
if (a->type == NA_BROADCAST)
|
||||
{
|
||||
s->sin_family = AF_INET;
|
||||
|
||||
s->sin_port = a->port;
|
||||
*(int *)&s->sin_addr = -1;
|
||||
}
|
||||
else if (a->type == NA_IP)
|
||||
{
|
||||
s->sin_family = AF_INET;
|
||||
|
||||
*(int *)&s->sin_addr = *(int *)&a->ip;
|
||||
s->sin_port = a->port;
|
||||
}
|
||||
}
|
||||
|
||||
void SockadrToNetadr (struct sockaddr_in *s, netadr_t *a)
|
||||
{
|
||||
*(int *)&a->ip = *(int *)&s->sin_addr;
|
||||
a->port = s->sin_port;
|
||||
a->type = NA_IP;
|
||||
}
|
||||
|
||||
|
||||
qboolean NET_CompareAdr (netadr_t a, netadr_t b)
|
||||
{
|
||||
if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3] && a.port == b.port)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
NET_CompareBaseAdr
|
||||
|
||||
Compares without the port
|
||||
===================
|
||||
*/
|
||||
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b)
|
||||
{
|
||||
if (a.type != b.type)
|
||||
return false;
|
||||
|
||||
if (a.type == NA_LOOPBACK)
|
||||
return true;
|
||||
|
||||
if (a.type == NA_IP)
|
||||
{
|
||||
if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a.type == NA_IPX)
|
||||
{
|
||||
if ((memcmp(a.ipx, b.ipx, 10) == 0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
char *NET_AdrToString (netadr_t a)
|
||||
{
|
||||
static char s[64];
|
||||
|
||||
Com_sprintf (s, sizeof(s), "%i.%i.%i.%i:%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3], ntohs(a.port));
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
char *NET_BaseAdrToString (netadr_t a)
|
||||
{
|
||||
static char s[64];
|
||||
|
||||
Com_sprintf (s, sizeof(s), "%i.%i.%i.%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
NET_StringToAdr
|
||||
|
||||
localhost
|
||||
idnewt
|
||||
idnewt:28000
|
||||
192.246.40.70
|
||||
192.246.40.70:28000
|
||||
=============
|
||||
*/
|
||||
qboolean NET_StringToSockaddr (char *s, struct sockaddr *sadr)
|
||||
{
|
||||
struct hostent *h;
|
||||
char *colon;
|
||||
char copy[128];
|
||||
|
||||
memset (sadr, 0, sizeof(*sadr));
|
||||
((struct sockaddr_in *)sadr)->sin_family = AF_INET;
|
||||
|
||||
((struct sockaddr_in *)sadr)->sin_port = 0;
|
||||
|
||||
strcpy (copy, s);
|
||||
// strip off a trailing :port if present
|
||||
for (colon = copy ; *colon ; colon++)
|
||||
if (*colon == ':')
|
||||
{
|
||||
*colon = 0;
|
||||
((struct sockaddr_in *)sadr)->sin_port = htons((short)atoi(colon+1));
|
||||
}
|
||||
|
||||
if (copy[0] >= '0' && copy[0] <= '9')
|
||||
{
|
||||
*(int *)&((struct sockaddr_in *)sadr)->sin_addr = inet_addr(copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! (h = gethostbyname(copy)) )
|
||||
return 0;
|
||||
*(int *)&((struct sockaddr_in *)sadr)->sin_addr = *(int *)h->h_addr_list[0];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
NET_StringToAdr
|
||||
|
||||
localhost
|
||||
idnewt
|
||||
idnewt:28000
|
||||
192.246.40.70
|
||||
192.246.40.70:28000
|
||||
=============
|
||||
*/
|
||||
qboolean NET_StringToAdr (char *s, netadr_t *a)
|
||||
{
|
||||
struct sockaddr_in sadr;
|
||||
|
||||
if (!strcmp (s, "localhost"))
|
||||
{
|
||||
memset (a, 0, sizeof(*a));
|
||||
a->type = NA_LOOPBACK;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!NET_StringToSockaddr (s, (struct sockaddr *)&sadr))
|
||||
return false;
|
||||
|
||||
SockadrToNetadr (&sadr, a);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
qboolean NET_IsLocalAddress (netadr_t adr)
|
||||
{
|
||||
return NET_CompareAdr (adr, net_local_adr);
|
||||
}
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
LOOPBACK BUFFERS FOR LOCAL PLAYER
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message)
|
||||
{
|
||||
int i;
|
||||
loopback_t *loop;
|
||||
|
||||
loop = &loopbacks[sock];
|
||||
|
||||
if (loop->send - loop->get > MAX_LOOPBACK)
|
||||
loop->get = loop->send - MAX_LOOPBACK;
|
||||
|
||||
if (loop->get >= loop->send)
|
||||
return false;
|
||||
|
||||
i = loop->get & (MAX_LOOPBACK-1);
|
||||
loop->get++;
|
||||
|
||||
memcpy (net_message->data, loop->msgs[i].data, loop->msgs[i].datalen);
|
||||
net_message->cursize = loop->msgs[i].datalen;
|
||||
*net_from = net_local_adr;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void NET_SendLoopPacket (netsrc_t sock, int length, void *data, netadr_t to)
|
||||
{
|
||||
int i;
|
||||
loopback_t *loop;
|
||||
|
||||
loop = &loopbacks[sock^1];
|
||||
|
||||
i = loop->send & (MAX_LOOPBACK-1);
|
||||
loop->send++;
|
||||
|
||||
memcpy (loop->msgs[i].data, data, length);
|
||||
loop->msgs[i].datalen = length;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
qboolean NET_GetPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message)
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
int net_socket;
|
||||
int protocol;
|
||||
int err;
|
||||
|
||||
if (NET_GetLoopPacket (sock, net_from, net_message))
|
||||
return true;
|
||||
|
||||
for (protocol = 0 ; protocol < 2 ; protocol++)
|
||||
{
|
||||
if (protocol == 0)
|
||||
net_socket = ip_sockets[sock];
|
||||
else
|
||||
net_socket = ipx_sockets[sock];
|
||||
|
||||
if (!net_socket)
|
||||
continue;
|
||||
|
||||
fromlen = sizeof(from);
|
||||
ret = recvfrom (net_socket, net_message->data, net_message->maxsize
|
||||
, 0, (struct sockaddr *)&from, &fromlen);
|
||||
if (ret == -1)
|
||||
{
|
||||
err = errno;
|
||||
|
||||
if (err == EWOULDBLOCK || err == ECONNREFUSED)
|
||||
continue;
|
||||
Com_Printf ("NET_GetPacket: %s", NET_ErrorString());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ret == net_message->maxsize)
|
||||
{
|
||||
Com_Printf ("Oversize packet from %s\n", NET_AdrToString (*net_from));
|
||||
continue;
|
||||
}
|
||||
|
||||
net_message->cursize = ret;
|
||||
SockadrToNetadr (&from, net_from);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void NET_SendPacket (netsrc_t sock, int length, void *data, netadr_t to)
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in addr;
|
||||
int net_socket;
|
||||
|
||||
if ( to.type == NA_LOOPBACK )
|
||||
{
|
||||
NET_SendLoopPacket (sock, length, data, to);
|
||||
return;
|
||||
}
|
||||
|
||||
if (to.type == NA_BROADCAST)
|
||||
{
|
||||
net_socket = ip_sockets[sock];
|
||||
if (!net_socket)
|
||||
return;
|
||||
}
|
||||
else if (to.type == NA_IP)
|
||||
{
|
||||
net_socket = ip_sockets[sock];
|
||||
if (!net_socket)
|
||||
return;
|
||||
}
|
||||
else if (to.type == NA_IPX)
|
||||
{
|
||||
net_socket = ipx_sockets[sock];
|
||||
if (!net_socket)
|
||||
return;
|
||||
}
|
||||
else if (to.type == NA_BROADCAST_IPX)
|
||||
{
|
||||
net_socket = ipx_sockets[sock];
|
||||
if (!net_socket)
|
||||
return;
|
||||
}
|
||||
else
|
||||
Com_Error (ERR_FATAL, "NET_SendPacket: bad address type");
|
||||
|
||||
NetadrToSockadr (&to, &addr);
|
||||
|
||||
ret = sendto (net_socket, data, length, 0, (struct sockaddr *)&addr, sizeof(addr) );
|
||||
if (ret == -1)
|
||||
{
|
||||
Com_Printf ("NET_SendPacket ERROR: %i\n", NET_ErrorString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_OpenIP
|
||||
====================
|
||||
*/
|
||||
void NET_OpenIP (void)
|
||||
{
|
||||
cvar_t *port, *ip;
|
||||
|
||||
port = Cvar_Get ("port", va("%i", PORT_SERVER), CVAR_NOSET);
|
||||
ip = Cvar_Get ("ip", "localhost", CVAR_NOSET);
|
||||
|
||||
if (!ip_sockets[NS_SERVER])
|
||||
ip_sockets[NS_SERVER] = NET_Socket (ip->string, port->value);
|
||||
if (!ip_sockets[NS_CLIENT])
|
||||
ip_sockets[NS_CLIENT] = NET_Socket (ip->string, PORT_ANY);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_OpenIPX
|
||||
====================
|
||||
*/
|
||||
void NET_OpenIPX (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_Config
|
||||
|
||||
A single player game will only use the loopback code
|
||||
====================
|
||||
*/
|
||||
void NET_Config (qboolean multiplayer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!multiplayer)
|
||||
{ // shut down any existing sockets
|
||||
for (i=0 ; i<2 ; i++)
|
||||
{
|
||||
if (ip_sockets[i])
|
||||
{
|
||||
close (ip_sockets[i]);
|
||||
ip_sockets[i] = 0;
|
||||
}
|
||||
if (ipx_sockets[i])
|
||||
{
|
||||
close (ipx_sockets[i]);
|
||||
ipx_sockets[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // open sockets
|
||||
NET_OpenIP ();
|
||||
NET_OpenIPX ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===================================================================
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_Init
|
||||
====================
|
||||
*/
|
||||
void NET_Init (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_Socket
|
||||
====================
|
||||
*/
|
||||
int NET_Socket (char *net_interface, int port)
|
||||
{
|
||||
int newsocket;
|
||||
struct sockaddr_in address;
|
||||
qboolean _true = true;
|
||||
int i = 1;
|
||||
|
||||
if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
|
||||
{
|
||||
Com_Printf ("ERROR: UDP_OpenSocket: socket:", NET_ErrorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// make it non-blocking
|
||||
if (ioctl (newsocket, FIONBIO, &_true) == -1)
|
||||
{
|
||||
Com_Printf ("ERROR: UDP_OpenSocket: ioctl FIONBIO:%s\n", NET_ErrorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// make it broadcast capable
|
||||
if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)) == -1)
|
||||
{
|
||||
Com_Printf ("ERROR: UDP_OpenSocket: setsockopt SO_BROADCAST:%s\n", NET_ErrorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!net_interface || !net_interface[0] || !stricmp(net_interface, "localhost"))
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
else
|
||||
NET_StringToSockaddr (net_interface, (struct sockaddr *)&address);
|
||||
|
||||
if (port == PORT_ANY)
|
||||
address.sin_port = 0;
|
||||
else
|
||||
address.sin_port = htons((short)port);
|
||||
|
||||
address.sin_family = AF_INET;
|
||||
|
||||
if( bind (newsocket, (void *)&address, sizeof(address)) == -1)
|
||||
{
|
||||
Com_Printf ("ERROR: UDP_OpenSocket: bind: %s\n", NET_ErrorString());
|
||||
close (newsocket);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return newsocket;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_Shutdown
|
||||
====================
|
||||
*/
|
||||
void NET_Shutdown (void)
|
||||
{
|
||||
NET_Config (false); // close sockets
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_ErrorString
|
||||
====================
|
||||
*/
|
||||
char *NET_ErrorString (void)
|
||||
{
|
||||
int code;
|
||||
|
||||
code = errno;
|
||||
return strerror (code);
|
||||
}
|
||||
|
||||
// sleeps msec or until net socket is ready
|
||||
void NET_Sleep(int msec)
|
||||
{
|
||||
struct timeval timeout;
|
||||
fd_set fdset;
|
||||
extern cvar_t *dedicated;
|
||||
extern qboolean stdin_active;
|
||||
|
||||
if (!ip_sockets[NS_SERVER] || (dedicated && !dedicated->value))
|
||||
return; // we're not a server, just run full speed
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
if (stdin_active)
|
||||
FD_SET(0, &fdset); // stdin is processed too
|
||||
FD_SET(ip_sockets[NS_SERVER], &fdset); // network socket
|
||||
timeout.tv_sec = msec/1000;
|
||||
timeout.tv_usec = (msec%1000)*1000;
|
||||
select(ip_sockets[NS_SERVER]+1, &fdset, NULL, NULL, &timeout);
|
||||
}
|
||||
|
196
solaris/q_shsolaris.c
Normal file
196
solaris/q_shsolaris.c
Normal file
@ -0,0 +1,196 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "../linux/glob.h"
|
||||
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
//===============================================================================
|
||||
|
||||
byte *membase;
|
||||
int maxhunksize;
|
||||
int curhunksize;
|
||||
|
||||
void *Hunk_Begin (int maxsize)
|
||||
{
|
||||
// reserve a huge chunk of memory, but don't commit any yet
|
||||
maxhunksize = maxsize;
|
||||
curhunksize = 0;
|
||||
membase = malloc(maxhunksize);
|
||||
if (membase == NULL)
|
||||
Sys_Error(ERR_FATAL, "unable to allocate %d bytes", maxsize);
|
||||
|
||||
return membase;
|
||||
}
|
||||
|
||||
void *Hunk_Alloc (int size)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
// round to cacheline
|
||||
size = (size+31)&~31;
|
||||
if (curhunksize + size > maxhunksize)
|
||||
Sys_Error(ERR_FATAL, "Hunk_Alloc overflow");
|
||||
buf = membase + curhunksize;
|
||||
curhunksize += size;
|
||||
return buf;
|
||||
}
|
||||
|
||||
int Hunk_End (void)
|
||||
{
|
||||
byte *n;
|
||||
|
||||
n = realloc(membase, curhunksize);
|
||||
if (n != membase)
|
||||
Sys_Error(ERR_FATAL, "Hunk_End: Could not remap virtual block (%d)", errno);
|
||||
|
||||
return curhunksize;
|
||||
}
|
||||
|
||||
void Hunk_Free (void *base)
|
||||
{
|
||||
if (base)
|
||||
free(base);
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_Milliseconds
|
||||
================
|
||||
*/
|
||||
int curtime;
|
||||
int Sys_Milliseconds (void)
|
||||
{
|
||||
struct timeval tp;
|
||||
struct timezone tzp;
|
||||
static int secbase;
|
||||
|
||||
gettimeofday(&tp, &tzp);
|
||||
|
||||
if (!secbase)
|
||||
{
|
||||
secbase = tp.tv_sec;
|
||||
return tp.tv_usec/1000;
|
||||
}
|
||||
|
||||
curtime = (tp.tv_sec - secbase)*1000 + tp.tv_usec/1000;
|
||||
|
||||
return curtime;
|
||||
}
|
||||
|
||||
void Sys_Mkdir (char *path)
|
||||
{
|
||||
mkdir (path, 0777);
|
||||
}
|
||||
|
||||
char *strlwr (char *s)
|
||||
{
|
||||
while (*s) {
|
||||
*s = tolower(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================
|
||||
|
||||
static char findbase[MAX_OSPATH];
|
||||
static char findpath[MAX_OSPATH];
|
||||
static char findpattern[MAX_OSPATH];
|
||||
static DIR *fdir;
|
||||
|
||||
static qboolean CompareAttributes(char *path, char *name,
|
||||
unsigned musthave, unsigned canthave )
|
||||
{
|
||||
struct stat st;
|
||||
char fn[MAX_OSPATH];
|
||||
|
||||
// . and .. never match
|
||||
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
|
||||
return false;
|
||||
|
||||
sprintf(fn, "%s/%s", path, name);
|
||||
if (stat(fn, &st) == -1)
|
||||
return false; // shouldn't happen
|
||||
|
||||
if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) )
|
||||
return false;
|
||||
|
||||
if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
char *Sys_FindFirst (char *path, unsigned musthave, unsigned canhave)
|
||||
{
|
||||
struct dirent *d;
|
||||
char *p;
|
||||
|
||||
if (fdir)
|
||||
Sys_Error ("Sys_BeginFind without close");
|
||||
|
||||
// COM_FilePath (path, findbase);
|
||||
strcpy(findbase, path);
|
||||
|
||||
if ((p = strrchr(findbase, '/')) != NULL) {
|
||||
*p = 0;
|
||||
strcpy(findpattern, p + 1);
|
||||
} else
|
||||
strcpy(findpattern, "*");
|
||||
|
||||
if (strcmp(findpattern, "*.*") == 0)
|
||||
strcpy(findpattern, "*");
|
||||
|
||||
if ((fdir = opendir(path)) == NULL)
|
||||
return NULL;
|
||||
while ((d = readdir(fdir)) != NULL) {
|
||||
if (!*findpattern || glob_match(findpattern, d->d_name)) {
|
||||
// if (*findpattern)
|
||||
// printf("%s matched %s\n", findpattern, d->d_name);
|
||||
if (CompareAttributes(findbase, d->d_name, musthave, canhave)) {
|
||||
sprintf (findpath, "%s/%s", findbase, d->d_name);
|
||||
return findpath;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *Sys_FindNext (unsigned musthave, unsigned canhave)
|
||||
{
|
||||
struct dirent *d;
|
||||
|
||||
if (fdir == NULL)
|
||||
return NULL;
|
||||
while ((d = readdir(fdir)) != NULL) {
|
||||
if (!*findpattern || glob_match(findpattern, d->d_name)) {
|
||||
// if (*findpattern)
|
||||
// printf("%s matched %s\n", findpattern, d->d_name);
|
||||
if (CompareAttributes(findbase, d->d_name, musthave, canhave)) {
|
||||
sprintf (findpath, "%s/%s", findbase, d->d_name);
|
||||
return findpath;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Sys_FindClose (void)
|
||||
{
|
||||
if (fdir != NULL)
|
||||
closedir(fdir);
|
||||
fdir = NULL;
|
||||
}
|
||||
|
||||
|
||||
//============================================
|
||||
|
337
solaris/sys_solaris.c
Normal file
337
solaris/sys_solaris.c
Normal file
@ -0,0 +1,337 @@
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
cvar_t *nostdout;
|
||||
|
||||
unsigned sys_frame_time;
|
||||
|
||||
qboolean stdin_active = true;
|
||||
|
||||
// =======================================================================
|
||||
// General routines
|
||||
// =======================================================================
|
||||
|
||||
void Sys_ConsoleOutput (char *string)
|
||||
{
|
||||
if (nostdout && nostdout->value)
|
||||
return;
|
||||
|
||||
fputs(string, stdout);
|
||||
}
|
||||
|
||||
void Sys_Printf (char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
unsigned char *p;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
vsprintf (text,fmt,argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (strlen(text) > sizeof(text))
|
||||
Sys_Error("memory overwrite in Sys_Printf");
|
||||
|
||||
if (nostdout && nostdout->value)
|
||||
return;
|
||||
|
||||
for (p = (unsigned char *)text; *p; p++) {
|
||||
*p &= 0x7f;
|
||||
if ((*p > 128 || *p < 32) && *p != 10 && *p != 13 && *p != 9)
|
||||
printf("[%02x]", *p);
|
||||
else
|
||||
putc(*p, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void Sys_Quit (void)
|
||||
{
|
||||
CL_Shutdown ();
|
||||
Qcommon_Shutdown ();
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
void Sys_Init(void)
|
||||
{
|
||||
#if id386
|
||||
// Sys_SetFPCW();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Sys_Error (char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
// change stdin to non blocking
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||
|
||||
va_start (argptr,error);
|
||||
vsprintf (string,error,argptr);
|
||||
va_end (argptr);
|
||||
fprintf(stderr, "Error: %s\n", string);
|
||||
|
||||
CL_Shutdown ();
|
||||
Qcommon_Shutdown ();
|
||||
_exit (1);
|
||||
|
||||
}
|
||||
|
||||
void Sys_Warn (char *warning, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
va_start (argptr,warning);
|
||||
vsprintf (string,warning,argptr);
|
||||
va_end (argptr);
|
||||
fprintf(stderr, "Warning: %s", string);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Sys_FileTime
|
||||
|
||||
returns -1 if not present
|
||||
============
|
||||
*/
|
||||
int Sys_FileTime (char *path)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat (path,&buf) == -1)
|
||||
return -1;
|
||||
|
||||
return buf.st_mtime;
|
||||
}
|
||||
|
||||
void floating_point_exception_handler(int whatever)
|
||||
{
|
||||
// Sys_Warn("floating point exception\n");
|
||||
signal(SIGFPE, floating_point_exception_handler);
|
||||
}
|
||||
|
||||
char *Sys_ConsoleInput(void)
|
||||
{
|
||||
static char text[256];
|
||||
int len;
|
||||
fd_set fdset;
|
||||
struct timeval timeout;
|
||||
|
||||
if (!dedicated || !dedicated->value)
|
||||
return NULL;
|
||||
|
||||
if (!stdin_active)
|
||||
return NULL;
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(0, &fdset); // stdin
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
if (select (1, &fdset, NULL, NULL, &timeout) == -1 || !FD_ISSET(0, &fdset))
|
||||
return NULL;
|
||||
|
||||
len = read (0, text, sizeof(text));
|
||||
if (len == 0) { // eof!
|
||||
stdin_active = false;
|
||||
return NULL;
|
||||
}
|
||||
if (len < 1)
|
||||
return NULL;
|
||||
text[len-1] = 0; // rip off the /n and terminate
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void *game_library;
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_UnloadGame
|
||||
=================
|
||||
*/
|
||||
void Sys_UnloadGame (void)
|
||||
{
|
||||
if (game_library)
|
||||
dlclose (game_library);
|
||||
game_library = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_GetGameAPI
|
||||
|
||||
Loads the game dll
|
||||
=================
|
||||
*/
|
||||
void *Sys_GetGameAPI (void *parms)
|
||||
{
|
||||
void *(*GetGameAPI) (void *);
|
||||
|
||||
char name[MAX_OSPATH];
|
||||
char curpath[MAX_OSPATH];
|
||||
char *path;
|
||||
#ifdef __i386__
|
||||
const char *gamename = "gamei386.so";
|
||||
#elif defined __sun__
|
||||
const char *gamename = "gamesparc.so";
|
||||
#else
|
||||
#error Unknown arch
|
||||
#endif
|
||||
|
||||
if (game_library)
|
||||
Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
|
||||
|
||||
getcwd(curpath, sizeof(curpath));
|
||||
|
||||
Com_Printf("------- Loading %s -------", gamename);
|
||||
|
||||
// now run through the search paths
|
||||
path = NULL;
|
||||
while (1)
|
||||
{
|
||||
path = FS_NextPath (path);
|
||||
if (!path)
|
||||
return NULL; // couldn't find one anywhere
|
||||
sprintf (name, "%s/%s/%s", curpath, path, gamename);
|
||||
game_library = dlopen (name, RTLD_NOW );
|
||||
if (game_library)
|
||||
{
|
||||
Com_DPrintf ("LoadLibrary (%s)\n",name);
|
||||
break;
|
||||
} else
|
||||
Com_Printf("error: %s\n", dlerror());
|
||||
}
|
||||
|
||||
GetGameAPI = (void *)dlsym (game_library, "GetGameAPI");
|
||||
if (!GetGameAPI)
|
||||
{
|
||||
Sys_UnloadGame ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return GetGameAPI (parms);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void Sys_AppActivate (void)
|
||||
{
|
||||
}
|
||||
|
||||
void Sys_SendKeyEvents (void)
|
||||
{
|
||||
// grab frame time
|
||||
sys_frame_time = Sys_Milliseconds();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
char *Sys_GetClipboardData(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int time, oldtime, newtime;
|
||||
|
||||
#if 0
|
||||
int newargc;
|
||||
char **newargv;
|
||||
int i;
|
||||
|
||||
// force dedicated
|
||||
newargc = argc;
|
||||
newargv = malloc((argc + 3) * sizeof(char *));
|
||||
newargv[0] = argv[0];
|
||||
newargv[1] = "+set";
|
||||
newargv[2] = "dedicated";
|
||||
newargv[3] = "1";
|
||||
for (i = 1; i < argc; i++)
|
||||
newargv[i + 3] = argv[i];
|
||||
newargc += 3;
|
||||
|
||||
Qcommon_Init(newargc, newargv);
|
||||
#else
|
||||
Qcommon_Init(argc, argv);
|
||||
#endif
|
||||
|
||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||
|
||||
nostdout = Cvar_Get("nostdout", "0", 0);
|
||||
|
||||
if (!nostdout->value) {
|
||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||
// printf ("Linux Quake -- Version %0.3f\n", LINUX_VERSION);
|
||||
}
|
||||
|
||||
oldtime = Sys_Milliseconds ();
|
||||
while (1)
|
||||
{
|
||||
// find time spent rendering last frame
|
||||
do {
|
||||
newtime = Sys_Milliseconds ();
|
||||
time = newtime - oldtime;
|
||||
} while (time < 1);
|
||||
Qcommon_Frame (time);
|
||||
oldtime = newtime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Sys_CopyProtect(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
================
|
||||
Sys_MakeCodeWriteable
|
||||
================
|
||||
*/
|
||||
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||
{
|
||||
|
||||
int r;
|
||||
unsigned long addr;
|
||||
int psize = getpagesize();
|
||||
|
||||
addr = (startaddr & ~(psize-1)) - psize;
|
||||
|
||||
// fprintf(stderr, "writable code %lx(%lx)-%lx, length=%lx\n", startaddr,
|
||||
// addr, startaddr+length, length);
|
||||
|
||||
r = mprotect((char*)addr, length + startaddr - addr + psize, 7);
|
||||
|
||||
if (r < 0)
|
||||
Sys_Error("Protection change failed\n");
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user