EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
-# libjpeg dependency (set these to "" if you want to use dynamic loading instead)
+# set these to "" if you want to use dynamic loading instead
+# zlib
+CFLAGS_LIBZ=-DLINK_TO_ZLIB
+LIB_Z=-lz
+
+# jpeg
CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
LIB_JPEG=-ljpeg
+# ode
+ODE_CONFIG?=ode-config
+LIB_ODE=`$(ODE_CONFIG) --libs`
+CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
+
+# d0_blind_id
+# most distros do not have d0_blind_id package, dlopen will used by default
+# LIB_CRYPTO=-ld0_blind_id
+# CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
+# LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
+# CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
+LIB_CRYPTO=
+CFLAGS_CRYPTO=
+LIB_CRYPTO_RIJNDAEL=
+CFLAGS_CRYPTO_RIJNDAEL=
+
+# modplug
+# now ogg is mostly used, modplug is required rarely, keep it dlopen by default
+# LIB_SND_MODPLUG=-lmodplug
+# CFLAGS_SND_MODPLUG=-DLINK_TO_LIBMODPLUG
+LIB_SND_MODPLUG=
+CFLAGS_SND_MODPLUG=
+
.endif
#define USE_AES
-#ifdef CRYPTO_STATIC
+#ifdef LINK_TO_CRYPTO
#include <d0_blind_id/d0_blind_id.h>
#endif
-#ifdef CRYPTO_RIJNDAEL_STATIC
+#ifdef LINK_TO_CRYPTO_RIJNDAEL
#include <d0_blind_id/d0_rijndael.h>
EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
- # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
- CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
- LIB_JPEG=-ljpeg
+ DP_LINK_LIBS=shared
endif
# Mac OS X configuration
CFLAGS_MAKEDEP=
endif
- # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
- # we don't currently link to libjpeg on Mac because the OS does not have an easy way to load libjpeg and we provide our own in the .app
- CFLAGS_LIBJPEG=
- LIB_JPEG=
+ DP_LINK_LIBS=dlopen
# on OS X, we don't build the CL by default because it uses deprecated
# and not-implemented-in-64bit Carbon
EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
- # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
- CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
- LIB_JPEG=-ljpeg
+ DP_LINK_LIBS=shared
endif
# BSD configuration
EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
- # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
- CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
- LIB_JPEG=-ljpeg
+ DP_LINK_LIBS=shared
endif
# Win32 configuration
EXE_SVNEXUIZ=$(EXE_WINSVNEXUIZ)
EXE_SDLNEXUIZ=$(EXE_WINSDLNEXUIZ)
- # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
+ DP_LINK_LIBS=shared
+endif
+
+# set these to "" if you want to use dynamic loading instead
+# zlib
+ifeq ($(DP_LINK_LIBS), shared)
+ CFLAGS_LIBZ=-DLINK_TO_ZLIB
+ LIB_Z=-lz
+endif
+ifeq ($(DP_LINK_LIBS), dlopen)
+ CFLAGS_LIBZ=
+ LIB_Z=
+endif
+
+# jpeg
+ifeq ($(DP_LINK_LIBS), shared)
CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
LIB_JPEG=-ljpeg
endif
+ifeq ($(DP_LINK_LIBS), dlopen)
+ CFLAGS_LIBJPEG=
+ LIB_JPEG=
+endif
+
+# ode
+ifeq ($(DP_LINK_LIBS), shared)
+ ODE_CONFIG?=ode-config
+ LIB_ODE=`$(ODE_CONFIG) --libs`
+ CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
+endif
+ifeq ($(DP_LINK_LIBS), dlopen)
+ LIB_ODE=
+ CFLAGS_ODE=-DUSEODE
+endif
+
+# d0_blind_id
+# most distros do not have d0_blind_id package, dlopen will used by default
+# LIB_CRYPTO=-ld0_blind_id
+# CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
+# LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
+# CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
+LIB_CRYPTO=
+CFLAGS_CRYPTO=
+LIB_CRYPTO_RIJNDAEL=
+CFLAGS_CRYPTO_RIJNDAEL=
+
+# modplug
+# now ogg is mostly used, modplug is required rarely, keep it dlopen by default
+# LIB_SND_MODPLUG=-lmodplug
+# CFLAGS_SND_MODPLUG=-DLINK_TO_LIBMODPLUG
+LIB_SND_MODPLUG=
+CFLAGS_SND_MODPLUG=
##### Sound configuration #####
CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math
# NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
-# Additional stuff for libode
-LIB_ODE=`[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && "$(DP_ODE_STATIC_LIBDIR)/../bin/ode-config" --libs` `[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && echo -lstdc++`
-CFLAGS_ODE=`[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && "$(DP_ODE_STATIC_LIBDIR)/../bin/ode-config" --cflags || { [ -n "$(DP_ODE_DYNAMIC)" ] && echo \ -DODE_DYNAMIC; }` `[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && echo -DODE_STATIC`
-
-
SDL_CONFIG?=sdl-config
SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
SDLCONFIG_UNIXCFLAGS_X11?=
OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o snd_modplug.o
-# statically loading d0_blind_id
-LIB_CRYPTO=`[ -n "$(DP_CRYPTO_STATIC_LIBDIR)" ] && echo \ $(DP_CRYPTO_STATIC_LIBDIR)/libd0_blind_id.a`
-LIB_GMP=`[ -n "$(DP_CRYPTO_STATIC_LIBDIR)" ] && { [ -n "$(DP_GMP_STATIC_LIBDIR)" ] && echo \ $(DP_GMP_STATIC_LIBDIR)/libgmp.a || echo \ -lgmp; }`
-CFLAGS_CRYPTO=`[ -n "$(DP_CRYPTO_STATIC_LIBDIR)" ] && echo \ -I$(DP_CRYPTO_STATIC_LIBDIR)/../include\ -DCRYPTO_STATIC`
-LIB_CRYPTO_RIJNDAEL=`[ -n "$(DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR)" ] && echo \ $(DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR)/libd0_rijndael.a`
-CFLAGS_CRYPTO_RIJNDAEL=`[ -n "$(DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR)" ] && echo \ -I$(DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR)/../include\ -DCRYPTO_RIJNDAEL_STATIC`
-
-# Additional stuff for libmodplug
-LIB_SND_MODPLUG=`[ -n "$(DP_MODPLUG_STATIC_LIBDIR)" ] && echo \ $(DP_MODPLUG_STATIC_LIBDIR)/libmodplug.a\ -lstdc++`
-CFLAGS_SND_MODPLUG=`[ -n "$(DP_MODPLUG_STATIC_LIBDIR)" ] && echo \ -I$(DP_MODPLUG_STATIC_LIBDIR)/../include\ -DSND_MODPLUG_STATIC`
-
# No sound
OBJ_SND_NULL=snd_null.o
LIB_SND_NULL=
# Compilation
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES
CFLAGS_DEBUG=-ggdb
CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
CFLAGS_RELEASE=
OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_pthread.o keysym2ucs.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
-LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_GMP) $(LIB_CRYPTO_RIJNDAEL)
+LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND)
LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug
LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
# Link
# see LDFLAGS_WINCOMMON in makefile
-LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_GMP) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_JPEG)
-LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_GMP) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_JPEG)
-LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_GMP) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 $(LIB_JPEG)
+LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_Z) $(LIB_JPEG)
+LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
+LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
EXE_WINCL=darkplaces.exe
EXE_WINSV=darkplaces-dedicated.exe
EXE_WINSDL=darkplaces-sdl.exe
$(CHECKLEVEL2)
$(DO_CC) $(CFLAGS_SND_MODPLUG)
-#this checks ODE_DYNAMIC and ODE_STATIC when compiling so it needs the ODE flags as well
+#this checks USEODE when compiling so it needs the ODE flags as well
prvm_cmds.o: prvm_cmds.c
$(CHECKLEVEL2)
$(DO_CC) $(CFLAGS_ODE)
#include "mdfour.h"
extern cvar_t prvm_backtraceforwarnings;
+#ifdef USEODE
extern dllhandle_t ode_dll;
+#endif
// LordHavoc: changed this to NOT use a return statement, so that it can be used in functions that must return a value
void VM_Warning(prvm_prog_t *prog, const char *fmt, ...)
e++;
if ((e - start) == len && !strncasecmp(start, name, len))
{
+#ifdef USEODE
// special sheck for ODE
if (!strncasecmp("DP_PHYSICS_ODE", name, 14))
{
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
return ode_dll ? true : false;
#else
-#ifdef ODE_STATIC
+#ifdef LINK_TO_LIBODE
return true;
#else
return false;
#endif
#endif
}
+#endif
// special sheck for d0_blind_id
if (!strcasecmp("DP_CRYPTO", name))
#include "snd_main.h"
#include "snd_modplug.h"
-#ifdef SND_MODPLUG_STATIC
+#ifdef LINK_TO_LIBMODPLUG
#include <libmodplug/modplug.h>
qboolean ModPlug_OpenLibrary (void)
return;
}
-#ifndef SND_MODPLUG_STATIC
+#ifndef LINK_TO_LIBMODPLUG
if(qModPlug_SetMasterVolume)
#endif
qModPlug_SetMasterVolume(per_ch->mf, 512); // max volume, DP scales down!
return false;
}
-#ifndef SND_MODPLUG_STATIC
+#ifndef LINK_TO_LIBMODPLUG
if(qModPlug_SetMasterVolume)
#endif
qModPlug_SetMasterVolume(mf, 512); // max volume, DP scales down!
// LordHavoc: this large chunk of definitions comes from the ODE library
// include files.
-#ifdef ODE_STATIC
+#ifdef LINK_TO_LIBODE
#include "ode/ode.h"
#else
#ifdef WINAPI
static void World_Physics_Init(void)
{
#ifdef USEODE
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
const char* dllnames [] =
{
# if defined(WIN32)
Cvar_RegisterVariable(&physics_ode_allowconvex);
Cvar_RegisterVariable(&physics_ode);
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
// Load the DLL
if (Sys_LoadLibrary (dllnames, &ode_dll, odefuncs))
#endif
{
dInitODE();
// dInitODE2(0);
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
# ifdef dSINGLE
if (!dCheckConfiguration("ODE_single_precision"))
# else
static void World_Physics_Shutdown(void)
{
#ifdef USEODE
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
if (ode_dll)
#endif
{
dCloseODE();
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
Sys_UnloadLibrary(&ode_dll);
ode_dll = NULL;
#endif
dVector3 center, extents;
if (world->physics.ode)
return;
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
if (!ode_dll)
return;
#endif
void World_Physics_ApplyCmd(prvm_edict_t *ed, edict_odefunc_t *f)
{
+#ifdef USEODE
dBodyID body = (dBodyID)ed->priv.server->ode_body;
-#ifdef USEODE
switch(f->type)
{
case ODEFUNC_ENABLE:
qboolean *mapped, *used, convex_compatible;
int numplanes = 0, numpoints = 0, i;
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
if (!ode_dll)
return;
#endif
void World_Physics_Frame(world_t *world, double frametime, double gravity)
{
prvm_prog_t *prog = world->prog;
+#ifdef USEODE
double tdelta, tdelta2, tdelta3, simulationtime, collisiontime;
tdelta = Sys_DirtyTime();
-#ifdef USEODE
if (world->physics.ode && physics_ode.integer)
{
int i;
void World_Start(world_t *world);
void World_End(world_t *world);
-// physics macros
-#ifndef ODE_STATIC
-# define ODE_DYNAMIC 1
-#endif
-
-#if defined(ODE_STATIC) || defined(ODE_DYNAMIC)
-# define USEODE 1
-#endif
-
// update physics
// this is called by SV_Physics
void World_Physics_Frame(world_t *world, double frametime, double gravity);