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