--- Makefile.orig 2007-12-16 18:09:18.000000000 -0300 +++ Makefile 2008-02-28 11:39:45.000000000 -0300 @@ -27,16 +27,22 @@ endif endif -BUILD_CLIENT =1 -BUILD_CLIENT_SMP =0 -BUILD_SERVER =0 -BUILD_GAME_SO =0 -BUILD_GAME_QVM =0 -OPTIMIZE =1 -USE_SDL =1 -USE_OPENAL =0 -USE_CURL =1 -USE_CODEC_VORBIS =0 +BUILD_CLIENT?=0 +BUILD_CLIENT_SMP?=0 +BUILD_GAME_QVM?=0 +BUILD_GAME_SO?=0 +BUILD_SERVER?=0 +HAVE_VM_COMPILED?=false +USE_CODEC_MP3?=0 +USE_CODEC_VORBIS?=0 +USE_CURL?=0 +USE_CURL_DLOPEN?=0 +USE_LOCAL_HEADERS?=0 +USE_OPENAL?=0 +USE_OPENAL_DLOPEN?=0 +USE_OPTIMIZED_CFLAGS?=0 +USE_SDL_AUDIO?=0 +USE_SDL_VIDEO?=0 ifeq ($(V),1) echo_cmd=@: @@ -106,38 +112,10 @@ USE_SDL=1 endif -ifndef USE_OPENAL -USE_OPENAL=1 -endif - -ifndef USE_OPENAL_DLOPEN -USE_OPENAL_DLOPEN=0 -endif - -ifndef USE_CURL -USE_CURL=1 -endif - -ifndef USE_CURL_DLOPEN - ifeq ($(PLATFORM),mingw32) - USE_CURL_DLOPEN=0 - else - USE_CURL_DLOPEN=1 - endif -endif - -ifndef USE_CODEC_VORBIS -USE_CODEC_VORBIS=0 -endif - -ifndef USE_LOCAL_HEADERS -USE_LOCAL_HEADERS=1 -endif - ############################################################################# -BD=$(BUILD_DIR)/debug-$(PLATFORM)-$(ARCH) -BR=$(BUILD_DIR)/release-$(PLATFORM)-$(ARCH) +BD=$(BUILD_DIR)/debug +BR=$(BUILD_DIR)/release CDIR=$(MOUNT_DIR)/client SDIR=$(MOUNT_DIR)/server RDIR=$(MOUNT_DIR)/renderer @@ -221,6 +199,10 @@ BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 endif + ifeq ($(USE_CODEC_MP3),1) + BASE_CFLAGS += -DUSE_CODEC_MP3=1 + endif + ifeq ($(USE_SDL),1) BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags) else @@ -385,6 +367,11 @@ endif endif + ifeq ($(USE_CODEC_MP3),1) + BASE_CFLAGS += -DUSE_CODEC_MP3=1 + CLIENT_LDFLAGS += -lmad + endif + ifeq ($(USE_CODEC_VORBIS),1) BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg @@ -476,6 +463,10 @@ endif endif + ifeq ($(USE_CODEC_MP3),1) + CLIENT_LDFLAGS += -lmad + endif + ifeq ($(USE_CODEC_VORBIS),1) CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg endif @@ -497,17 +488,10 @@ ifeq ($(PLATFORM),freebsd) - ifneq (,$(findstring alpha,$(shell uname -m))) - ARCH=axp - else #default to i386 - ARCH=i386 - endif #alpha test - - - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -I/usr/X11R6/include + BASE_CFLAGS = -DARCH='\"$(ARCH)\"' -DLIBDIR='\"$(LIBDIR)\"' -I$(LOCALBASE)/include -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes DEBUG_CFLAGS=$(BASE_CFLAGS) -g + RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -pipe ifeq ($(USE_OPENAL),1) BASE_CFLAGS += -DUSE_OPENAL=1 @@ -516,49 +500,80 @@ endif endif + ifeq ($(USE_CURL),1) + BASE_CFLAGS += -DUSE_CURL=1 + ifneq ($(USE_CURL_DLOPEN),1) + CLIENT_LDFLAGS += -lcurl + else + BASE_CFLAGS += -DUSE_CURL_DLOPEN=1 + endif + endif + ifeq ($(USE_CODEC_VORBIS),1) BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 endif - ifeq ($(USE_SDL),1) - BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 + ifeq ($(USE_SDL_AUDIO),1) + BASE_CFLAGS += $(shell $(SDL_CONFIG) --cflags) + else + ifeq ($(USE_SDL_VIDEO),1) + BASE_CFLAGS += $(shell $(SDL_CONFIG) --cflags) + endif endif - ifeq ($(ARCH),axp) - BASE_CFLAGS += -DNO_VM_COMPILED - RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations - else - ifeq ($(ARCH),i386) - RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -mtune=pentiumpro \ - -march=pentium -fomit-frame-pointer -pipe -ffast-math \ - -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ - -funroll-loops -fstrength-reduce - HAVE_VM_COMPILED=true - else - BASE_CFLAGS += -DNO_VM_COMPILED + ifeq ($(USE_SDL_AUDIO),1) + BASE_CFLAGS += -DUSE_SDL_SOUND=1 endif + + ifeq ($(USE_SDL_VIDEO),1) + BASE_CFLAGS += -DUSE_SDL_VIDEO=1 + endif + + ifeq ($(USE_OPTIMIZED_CFLAGS),1) + RELEASE_CFLAGS+=-O3 -ffast-math -funroll-loops -fomit-frame-pointer \ + -fexpensive-optimizations + ifeq ($(ARCH),i386) + RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 \ + -fstrength-reduce + endif + endif + + ifneq ($(HAVE_VM_COMPILED),true) + BASE_CFLAGS += -DNO_VM_COMPILED endif SHLIBEXT=so SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LDFLAGS=-lpthread + THREAD_LDFLAGS=$(PTHREAD_LIBS) # don't need -ldl (FreeBSD) LDFLAGS=-lm - CLIENT_LDFLAGS = + CLIENT_LDFLAGS = -L$(LOCALBASE)/lib - ifeq ($(USE_SDL),1) - CLIENT_LDFLAGS += $(shell sdl-config --libs) + ifeq ($(USE_SDL_AUDIO),1) + CLIENT_LDFLAGS += $(shell $(SDL_CONFIG) --libs) else - CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm + ifeq ($(USE_SDL_VIDEO),1) + CLIENT_LDFLAGS += $(shell $(SDL_CONFIG) --libs) + endif + endif + + ifneq ($(USE_SDL_VIDEO),1) + CLIENT_LDFLAGS += -L$(LOCALBASE)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm endif ifeq ($(USE_OPENAL),1) + CLIENT_LDFLAGS += $(THREAD_LDFLAGS) ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lopenal + CLIENT_LDFLAGS += -lopenal + endif + endif + + ifeq ($(USE_CURL),1) + ifneq ($(USE_CURL_DLOPEN),1) + CLIENT_LDFLAGS += -lcurl endif endif @@ -566,7 +581,6 @@ CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg endif - else # ifeq freebsd ############################################################################# @@ -717,24 +731,25 @@ TARGETS = ifneq ($(BUILD_SERVER),0) - TARGETS += $(B)/ioUrTded.$(ARCH)$(BINEXT) + TARGETS += $(B)/ioUrTded$(BINEXT) endif ifneq ($(BUILD_CLIENT),0) - TARGETS += $(B)/ioUrbanTerror.$(ARCH)$(BINEXT) - ifneq ($(BUILD_CLIENT_SMP),0) - TARGETS += $(B)/ioUrbanTerror-smp.$(ARCH)$(BINEXT) - endif + TARGETS += $(B)/ioUrbanTerror$(BINEXT) +endif + +ifneq ($(BUILD_CLIENT_SMP),0) + TARGETS += $(B)/ioUrbanTerror-smp$(BINEXT) endif ifneq ($(BUILD_GAME_SO),0) TARGETS += \ - $(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) + $(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 ifneq ($(BUILD_GAME_QVM),0) @@ -824,10 +839,10 @@ all: debug release debug: - @$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)" V=$(V) + @$(MAKE) targets B=$(BD) CFLAGS+="$(CFLAGS) $(DEBUG_CFLAGS)" V=$(V) release: - @$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)" V=$(V) + @$(MAKE) targets B=$(BR) CFLAGS+="$(CFLAGS) $(RELEASE_CFLAGS)" V=$(V) # Create the build directories and tools, print out # an informational message, then start building @@ -880,7 +895,7 @@ Q3LCC=$(TOOLSDIR)/q3lcc$(BINEXT) Q3ASM=$(TOOLSDIR)/q3asm$(BINEXT) -ifeq ($(CROSS_COMPILING),1) +ifeq ($(BUILD_GAME_QVM),0) tools: @echo QVM tools not built when cross-compiling else @@ -943,8 +958,13 @@ $(B)/client/snd_main.o \ $(B)/client/snd_codec.o \ $(B)/client/snd_codec_wav.o \ - $(B)/client/snd_codec_ogg.o \ - \ + $(B)/client/snd_codec_ogg.o + +ifeq ($(USE_CODEC_MP3),1) + Q3OBJ += $(B)/client/snd_codec_mp3.o +endif + +Q3OBJ += \ $(B)/client/qal.o \ $(B)/client/snd_openal.o \ \ @@ -1078,9 +1098,15 @@ ifeq ($(ARCH),x86) Q3OBJ += $(B)/client/vm_x86.o endif + ifeq ($(ARCH),amd64) + Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o + endif ifeq ($(ARCH),x86_64) Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o endif + ifeq ($(ARCH),powerpc) + Q3OBJ += $(B)/client/vm_ppc.o + endif ifeq ($(ARCH),ppc) Q3OBJ += $(B)/client/vm_ppc.o endif @@ -1113,7 +1139,7 @@ ifeq ($(USE_SDL),1) ifneq ($(PLATFORM),darwin) - BUILD_CLIENT_SMP = 0 + #BUILD_CLIENT_SMP = 0 endif endif @@ -1126,12 +1152,12 @@ $(B)/clientsmp/sdl_glimp.o endif -$(B)/ioUrbanTerror.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) +$(B)/ioUrbanTerror$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \ $(LDFLAGS) $(LIBSDLMAIN) -$(B)/ioUrbanTerror-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) +$(B)/ioUrbanTerror-smp$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(CLIENT_LDFLAGS) \ $(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN) @@ -1240,15 +1266,21 @@ ifeq ($(ARCH),x86) Q3DOBJ += $(B)/ded/vm_x86.o endif + ifeq ($(ARCH),amd64) + Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o + endif ifeq ($(ARCH),x86_64) Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o endif + ifeq ($(ARCH),powerpc) + Q3DOBJ += $(B)/ded/vm_ppc.o + endif ifeq ($(ARCH),ppc) Q3DOBJ += $(B)/ded/vm_ppc.o endif endif -$(B)/ioUrTded.$(ARCH)$(BINEXT): $(Q3DOBJ) +$(B)/ioUrTded$(BINEXT): $(Q3DOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS) @@ -1287,7 +1319,7 @@ Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm -$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) : $(Q3CGOBJ) +$(B)/baseq3/cgame.$(SHLIBEXT) : $(Q3CGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ) @@ -1330,7 +1362,7 @@ MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm) $(B)/missionpack/game/bg_lib.asm -$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) : $(MPCGOBJ) +$(B)/missionpack/cgame.$(SHLIBEXT) : $(MPCGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ) @@ -1382,7 +1414,7 @@ Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm -$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) : $(Q3GOBJ) +$(B)/baseq3/qagame.$(SHLIBEXT) : $(Q3GOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ) @@ -1432,7 +1464,7 @@ MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o MPGVMOBJ = $(MPGOBJ_:%.o=%.asm) $(B)/missionpack/game/bg_lib.asm -$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) : $(MPGOBJ) +$(B)/missionpack/qagame.$(SHLIBEXT) : $(MPGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ) @@ -1494,7 +1526,7 @@ Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm -$(B)/baseq3/ui$(ARCH).$(SHLIBEXT) : $(Q3UIOBJ) +$(B)/baseq3/ui.$(SHLIBEXT) : $(Q3UIOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ) @@ -1521,7 +1553,7 @@ MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm -$(B)/missionpack/ui$(ARCH).$(SHLIBEXT) : $(MPUIOBJ) +$(B)/missionpack/ui.$(SHLIBEXT) : $(MPUIOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)