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