--- code/unix/Makefile.orig Sun Jun 4 18:06:17 2006 +++ code/unix/Makefile Sun Jun 4 18:07:46 2006 @@ -19,6 +19,7 @@ PLATFORM=$(shell uname|tr A-Z a-z) PLATFORM_RELEASE=$(shell uname -r) +ARCH=$(shell uname -m) ### ### These paths are where you probably want to change things @@ -34,7 +35,7 @@ # Build name # BUILD_NAME=$(BUILD_NAME) -BUILD_NAME=quake3.x86 +BUILD_NAME=quake3 @@ -46,8 +47,8 @@ BASEQ3_DIR=$(BDIR)/baseq3 -BD=debug$(ARCH)$(GLIBC) -BR=release$(ARCH)$(GLIBC) +BD=debug +BR=release CDIR=$(MOUNT_DIR)/client SDIR=$(MOUNT_DIR)/server RDIR=$(MOUNT_DIR)/renderer @@ -76,7 +77,7 @@ ############################################################################# ## Defaults -DLL_ONLY=false +DLL_ONLY?=false # bk010215 - TODO - add all defaults / kill Ryan @@ -199,31 +200,23 @@ GLIBC= #libc is irrelevant -ifneq (,$(findstring alpha,$(shell uname -m))) -ARCH=axp -RPMARCH=alpha -VENDOR=dec -else #default to i386 -ARCH=i386 -RPMARCH=i386 -VENDOR=unknown -endif #alpha test +BASE_CFLAGS = $(CFLAGS) -DDATADIR='\"$(Q3DIR)\"' -DLIBDIR='\"$(LIBDIR)\"' -pipe +GL_CFLAGS = -I$(LOCALBASE)/include -BASE_CFLAGS = -pipe +DEBUG_CFLAGS=$(BASE_CFLAGS) -g -Wall -Werror +RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -GL_CFLAGS = -I$(MESADIR)/include -I/usr/X11R6/include +ifdef OPTIMIZED_CFLAGS + ifeq ($(ARCH),i386) +RELEASE_CFLAGS=$(BASE_CFLAGS) -O3 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce + else +RELEASE_CFLAGS=$(BASE_CFLAGS) -O3 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations + endif +endif -DEBUG_CFLAGS=$(BASE_CFLAGS) -g -Wall -Werror -ifeq ($(ARCH),axp) -CC=pgcc -RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations -else -#NEWPGCC=/loki/global/x86/bin/gcc # raistlin012301 -#NEWPGCC=/usr/local/gcc-2.95.2/bin/gcc -NEWPGCC=/home/raistllin/src/gcc/build/install/bin/gcc -CC=$(shell if [ -f $(NEWPGCC) ]; then echo $(NEWPGCC); else echo pgcc; fi ) -RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing - fstrength-reduce +ifeq ($(DLL_ONLY),true) +BASE_CFLAGS += -DDLL_ONLY endif LIBEXT=a @@ -235,25 +228,37 @@ ARFLAGS=ar rv RANLIB=ranlib -THREAD_LDFLAGS=-lpthread +THREAD_LDFLAGS=$(PTHREAD_LIBS) # don't need -ldl (FreeBSD) -LDFLAGS=-lm +LDFLAGS+=-lm #GLLDFLAGS=-L/usr/X11R6/lib -L$(MESADIR)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm #GLLDFLAGS=-L/usr/X11/lib -lGL -lX11 -lXext -lm -GLLDFLAGS=-L/usr/X11R6/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm +GLLDFLAGS=-L$(LOCALBASE)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm -ifeq ($(ARCH),axp) -TARGETS=\ - $(B)/$(PLATFORM)q3ded -else -TARGETS=\ - $(B)/$(PLATFORM)quake3 \ - $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \ - $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \ - $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \ - $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \ - $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \ - $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) +ifdef CLIENT +TARGETS+=$(B)/cleanq3 +endif + +ifdef DEDICATED +TARGETS+=$(B)/cleanq3ded +endif + +ifdef SMP +TARGETS+=$(B)/cleanq3-smp +endif + +ifeq ($(DLL_ONLY),true) +GAMELIBS=yes +endif + +ifdef GAMELIBS +TARGETS+=\ + $(B)/baseq3/cgame.$(SHLIBEXT) \ + $(B)/baseq3/qagame.$(SHLIBEXT) \ + $(B)/baseq3/ui.$(SHLIBEXT) \ + $(B)/missionpack/cgame.$(SHLIBEXT) \ + $(B)/missionpack/qagame.$(SHLIBEXT) \ + $(B)/missionpack/ui.$(SHLIBEXT) endif else # ifeq freebsd @@ -348,7 +353,7 @@ $(MAKE) targets B=$(BR) CFLAGS="$(RELEASE_CFLAGS)" #Build both debug and release builds -all:build_debug build_release +all:build_release targets:makedirs $(TARGETS) @@ -516,20 +521,6 @@ $(B)/client/unix_net.o \ $(B)/client/unix_shared.o \ \ - $(B)/client/ahoptim.o \ - $(B)/client/autohint.o \ - $(B)/client/ftbase.o \ - $(B)/client/ftdebug.o \ - $(B)/client/ftglyph.o \ - $(B)/client/ftinit.o \ - $(B)/client/ftmm.o \ - $(B)/client/ftsystem.o \ - $(B)/client/raster1.o \ - $(B)/client/sfnt.o \ - $(B)/client/sfobjs.o \ - $(B)/client/smooth.o \ - $(B)/client/truetype.o -# \ # $(B)/client/q_parse.o \ # $(B)/client/math_quaternion.o \ # $(B)/client/util_str.o \ @@ -541,10 +532,12 @@ # $(B)/client/q_shared.o \ ifeq ($(ARCH),i386) - Q3OBJ += $(B)/client/vm_x86.o + ifeq ($(DLL_ONLY),false) + Q3OBJ += $(B)/client/vm_x86.o + endif endif - ifeq ($(ARCH),ppc) + ifeq ($(ARCH),powerpc) ifeq ($(DLL_ONLY),false) Q3OBJ += $(B)/client/vm_ppc.o endif @@ -559,10 +552,24 @@ $(B)/client/linux_qgl.o \ $(B)/client/linux_glimp.o \ $(B)/client/linux_snd.o \ + $(B)/client/linux_signals.o \ + $(B)/client/snd_mixa.o \ + $(B)/client/matha.o + + Q3POBJ_SMP=\ + $(B)/client/linux_common.o \ + $(B)/client/linux_qgl.o \ + $(B)/client/linux_glimp_smp.o \ + $(B)/client/linux_snd.o \ + $(B)/client/linux_signals.o \ $(B)/client/snd_mixa.o \ $(B)/client/matha.o \ - $(B)/client/ftol.o \ - $(B)/client/snapvector.o + + ifeq ($(ARCH),i386) + Q3POBJ += $(B)/client/ftol.o $(B)/client/snapvector.o + Q3POBJ_SMP += $(B)/client/ftol.o $(B)/client/snapvector.o + endif + else ifeq ($(PLATFORM),irix) Q3POBJ=\ @@ -602,12 +609,12 @@ endif #FreeBSD endif #IRIX -$(B)/$(PLATFORM)quake3 : $(Q3OBJ) $(Q3POBJ) +$(B)/cleanq3 : $(Q3OBJ) $(Q3POBJ) $(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(GLLDFLAGS) $(LDFLAGS) # TTimo: splines code requires C++ linking, but splines have not been officially included in the codebase # $(CXX) -o $@ $(Q3OBJ) $(Q3POBJ) $(GLLDFLAGS) $(LDFLAGS) -$(B)/$(PLATFORM)quake3-smp : $(Q3OBJ) $(Q3POBJ_SMP) +$(B)/cleanq3-smp : $(Q3OBJ) $(Q3POBJ_SMP) $(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(GLLDFLAGS) \ $(THREAD_LDFLAGS) $(LDFLAGS) @@ -758,6 +765,7 @@ $(B)/client/linux_qgl.o : $(UDIR)/linux_qgl.c; $(DO_CC) $(GL_CFLAGS) $(B)/client/linux_input.o : $(UDIR)/linux_input.c; $(DO_CC) $(B)/client/linux_snd.o : $(UDIR)/linux_snd.c; $(DO_CC) +$(B)/client/linux_signals.o : $(UDIR)/linux_signals.c; $(DO_CC) $(GL_CFLAGS) $(B)/client/snd_mixa.o : $(UDIR)/snd_mixa.s; $(DO_AS) $(B)/client/matha.o : $(UDIR)/matha.s; $(DO_AS) @@ -767,7 +775,7 @@ $(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC) endif -ifeq ($(ARCH),ppc) +ifeq ($(ARCH),powerpc) ifeq ($(DLL_ONLY),false) $(B)/client/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC) endif @@ -912,22 +920,26 @@ $(B)/ded/unix_main.o \ $(B)/ded/unix_net.o \ $(B)/ded/unix_shared.o \ + $(B)/ded/linux_signals.o \ \ $(B)/ded/null_client.o \ $(B)/ded/null_input.o \ $(B)/ded/null_snddma.o ifeq ($(ARCH),i386) - Q3DOBJ += $(B)/ded/vm_x86.o $(B)/ded/ftol.o $(B)/ded/snapvector.o + Q3DOBJ += $(B)/ded/ftol.o $(B)/ded/snapvector.o + ifeq ($(DLL_ONLY),false) + Q3DOBJ += $(B)/ded/vm_x86.o + endif endif -ifeq ($(ARCH),ppc) +ifeq ($(ARCH),powerpc) ifeq ($(DLL_ONLY),false) Q3DOBJ += $(B)/ded/vm_ppc.o endif endif -$(B)/$(PLATFORM)q3ded : $(Q3DOBJ) +$(B)/cleanq3ded : $(Q3DOBJ) $(CC) -o $@ $(Q3DOBJ) $(LDFLAGS) $(B)/ded/sv_bot.o : $(SDIR)/sv_bot.c; $(DO_DED_CC) @@ -988,6 +1000,7 @@ $(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) +$(B)/ded/linux_signals.o : $(UDIR)/linux_signals.c; $(DO_DED_CC) $(B)/ded/null_client.o : $(NDIR)/null_client.c; $(DO_DED_CC) $(B)/ded/null_input.o : $(NDIR)/null_input.c; $(DO_DED_CC) $(B)/ded/null_snddma.o : $(NDIR)/null_snddma.c; $(DO_DED_CC) @@ -1001,7 +1014,7 @@ $(B)/ded/snapvector.o : $(UDIR)/snapvector.nasm; $(DO_NASM) endif -ifeq ($(ARCH),ppc) +ifeq ($(ARCH),powerpc) ifeq ($(DLL_ONLY),false) $(B)/ded/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_DED_CC) endif @@ -1068,7 +1081,7 @@ $(B)/baseq3/cgame/q_math.o \ $(B)/baseq3/cgame/q_shared.o -$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) : $(Q3CGOBJ) +$(B)/baseq3/cgame.$(SHLIBEXT) : $(Q3CGOBJ) $(CC) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ) $(B)/baseq3/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC) @@ -1128,7 +1141,7 @@ $(B)/missionpack/cgame/q_shared.o \ $(B)/missionpack/cgame/ui_shared.o -$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) : $(MPCGOBJ) +$(B)/missionpack/cgame.$(SHLIBEXT) : $(MPCGOBJ) $(CC) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ) $(B)/missionpack/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC) -DMISSIONPACK @@ -1200,7 +1213,7 @@ $(B)/baseq3/game/q_math.o \ $(B)/baseq3/game/q_shared.o -$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) : $(Q3GOBJ) +$(B)/baseq3/qagame.$(SHLIBEXT) : $(Q3GOBJ) $(CC) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ) $(B)/baseq3/game/ai_chat.o : $(GDIR)/ai_chat.c; $(DO_SHLIB_CC) @@ -1278,7 +1291,7 @@ $(B)/missionpack/game/q_math.o \ $(B)/missionpack/game/q_shared.o -$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) : $(MPGOBJ) +$(B)/missionpack/qagame.$(SHLIBEXT) : $(MPGOBJ) $(CC) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ) $(B)/missionpack/game/ai_chat.o : $(GDIR)/ai_chat.c; $(DO_SHLIB_CC) -DMISSIONPACK @@ -1367,7 +1380,7 @@ $(B)/baseq3/ui/q_math.o \ $(B)/baseq3/ui/q_shared.o -$(B)/baseq3/ui$(ARCH).$(SHLIBEXT) : $(Q3UIOBJ) +$(B)/baseq3/ui.$(SHLIBEXT) : $(Q3UIOBJ) $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ) $(B)/baseq3/ui/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC) @@ -1410,7 +1423,7 @@ $(B)/baseq3/ui/ui_startserver.o : $(Q3UIDIR)/ui_startserver.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_team.o : $(Q3UIDIR)/ui_team.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_teamorders.o : $(Q3UIDIR)/ui_teamorders.c; $(DO_SHLIB_CC) -$(B)/baseq3/ui/ui_syscalls.o : $(Q3UIDIR)/ui_syscalls.c; $(DO_SHLIB_CC) +$(B)/baseq3/ui/ui_syscalls.o : $(UIDIR)/ui_syscalls.c; $(DO_SHLIB_CC) $(B)/baseq3/ui/ui_video.o : $(Q3UIDIR)/ui_video.c; $(DO_SHLIB_CC) # bk001205 - these wre the only SHLIB compiles in 1.17 @@ -1450,7 +1463,7 @@ # $(B)/missionpack/ui/q_math.o \ # $(B)/missionpack/ui/q_shared.o -$(B)/missionpack/ui$(ARCH).$(SHLIBEXT) : $(MPUIOBJ) +$(B)/missionpack/ui.$(SHLIBEXT) : $(MPUIOBJ) $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ) $(B)/missionpack/ui/ui_atoms.o : $(UIDIR)/ui_atoms.c; $(DO_SHLIB_CC) -DMISSIONPACK @@ -2059,9 +2072,9 @@ copyfiles: -mkdirhier $(COPYDIR) - cp $(BR)/linuxquake3 $(COPYDIR)/quake3.x86 - strip $(COPYDIR)/quake3.x86 - chmod 755 $(COPYDIR)/quake3.x86 + cp $(BR)/linuxquake3 $(COPYDIR)/quake3 + strip $(COPYDIR)/quake3 + chmod 755 $(COPYDIR)/quake3 cp $(BR)/linuxq3ded $(COPYDIR)/q3ded strip $(COPYDIR)/q3ded chmod 755 $(COPYDIR)/q3ded