Changed default sound module for linux to ALSA. Modified makefiles to allow people...
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 8 Jun 2005 06:06:44 +0000 (06:06 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 8 Jun 2005 06:06:44 +0000 (06:06 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5409 d7cf8633-e32d-0410-b094-e92efae38249

makefile
makefile.bsd
makefile.inc

index f4c054a..bed6ab0 100644 (file)
--- a/makefile
+++ b/makefile
@@ -50,8 +50,7 @@ endif
 
 # Linux configuration
 ifeq ($(DP_MAKE_TARGET), linux)
-       OBJ_SOUND=$(OBJ_LINUXSOUND)
-       LIB_SOUND=$(LIB_LINUXSOUND)
+       DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_LINUX)
        OBJ_CD=$(OBJ_LINUXCD)
 
        OBJ_CL=$(OBJ_GLX)
@@ -67,8 +66,7 @@ endif
 
 # Mac OS X configuration
 ifeq ($(DP_MAKE_TARGET), macosx)
-       OBJ_SOUND=$(OBJ_MACOSXSOUND)
-       LIB_SOUND=$(LIB_MACOSXSOUND)
+       DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_MACOSX)
        OBJ_CD=$(OBJ_MACOSXCD)
 
        OBJ_CL=$(OBJ_AGL)
@@ -84,8 +82,7 @@ endif
 
 # SunOS configuration (Solaris)
 ifeq ($(DP_MAKE_TARGET), sunos)
-       OBJ_SOUND=$(OBJ_SUNOSSOUND)
-       LIB_SOUND=$(LIB_SUNOSSOUND)
+       DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_SUNOS)
        OBJ_CD=$(OBJ_SUNOSCD)
 
        OBJ_CL=$(OBJ_GLX)
@@ -104,11 +101,9 @@ endif
 # BSD configuration
 ifeq ($(DP_MAKE_TARGET), bsd)
 ifeq ($(DP_ARCH),FreeBSD)
-       OBJ_SOUND=$(OBJ_OSSSOUND)
-       LIB_SOUND=$(LIB_OSSSOUND)
+       DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_OSS)
 else
-       OBJ_SOUND=$(OBJ_BSDSOUND)
-       LIB_SOUND=$(LIB_BSDSOUND)
+       DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_BSD)
 endif
        OBJ_CD=$(OBJ_BSDCD)
 
@@ -125,8 +120,7 @@ endif
 
 # Win32 configuration
 ifeq ($(DP_MAKE_TARGET), mingw)
-       OBJ_SOUND=$(OBJ_WINSOUND)
-       LIB_SOUND=$(LIB_WINSOUND)
+       DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_WIN32)
        OBJ_CD=$(OBJ_WINCD)
 
        OBJ_CL=$(OBJ_WGL)
@@ -141,6 +135,49 @@ ifeq ($(DP_MAKE_TARGET), mingw)
 endif
 
 
+##### Sound configuration #####
+
+ifndef DP_SOUND_API
+       DP_SOUND_API=$(DEFAULT_SNDAPI)
+endif
+
+# NULL: no sound
+ifeq ($(DP_SOUND_API), NULL)
+       OBJ_SOUND=$(OBJ_SND_NULL)
+       LIB_SOUND=$(LIB_SND_NULL)
+endif
+
+# OSS: Open Sound System
+ifeq ($(DP_SOUND_API), OSS)
+       OBJ_SOUND=$(OBJ_SND_OSS)
+       LIB_SOUND=$(LIB_SND_OSS)
+endif
+
+# ALSA: Advanced Linux Sound Architecture
+ifeq ($(DP_SOUND_API), ALSA)
+       OBJ_SOUND=$(OBJ_SND_ALSA)
+       LIB_SOUND=$(LIB_SND_ALSA)
+endif
+
+# COREAUDIO: Core Audio
+ifeq ($(DP_SOUND_API), COREAUDIO)
+       OBJ_SOUND=$(OBJ_SND_COREAUDIO)
+       LIB_SOUND=$(LIB_SND_COREAUDIO)
+endif
+
+# BSD: BSD / Sun audio API
+ifeq ($(DP_SOUND_API), BSD)
+       OBJ_SOUND=$(OBJ_SND_BSD)
+       LIB_SOUND=$(LIB_SND_BSD)
+endif
+
+# WIN: DirectX and Win32 WAVE output
+ifeq ($(DP_SOUND_API), WIN)
+       OBJ_SOUND=$(OBJ_SND_WIN)
+       LIB_SOUND=$(LIB_SND_WIN)
+endif
+
+
 ##### GNU Make specific definitions #####
 
 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
