Make cdda optional, server does not need to play music
[xonotic/darkplaces.git] / BSDmakefile
1 #####  DP_MAKE_TARGET autodetection and arch specific variables #####
2
3 .ifndef DP_MAKE_TARGET
4
5 DP_MAKE_TARGET=bsd
6
7 .endif
8 DP_ARCH != uname
9
10 # Makefile name
11 MAKEFILE=BSDmakefile
12
13 # Commands
14 CMD_RM=$(CMD_UNIXRM)
15 CMD_CP=$(CMD_UNIXCP)
16 CMD_MKDIR=$(CMD_UNIXMKDIR)
17
18 # default targets
19 TARGETS_DEBUG=sv-debug cl-debug sdl-debug
20 TARGETS_PROFILE=sv-profile cl-profile sdl-profile
21 TARGETS_RELEASE=sv-release cl-release sdl-release
22 TARGETS_RELEASE_PROFILE=sv-release-profile cl-release-profile sdl-release-profile
23 TARGETS_NEXUIZ=sv-nexuiz cl-nexuiz sdl-nexuiz
24
25 ###### Optional features #####
26 DP_CDDA?=enabled
27 .if $(DP_CDDA) == "enabled"
28         OBJ_SDLCD=$(OBJ_CD_COMMON) cd_sdl.o
29         OBJ_BSDCD=$(OBJ_CD_COMMON) cd_bsd.o
30 .else
31         OBJ_SDLCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
32         OBJ_BSDCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
33 .endif
34
35 # X11 libs
36 UNIX_X11LIBPATH=/usr/X11R6/lib
37
38 # BSD configuration
39 .if $(DP_MAKE_TARGET) == "bsd"
40
41 # FreeBSD uses OSS
42 .if $(DP_ARCH) == "FreeBSD"
43 DEFAULT_SNDAPI=OSS
44 .else
45 DEFAULT_SNDAPI=BSD
46 .endif
47 OBJ_CD=$(OBJ_BSDCD)
48
49 OBJ_CL=$(OBJ_GLX)
50 OBJ_ICON=
51 OBJ_ICON_NEXUIZ=
52
53 LDFLAGS_CL=$(LDFLAGS_BSDCL)
54 LDFLAGS_SV=$(LDFLAGS_BSDSV)
55 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
56
57 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
58 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
59 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
60
61 EXE_CL=$(EXE_UNIXCL)
62 EXE_SV=$(EXE_UNIXSV)
63 EXE_SDL=$(EXE_UNIXSDL)
64 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
65 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
66 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
67
68 # set these to "" if you want to use dynamic loading instead
69 # zlib
70 CFLAGS_LIBZ=-DLINK_TO_ZLIB
71 LIB_Z=-lz
72
73 # jpeg
74 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
75 LIB_JPEG=-ljpeg
76
77 # ode
78 ODE_CONFIG?=ode-config
79 LIB_ODE=`$(ODE_CONFIG) --libs`
80 CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
81
82 # d0_blind_id
83 # most distros do not have d0_blind_id package, dlopen will used by default
84 # LIB_CRYPTO=-ld0_blind_id
85 # CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
86 # LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
87 # CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
88 LIB_CRYPTO=
89 CFLAGS_CRYPTO=
90 LIB_CRYPTO_RIJNDAEL=
91 CFLAGS_CRYPTO_RIJNDAEL=
92
93 # modplug
94 # now ogg is mostly used, modplug is required rarely, keep it dlopen by default
95 # LIB_SND_MODPLUG=-lmodplug
96 # CFLAGS_SND_MODPLUG=-DLINK_TO_LIBMODPLUG
97 LIB_SND_MODPLUG=
98 CFLAGS_SND_MODPLUG=
99
100 .endif
101
102
103 ##### Sound configuration #####
104
105 .ifndef DP_SOUND_API
106 DP_SOUND_API=$(DEFAULT_SNDAPI)
107 .endif
108
109 # NULL: no sound
110 .if $(DP_SOUND_API) == "NULL"
111 OBJ_SOUND=$(OBJ_SND_NULL)
112 LIB_SOUND=$(LIB_SND_NULL)
113 .endif
114
115 # OSS: Open Sound System
116 .if $(DP_SOUND_API) == "OSS"
117 OBJ_SOUND=$(OBJ_SND_OSS)
118 LIB_SOUND=$(LIB_SND_OSS)
119 .endif
120
121 # BSD: BSD / Sun audio API
122 .if $(DP_SOUND_API) == "BSD"
123 OBJ_SOUND=$(OBJ_SND_BSD)
124 LIB_SOUND=$(LIB_SND_BSD)
125 .endif
126
127
128 ##### Extra CFLAGS #####
129
130 CFLAGS_MAKEDEP=-MD
131 .ifdef DP_FS_BASEDIR
132 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
133 .else
134 CFLAGS_FS=
135 .endif
136
137 CFLAGS_PRELOAD=
138 .ifdef DP_PRELOAD_DEPENDENCIES
139 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
140 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
141 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
142 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
143 .endif
144
145
146 ##### BSD Make specific definitions #####
147
148 MAKE:=$(MAKE) -f BSDmakefile
149
150 DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
151
152
153 ##### Definitions shared by all makefiles #####
154 .include "makefile.inc"