Makefile: Allow overriding options for different setups, OpenBSD fixes.

Fixes Bugzilla #3955.
This commit is contained in:
Ryan C. Gordon 2009-09-14 23:49:20 +00:00
parent cf1bb85183
commit 2f0abce691

View file

@ -91,6 +91,10 @@ ifndef COPYDIR
COPYDIR="/usr/local/games/quake3" COPYDIR="/usr/local/games/quake3"
endif endif
ifndef COPYBINDIR
COPYBINDIR=$(COPYDIR)
endif
ifndef MOUNT_DIR ifndef MOUNT_DIR
MOUNT_DIR=code MOUNT_DIR=code
endif endif
@ -615,20 +619,23 @@ ifeq ($(PLATFORM),openbsd)
BASE_CFLAGS += -DUSE_CODEC_VORBIS BASE_CFLAGS += -DUSE_CODEC_VORBIS
endif endif
BASE_CFLAGS += -DNO_VM_COMPILED -I/usr/X11R6/include -I/usr/local/include ifeq ($(USE_CURL),1)
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 \ BASE_CFLAGS += -DUSE_CURL $(CURL_CFLAGS)
-march=pentium -fomit-frame-pointer -pipe -ffast-math \ USE_CURL_DLOPEN=0
-falign-loops=2 -falign-jumps=2 -falign-functions=2 \ endif
-funroll-loops -fstrength-reduce
BASE_CFLAGS += -DNO_VM_COMPILED
RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG
HAVE_VM_COMPILED=false HAVE_VM_COMPILED=false
DEBUG_CFLAGS=$(BASE_CFLAGS) -g DEBUG_CFLAGS=$(BASE_CFLAGS) -g
SHLIBEXT=so SHLIBEXT=so
SHLIBNAME=.$(SHLIBEXT)
SHLIBCFLAGS=-fPIC SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS) SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LIBS=-lpthread THREAD_LIBS=-pthread
LIBS=-lm LIBS=-lm
CLIENT_LIBS = CLIENT_LIBS =
@ -645,6 +652,12 @@ ifeq ($(PLATFORM),openbsd)
CLIENT_LIBS += -lvorbisfile -lvorbis -logg CLIENT_LIBS += -lvorbisfile -lvorbis -logg
endif endif
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += -lcurl
endif
endif
else # ifeq openbsd else # ifeq openbsd
############################################################################# #############################################################################
@ -792,27 +805,35 @@ endif #SunOS
TARGETS = TARGETS =
ifndef FULLBINEXT
FULLBINEXT=.$(ARCH)$(BINEXT)
endif
ifndef SHLIBNAME
SHLIBNAME=$(ARCH).$(SHLIBEXT)
endif
ifneq ($(BUILD_SERVER),0) ifneq ($(BUILD_SERVER),0)
TARGETS += $(B)/ioq3ded.$(ARCH)$(BINEXT) TARGETS += $(B)/ioq3ded$(FULLBINEXT)
endif endif
ifneq ($(BUILD_CLIENT),0) ifneq ($(BUILD_CLIENT),0)
TARGETS += $(B)/ioquake3.$(ARCH)$(BINEXT) TARGETS += $(B)/ioquake3$(FULLBINEXT)
ifneq ($(BUILD_CLIENT_SMP),0) ifneq ($(BUILD_CLIENT_SMP),0)
TARGETS += $(B)/ioquake3-smp.$(ARCH)$(BINEXT) TARGETS += $(B)/ioquake3-smp$(FULLBINEXT)
endif endif
endif endif
ifneq ($(BUILD_GAME_SO),0) ifneq ($(BUILD_GAME_SO),0)
TARGETS += \ TARGETS += \
$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \ $(B)/baseq3/cgame$(SHLIBNAME) \
$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \ $(B)/baseq3/qagame$(SHLIBNAME) \
$(B)/baseq3/ui$(ARCH).$(SHLIBEXT) $(B)/baseq3/ui$(SHLIBNAME)
ifneq ($(BUILD_MISSIONPACK),0) ifneq ($(BUILD_MISSIONPACK),0)
TARGETS += \ TARGETS += \
$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \ $(B)/missionpack/cgame$(SHLIBNAME) \
$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \ $(B)/missionpack/qagame$(SHLIBNAME) \
$(B)/missionpack/ui$(ARCH).$(SHLIBEXT) $(B)/missionpack/ui$(SHLIBNAME)
endif endif
endif endif
@ -862,6 +883,12 @@ else
DEPEND_CFLAGS = DEPEND_CFLAGS =
endif endif
ifeq ($(NO_STRIP),1)
STRIP_FLAG =
else
STRIP_FLAG = -s
endif
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\" BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
ifeq ($(V),1) ifeq ($(V),1)
@ -1486,13 +1513,13 @@ Q3POBJ += \
Q3POBJ_SMP += \ Q3POBJ_SMP += \
$(B)/clientsmp/sdl_glimp.o $(B)/clientsmp/sdl_glimp.o
$(B)/ioquake3.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN) $(B)/ioquake3$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3POBJ) \ -o $@ $(Q3OBJ) $(Q3POBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
$(B)/ioquake3-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN) $(B)/ioquake3-smp$(FULLBINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(THREAD_LDFLAGS) \
-o $@ $(Q3OBJ) $(Q3POBJ_SMP) \ -o $@ $(Q3OBJ) $(Q3POBJ_SMP) \
@ -1626,7 +1653,7 @@ else
$(B)/ded/con_tty.o $(B)/ded/con_tty.o
endif endif
$(B)/ioq3ded.$(ARCH)$(BINEXT): $(Q3DOBJ) $(B)/ioq3ded$(FULLBINEXT): $(Q3DOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS)
@ -1666,7 +1693,7 @@ Q3CGOBJ_ = \
Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o
Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm)
$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT): $(Q3CGOBJ) $(B)/baseq3/cgame$(SHLIBNAME): $(Q3CGOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
@ -1710,7 +1737,7 @@ MPCGOBJ_ = \
MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o
MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm) MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm)
$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT): $(MPCGOBJ) $(B)/missionpack/cgame$(SHLIBNAME): $(MPCGOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ)
@ -1763,7 +1790,7 @@ Q3GOBJ_ = \
Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o
Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm)
$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT): $(Q3GOBJ) $(B)/baseq3/qagame$(SHLIBNAME): $(Q3GOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
@ -1814,7 +1841,7 @@ MPGOBJ_ = \
MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o
MPGVMOBJ = $(MPGOBJ_:%.o=%.asm) MPGVMOBJ = $(MPGOBJ_:%.o=%.asm)
$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT): $(MPGOBJ) $(B)/missionpack/qagame$(SHLIBNAME): $(MPGOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ)
@ -1877,7 +1904,7 @@ Q3UIOBJ_ = \
Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm) Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm)
$(B)/baseq3/ui$(ARCH).$(SHLIBEXT): $(Q3UIOBJ) $(B)/baseq3/ui$(SHLIBNAME): $(Q3UIOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
@ -1905,7 +1932,7 @@ MPUIOBJ_ = \
MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm) MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm)
$(B)/missionpack/ui$(ARCH).$(SHLIBEXT): $(MPUIOBJ) $(B)/missionpack/ui$(SHLIBNAME): $(MPUIOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ) $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)
@ -2081,34 +2108,34 @@ copyfiles: release
-$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack -$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack
ifneq ($(BUILD_CLIENT),0) 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 endif
# Don't copy the SMP until it's working together with SDL. # Don't copy the SMP until it's working together with SDL.
#ifneq ($(BUILD_CLIENT_SMP),0) #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 #endif
ifneq ($(BUILD_SERVER),0) ifneq ($(BUILD_SERVER),0)
@if [ -f $(BR)/ioq3ded.$(ARCH)$(BINEXT) ]; then \ @if [ -f $(BR)/ioq3ded$(FULLBINEXT) ]; then \
$(INSTALL) -s -m 0755 $(BR)/ioq3ded.$(ARCH)$(BINEXT) $(COPYDIR)/ioq3ded.$(ARCH)$(BINEXT); \ $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/ioq3ded$(FULLBINEXT) $(COPYBINDIR)/ioq3ded$(FULLBINEXT); \
fi fi
endif endif
ifneq ($(BUILD_GAME_SO),0) 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/. $(COPYDIR)/baseq3/.
$(INSTALL) -s -m 0755 $(BR)/baseq3/qagame$(ARCH).$(SHLIBEXT) \ $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3/qagame$(SHLIBNAME) \
$(COPYDIR)/baseq3/. $(COPYDIR)/baseq3/.
$(INSTALL) -s -m 0755 $(BR)/baseq3/ui$(ARCH).$(SHLIBEXT) \ $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/baseq3/ui$(SHLIBNAME) \
$(COPYDIR)/baseq3/. $(COPYDIR)/baseq3/.
ifneq ($(BUILD_MISSIONPACK),0) ifneq ($(BUILD_MISSIONPACK),0)
-$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack -$(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/. $(COPYDIR)/missionpack/.
$(INSTALL) -s -m 0755 $(BR)/missionpack/qagame$(ARCH).$(SHLIBEXT) \ $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/qagame$(SHLIBNAME) \
$(COPYDIR)/missionpack/. $(COPYDIR)/missionpack/.
$(INSTALL) -s -m 0755 $(BR)/missionpack/ui$(ARCH).$(SHLIBEXT) \ $(INSTALL) $(STRIP_FLAG) -m 0755 $(BR)/missionpack/ui$(SHLIBNAME) \
$(COPYDIR)/missionpack/. $(COPYDIR)/missionpack/.
endif endif
endif endif