index a4337a4..801ec0e 100644 (file)
@@ -18,11 +18,9 @@ UNIX_X11LIBPATH=-L/usr/X11R6/lib
 
 # FreeBSD uses OSS
 .if $(DP_ARCH) == "FreeBSD"
-OBJ_SOUND=$(OBJ_OSSSOUND)
-LIB_SOUND=$(LIB_OSSSOUND)
+DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_OSS)
 .else
-OBJ_SOUND=$(OBJ_BSDSOUND)
-LIB_SOUND=$(LIB_BSDSOUND)
+DEFAULT_SNDAPI=$(DEFAULT_SNDAPI_BSD)
 .endif
 OBJ_CD=$(OBJ_BSDCD)
 
@@ -38,6 +36,31 @@ EXE_SDL=$(EXE_UNIXSDL)
 .endif
 
 
+##### Sound configuration #####
+
+.ifndef DP_SOUND_API
+       DP_SOUND_API=$(DEFAULT_SNDAPI)
+.endif
+
+# NULL: no sound
+.if $(DP_SOUND_API) == "NULL"
+OBJ_SOUND=$(OBJ_SND_NULL)
+LIB_SOUND=$(LIB_SND_NULL)
+.endif
+
+# OSS: Open Sound System
+.if $(DP_SOUND_API) == "OSS"
+OBJ_SOUND=$(OBJ_SND_OSS)
+LIB_SOUND=$(LIB_SND_OSS)
+.endif
+
+# BSD: BSD / Sun audio API
+.if $(DP_SOUND_API) == "BSD"
+OBJ_SOUND=$(OBJ_SND_BSD)
+LIB_SOUND=$(LIB_SND_BSD)
+.endif
+
+
 ##### BSD Make specific definitions #####
 
 MAKE:=$(MAKE) -f makefile.bsd
index 37fe922..58135ea 100644 (file)
@@ -1,5 +1,3 @@
-##### Variables that you may want to modify #####
-
 # Choose the compiler you want to use
 CC=gcc
 
@@ -17,17 +15,41 @@ CC=gcc
 CPUOPTIMIZATIONS=
 
 
-##### Variables that you shouldn't care about #####
+###### Sound and audio CD #####
+
+OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
+
+# No sound
+OBJ_SND_NULL=snd_null.o
+LIB_SND_NULL=
+
+# Open Sound System (Linux, FreeBSD and Solaris)
+OBJ_SND_OSS=$(OBJ_SND_COMMON) snd_oss.o
+LIB_SND_OSS=
+
+# Advanced Linux Sound Architecture (Linux)
+OBJ_SND_ALSA=$(OBJ_SND_COMMON) snd_alsa.o
+LIB_SND_ALSA=-lasound
+
+# Core Audio (Mac OS X)
+OBJ_SND_COREAUDIO=$(OBJ_SND_COMMON) snd_coreaudio.c
+LIB_SND_COREAUDIO=
+
+# BSD / Sun audio API (NetBSD and OpenBSD)
+OBJ_SND_BSD=$(OBJ_SND_COMMON) snd_bsd.o
+LIB_SND_BSD=
+
+# DirectX and Win32 WAVE output (Win32)
+OBJ_SND_WIN=$(OBJ_SND_COMMON) snd_win.o
+LIB_SND_WIN=
 
-# Sound objects
-OBJ_COMMONSOUND=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
-OBJ_NOSOUND=snd_null.o
-OBJ_OSSSOUND=$(OBJ_COMMONSOUND) snd_oss.o
-LIB_OSSSOUND=
 
 # CD objects
 OBJ_NOCD=cd_null.o
 
+
+###### Common objects and flags #####
+
 # Common objects
 OBJ_COMMON= \
        cd_shared.o \
@@ -71,13 +93,12 @@ OBJ_COMMON= \
        model_brush.o \
        model_shared.o \
        model_sprite.o \
+       mvm_cmds.o \
        netconn.o \
        palette.o \
        polygon.o \
        portals.o \
        protocol.o \
-       mvm_cmds.o \
-       svvm_cmds.o \
        prvm_cmds.o \
        prvm_edict.o \
        prvm_exec.o \
@@ -95,6 +116,7 @@ OBJ_COMMON= \
        sv_move.o \
        sv_phys.o \
        sv_user.o \
