diff options
author | Tim Angus <tim@ngus.net> | 2009-10-03 12:31:59 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:03 +0000 |
commit | 304d4258d3a49488f570b8ad71931faa7e5d40ba (patch) | |
tree | bf9ec15bd9154305ff9fab2943b3daf25024f8a5 /Makefile | |
parent | 6e90e4e7861f5cb354487d1fe0f1fd06c385308e (diff) |
* Merge ioq3-r1498, by popular demand
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 150 |
1 files changed, 86 insertions, 64 deletions
@@ -61,6 +61,9 @@ export PLATFORM ifeq ($(COMPILE_ARCH),powerpc) COMPILE_ARCH=ppc endif +ifeq ($(COMPILE_ARCH),powerpc64) + COMPILE_ARCH=ppc64 +endif ifndef ARCH ARCH=$(COMPILE_ARCH) @@ -193,7 +196,7 @@ ifeq ($(wildcard .svn),.svn) endif else ifeq ($(wildcard .git/svn/.metadata),.git/svn/.metadata) - SVN_REV=$(shell LANG=C git-svn info | awk '$$1 == "Revision:" {print $$2; exit 0}') + SVN_REV=$(shell LANG=C git svn info | awk '$$1 == "Revision:" {print $$2; exit 0}') ifneq ($(SVN_REV),) VERSION:=$(VERSION)_SVN$(SVN_REV) endif @@ -267,7 +270,11 @@ ifeq ($(PLATFORM),linux) else ifeq ($(ARCH),ppc) BASE_CFLAGS += -maltivec - HAVE_VM_COMPILED=false + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),ppc64) + BASE_CFLAGS += -maltivec + HAVE_VM_COMPILED=true endif endif endif @@ -280,29 +287,29 @@ ifeq ($(PLATFORM),linux) SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LDFLAGS=-lpthread - LDFLAGS=-ldl -lm + THREAD_LIBS=-lpthread + LIBS=-ldl -lm - CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL + CLIENT_LIBS=$(shell sdl-config --libs) -lGL ifeq ($(USE_OPENAL),1) ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LDFLAGS += -lopenal + CLIENT_LIBS += -lopenal endif endif ifeq ($(USE_CURL),1) ifneq ($(USE_CURL_DLOPEN),1) - CLIENT_LDFLAGS += -lcurl + CLIENT_LIBS += -lcurl endif endif ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg + CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif ifeq ($(USE_MUMBLE),1) - CLIENT_LDFLAGS += -lrt + CLIENT_LIBS += -lrt endif ifeq ($(USE_LOCAL_HEADERS),1) @@ -312,11 +319,9 @@ ifeq ($(PLATFORM),linux) ifeq ($(ARCH),x86) # linux32 make ... BASE_CFLAGS += -m32 - LDFLAGS+=-m32 else ifeq ($(ARCH),ppc64) BASE_CFLAGS += -m64 - LDFLAGS += -m64 endif endif @@ -331,7 +336,7 @@ else # ifeq Linux ifeq ($(PLATFORM),darwin) HAVE_VM_COMPILED=true - CLIENT_LDFLAGS= + CLIENT_LIBS= OPTIMIZE= BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes @@ -340,6 +345,9 @@ ifeq ($(PLATFORM),darwin) BASE_CFLAGS += -faltivec OPTIMIZE += -O3 endif + ifeq ($(ARCH),ppc64) + BASE_CFLAGS += -faltivec + endif ifeq ($(ARCH),x86) OPTIMIZE += -march=prescott -mfpmath=sse # x86 vm will crash without -mstackrealign since MMX instructions will be @@ -352,7 +360,7 @@ ifeq ($(PLATFORM),darwin) ifeq ($(USE_OPENAL),1) BASE_CFLAGS += -DUSE_OPENAL ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LDFLAGS += -framework OpenAL + CLIENT_LIBS += -framework OpenAL else BASE_CFLAGS += -DUSE_OPENAL_DLOPEN endif @@ -361,7 +369,7 @@ ifeq ($(PLATFORM),darwin) ifeq ($(USE_CURL),1) BASE_CFLAGS += -DUSE_CURL ifneq ($(USE_CURL_DLOPEN),1) - CLIENT_LDFLAGS += -lcurl + CLIENT_LIBS += -lcurl else BASE_CFLAGS += -DUSE_CURL_DLOPEN endif @@ -369,7 +377,7 @@ ifeq ($(PLATFORM),darwin) ifeq ($(USE_CODEC_VORBIS),1) BASE_CFLAGS += -DUSE_CODEC_VORBIS - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg + CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif BASE_CFLAGS += -D_THREAD_SAFE=1 @@ -382,7 +390,7 @@ ifeq ($(PLATFORM),darwin) # the file has been modified by each build. LIBSDLMAIN=$(B)/libSDLmain.a LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a - CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \ + CLIENT_LIBS += -framework Cocoa -framework IOKit -framework OpenGL \ $(LIBSDIR)/macosx/libSDL-1.2.0.dylib OPTIMIZE += -ffast-math -falign-loops=16 @@ -452,8 +460,9 @@ ifeq ($(PLATFORM),mingw32) BINEXT=.exe - LDFLAGS= -lws2_32 -lwinmm - CLIENT_LDFLAGS = -mwindows -lgdi32 -lole32 -lopengl32 + LIBS= -lws2_32 -lwinmm + CLIENT_LDFLAGS = -mwindows + CLIENT_LIBS = -lgdi32 -lole32 -lopengl32 ifeq ($(USE_CURL),1) BASE_CFLAGS += -DUSE_CURL @@ -461,35 +470,34 @@ ifeq ($(PLATFORM),mingw32) ifneq ($(USE_CURL_DLOPEN),1) ifeq ($(USE_LOCAL_HEADERS),1) BASE_CFLAGS += -DCURL_STATICLIB - CLIENT_LDFLAGS += $(LIBSDIR)/win32/libcurl.a + CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a else - CLIENT_LDFLAGS += $(CURL_LIBS) + CLIENT_LIBS += $(CURL_LIBS) endif endif endif ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg + CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif ifeq ($(ARCH),x86) # build 32bit BASE_CFLAGS += -m32 - LDFLAGS+=-m32 endif DEBUG_CFLAGS=$(BASE_CFLAGS) -g -O0 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE) # libmingw32 must be linked before libSDLmain - CLIENT_LDFLAGS += -lmingw32 + CLIENT_LIBS += -lmingw32 ifeq ($(USE_LOCAL_HEADERS),1) BASE_CFLAGS += -I$(SDLHDIR)/include - CLIENT_LDFLAGS += $(LIBSDIR)/win32/libSDLmain.a \ + CLIENT_LIBS += $(LIBSDIR)/win32/libSDLmain.a \ $(LIBSDIR)/win32/libSDL.dll.a else BASE_CFLAGS += $(SDL_CFLAGS) - CLIENT_LDFLAGS += $(SDL_LIBS) + CLIENT_LIBS += $(SDL_LIBS) endif @@ -547,22 +555,22 @@ ifeq ($(PLATFORM),freebsd) SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LDFLAGS=-lpthread + THREAD_LIBS=-lpthread # don't need -ldl (FreeBSD) - LDFLAGS=-lm + LIBS=-lm - CLIENT_LDFLAGS = + CLIENT_LIBS = - CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL + CLIENT_LIBS += $(shell sdl-config --libs) -lGL ifeq ($(USE_OPENAL),1) ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lopenal + CLIENT_LIBS += $(THREAD_LIBS) -lopenal endif endif ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg + CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif else # ifeq freebsd @@ -604,21 +612,21 @@ ifeq ($(PLATFORM),openbsd) SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LDFLAGS=-lpthread - LDFLAGS=-lm + THREAD_LIBS=-lpthread + LIBS=-lm - CLIENT_LDFLAGS = + CLIENT_LIBS = - CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL + CLIENT_LIBS += $(shell sdl-config --libs) -lGL ifeq ($(USE_OPENAL),1) ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lossaudio -lopenal + CLIENT_LIBS += $(THREAD_LIBS) -lossaudio -lopenal endif endif ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg + CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif else # ifeq openbsd @@ -633,11 +641,11 @@ ifeq ($(PLATFORM),netbsd) ARCH=x86 endif - LDFLAGS=-lm + LIBS=-lm SHLIBEXT=so SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LDFLAGS=-lpthread + THREAD_LIBS=-lpthread BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes @@ -672,9 +680,9 @@ ifeq ($(PLATFORM),irix64) SHLIBCFLAGS= SHLIBLDFLAGS=-shared - LDFLAGS=-ldl -lm -lgen + LIBS=-ldl -lm -lgen # FIXME: The X libraries probably aren't necessary? - CLIENT_LDFLAGS=-L/usr/X11/$(LIB) $(shell sdl-config --libs) -lGL \ + CLIENT_LIBS=-L/usr/X11/$(LIB) $(shell sdl-config --libs) -lGL \ -lX11 -lXext -lm else # ifeq IRIX @@ -720,7 +728,6 @@ ifeq ($(PLATFORM),sunos) -falign-functions=2 -fstrength-reduce HAVE_VM_COMPILED=true BASE_CFLAGS += -m32 - LDFLAGS += -m32 BASE_CFLAGS += -I/usr/X11/include/NVIDIA CLIENT_LDFLAGS += -L/usr/X11/lib/NVIDIA -R/usr/X11/lib/NVIDIA endif @@ -738,12 +745,12 @@ ifeq ($(PLATFORM),sunos) SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LDFLAGS=-lpthread - LDFLAGS=-lsocket -lnsl -ldl -lm + THREAD_LIBS=-lpthread + LIBS=-lsocket -lnsl -ldl -lm BOTCFLAGS=-O0 - CLIENT_LDFLAGS +=$(shell sdl-config --libs) -lGL + CLIENT_LIBS +=$(shell sdl-config --libs) -lGL else # ifeq sunos @@ -805,7 +812,7 @@ ifeq ($(USE_VOIP),1) ifeq ($(USE_INTERNAL_SPEEX),1) BASE_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include else - CLIENT_LDFLAGS += -lspeex + CLIENT_LIBS += -lspeex endif endif @@ -925,19 +932,25 @@ targets: makedirs @echo " CC: $(CC)" @echo "" @echo " CFLAGS:" - @for i in $(CFLAGS); \ + -@for i in $(CFLAGS); \ do \ echo " $$i"; \ done @echo "" @echo " LDFLAGS:" - @for i in $(LDFLAGS); \ + -@for i in $(LDFLAGS); \ + do \ + echo " $$i"; \ + done + @echo "" + @echo " LIBS:" + -@for i in $(LIBS); \ do \ echo " $$i"; \ done @echo "" @echo " Output:" - @for i in $(TARGETS); \ + -@for i in $(TARGETS); \ do \ echo " $$i"; \ done @@ -974,6 +987,7 @@ TOOLS_CFLAGS = $(TOOLS_OPTIMIZE) \ -DTEMPDIR=\"$(TEMPDIR)\" -DSYSTEM=\"\" \ -I$(Q3LCCSRCDIR) \ -I$(LBURGDIR) +TOOLS_LIBS = TOOLS_LDFLAGS = ifeq ($(GENERATE_DEPENDENCIES),1) @@ -1006,7 +1020,7 @@ $(B)/tools/lburg/%.o: $(LBURGDIR)/%.c $(LBURG): $(LBURGOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $^ + $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) Q3RCCOBJ = \ $(B)/tools/rcc/alloc.o \ @@ -1051,7 +1065,7 @@ $(B)/tools/rcc/%.o: $(Q3LCCSRCDIR)/%.c $(Q3RCC): $(Q3RCCOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $^ + $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) Q3CPPOBJ = \ $(B)/tools/cpp/cpp.o \ @@ -1070,7 +1084,7 @@ $(B)/tools/cpp/%.o: $(Q3CPPDIR)/%.c $(Q3CPP): $(Q3CPPOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $^ + $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) Q3LCCOBJ = \ $(B)/tools/etc/lcc.o \ @@ -1081,7 +1095,7 @@ $(B)/tools/etc/%.o: $(Q3LCCETCDIR)/%.c $(Q3LCC): $(Q3LCCOBJ) $(Q3RCC) $(Q3CPP) $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $(Q3LCCOBJ) + $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $(Q3LCCOBJ) $(TOOLS_LIBS) define DO_Q3LCC $(echo_cmd) "Q3LCC $<" @@ -1113,7 +1127,7 @@ $(B)/tools/asm/%.o: $(Q3ASMDIR)/%.c $(Q3ASM): $(Q3ASMOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $^ + $(Q)$(CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) ############################################################################# @@ -1320,7 +1334,10 @@ ifeq ($(HAVE_VM_COMPILED),true) Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o endif ifeq ($(ARCH),ppc) - Q3OBJ += $(B)/client/vm_ppc.o + Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o + endif + ifeq ($(ARCH),ppc64) + Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o endif endif @@ -1346,13 +1363,15 @@ Q3POBJ_SMP += \ $(B)/tremulous.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) $(echo_cmd) "LD $@" - $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \ - $(LDFLAGS) $(LIBSDLMAIN) + $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ + -o $@ $(Q3OBJ) $(Q3POBJ) \ + $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) $(B)/tremulous-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) $(echo_cmd) "LD $@" - $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(CLIENT_LDFLAGS) \ - $(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN) + $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \ + -o $@ $(Q3OBJ) $(Q3POBJ_SMP) \ + $(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) ifneq ($(strip $(LIBSDLMAIN)),) ifneq ($(strip $(LIBSDLMAINSRC)),) @@ -1420,10 +1439,13 @@ ifeq ($(HAVE_VM_COMPILED),true) Q3DOBJ += $(B)/ded/vm_x86.o endif ifeq ($(ARCH),x86_64) - Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o + Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o endif ifeq ($(ARCH),ppc) - Q3DOBJ += $(B)/ded/vm_ppc.o + Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o + endif + ifeq ($(ARCH),ppc64) + Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o endif endif @@ -1440,7 +1462,7 @@ endif $(B)/tremded.$(ARCH)$(BINEXT): $(Q3DOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS) + $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) @@ -1488,7 +1510,7 @@ CGVMOBJ = $(CGOBJ_:%.o=%.asm) $(B)/base/cgame$(ARCH).$(SHLIBEXT): $(CGOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(CGOBJ) + $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CGOBJ) $(B)/base/vm/cgame.qvm: $(CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" @@ -1537,7 +1559,7 @@ GVMOBJ = $(GOBJ_:%.o=%.asm) $(B)/base/game$(ARCH).$(SHLIBEXT): $(GOBJ) $(echo_cmd) "LD $@" - $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(GOBJ) + $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GOBJ) $(B)/base/vm/game.qvm: $(GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM) $(echo_cmd) "Q3ASM $@" |