--- Makefile.orig 2009-04-22 18:54:48 UTC +++ Makefile @@ -16,6 +16,10 @@ ifeq ($(COMPILE_PLATFORM),darwin) # Apple does some things a little differently... COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/) endif +ifeq ($(COMPILE_PLATFORM),freebsd) + # FreeBSD does some things a little differently... + COMPILE_ARCH=$(shell uname -p) +endif ifeq ($(COMPILE_PLATFORM),mingw32) ifeq ($(COMPILE_ARCH),i386) @@ -70,6 +74,9 @@ endif ifeq ($(COMPILE_ARCH),powerpc64) COMPILE_ARCH=ppc64 endif +ifeq ($(COMPILE_ARCH),powerpc64le) + COMPILE_ARCH=ppc64le +endif ifndef ARCH ARCH=$(COMPILE_ARCH) @@ -187,6 +194,8 @@ ifeq ($(shell which pkg-config > /dev/null; echo $$?), # FIXME: introduce CLIENT_CFLAGS SDL_CFLAGS=$(shell pkg-config --cflags sdl|sed 's/-Dmain=SDL_main//') SDL_LIBS=$(shell pkg-config --libs sdl) + VORBIS_CFLAGS=$(shell pkg-config --silence-errors --cflags vorbis vorbisfile) + VORBIS_LIBS=$(shell pkg-config --silence-errors --libs vorbis vorbisfile) endif # version info @@ -521,45 +530,26 @@ else # ifeq mingw32 ifeq ($(PLATFORM),freebsd) - ifneq (,$(findstring alpha,$(shell uname -m))) - ARCH=axp - else #default to i386 - ARCH=i386 - endif #alpha test + ifndef HOMEPATH + HOMEPATH = /.ioquake3 + endif + + ifndef DEFAULT_LIBDIR + DEFAULT_LIBDIR = /usr/local/lib/ioquake3 + endif + + # flags + BASE_CFLAGS = $(shell env MACHINE_ARCH=$(ARCH) make -f /dev/null -VCFLAGS) \ + -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -DHOMEPATH=\\\"$(HOMEPATH)\\\" \ + -DDEFAULT_LIBDIR=\\\"$(DEFAULT_LIBDIR)\\\" \ + -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON + CLIENT_CFLAGS += $(SDL_CFLAGS) + HAVE_VM_COMPILED = true + OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer + OPTIMIZE = $(OPTIMIZEVM) -ffast-math - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -DUSE_ICON $(shell sdl-config --cflags) - - ifeq ($(USE_OPENAL),1) - BASE_CFLAGS += -DUSE_OPENAL - ifeq ($(USE_OPENAL_DLOPEN),1) - BASE_CFLAGS += -DUSE_OPENAL_DLOPEN - endif - endif - - ifeq ($(USE_CODEC_VORBIS),1) - BASE_CFLAGS += -DUSE_CODEC_VORBIS - 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 - endif - endif - - DEBUG_CFLAGS=$(BASE_CFLAGS) -g - SHLIBEXT=so SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) @@ -568,20 +558,52 @@ ifeq ($(PLATFORM),freebsd) # don't need -ldl (FreeBSD) LIBS=-lm - CLIENT_LIBS = + CLIENT_LIBS = $(SDL_LIBS) -lGL - CLIENT_LIBS += $(shell sdl-config --libs) -lGL - + # optional features/libraries ifeq ($(USE_OPENAL),1) - ifneq ($(USE_OPENAL_DLOPEN),1) - CLIENT_LIBS += $(THREAD_LIBS) -lopenal + CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS) + CLIENT_CFLAGS += -DUSE_OPENAL + ifneq ($(USE_LOCAL_HEADERS),1) + CLIENT_CFLAGS += $(OPENAL_CFLAGS) endif endif + ifeq ($(USE_CURL),1) + CLIENT_LIBS += $(CURL_LIBS) + CLIENT_CFLAGS += -DUSE_CURL + ifneq ($(USE_LOCAL_HEADERS),1) + CLIENT_CFLAGS += $(CURL_CFLAGS) + endif + endif + ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_LIBS += -lvorbisfile -lvorbis -logg + CLIENT_LIBS += $(VORBIS_LIBS) + CLIENT_CFLAGS += -DUSE_CODEC_VORBIS + ifneq ($(USE_LOCAL_HEADERS),1) + CLIENT_CFLAGS += $(VORBIS_CFLAGS) + endif endif + ifeq ($(BUILD_CLIENT),1) + BASE_CFLAGS += $(CLIENT_CFLAGS) + endif + + # cross-compiling tweaks + ifeq ($(ARCH),i386) + ifeq ($(CROSS_COMPILING),1) + BASE_CFLAGS += -m32 + endif + endif + ifeq ($(ARCH),amd64) + ifeq ($(CROSS_COMPILING),1) + BASE_CFLAGS += -m64 + endif + endif + + RELEASE_CFLAGS = $(BASE_CFLAGS) + DEBUG_CFLAGS = $(BASE_CFLAGS) -g + else # ifeq freebsd ############################################################################# @@ -831,7 +853,7 @@ endif ifeq ($(USE_VOIP),1) BASE_CFLAGS += -DUSE_VOIP ifeq ($(USE_INTERNAL_SPEEX),1) - BASE_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include + BASE_CFLAGS := -I$(SPEEXDIR)/include -DFLOATING_POINT -DUSE_ALLOCA $(BASE_CFLAGS) else CLIENT_LIBS += -lspeex endif @@ -1442,12 +1464,18 @@ ifeq ($(HAVE_VM_COMPILED),true) ifeq ($(ARCH),x86_64) Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o endif + ifeq ($(ARCH),amd64) + Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o + endif ifeq ($(ARCH),ppc) 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 + ifeq ($(ARCH),ppc64le) + Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o + endif ifeq ($(ARCH),sparc) Q3OBJ += $(B)/client/vm_sparc.o endif @@ -1591,10 +1619,16 @@ ifeq ($(HAVE_VM_COMPILED),true) ifeq ($(ARCH),x86_64) Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o endif + ifeq ($(ARCH),amd64) + Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o + endif ifeq ($(ARCH),ppc) 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 + ifeq ($(ARCH),ppc64le) Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o endif ifeq ($(ARCH),sparc)