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