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