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