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