--- Makefile.orig Fri Sep 24 19:06:52 2004 +++ Makefile Thu Jul 27 16:16:06 2006 @@ -12,30 +12,30 @@ # (Note: not all options are available for all platforms). # quake2 (uses OSS for sound, cdrom ioctls for cd audio) is automatically built. # game$(ARCH).so is automatically built. -BUILD_SDLQUAKE2=YES # sdlquake2 executable (uses SDL for cdrom and sound) -BUILD_SVGA=NO # SVGAlib driver. Seems to work fine. -BUILD_X11=YES # X11 software driver. Works somewhat ok. -BUILD_GLX=YES # X11 GLX driver. Works somewhat ok. -BUILD_FXGL=NO # FXMesa driver. Not tested. (used only for V1 and V2). -BUILD_SDL=YES # SDL software driver. Works fine for some people. -BUILD_SDLGL=YES # SDL OpenGL driver. Works fine for some people. -BUILD_CTFDLL=YES # game$(ARCH).so for ctf -BUILD_XATRIX=NO # game$(ARCH).so for xatrix (see README.r for details) -BUILD_ROGUE=NO # game$(ARCH).so for rogue (see README.r for details) -BUILD_JOYSTICK=YES # build in joystick support -BUILD_ARTS=NO # build in support for libaRts sound. -BUILD_ALSA=NO # build in support for ALSA (default sound on 2.6) -BUILD_DEDICATED=NO # build a dedicated quake2 server -BUILD_AA=NO # build the ascii soft renderer. -BUILD_QMAX=NO # build the fancier GL graphics -BUILD_RETEXTURE=NO # build a version supporting retextured graphics -BUILD_REDBLUE=NO # build a red-blue 3d glasses renderer... +#BUILD_SDLQUAKE2=YES # sdlquake2 executable (uses SDL for cdrom and sound) +#BUILD_SVGA=NO # SVGAlib driver. Seems to work fine. +#BUILD_X11=YES # X11 software driver. Works somewhat ok. +#BUILD_GLX=YES # X11 GLX driver. Works somewhat ok. +#BUILD_FXGL=NO # FXMesa driver. Not tested. (used only for V1 and V2). +#BUILD_SDL=YES # SDL software driver. Works fine for some people. +#BUILD_SDLGL=YES # SDL OpenGL driver. Works fine for some people. +#BUILD_CTFDLL=YES # game$(ARCH).so for ctf +#BUILD_XATRIX=NO # game$(ARCH).so for xatrix (see README.r for details) +#BUILD_ROGUE=NO # game$(ARCH).so for rogue (see README.r for details) +#BUILD_JOYSTICK=YES # build in joystick support +#BUILD_ARTS=NO # build in support for libaRts sound. +#BUILD_ALSA=NO # build in support for ALSA (default sound on 2.6) +#BUILD_DEDICATED=NO # build a dedicated quake2 server +#BUILD_AA=NO # build the ascii soft renderer. +#BUILD_QMAX=NO # build the fancier GL graphics +#BUILD_RETEXTURE=NO # build a version supporting retextured graphics +#BUILD_REDBLUE=NO # build a red-blue 3d glasses renderer... STATICSDL=NO -SDLDIR=/usr/local/lib +SDLDIR=${PREFIX}/lib # Other compile-time options: # Compile with IPv6 (protocol independent API). Tested on FreeBSD -HAVE_IPV6=NO +#HAVE_IPV6=NO # (hopefully) end of configurable options @@ -52,60 +52,16 @@ endif endif +CC?=gcc -# this nice line comes from the linux kernel makefile -ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/) - -ifneq ($(ARCH),x86_64) -ifneq ($(ARCH),i386) -ifneq ($(ARCH),axp) -ifneq ($(ARCH),ppc) -ifneq ($(ARCH),sparc) -$(error arch $(ARCH) is currently not supported) -endif -endif -endif -endif -endif - -CC=gcc - -ifeq ($(ARCH),axp) -RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -endif - -ifeq ($(ARCH),ppc) -RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -endif - -ifeq ($(ARCH),sparc) -RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -endif - -ifeq ($(ARCH),i386) -RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \ - -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -# compiler bugs with gcc 2.96 and 3.0.1 can cause bad builds with heavy opts. -#RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -m486 -ffast-math -funroll-loops \ -# -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ -# -malign-jumps=2 -malign-functions=2 -endif - -ifeq ($(ARCH),x86_64) -_LIB := 64 -RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing -endif +RELEASE_CFLAGS=$(BASE_CFLAGS) $(OPTIMIZED_CFLAGS) -VERSION=3.21+r0.16 +VERSION=3.21+r0.16.2 MOUNT_DIR=src -BUILD_DEBUG_DIR=debug$(ARCH) -BUILD_RELEASE_DIR=release$(ARCH) +BUILD_DEBUG_DIR=debug +BUILD_RELEASE_DIR=release CLIENT_DIR=$(MOUNT_DIR)/client SERVER_DIR=$(MOUNT_DIR)/server REF_SOFT_DIR=$(MOUNT_DIR)/ref_soft @@ -118,7 +74,7 @@ ROGUE_DIR=$(MOUNT_DIR)/rogue NULL_DIR=$(MOUNT_DIR)/null -BASE_CFLAGS=-Wall -pipe -Dstricmp=strcasecmp +BASE_CFLAGS=-Wall $(CFLAGS) -Dstricmp=strcasecmp ifeq ($(HAVE_IPV6),YES) BASE_CFLAGS+= -DHAVE_IPV6 ifeq ($(OSTYPE),FreeBSD) @@ -144,7 +100,13 @@ BASE_CFLAGS+=$(shell artsc-config --cflags) endif -ifneq ($(ARCH),i386) +ifeq ($(ARCH),i386) +ifneq ($(strip $(NO_X86_ASM)),YES) + BASE_CFLAGS+=-Did386 +else + BASE_CFLAGS+=-DC_ONLY +endif +else BASE_CFLAGS+=-DC_ONLY endif @@ -166,20 +128,22 @@ endif -SVGALDFLAGS=-lvga +SVGALDFLAGS=-L${PREFIX}/lib -lvga +SVGACFLAGS=-I${PREFIX}/include -XCFLAGS=-I/usr/X11R6/include -XLDFLAGS=-L/usr/X11R6/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm -AALDFLAGS=-lm -laa +XCFLAGS=-I${LOCALBASE}/include +XLDFLAGS=-L${LOCALBASE}/lib -lX11 -lXext -lXxf86dga -lXxf86vm +AACFLAGS=-I${PREFIX}/include +AALDFLAGS=-L${PREFIX}/lib -laa -SDLCFLAGS=$(shell sdl-config --cflags) +SDLCFLAGS=$(shell ${SDL_CONFIG} --cflags) ifeq ($(strip $(STATICSDL)),YES) - SDLLDFLAGS += -L/usr/X11R6/lib$(_LIB) -Wl,-Bstatic $(SDLDIR)/libSDL.a + SDLLDFLAGS += -L${LOCALBASE}/lib$(_LIB) -Wl,-Bstatic $(SDLDIR)/libSDL.a SDLLDFLAGS += $(SDLDIR)/libesd.a $(SDLDIR)/libartsc.a -Wl,-Bdynamic SDLLDFLAGS += -lpthread -lX11 -lXext -lXxf86dga -lXxf86vm -lXv \ -lXinerama else - SDLLDFLAGS=$(shell sdl-config --libs) + SDLLDFLAGS=$(shell ${SDL_CONFIG} --libs) endif ifeq ($(strip $(BUILD_JOYSTICK)),YES) @@ -190,15 +154,16 @@ FXGLLDFLAGS=-L/usr/local/glide/lib -L/usr/X11/lib -L/usr/local/lib \ -L/usr/X11R6/lib -lX11 -lXext -lGL -lvga -GLXCFLAGS=-I/usr/X11R6/include -DOPENGL -GLXLDFLAGS=-L/usr/X11R6/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm +GLXCFLAGS=-I${LOCALBASE}/include -DOPENGL +GLXLDFLAGS=-L${LOCALBASE}/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL SDLGLLDFLAGS=$(SDLLDFLAGS) ifeq ($(strip $(BUILD_QMAX)),YES) -GLXLDFLAGS+=-ljpeg -SDLGLLDFLAGS+=-ljpeg +GLXCFLAGS+=-I${PREFIX}/include +GLXLDFLAGS+=-L${PREFIX}/lib -ljpeg +SDLGLLDFLAGS+=-L${PREFIX}/lib -ljpeg REF_GL_DIR = $(MOUNT_DIR)/ref_candygl CL_FX = cl_fxmax.c else @@ -214,7 +179,7 @@ DO_DED_CC=$(CC) $(CFLAGS) -DDEDICATED_ONLY -o $@ -c $< DO_DED_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -DDEDICATED_ONLY -o $@ -c $< DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< -DO_GL_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(GLCFLAGS) -o $@ -c $< +DO_GL_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(GLCFLAGS) $(GLXCFLAGS) -o $@ -c $< DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< DO_SHLIB_AS=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< @@ -224,167 +189,53 @@ .PHONY : targets build_debug build_release clean clean-debug clean-release clean2 -TARGETS=$(BUILDDIR)/quake2 $(BUILDDIR)/game$(ARCH).$(SHLIBEXT) -ifeq ($(strip $(BUILD_DEDICATED)),YES) - TARGETS += $(BUILDDIR)/q2ded -endif -ifeq ($(strip $(BUILD_CTFDLL)),YES) - TARGETS += $(BUILDDIR)/ctf/game$(ARCH).$(SHLIBEXT) +ifeq ($(strip $(BUILD_CLIENT)),YES) + TARGETS += $(BUILDDIR)/quake2 endif -ifeq ($(strip $(BUILD_XATRIX)),YES) - TARGETS += $(BUILDDIR)/xatrix/game$(ARCH).$(SHLIBEXT) +ifeq ($(strip $(BUILD_SDLQUAKE2)),YES) + TARGETS += $(BUILDDIR)/quake2-sdl endif -ifeq ($(strip $(BUILD_ROGUE)),YES) - TARGETS += $(BUILDDIR)/rogue/game$(ARCH).$(SHLIBEXT) +ifeq ($(strip $(BUILD_SVGA)),YES) + TARGETS += $(BUILDDIR)/ref_soft.$(SHLIBEXT) endif -ifeq ($(ARCH),axp) - ifeq ($(strip $(BUILD_SDLQUAKE2)),YES) - $(warning Warning: SDLQuake2 not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_SVGA)),YES) - $(warning Warning: SVGAlib support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_X11)),YES) - $(warning Warning: X11 support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_GLX)),YES) - $(warning Warning: support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_FXGL)),YES) - $(warning Warning: FXGL support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_SDL)),YES) - $(warning Warning: SDL support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_SDLGL)),YES) - $(warning Warning: SDLGL support not supported for $(ARCH)) - endif -endif # ARCH axp - -ifeq ($(ARCH),ppc) - ifeq ($(strip $(BUILD_SDLQUAKE2)),YES) - TARGETS += $(BUILDDIR)/sdlquake2 - endif - - ifeq ($(strip $(BUILD_SVGA)),YES) - $(warning Warning: SVGAlib support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_X11)),YES) - TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT) - endif - - ifeq ($(strip $(BUILD_GLX)),YES) - TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT) - endif - - ifeq ($(strip $(BUILD_FXGL)),YES) - $(warning Warning: FXGL support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_SDL)),YES) - TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT) - endif - - ifeq ($(strip $(BUILD_SDLGL)),YES) - TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT) - endif -endif # ARCH ppc - -ifeq ($(ARCH),sparc) - ifeq ($(strip $(BUILD_SDLQUAKE2)),YES) - TARGETS += $(BUILDDIR)/sdlquake2 - endif - - ifeq ($(strip $(BUILD_SVGA)),YES) - $(warning Warning: SVGAlib support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_X11)),YES) - TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT) - endif - - ifeq ($(strip $(BUILD_GLX)),YES) - $(warning Warning: GLX support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_FXGL)),YES) - $(warning Warning: FXGL support not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_SDL)),YES) - TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT) - endif - - ifeq ($(strip $(BUILD_SDLGL)),YES) - $(warning Warning: SDLGL support not supported for $(ARCH)) - endif -endif # ARCH sparc - -ifeq ($(ARCH),x86_64) - ifeq ($(strip $(BUILD_SDLQUAKE2)),YES) - TARGETS += $(BUILDDIR)/sdlquake2 - endif - - ifeq ($(strip $(BUILD_SVGA)),YES) - $(warning Warning: SVGA not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_SOFTX)),YES) - $(warning Warning: Software X Renderer not supported for $(ARCH)) - endif - - ifeq ($(strip $(BUILD_GLX)),YES) - TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT) - endif - - ifeq ($(strip $(BUILD_FXGL)),YES) - $(warning Warning: FXGL not currently supported for $(ARCH)) - endif +ifeq ($(strip $(BUILD_X11)),YES) + TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT) +endif - ifeq ($(strip $(BUILD_SDLGL)),YES) - TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT) - endif -endif # ARCH x86_64 +ifeq ($(strip $(BUILD_GLX)),YES) + TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT) +endif -ifeq ($(ARCH),i386) - ifeq ($(strip $(BUILD_SDLQUAKE2)),YES) - TARGETS += $(BUILDDIR)/sdlquake2 - endif +ifeq ($(strip $(BUILD_SDL)),YES) + TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT) +endif - ifeq ($(strip $(BUILD_SVGA)),YES) - TARGETS += $(BUILDDIR)/ref_soft.$(SHLIBEXT) - endif +ifeq ($(strip $(BUILD_SDLGL)),YES) + TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT) +endif - ifeq ($(strip $(BUILD_X11)),YES) - TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT) - endif +ifeq ($(strip $(BUILD_DEDICATED)),YES) + TARGETS += $(BUILDDIR)/q2ded +endif - ifeq ($(strip $(BUILD_GLX)),YES) - TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT) - endif +ifeq ($(strip $(BUILD_GAME)),YES) + TARGETS += $(BUILDDIR)/game.$(SHLIBEXT) +endif - ifeq ($(strip $(BUILD_FXGL)),YES) - TARGETS += $(BUILDDIR)/ref_gl.$(SHLIBEXT) - endif +ifeq ($(strip $(BUILD_CTFDLL)),YES) + TARGETS += $(BUILDDIR)/ctf/game.$(SHLIBEXT) +endif - ifeq ($(strip $(BUILD_SDL)),YES) - TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT) - endif +ifeq ($(strip $(BUILD_XATRIX)),YES) + TARGETS += $(BUILDDIR)/xatrix/game.$(SHLIBEXT) +endif - ifeq ($(strip $(BUILD_SDLGL)),YES) - TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT) - endif -endif # ARCH i386 +ifeq ($(strip $(BUILD_ROGUE)),YES) + TARGETS += $(BUILDDIR)/rogue/game.$(SHLIBEXT) +endif ifeq ($(strip $(BUILD_AA)),YES) TARGETS += $(BUILDDIR)/ref_softaa.$(SHLIBEXT) @@ -493,16 +344,17 @@ $(BUILDDIR)/client/snd_sdl.o ifeq ($(ARCH),i386) +ifneq ($(strip $(NO_X86_ASM)),YES) QUAKE2_AS_OBJS = \ $(BUILDDIR)/client/snd_mixa.o else -QUAKE2_AS_OBJS = #blank +endif endif $(BUILDDIR)/quake2 : $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS) $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS) $(LDFLAGS) -$(BUILDDIR)/sdlquake2 : $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) +$(BUILDDIR)/quake2-sdl : $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) $(LDFLAGS) $(SDLLDFLAGS) $(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c @@ -719,7 +571,7 @@ $(DO_DED_CC) $(BUILDDIR)/ded/q_shared.o : $(GAME_DIR)/q_shared.c - $(DO_DED_DEBUG_CC) + $(DO_DED_CC) $(BUILDDIR)/ded/pmove.o : $(COMMON_DIR)/pmove.c $(DO_DED_CC) @@ -821,7 +673,7 @@ $(BUILDDIR)/game/q_shared.o \ $(BUILDDIR)/game/m_flash.o -$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS) +$(BUILDDIR)/game.$(SHLIBEXT) : $(GAME_OBJS) $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) $(BUILDDIR)/game/g_ai.o : $(GAME_DIR)/g_ai.c @@ -1000,7 +852,7 @@ $(BUILDDIR)/ctf/p_weapon.o \ $(BUILDDIR)/ctf/q_shared.o -$(BUILDDIR)/ctf/game$(ARCH).$(SHLIBEXT) : $(CTF_OBJS) +$(BUILDDIR)/ctf/game.$(SHLIBEXT) : $(CTF_OBJS) $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CTF_OBJS) $(BUILDDIR)/ctf/g_ai.o : $(CTF_DIR)/g_ai.c @@ -1139,7 +991,7 @@ $(BUILDDIR)/xatrix/p_weapon.o \ $(BUILDDIR)/xatrix/q_shared.o -$(BUILDDIR)/xatrix/game$(ARCH).$(SHLIBEXT) : $(XATRIX_OBJS) +$(BUILDDIR)/xatrix/game.$(SHLIBEXT) : $(XATRIX_OBJS) $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(XATRIX_OBJS) $(BUILDDIR)/xatrix/g_ai.o : $(XATRIX_DIR)/g_ai.c @@ -1367,7 +1219,7 @@ $(BUILDDIR)/rogue/q_shared.o -$(BUILDDIR)/rogue/game$(ARCH).$(SHLIBEXT) : $(ROGUE_OBJS) +$(BUILDDIR)/rogue/game.$(SHLIBEXT) : $(ROGUE_OBJS) $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(ROGUE_OBJS) $(BUILDDIR)/rogue/dm_ball.o : $(ROGUE_DIR)/dm_ball.c @@ -1588,6 +1440,7 @@ endif ifeq ($(ARCH),i386) +ifneq ($(strip $(NO_X86_ASM)),YES) REF_SOFT_OBJS += \ $(BUILDDIR)/ref_soft/r_aclipa.o \ $(BUILDDIR)/ref_soft/r_draw16.o \ @@ -1601,6 +1454,7 @@ $(BUILDDIR)/ref_soft/r_varsa.o \ $(BUILDDIR)/ref_soft/sys_dosa.o endif +endif REF_SOFT_SVGA_OBJS = \ $(BUILDDIR)/ref_soft/rw_svgalib.o \ @@ -1732,10 +1586,10 @@ $(DO_SHLIB_AS) $(BUILDDIR)/ref_soft/rw_svgalib.o : $(LINUX_DIR)/rw_svgalib.c - $(DO_SHLIB_CC) + $(DO_SHLIB_CC) $(SVGACFLAGS) $(BUILDDIR)/ref_soft/rw_in_svgalib.o : $(LINUX_DIR)/rw_in_svgalib.c - $(DO_SHLIB_CC) + $(DO_SHLIB_CC) $(SVGACFLAGS) $(BUILDDIR)/ref_soft/rw_x11.o : $(LINUX_DIR)/rw_x11.c $(DO_SHLIB_CC) $(XCFLAGS) @@ -1750,10 +1604,10 @@ $(DO_SHLIB_CC) $(SDLCFLAGS) $(BUILDDIR)/ref_soft/rw_aa.o : $(LINUX_DIR)/rw_aa.c - $(DO_SHLIB_CC) + $(DO_SHLIB_CC) $(AACFLAGS) $(BUILDDIR)/ref_soft/rw_in_aa.o : $(LINUX_DIR)/rw_in_aa.c - $(DO_SHLIB_CC) + $(DO_SHLIB_CC) $(AACFLAGS) ############################################################################# # REF_GL