fixed some issues with how D3D=1 worked in the makefile
[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 # 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 -I$(HOME)/Library/Frameworks/SDL.framework/Headers
42 SDLCONFIG_MACOSXLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS)
43 SDLCONFIG_MACOSXSTATICLIBS=-F$(HOME)/Library/Frameworks/ -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 # libjpeg dependency (set these to "" if you want to use dynamic loading instead)
181 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
182 LIB_JPEG=-ljpeg
183
184 # Compilation
185 CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_CG) $(CFLAGS_WARNINGS) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D)
186 CFLAGS_DEBUG=-ggdb
187 CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
188 CFLAGS_RELEASE=
189 CFLAGS_RELEASE_PROFILE=-fbranch-probabilities
190 CFLAGS_SDL=$(SDLCONFIG_CFLAGS)
191
192 OPTIM_DEBUG=$(CPUOPTIMIZATIONS)
193 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
194 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS)
195 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS)
196 #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
197 OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
198 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
199
200 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
201
202
203 # Link
204 LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=debug
205 LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=profile
206 LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=release
207
208
209 ##### UNIX specific variables #####
210
211 OBJ_GLX= builddate.c sys_linux.o vid_glx.o keysym2ucs.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
212
213 LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_CG) $(LIB_JPEG)
214 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
215 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug
216 LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
217 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug
218 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
219
220 LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG)
221 EXE_UNIXCL=darkplaces-glx
222 EXE_UNIXSV=darkplaces-dedicated
223 EXE_UNIXSDL=darkplaces-sdl
224 EXE_UNIXCLNEXUIZ=nexuiz-glx
225 EXE_UNIXSVNEXUIZ=nexuiz-dedicated
226 EXE_UNIXSDLNEXUIZ=nexuiz-sdl
227
228 CMD_UNIXRM=rm -rf
229
230
231 ##### Linux specific variables #####
232
233 # If you want CD sound in Linux
234 OBJ_LINUXCD=cd_linux.o
235 # If you want no CD audio
236 #OBJ_LINUXCD=$(OBJ_NOCD)
237
238 # Link
239 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXCL)
240 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl
241 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXSDL)
242
243
244 ##### Mac OS X specific variables #####
245
246 # No CD support available
247 OBJ_MACOSXCD=$(OBJ_NOCD)
248
249 # Link
250 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit -framework Carbon $(LIB_SOUND)
251 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
252 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(SDLCONFIG_STATICLIBS) SDLMain.m
253
254 OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
255
256 EXE_MACOSXCL=darkplaces-agl
257 EXE_MACOSXCLNEXUIZ=nexuiz-agl
258
259
260 ##### SunOS specific variables #####
261
262 # No CD support available
263 OBJ_SUNOSCD=$(OBJ_NOCD)
264
265 CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP -DSUNOS
266
267 # Link
268 LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl -R$(UNIX_X11LIBPATH) -L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm $(LIB_SOUND)
269 LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl
270 LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
271
272
273 ##### BSD specific variables #####
274
275 #if you want CD sound in BSD
276 OBJ_BSDCD=cd_bsd.o
277 #if you want no CD audio
278 #OBJ_BSDCD=$(OBJ_NOCD)
279
280 # Link
281 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
282 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) 
283 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
284
285
286 ##### Win32 specific variables #####
287
288 WINDRES ?= windres
289 #if you want CD sound in Win32
290 OBJ_WINCD=cd_win.o
291 #if you want no CD audio
292 #OBJ_WINCD=$(OBJ_NOCD)
293
294 OBJ_WGL= builddate.c sys_win.o vid_wgl.o $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_COMMON)
295
296 # Link
297 # see LDFLAGS_WINCOMMON in makefile
298 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_JPEG)
299 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole -lwinmm -lws2_32 $(LIB_JPEG)
300 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 $(LIB_JPEG)
301 EXE_WINCL=darkplaces.exe
302 EXE_WINSV=darkplaces-dedicated.exe
303 EXE_WINSDL=darkplaces-sdl.exe
304 EXE_WINCLNEXUIZ=nexuiz.exe
305 EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
306 EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
307
308
309 ##### Commands #####
310
311 .PHONY : clean clean-profile help \
312          debug profile release \
313          cl-debug cl-profile cl-release \
314          sv-debug sv-profile sv-release \
315          sdl-debug sdl-profile sdl-release
316
317 help:
318         @echo
319         @echo "===== Choose one ====="
320         @echo "* $(MAKE) clean               : delete all files produced by the build except"
321         @echo "                             profiling information"
322         @echo "* $(MAKE) clean-profile       : delete all files produced by the build, including"
323         @echo "                             profiling informaiton"
324         @echo "* $(MAKE) help                : this help"
325         @echo "* $(MAKE) debug               : make client and server binaries (debug versions)"
326         @echo "* $(MAKE) profile             : make client and server binaries (profile versions)"
327         @echo "* $(MAKE) release             : make client and server binaries (release versions)"
328         @echo "* $(MAKE) release-profile     : make client and server binaries (release versions)"
329         @echo "                             with profileing optomizations) The profiled"
330         @echo "                             version of the program must have been"
331         @echo "                             previously compiled"
332         @echo "* $(MAKE) nexuiz              : make client and server binaries with nexuiz icon"
333         @echo "                             (release versions)"
334         @echo "* $(MAKE) cl-debug            : make client (debug version)"
335         @echo "* $(MAKE) cl-profile          : make client (profile version)"
336         @echo "* $(MAKE) cl-release          : make client (release version)"
337         @echo "* $(MAKE) cl-release-profile  : make client (release version)"
338         @echo "* $(MAKE) cl-nexuiz           : make client with nexuiz icon (release version)"
339         @echo "* $(MAKE) sv-debug            : make dedicated server (debug version)"
340         @echo "* $(MAKE) sv-profile          : make dedicated server (profile version)"
341         @echo "* $(MAKE) sv-release          : make dedicated server (release version)"
342         @echo "* $(MAKE) sv-release-profile  : make dedicated server (release version)"
343         @echo "* $(MAKE) sv-nexuiz           : make dedicated server with nexuiz icon"
344         @echo "                             (release version)"
345         @echo "* $(MAKE) sdl-debug           : make SDL client (debug version)"
346         @echo "* $(MAKE) sdl-profile         : make SDL client (profile version)"
347         @echo "* $(MAKE) sdl-profile-profile : make SDL client (profile version)"
348         @echo "* $(MAKE) sdl-release         : make SDL client (release version)"
349         @echo "* $(MAKE) sdl-nexuiz          : make SDL client with nexuiz icon (release version)"
350         @echo
351
352 debug :
353         $(MAKE) sv-debug cl-debug sdl-debug
354
355 profile :
356         $(MAKE) sv-profile cl-profile sdl-profile
357
358 release :
359         $(MAKE) sv-release cl-release sdl-release
360
361 release-profile :
362         $(MAKE) sv-release-profile cl-release-profile sdl-release-profile
363
364 nexuiz :
365         $(MAKE) sv-nexuiz cl-nexuiz sdl-nexuiz
366
367 cl-debug :
368         $(MAKE) bin-debug \
369                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
370                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
371
372 cl-profile :
373         $(MAKE) bin-profile \
374                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
375                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
376
377 cl-release :
378         $(MAKE) bin-release \
379                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
380                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
381
382 cl-release-profile :
383         $(MAKE) bin-release-profile \
384                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
385                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
386
387 cl-nexuiz :
388         $(MAKE) bin-release \
389                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
390                 EXE="$(EXE_CLNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
391
392 sv-debug :
393         $(MAKE) bin-debug \
394                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
395                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
396
397 sv-profile :
398         $(MAKE) bin-profile \
399                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
400                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
401
402 sv-release :
403         $(MAKE) bin-release \
404                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
405                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
406
407 sv-release-profile :
408         $(MAKE) bin-release-profile \
409                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
410                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
411
412 sv-nexuiz :
413         $(MAKE) bin-release \
414                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
415                 EXE="$(EXE_SVNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
416
417 sdl-debug :
418         $(MAKE) bin-debug \
419                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
420                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
421
422 sdl-profile :
423         $(MAKE) bin-profile \
424                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
425                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
426
427 sdl-release :
428         $(MAKE) bin-release \
429                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
430                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
431
432 sdl-release-profile :
433         $(MAKE) bin-release-profile \
434                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
435                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
436
437 sdl-nexuiz :
438         $(MAKE) bin-release \
439                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
440                 EXE="$(EXE_SDLNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
441
442 bin-debug :
443         $(CHECKLEVEL1)
444         @echo
445         @echo "========== $(EXE) (debug) =========="
446         $(MAKE) $(EXE) \
447                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
448                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
449                 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)" LEVEL=2
450
451 bin-profile :
452         $(CHECKLEVEL1)
453         @echo
454         @echo "========== $(EXE) (profile) =========="
455         $(MAKE) $(EXE) \
456                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
457                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
458                 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)" LEVEL=2
459
460 bin-release :
461         $(CHECKLEVEL1)
462         @echo
463         @echo "========== $(EXE) (release) =========="
464         $(MAKE) $(EXE) \
465                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
466                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
467                 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
468         $(STRIP) $(EXE)
469
470 bin-release-profile :
471         $(CHECKLEVEL1)
472         @echo
473         @echo "========== $(EXE) (release) =========="
474         $(MAKE) $(EXE) \
475                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
476                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)"\
477                 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
478         $(STRIP) $(EXE)
479
480
481 snd_modplug.o: snd_modplug.c
482         $(CHECKLEVEL2)
483         $(DO_CC) $(CFLAGS_SND_MODPLUG)
484
485 world.o: world.c
486         $(CHECKLEVEL2)
487         $(DO_CC) $(CFLAGS_ODE)
488
489 vid_glx.o: vid_glx.c
490         $(CHECKLEVEL2)
491         $(DO_CC) -I/usr/X11R6/include
492
493 keysym2ucs.o: keysym2ucs.c
494         $(CHECKLEVEL2)
495         $(DO_CC) -I/usr/X11R6/include
496
497 vid_sdl.o: vid_sdl.c
498         $(CHECKLEVEL2)
499         $(DO_CC) $(CFLAGS_SDL)
500
501 sys_sdl.o: sys_sdl.c
502         $(CHECKLEVEL2)
503         $(DO_CC) $(CFLAGS_SDL)
504
505 snd_sdl.o: snd_sdl.c
506         $(CHECKLEVEL2)
507         $(DO_CC) $(CFLAGS_SDL)
508
509 snd_3dras.o: snd_3dras.c
510         $(CHECKLEVEL2)
511         $(DO_CC)
512
513 cd_sdl.o: cd_sdl.c
514         $(CHECKLEVEL2)
515         $(DO_CC) $(CFLAGS_SDL)
516
517 darkplaces.o: %.o : %.rc
518         $(CHECKLEVEL2)
519         $(WINDRES) -o $@ $<
520
521 nexuiz.o: %.o : %.rc
522         $(CHECKLEVEL2)
523         $(WINDRES) -o $@ $<
524
525 .c.o:
526         $(CHECKLEVEL2)
527         $(DO_CC)
528
529 $(EXE_CL): $(OBJ_CL) $(OBJ_ICON)
530         $(CHECKLEVEL2)
531         $(DO_LD)
532
533 $(EXE_SV): $(OBJ_SV) $(OBJ_ICON)
534         $(CHECKLEVEL2)
535         $(DO_LD)
536
537 $(EXE_SDL): $(OBJ_SDL) $(OBJ_ICON)
538         $(CHECKLEVEL2)
539         $(DO_LD)
540
541 $(EXE_CLNEXUIZ): $(OBJ_CL) $(OBJ_ICON_NEXUIZ)
542         $(CHECKLEVEL2)
543         $(DO_LD)
544
545 $(EXE_SVNEXUIZ): $(OBJ_SV) $(OBJ_ICON_NEXUIZ)
546         $(CHECKLEVEL2)
547         $(DO_LD)
548
549 $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ)
550         $(CHECKLEVEL2)
551         $(DO_LD)
552
553 clean:
554         -$(CMD_RM) $(EXE_CL)
555         -$(CMD_RM) $(EXE_SV)
556         -$(CMD_RM) $(EXE_SDL)
557         -$(CMD_RM) $(EXE_CLNEXUIZ)
558         -$(CMD_RM) $(EXE_SVNEXUIZ)
559         -$(CMD_RM) $(EXE_SDLNEXUIZ)
560         -$(CMD_RM) *.o
561         -$(CMD_RM) *.d
562
563 clean-profile: clean
564         -$(CMD_RM) *.gcda
565         -$(CMD_RM) *.gcno
566