+       svvm_cmds.o \
        sys_shared.o \
        ui.o \
        vid_shared.o \
@@ -107,8 +129,8 @@ OBJ_COMMON= \
 # note that builddate.c is very intentionally not compiled to a .o before
 # being linked, because it should be recompiled every time an executable is
 # built to give the executable a proper date string
-OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
-OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_COMMONSOUND) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
+OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_SND_NULL) $(OBJ_NOCD) $(OBJ_COMMON)
+OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
 
 
 # Compilation
@@ -147,15 +169,7 @@ CMD_UNIXRM=rm -rf
 
 ##### Linux specific variables #####
 
-# Recommended for: anyone not using ALSA
-OBJ_LINUXSOUND=$(OBJ_OSSSOUND)
-LIB_LINUXSOUND=$(LIB_OSSSOUND)
-# Recommended for: anyone using ALSA
-#OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa.o
-#LIB_LINUXSOUND=-lasound
-# Recommended for: anyone who can't use the above drivers
-#OBJ_LINUXSOUND=$(OBJ_NOSOUND)
-#LIB_LINUXSOUND=
+DEFAULT_SNDAPI_LINUX=ALSA
 
 # If you want CD sound in Linux
 OBJ_LINUXCD=cd_linux.o
@@ -170,9 +184,7 @@ LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
 
 ##### Mac OS X specific variables #####
 
-#OBJ_MACOSXSOUND=$(OBJ_COMMONSOUND) snd_coreaudio.c
-OBJ_MACOSXSOUND=$(OBJ_NOSOUND)
-LIB_MACOSXSOUND=
+DEFAULT_SNDAPI_MACOSX=COREAUDIO
 
 # If you want CD sound in Mac OS X
 #OBJ_MACOSXCD=cd_macosx.o
@@ -188,8 +200,7 @@ OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
 
 ##### SunOS specific variables #####
 
-OBJ_SUNOSSOUND=$(OBJ_OSSSOUND)
-LIB_SUNOSSOUND=$(LIB_OSSSOUND)
+DEFAULT_SNDAPI_SUNOS=OSS
 
 # No CD support available
 OBJ_SUNOSCD=$(OBJ_NOCD)
@@ -204,9 +215,7 @@ LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
 
 ##### BSD specific variables #####
 
-OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
-#OBJ_BSDSOUND=$(OBJ_NOSOUND)
-LIB_BSDSOUND=
+DEFAULT_SNDAPI_BSD=BSD
 
 #if you want CD sound in BSD
 OBJ_BSDCD=cd_bsd.o
@@ -221,16 +230,14 @@ LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
 
 ##### Win32 specific variables #####
 
-OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
-#OBJ_WINSOUND=$(OBJ_NOSOUND)
-LIB_WINSOUND=
+DEFAULT_SNDAPI_WIN32=WIN
 
 #if you want CD sound in Win32
 OBJ_WINCD=cd_win.o
 #if you want no CD audio
 #OBJ_WINCD=$(OBJ_NOCD)
 
-OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
+OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_COMMON)
 
 # Link
 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
@@ -270,68 +277,83 @@ help:
        @echo
 
 debug :
-       $(MAKE) sdl-debug cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
+       $(MAKE) sdl-debug cl-debug sv-debug \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API)
 
 profile :
-       $(MAKE) sdl-profile cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
+       $(MAKE) sdl-profile cl-profile sv-profile \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API)
 
 release :
-       $(MAKE) sdl-release cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
+       $(MAKE) sdl-release cl-release sv-release \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API)
 
 cl-debug :
-       $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-debug \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
 
 cl-profile :
-       $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-profile \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
 
 cl-release :
-       $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-release \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
 
 sv-debug :
-       $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-debug \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
 
 sv-profile :
-       $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-profile \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
 
 sv-release :
-       $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-release \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
 
 sdl-debug :
-       $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-debug \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
 
 sdl-profile :
-       $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-profile \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
 
 sdl-release :
-       $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) bin-release \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
 
 bin-debug :
        @echo
        @echo "========== $(EXE) (debug) =========="
-       $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) $(EXE) \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
                LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
 
 bin-profile :
        @echo
        @echo "========== $(EXE) (profile) =========="
-       $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) $(EXE) \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
                LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
 
 bin-release :
        @echo
        @echo "========== $(EXE) (release) =========="
-       $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
+       $(MAKE) $(EXE) \
+               DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
                CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
                LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
        strip $(EXE)