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