]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - makefile.inc
::stable-branch::reset=2b2ce6d4f94d18b45451c9e648c1c0bb40557416
[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         dpvsimpledecode.o \
124         filematch.o \
125         fractalnoise.o \
126         fs.o \
127         ft2.o \
128         utf8lib.o \
129         gl_backend.o \
130         gl_draw.o \
131         gl_rmain.o \
132         gl_rsurf.o \
133         gl_textures.o \
134         hmac.o \
135         host.o \
136         host_cmd.o \
137         image.o \
138         image_png.o \
139         jpeg.o \
140         keys.o \
141         lhnet.o \
142         libcurl.o \
143         mathlib.o \
144         matrixlib.o \
145         mdfour.o \
146         menu.o \
147         meshqueue.o \
148         mod_skeletal_animatevertices_sse.o \
149         mod_skeletal_animatevertices_generic.o \
150         model_alias.o \
151         model_brush.o \
152         model_shared.o \
153         model_sprite.o \
154         mvm_cmds.o \
155         netconn.o \
156         palette.o \
157         polygon.o \
158         portals.o \
159         protocol.o \
160         prvm_cmds.o \
161         prvm_edict.o \
162         prvm_exec.o \
163         r_explosion.o \
164         r_lerpanim.o \
165         r_lightning.o \
166         r_modules.o \
167         r_shadow.o \
168         r_sky.o \
169         r_sprites.o \
170         sbar.o \
171         sv_demo.o \
172         sv_main.o \
173         sv_move.o \
174         sv_phys.o \
175         sv_user.o \
176         svbsp.o \
177         svvm_cmds.o \
178         sys_shared.o \
179         vid_shared.o \
180         view.o \
181         wad.o \
182         world.o \
183         zone.o
184
185 # note that builddate.c is very intentionally not compiled to a .o before
186 # being linked, because it should be recompiled every time an executable is
187 # built to give the executable a proper date string
188 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_SND_NULL) $(OBJ_NOCD) $(OBJ_COMMON)
189 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
190
191
192 # Compilation
193 CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_CG) $(CFLAGS_WARNINGS) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D)
194 CFLAGS_DEBUG=-ggdb
195 CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
196 CFLAGS_RELEASE=
197 CFLAGS_RELEASE_PROFILE=-fbranch-probabilities
198 CFLAGS_SDL=$(SDLCONFIG_CFLAGS)
199
200 CFLAGS_SSE=-msse
201
202 OPTIM_DEBUG=$(CPUOPTIMIZATIONS)
203 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
204 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS)
205 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS)
206 #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
207 OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
208 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
209
210 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
211
212
213 # Link
214 LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=debug
215 LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=profile
216 LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=release
217
218
219 ##### UNIX specific variables #####
220
221 OBJ_GLX= builddate.c sys_linux.o vid_glx.o keysym2ucs.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
222
223 LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_CG) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
224 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
225 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug
226 LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
227 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug
228 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
229
230 LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG)
231 EXE_UNIXCL=darkplaces-glx
232 EXE_UNIXSV=darkplaces-dedicated
233 EXE_UNIXSDL=darkplaces-sdl
234 EXE_UNIXCLNEXUIZ=nexuiz-glx
235 EXE_UNIXSVNEXUIZ=nexuiz-dedicated
236 EXE_UNIXSDLNEXUIZ=nexuiz-sdl
237
238 CMD_UNIXRM=rm -rf
239
240
241 ##### Linux specific variables #####
242
243 # If you want CD sound in Linux
244 OBJ_LINUXCD=cd_linux.o
245 # If you want no CD audio
246 #OBJ_LINUXCD=$(OBJ_NOCD)
247
248 # Link
249 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXCL)
250 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl
251 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXSDL)
252
253
254 ##### Mac OS X specific variables #####
255
256 # No CD support available
257 OBJ_MACOSXCD=$(OBJ_NOCD)
258
259 # Link
260 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit -framework Carbon $(LIB_SOUND)
261 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
262 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit $(SDLCONFIG_STATICLIBS) SDLMain.m
263
264 OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
265
266 EXE_MACOSXCL=darkplaces-agl
267 EXE_MACOSXCLNEXUIZ=nexuiz-agl
268
269
270 ##### SunOS specific variables #####
271
272 # No CD support available
273 OBJ_SUNOSCD=$(OBJ_NOCD)
274
275 CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP -DSUNOS
276
277 # Link
278 LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl -R$(UNIX_X11LIBPATH) -L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm $(LIB_SOUND)
279 LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl
280 LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
281
282
283 ##### BSD specific variables #####
284
285 #if you want CD sound in BSD
286 OBJ_BSDCD=cd_bsd.o
287 #if you want no CD audio
288 #OBJ_BSDCD=$(OBJ_NOCD)
289
290 # Link
291 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
292 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) 
293 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
294
295
296 ##### Win32 specific variables #####
297
298 WINDRES ?= windres
299 #if you want CD sound in Win32
300 OBJ_WINCD=cd_win.o
301 #if you want no CD audio
302 #OBJ_WINCD=$(OBJ_NOCD)
303
304 OBJ_WGL= builddate.c sys_win.o vid_wgl.o $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_COMMON)
305
306 # Link
307 # see LDFLAGS_WINCOMMON in makefile
308 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_JPEG)
309 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_JPEG)
310 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 $(LIB_JPEG)
311 EXE_WINCL=darkplaces.exe
312 EXE_WINSV=darkplaces-dedicated.exe
313 EXE_WINSDL=darkplaces-sdl.exe
314 EXE_WINCLNEXUIZ=nexuiz.exe
315 EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
316 EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
317
318
319 ##### Commands #####
320
321 .PHONY : clean clean-profile help \
322          debug profile release \
323          cl-debug cl-profile cl-release \
324          sv-debug sv-profile sv-release \
325          sdl-debug sdl-profile sdl-release
326
327 help:
328         @echo
329         @echo "===== Choose one ====="
330         @echo "* $(MAKE) clean               : delete all files produced by the build except"
331         @echo "                             profiling information"
332         @echo "* $(MAKE) clean-profile       : delete all files produced by the build, including"
333         @echo "                             profiling informaiton"
334         @echo "* $(MAKE) help                : this help"
335         @echo "* $(MAKE) debug               : make client and server binaries (debug versions)"
336         @echo "* $(MAKE) profile             : make client and server binaries (profile versions)"
337         @echo "* $(MAKE) release             : make client and server binaries (release versions)"
338         @echo "* $(MAKE) release-profile     : make client and server binaries (release versions)"
339         @echo "                             with profileing optomizations) The profiled"
340         @echo "                             version of the program must have been"
341         @echo "                             previously compiled"
342         @echo "* $(MAKE) nexuiz              : make client and server binaries with nexuiz icon"
343         @echo "                             (release versions)"
344         @echo "* $(MAKE) cl-debug            : make client (debug version)"
345         @echo "* $(MAKE) cl-profile          : make client (profile version)"
346         @echo "* $(MAKE) cl-release          : make client (release version)"
347         @echo "* $(MAKE) cl-release-profile  : make client (release version)"
348         @echo "* $(MAKE) cl-nexuiz           : make client with nexuiz icon (release version)"
349         @echo "* $(MAKE) sv-debug            : make dedicated server (debug version)"
350         @echo "* $(MAKE) sv-profile          : make dedicated server (profile version)"
351         @echo "* $(MAKE) sv-release          : make dedicated server (release version)"
352         @echo "* $(MAKE) sv-release-profile  : make dedicated server (release version)"
353         @echo "* $(MAKE) sv-nexuiz           : make dedicated server with nexuiz icon"
354         @echo "                             (release version)"
355         @echo "* $(MAKE) sdl-debug           : make SDL client (debug version)"
356         @echo "* $(MAKE) sdl-profile         : make SDL client (profile version)"
357         @echo "* $(MAKE) sdl-profile-profile : make SDL client (profile version)"
358         @echo "* $(MAKE) sdl-release         : make SDL client (release version)"
359         @echo "* $(MAKE) sdl-nexuiz          : make SDL client with nexuiz icon (release version)"
360         @echo
361
362 debug :
363         $(MAKE) sv-debug cl-debug sdl-debug
364
365 profile :
366         $(MAKE) sv-profile cl-profile sdl-profile
367
368 release :
369         $(MAKE) sv-release cl-release sdl-release
370
371 release-profile :
372         $(MAKE) sv-release-profile cl-release-profile sdl-release-profile
373
374 nexuiz :
375         $(MAKE) sv-nexuiz cl-nexuiz sdl-nexuiz
376
377 cl-debug :
378         $(MAKE) bin-debug \
379                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
380                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
381
382 cl-profile :
383         $(MAKE) bin-profile \
384                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
385                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
386
387 cl-release :
388         $(MAKE) bin-release \
389                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
390                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
391
392 cl-release-profile :
393         $(MAKE) bin-release-profile \
394                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
395                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
396
397 cl-nexuiz :
398         $(MAKE) bin-release \
399                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
400                 EXE="$(EXE_CLNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
401
402 sv-debug :
403         $(MAKE) bin-debug \
404                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
405                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
406
407 sv-profile :
408         $(MAKE) bin-profile \
409                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
410                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
411
412 sv-release :
413         $(MAKE) bin-release \
414                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
415                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
416
417 sv-release-profile :
418         $(MAKE) bin-release-profile \
419                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
420                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
421
422 sv-nexuiz :
423         $(MAKE) bin-release \
424                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
425                 EXE="$(EXE_SVNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
426
427 sdl-debug :
428         $(MAKE) bin-debug \
429                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
430                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
431
432 sdl-profile :
433         $(MAKE) bin-profile \
434                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
435                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
436
437 sdl-release :
438         $(MAKE) bin-release \
439                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
440                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
441
442 sdl-release-profile :
443         $(MAKE) bin-release-profile \
444                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
445                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
446
447 sdl-nexuiz :
448         $(MAKE) bin-release \
449                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
450                 EXE="$(EXE_SDLNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
451
452 bin-debug :
453         $(CHECKLEVEL1)
454         @echo
455         @echo "========== $(EXE) (debug) =========="
456         $(MAKE) $(EXE) \
457                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
458                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
459                 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)" LEVEL=2
460
461 bin-profile :
462         $(CHECKLEVEL1)
463         @echo
464         @echo "========== $(EXE) (profile) =========="
465         $(MAKE) $(EXE) \
466                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
467                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
468                 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)" LEVEL=2
469
470 bin-release :
471         $(CHECKLEVEL1)
472         @echo
473         @echo "========== $(EXE) (release) =========="
474         $(MAKE) $(EXE) \
475                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
476                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
477                 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
478         $(STRIP) $(EXE)
479
480 bin-release-profile :
481         $(CHECKLEVEL1)
482         @echo
483         @echo "========== $(EXE) (release) =========="
484         $(MAKE) $(EXE) \
485                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
486                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)"\
487                 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
488         $(STRIP) $(EXE)
489
490
491 snd_modplug.o: snd_modplug.c
492         $(CHECKLEVEL2)
493         $(DO_CC) $(CFLAGS_SND_MODPLUG)
494
495 world.o: world.c
496         $(CHECKLEVEL2)
497         $(DO_CC) $(CFLAGS_ODE)
498
499 vid_glx.o: vid_glx.c
500         $(CHECKLEVEL2)
501         $(DO_CC) -I/usr/X11R6/include
502
503 keysym2ucs.o: keysym2ucs.c
504         $(CHECKLEVEL2)
505         $(DO_CC) -I/usr/X11R6/include
506
507 vid_sdl.o: vid_sdl.c
508         $(CHECKLEVEL2)
509         $(DO_CC) $(CFLAGS_SDL)
510
511 sys_sdl.o: sys_sdl.c
512         $(CHECKLEVEL2)
513         $(DO_CC) $(CFLAGS_SDL)
514
515 snd_sdl.o: snd_sdl.c
516         $(CHECKLEVEL2)
517         $(DO_CC) $(CFLAGS_SDL)
518
519 snd_3dras.o: snd_3dras.c
520         $(CHECKLEVEL2)
521         $(DO_CC)
522
523 cd_sdl.o: cd_sdl.c
524         $(CHECKLEVEL2)
525         $(DO_CC) $(CFLAGS_SDL)
526
527 crypto.o: crypto.c
528         $(CHECKLEVEL2)
529         $(DO_CC) $(CFLAGS_CRYPTO) $(CFLAGS_CRYPTO_RIJNDAEL)
530
531 mod_skeletal_animatevertices_sse.o: mod_skeletal_animatevertices_sse.c
532         $(CHECKLEVEL2)
533         $(DO_CC) $(CFLAGS_SSE)
534
535 darkplaces.o: %.o : %.rc
536         $(CHECKLEVEL2)
537         $(WINDRES) -o $@ $<
538
539 nexuiz.o: %.o : %.rc
540         $(CHECKLEVEL2)
541         $(WINDRES) -o $@ $<
542
543 .c.o:
544         $(CHECKLEVEL2)
545         $(DO_CC)
546
547 $(EXE_CL): $(OBJ_CL) $(OBJ_ICON)
548         $(CHECKLEVEL2)
549         $(DO_LD)
550
551 $(EXE_SV): $(OBJ_SV) $(OBJ_ICON)
552         $(CHECKLEVEL2)
553         $(DO_LD)
554
555 $(EXE_SDL): $(OBJ_SDL) $(OBJ_ICON)
556         $(CHECKLEVEL2)
557         $(DO_LD)
558
559 $(EXE_CLNEXUIZ): $(OBJ_CL) $(OBJ_ICON_NEXUIZ)
560         $(CHECKLEVEL2)
561         $(DO_LD)
562
563 $(EXE_SVNEXUIZ): $(OBJ_SV) $(OBJ_ICON_NEXUIZ)
564         $(CHECKLEVEL2)
565         $(DO_LD)
566
567 $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ)
568         $(CHECKLEVEL2)
569         $(DO_LD)
570
571 clean:
572         -$(CMD_RM) $(EXE_CL)
573         -$(CMD_RM) $(EXE_SV)
574         -$(CMD_RM) $(EXE_SDL)
575         -$(CMD_RM) $(EXE_CLNEXUIZ)
576         -$(CMD_RM) $(EXE_SVNEXUIZ)
577         -$(CMD_RM) $(EXE_SDLNEXUIZ)
578         -$(CMD_RM) *.o
579         -$(CMD_RM) *.d
580
581 clean-profile: clean
582         -$(CMD_RM) *.gcda
583         -$(CMD_RM) *.gcno
584