Change makefile.inc to use SDL2 by default rather than SDL1.2 - removed
[xonotic/darkplaces.git] / makefile.inc
1 # Invalid call detection
2 CHECKLEVEL1 = @if [ "$(LEVEL)" != 1 ]; then $(MAKE) help; false; fi
3 CHECKLEVEL2 = @if [ "$(LEVEL)" != 2 ]; then $(MAKE) help; false; fi
4
5 # Choose the compiler you want to use
6 CC?=gcc
7
8 # athlon optimizations
9 #CPUOPTIMIZATIONS?=-march=athlon
10 # athlon xp optimizations
11 #CPUOPTIMIZATIONS?=-march=athlon-xp
12 # athlon 64 optimizations
13 #CPUOPTIMIZATIONS?=-march=athlon64 -m32
14 # Pentium 3 optimizations
15 #CPUOPTIMIZATIONS?=-march=pentium3
16 # Pentium 4 optimizations
17 #CPUOPTIMIZATIONS?=-march=pentium4
18 # 686 (Pentium Pro/II) optimizations
19 #CPUOPTIMIZATIONS?=-march=i686
20 # No specific CPU (386 compatible)
21 #CPUOPTIMIZATIONS?=
22 # Experimental
23 #CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math
24 # Normal
25 CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math
26 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
27
28 SDL_CONFIG?=sdl2-config
29 SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
30 SDLCONFIG_UNIXCFLAGS_X11?=
31 SDLCONFIG_UNIXLIBS?=`$(SDL_CONFIG) --libs`
32 SDLCONFIG_UNIXLIBS_X11?=-lX11
33 SDLCONFIG_UNIXSTATICLIBS?=`$(SDL_CONFIG) --static-libs`
34 SDLCONFIG_UNIXSTATICLIBS_X11?=-lX11
35 SDLCONFIG_MACOSXCFLAGS=-I/Library/Frameworks/SDL2.framework/Headers -I$(HOME)/Library/Frameworks/SDL2.framework/Headers
36 SDLCONFIG_MACOSXLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL2 -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS)
37 SDLCONFIG_MACOSXSTATICLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL2 -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS)
38 STRIP?=strip
39
40
41 ###### Sound and audio CD #####
42
43 OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
44
45 # No sound
46 OBJ_SND_NULL=snd_null.o
47 LIB_SND_NULL=
48
49 # Open Sound System (Linux, FreeBSD and Solaris)
50 OBJ_SND_OSS=$(OBJ_SND_COMMON) snd_oss.o
51 LIB_SND_OSS=
52
53 # Advanced Linux Sound Architecture (Linux)
54 OBJ_SND_ALSA=$(OBJ_SND_COMMON) snd_alsa.o
55 LIB_SND_ALSA=-lasound
56
57 # Core Audio (Mac OS X)
58 OBJ_SND_COREAUDIO=$(OBJ_SND_COMMON) snd_coreaudio.o
59 LIB_SND_COREAUDIO=-framework CoreAudio
60
61 # BSD / Sun audio API (NetBSD and OpenBSD)
62 OBJ_SND_BSD=$(OBJ_SND_COMMON) snd_bsd.o
63 LIB_SND_BSD=
64
65 # DirectX and Win32 WAVE output (Win32)
66 OBJ_SND_WIN=$(OBJ_SND_COMMON) snd_win.o
67 LIB_SND_WIN=
68
69 # Qantourisc's 3D Realtime Acoustic Lib (3D RAS)
70 OBJ_SND_3DRAS=snd_3dras.o
71 LIB_SND_3DRAS=
72
73 # CD objects
74 OBJ_CD_COMMON=cd_shared.o
75 OBJ_NOCD=cd_null.o
76
77
78 ###### Common objects and flags #####
79
80 # Common objects
81 OBJ_COMMON= \
82         bih.o \
83         crypto.o \
84         cl_collision.o \
85         cl_demo.o \
86         cl_dyntexture.o \
87         cl_input.o \
88         cl_main.o \
89         cl_parse.o \
90         cl_particles.o \
91         cl_screen.o \
92         cl_video.o \
93         clvm_cmds.o \
94         cmd.o \
95         collision.o \
96         common.o \
97         console.o \
98         csprogs.o \
99         curves.o \
100         cvar.o \
101         dpsoftrast.o \
102         dpvsimpledecode.o \
103         filematch.o \
104         fractalnoise.o \
105         fs.o \
106         ft2.o \
107         utf8lib.o \
108         gl_backend.o \
109         gl_draw.o \
110         gl_rmain.o \
111         gl_rsurf.o \
112         gl_textures.o \
113         hmac.o \
114         host.o \
115         host_cmd.o \
116         image.o \
117         image_png.o \
118         jpeg.o \
119         keys.o \
120         lhnet.o \
121         libcurl.o \
122         mathlib.o \
123         matrixlib.o \
124         mdfour.o \
125         meshqueue.o \
126         mod_skeletal_animatevertices_sse.o \
127         mod_skeletal_animatevertices_generic.o \
128         model_alias.o \
129         model_brush.o \
130         model_shared.o \
131         model_sprite.o \
132         netconn.o \
133         palette.o \
134         polygon.o \
135         portals.o \
136         protocol.o \
137         prvm_cmds.o \
138         prvm_edict.o \
139         prvm_exec.o \
140         r_explosion.o \
141         r_lerpanim.o \
142         r_lightning.o \
143         r_modules.o \
144         r_shadow.o \
145         r_sky.o \
146         r_sprites.o \
147         sbar.o \
148         sv_demo.o \
149         sv_main.o \
150         sv_move.o \
151         sv_phys.o \
152         sv_user.o \
153         svbsp.o \
154         svvm_cmds.o \
155         sys_shared.o \
156         vid_shared.o \
157         view.o \
158         wad.o \
159         world.o \
160         zone.o
161
162 OBJ_MENU= \
163         menu.o \
164         mvm_cmds.o
165
166 # note that builddate.c is very intentionally not compiled to a .o before
167 # being linked, because it should be recompiled every time an executable is
168 # built to give the executable a proper date string
169 OBJ_SV= builddate.c sys_linux.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_COMMON)
170 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMMON) snd_sdl.o $(OBJ_SDLCD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
171
172
173 # Compilation
174 CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) $(CFLAGS_NET) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
175 CFLAGS_CLIENT=-DCONFIG_MENU -DCONFIG_CD $(CFLAGS_VIDEO_CAPTURE)
176 CFLAGS_SERVER=
177 CFLAGS_DEBUG=-ggdb
178 CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
179 CFLAGS_RELEASE=
180 CFLAGS_RELEASE_PROFILE=-fbranch-probabilities
181 CFLAGS_SDL=$(SDLCONFIG_CFLAGS)
182
183 CFLAGS_SSE=-msse
184 CFLAGS_SSE2=-msse2
185
186 OPTIM_DEBUG=$(CPUOPTIMIZATIONS)
187 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
188 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS)
189 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS)
190 #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
191 OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
192 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
193
194 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
195
196
197 # Link
198 LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=debug
199 LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=profile
200 LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=release
201
202
203 ##### UNIX specific variables #####
204
205 OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_pthread.o keysym2ucs.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
206
207 LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
208 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND)
209 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
210 LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
211 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
212 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
213
214 LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS)
215 EXE_UNIXCL=darkplaces-glx
216 EXE_UNIXSV=darkplaces-dedicated
217 EXE_UNIXSDL=darkplaces-sdl
218 EXE_UNIXCLNEXUIZ=nexuiz-glx
219 EXE_UNIXSVNEXUIZ=nexuiz-dedicated
220 EXE_UNIXSDLNEXUIZ=nexuiz-sdl
221
222 CMD_UNIXRM=rm -rf
223 CMD_UNIXCP=cp -f
224 CMD_UNIXMKDIR=mkdir -p
225
226
227 ##### Linux specific variables #####
228
229 # Link
230 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXCL)
231 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl
232 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXSDL)
233
234
235 ##### Mac OS X specific variables #####
236
237 # No CD support available
238 OBJ_MACOSXCD=$(OBJ_NOCD)
239
240 # Link
241 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit -framework Carbon $(LIB_SOUND)
242 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
243 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit $(SDLCONFIG_STATICLIBS) ../../../SDLMain.m
244
245 OBJ_AGL= builddate.c sys_linux.o vid_agl.o thread_null.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
246
247 EXE_MACOSXCL=darkplaces-agl
248 EXE_MACOSXCLNEXUIZ=nexuiz-agl
249
250
251 ##### SunOS specific variables #####
252
253 # No CD support available
254 OBJ_SUNOSCD=$(OBJ_NOCD)
255
256 CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP -DSUNOS
257
258 # Link
259 LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl -R$(UNIX_X11LIBPATH) -L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm $(LIB_SOUND)
260 LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl
261 LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
262
263
264 ##### BSD specific variables #####
265
266 # Link
267 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
268 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) 
269 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
270
271
272 ##### Win32 specific variables #####
273
274 WINDRES ?= windres
275
276 OBJ_WGL= builddate.c sys_win.o vid_wgl.o thread_null.o $(OBJ_MENU) $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
277
278 # Link
279 # see LDFLAGS_WINCOMMON in makefile
280 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_Z) $(LIB_JPEG)
281 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
282 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
283 EXE_WINCL=darkplaces.exe
284 EXE_WINSV=darkplaces-dedicated.exe
285 EXE_WINSDL=darkplaces-sdl.exe
286 EXE_WINCLNEXUIZ=nexuiz.exe
287 EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
288 EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
289
290 VPATH := ../../../
291
292 ##### Commands #####
293
294 .PHONY : clean clean-profile help \
295          debug profile release \
296          cl-debug cl-profile cl-release \
297          sv-debug sv-profile sv-release \
298          sdl-debug sdl-profile sdl-release
299
300 help:
301         @echo
302         @echo "===== Choose one ====="
303         @echo "* $(MAKE) clean                : delete all files produced by the build except"
304         @echo "                              profiling information"
305         @echo "* $(MAKE) clean-profile        : delete all files produced by the build, including"
306         @echo "                              profiling informaiton"
307         @echo "* $(MAKE) help                 : this help"
308         @echo "* $(MAKE) debug                : make client and server binaries (debug versions)"
309         @echo "* $(MAKE) profile              : make client and server binaries (profile versions)"
310         @echo "* $(MAKE) release              : make client and server binaries (release versions)"
311         @echo "* $(MAKE) release-profile      : make client and server binaries (release versions)"
312         @echo "                              (with profiling optimizations) The profiled"
313         @echo "                              version of the program must have been"
314         @echo "                              previously compiled"
315         @echo "* $(MAKE) nexuiz               : make client and server binaries with nexuiz icon"
316         @echo "                              (release versions)"
317         @echo "* $(MAKE) cl-debug             : make client (debug version)"
318         @echo "* $(MAKE) cl-profile           : make client (profile version)"
319         @echo "* $(MAKE) cl-release-profile   : make client (release profile version)"
320         @echo "* $(MAKE) cl-release           : make client (release version)"
321         @echo "* $(MAKE) cl-nexuiz            : make client with nexuiz icon (release version)"
322         @echo "* $(MAKE) sv-debug             : make dedicated server (debug version)"
323         @echo "* $(MAKE) sv-profile           : make dedicated server (profile version)"
324         @echo "* $(MAKE) sv-release-profile   : make dedicated server (release profile version)"
325         @echo "* $(MAKE) sv-release           : make dedicated server (release version)"
326         @echo "* $(MAKE) sv-nexuiz            : make dedicated server with nexuiz icon"
327         @echo "                              (release version)"
328         @echo "* $(MAKE) sdl-debug            : make SDL client (debug version)"
329         @echo "* $(MAKE) sdl-profile          : make SDL client (profile version)"
330         @echo "* $(MAKE) sdl-release-profile  : make SDL client (release version)"
331         @echo "* $(MAKE) sdl-release          : make SDL client (release version)"
332         @echo "* $(MAKE) sdl-nexuiz           : make SDL client with nexuiz icon (release version)"
333         @echo
334
335 debug :
336         $(MAKE) $(TARGETS_DEBUG)
337
338 profile :
339         $(MAKE) $(TARGETS_PROFILE)
340
341 release :
342         $(MAKE) $(TARGETS_RELEASE)
343
344 release-profile :
345         $(MAKE) $(TARGETS_RELEASE_PROFILE)
346
347 nexuiz :
348         $(MAKE) $(TARGETS_NEXUIZ)
349
350 cl-debug :
351         $(MAKE) bin-debug \
352                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
353                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
354
355 cl-profile :
356         $(MAKE) bin-profile \
357                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
358                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
359
360 cl-release :
361         $(MAKE) bin-release \
362                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
363                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
364
365 cl-release-profile :
366         $(MAKE) bin-release-profile \
367                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
368                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
369
370 cl-nexuiz :
371         $(MAKE) bin-release \
372                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
373                 EXE='$(EXE_CLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
374
375 sv-debug :
376         $(MAKE) bin-debug \
377                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
378                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
379
380 sv-profile :
381         $(MAKE) bin-profile \
382                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
383                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
384
385 sv-release :
386         $(MAKE) bin-release \
387                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
388                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
389
390 sv-release-profile :
391         $(MAKE) bin-release-profile \
392                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
393                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
394
395 sv-nexuiz :
396         $(MAKE) bin-release \
397                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
398                 EXE='$(EXE_SVNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
399
400 sdl-debug :
401         $(MAKE) bin-debug \
402                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
403                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
404
405 sdl-profile :
406         $(MAKE) bin-profile \
407                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
408                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
409
410 sdl-release :
411         $(MAKE) bin-release \
412                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
413                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
414
415 sdl-release-profile :
416         $(MAKE) bin-release-profile \
417                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
418                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
419
420 sdl-nexuiz :
421         $(MAKE) bin-release \
422                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
423                 EXE='$(EXE_SDLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
424
425 bin-debug :
426         $(CHECKLEVEL1)
427         @echo
428         @echo '========== $(EXE) (debug) =========='
429         $(MAKE) prepare BUILD_DIR=build-obj/debug/$(EXE)
430         $(MAKE) -C build-obj/debug/$(EXE) $(EXE) \
431                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
432                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)'\
433                 LDFLAGS='$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)' LEVEL=2
434
435 bin-profile :
436         $(CHECKLEVEL1)
437         @echo
438         @echo '========== $(EXE) (profile) =========='
439         $(MAKE) prepare BUILD_DIR=build-obj/profile/$(EXE)
440         $(MAKE) -C build-obj/profile/$(EXE) $(EXE) \
441                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
442                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)'\
443                 LDFLAGS='$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)' LEVEL=2
444
445 bin-release :
446         $(CHECKLEVEL1)
447         @echo
448         @echo '========== $(EXE) (release) =========='
449         $(MAKE) prepare BUILD_DIR=build-obj/release/$(EXE)
450         $(MAKE) -C build-obj/release/$(EXE) $(EXE) \
451                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
452                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)'\
453                 LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
454         $(STRIP) $(EXE)
455
456 bin-release-profile :
457         $(CHECKLEVEL1)
458         @echo
459         @echo '========== $(EXE) (release) =========='
460         $(MAKE) prepare BUILD_DIR=build-obj/release-profile/$(EXE)
461         $(MAKE) -C build-obj/release-profile/$(EXE) $(EXE) \
462                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
463                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)'\
464                 LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
465         $(STRIP) $(EXE)
466
467 prepare :
468         $(CMD_MKDIR) $(BUILD_DIR)
469         $(CMD_CP) makefile.inc $(BUILD_DIR)/
470         $(CMD_CP) $(MAKEFILE) $(BUILD_DIR)/
471
472 #this checks USEODE when compiling so it needs the ODE flags as well
473 prvm_cmds.o: prvm_cmds.c
474         $(CHECKLEVEL2)
475         $(DO_CC) $(CFLAGS_ODE)
476
477 world.o: world.c
478         $(CHECKLEVEL2)
479         $(DO_CC) $(CFLAGS_ODE)
480
481 vid_glx.o: vid_glx.c
482         $(CHECKLEVEL2)
483         $(DO_CC) -I/usr/X11R6/include
484
485 keysym2ucs.o: keysym2ucs.c
486         $(CHECKLEVEL2)
487         $(DO_CC) -I/usr/X11R6/include
488
489 vid_sdl.o: vid_sdl.c
490         $(CHECKLEVEL2)
491         $(DO_CC) $(CFLAGS_SDL)
492
493 sys_sdl.o: sys_sdl.c
494         $(CHECKLEVEL2)
495         $(DO_CC) $(CFLAGS_SDL)
496
497 snd_sdl.o: snd_sdl.c
498         $(CHECKLEVEL2)
499         $(DO_CC) $(CFLAGS_SDL)
500
501 thread_sdl.o: thread_sdl.c
502         $(CHECKLEVEL2)
503         $(DO_CC) $(CFLAGS_SDL)
504
505 snd_3dras.o: snd_3dras.c
506         $(CHECKLEVEL2)
507         $(DO_CC)
508
509 cd_sdl.o: cd_sdl.c
510         $(CHECKLEVEL2)
511         $(DO_CC) $(CFLAGS_SDL)
512
513 crypto.o: crypto.c
514         $(CHECKLEVEL2)
515         $(DO_CC) $(CFLAGS_CRYPTO) $(CFLAGS_CRYPTO_RIJNDAEL)
516
517 mod_skeletal_animatevertices_sse.o: mod_skeletal_animatevertices_sse.c
518         $(CHECKLEVEL2)
519         $(DO_CC) $(CFLAGS_SSE)
520
521 dpsoftrast.o: dpsoftrast.c
522         $(CHECKLEVEL2)
523         $(DO_CC) $(CFLAGS_SSE2)
524
525 darkplaces.o: %.o : %.rc
526         $(CHECKLEVEL2)
527         $(WINDRES) -o $@ $<
528
529 nexuiz.o: %.o : %.rc
530         $(CHECKLEVEL2)
531         $(WINDRES) -o $@ $<
532
533 .c.o:
534         $(CHECKLEVEL2)
535         $(DO_CC)
536
537 $(EXE_CL): $(OBJ_CL) $(OBJ_ICON)
538         $(CHECKLEVEL2)
539         $(DO_LD)
540
541 $(EXE_SV): $(OBJ_SV) $(OBJ_ICON)
542         $(CHECKLEVEL2)
543         $(DO_LD)
544
545 $(EXE_SDL): $(OBJ_SDL) $(OBJ_ICON)
546         $(CHECKLEVEL2)
547         $(DO_LD)
548
549 $(EXE_CLNEXUIZ): $(OBJ_CL) $(OBJ_ICON_NEXUIZ)
550         $(CHECKLEVEL2)
551         $(DO_LD)
552
553 $(EXE_SVNEXUIZ): $(OBJ_SV) $(OBJ_ICON_NEXUIZ)
554         $(CHECKLEVEL2)
555         $(DO_LD)
556
557 $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ)
558         $(CHECKLEVEL2)
559         $(DO_LD)
560
561 clean:
562         -$(CMD_RM) $(EXE_CL)
563         -$(CMD_RM) $(EXE_SV)
564         -$(CMD_RM) $(EXE_SDL)
565         -$(CMD_RM) $(EXE_CLNEXUIZ)
566         -$(CMD_RM) $(EXE_SVNEXUIZ)
567         -$(CMD_RM) $(EXE_SDLNEXUIZ)
568         -$(CMD_RM) *.o
569         -$(CMD_RM) *.d
570         -$(CMD_RM) build-obj/
571
572 clean-profile: clean
573         -$(CMD_RM) *.gcda
574         -$(CMD_RM) *.gcno