From 934a06bb6733e1cc3af26941a3d038ff8adee754 Mon Sep 17 00:00:00 2001 From: icculus Date: Mon, 14 Sep 2009 23:49:20 +0000 Subject: Makefile: Allow overriding options for different setups, OpenBSD fixes. Fixes Bugzilla #3955. git-svn-id: svn://svn.icculus.org/quake3/trunk@1599 edf5b092-35ff-0310-97b2-ce42778d08ea --- Makefile | 95 +++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 9eb6607..d80ed6b 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,10 @@ ifndef COPYDIR COPYDIR="/usr/local/games/quake3" endif +ifndef COPYBINDIR +COPYBINDIR=$(COPYDIR) +endif + ifndef MOUNT_DIR MOUNT_DIR=code endif @@ -615,20 +619,23 @@ ifeq ($(PLATFORM),openbsd) BASE_CFLAGS += -DUSE_CODEC_VORBIS endif - BASE_CFLAGS += -DNO_VM_COMPILED -I/usr/X11R6/include -I/usr/local/include - RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 \ - -march=pentium -fomit-frame-pointer -pipe -ffast-math \ - -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ - -funroll-loops -fstrength-reduce + ifeq ($(USE_CURL),1) + BASE_CFLAGS += -DUSE_CURL $(CURL_CFLAGS) + USE_CURL_DLOPEN=0 + endif + + BASE_CFLAGS += -DNO_VM_COMPILED + RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG HAVE_VM_COMPILED=false DEBUG_CFLAGS=$(BASE_CFLAGS) -g SHLIBEXT=so + SHLIBNAME=.$(SHLIBEXT) SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LIBS=-lpthread + THREAD_LIBS=-pthread LIBS=-lm CLIENT_LIBS = @@ -645,6 +652,12 @@ ifeq ($(PLATFORM),openbsd) CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif + ifeq ($(USE_CURL),1) + ifneq ($(USE_CURL_DLOPEN),1) + CLIENT_LIBS += -lcurl + endif + endif + else # ifeq openbsd ############################################################################# @@ -792,27 +805,35 @@ endif #SunOS TARGETS = +ifndef FULLBINEXT + FULLBINEXT=.$(ARCH)$(BINEXT) +endif + +ifndef SHLIBNAME + SHLIBNAME=$(ARCH).$(SHLIBEXT) +endif + ifneq ($(BUILD_SERVER),0) - TARGETS += $(B)/ioq3ded.$(ARCH)$(BINEXT) + TARGETS += $(B)/ioq3ded$(FULLBINEXT) endif ifneq ($(BUILD_CLIENT),0) - TARGETS += $(B)/ioquake3.$(ARCH)$(BINEXT) + TARGETS += $(B)/ioquake3$(FULLBINEXT) ifneq ($(BUILD_CLIENT_SMP),0) - TARGETS += $(B)/ioquake3-smp.$(ARCH)$(BINEXT) + TARGETS += $(B)/ioquake3-smp$(FULLBINEXT) endif endif ifneq ($(BUILD_GAME_SO),0) TARGETS += \ - $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \ - $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \ - $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) + $(B)/baseq3/cgame$(SHLIBNAME) \ + $(B)/baseq3/qagame$(SHLIBNAME) \ + $(B)/baseq3/ui$(SHLIBNAME) ifneq ($(BUILD_MISSIONPACK),0) TARGETS += \ - $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \ - $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \ - $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) + $(B)/missionpack/cgame$(SHLIBNAME) \ + $(B)/missionpack/qagame$(SHLIBNAME) \ + $(B)/missionpack/ui$(SHLIBNAME) endif endif @@ -862,6 +883,12 @@ else DEPEND_CFLAGS = endif +ifeq ($(NO_STRIP),1) + STRIP_FLAG = +else + STRIP_FLAG = -s +endif + BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\" ifeq ($(V),1) @@ -1486,13 +1513,13 @@ Q3POBJ += \ Q3POBJ_SMP += \ $(B)/clientsmp/sdl_glimp.o -$(B)/ioquake3.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) +$(B)/ioquake3$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ -o $@ $(Q3OBJ) $(Q3POBJ) \ $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) -$(B)/ioquake3-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) +$(B)/ioquake3-smp$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) $(echo_cmd) "LD $@" $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \ -o $@ $(Q3OBJ) $(Q3POBJ_SMP) \ @@ -1626,7 +1653,7 @@ else $(B)/ded/con_tty.o endif -$(B)/ioq3ded.$(ARCH)$(BINEXT): $(Q3DOBJ) +$(B)/ioq3ded$(FULLBINEXT): $(Q3DOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) @@ -1666,7 +1693,7 @@ Q3CGOBJ_ = \ Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) -$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT): $(Q3CGOBJ) +$(B)/baseq3/cgame$(SHLIBNAME): $(Q3CGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ) @@ -1710,7 +1737,7 @@ MPCGOBJ_ = \ MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm) -$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT): $(MPCGOBJ) +$(B)/missionpack/cgame$(SHLIBNAME): $(MPCGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ) @@ -1763,7 +1790,7 @@ Q3GOBJ_ = \ Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) -$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT): $(Q3GOBJ) +$(B)/baseq3/qagame$(SHLIBNAME): $(Q3GOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ) @@ -1814,7 +1841,7 @@ MPGOBJ_ = \ MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o MPGVMOBJ = $(MPGOBJ_:%.o=%.asm) -$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT): $(MPGOBJ) +$(B)/missionpack/qagame$(SHLIBNAME): $(MPGOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ) @@ -1877,7 +1904,7 @@ Q3UIOBJ_ = \ Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm) -$(B)/baseq3/ui$(ARCH).$(SHLIBEXT): $(Q3UIOBJ) +$(B)/baseq3/ui$(SHLIBNAME): $(Q3UIOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ) @@ -1905,7 +1932,7 @@ MPUIOBJ_ = \ MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm) -$(B)/missionpack/ui$(ARCH).$(SHLIBEXT): $(MPUIOBJ) +$(B)/missionpack/ui$(SHLIBNAME): $(MPUIOBJ) $(echo_cmd) "LD $@" $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ) @@ -2081,34 +2108,34 @@ copyfiles: release -$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack ifneq ($(BUILD_CLIENT),0) - $(INSTALL) -s -m 0755 $(BR)/ioquake3.$(ARCH)$(BINEXT) $(COPYDIR)/ioquake3.$(ARCH)$(BINEXT) + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioquake3$(FULLBINEXT) $(COPYBINDIR)/ioquake3$(FULLBINEXT) endif # Don't copy the SMP until it's working together with SDL. #ifneq ($(BUILD_CLIENT_SMP),0) -# $(INSTALL) -s -m 0755 $(BR)/ioquake3-smp.$(ARCH)$(BINEXT) $(COPYDIR)/ioquake3-smp.$(ARCH)$(BINEXT) +# $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioquake3-smp$(FULLBINEXT) $(COPYBINDIR)/ioquake3-smp$(FULLBINEXT) #endif ifneq ($(BUILD_SERVER),0) - @if [ -f $(BR)/ioq3ded.$(ARCH)$(BINEXT) ]; then \ - $(INSTALL) -s -m 0755 $(BR)/ioq3ded.$(ARCH)$(BINEXT) $(COPYDIR)/ioq3ded.$(ARCH)$(BINEXT); \ + @if [ -f $(BR)/ioq3ded$(FULLBINEXT) ]; then \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioq3ded$(FULLBINEXT) $(COPYBINDIR)/ioq3ded$(FULLBINEXT); \ fi endif ifneq ($(BUILD_GAME_SO),0) - $(INSTALL) -s -m 0755 $(BR)/baseq3/cgame$(ARCH).$(SHLIBEXT) \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3/cgame$(SHLIBNAME) \ $(COPYDIR)/baseq3/. - $(INSTALL) -s -m 0755 $(BR)/baseq3/qagame$(ARCH).$(SHLIBEXT) \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3/qagame$(SHLIBNAME) \ $(COPYDIR)/baseq3/. - $(INSTALL) -s -m 0755 $(BR)/baseq3/ui$(ARCH).$(SHLIBEXT) \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3/ui$(SHLIBNAME) \ $(COPYDIR)/baseq3/. ifneq ($(BUILD_MISSIONPACK),0) -$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack - $(INSTALL) -s -m 0755 $(BR)/missionpack/cgame$(ARCH).$(SHLIBEXT) \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/cgame$(SHLIBNAME) \ $(COPYDIR)/missionpack/. - $(INSTALL) -s -m 0755 $(BR)/missionpack/qagame$(ARCH).$(SHLIBEXT) \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/qagame$(SHLIBNAME) \ $(COPYDIR)/missionpack/. - $(INSTALL) -s -m 0755 $(BR)/missionpack/ui$(ARCH).$(SHLIBEXT) \ + $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/ui$(SHLIBNAME) \ $(COPYDIR)/missionpack/. endif endif -- cgit v1.2.3