Configure all of the CL_MeshEntities* meshes the same, the material flags decide...
[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 SDL_CONFIG?=sdl2-config
29 SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
30 SDLCONFIG_UNIXCFLAGS_X11?=
31 SDLCONFIG_UNIXLIBS?=`$(SDL_CONFIG) --libs`
32 SDLCONFIG_UNIXLIBS_X11?=-lX11
33 SDLCONFIG_UNIXSTATICLIBS?=`$(SDL_CONFIG) --static-libs`
34 SDLCONFIG_UNIXSTATICLIBS_X11?=-lX11
35 SDLCONFIG_MACOSXCFLAGS=-I/Library/Frameworks/SDL2.framework/Headers -I$(HOME)/Library/Frameworks/SDL2.framework/Headers
36 SDLCONFIG_MACOSXLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL2 -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS)
37 SDLCONFIG_MACOSXSTATICLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL2 -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS)
38 STRIP?=strip
39
40
41 ###### Sound and audio CD #####
42
43 OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
44
45 # No sound
46 OBJ_SND_NULL=snd_null.o
47 LIB_SND_NULL=
48
49 # Open Sound System (Linux, FreeBSD and Solaris)
50 OBJ_SND_OSS=$(OBJ_SND_COMMON) snd_oss.o
51 LIB_SND_OSS=
52
53 # Advanced Linux Sound Architecture (Linux)
54 OBJ_SND_ALSA=$(OBJ_SND_COMMON) snd_alsa.o
55 LIB_SND_ALSA=-lasound
56
57 # Core Audio (Mac OS X)
58 OBJ_SND_COREAUDIO=$(OBJ_SND_COMMON) snd_coreaudio.o
59 LIB_SND_COREAUDIO=-framework CoreAudio
60
61 # BSD / Sun audio API (NetBSD and OpenBSD)
62 OBJ_SND_BSD=$(OBJ_SND_COMMON) snd_bsd.o
63 LIB_SND_BSD=
64
65 # DirectX and Win32 WAVE output (Win32)
66 OBJ_SND_WIN=$(OBJ_SND_COMMON) snd_win.o
67 LIB_SND_WIN=
68
69 # Qantourisc's 3D Realtime Acoustic Lib (3D RAS)
70 OBJ_SND_3DRAS=snd_3dras.o
71 LIB_SND_3DRAS=
72
73 # CD objects
74 OBJ_CD_COMMON=cd_shared.o
75 OBJ_NOCD=cd_null.o
76
77
78 ###### Common objects and flags #####
79
80 # Common objects
81 OBJ_COMMON= \
82         bih.o \
83         crypto.o \
84         cl_collision.o \
85         cl_demo.o \
86         cl_dyntexture.o \
87         cl_input.o \
88         cl_main.o \
89         cl_parse.o \
90         cl_particles.o \
91         cl_screen.o \
92         cl_video.o \
93         clvm_cmds.o \
94         cmd.o \
95         collision.o \
96         common.o \
97         console.o \
98         csprogs.o \
99         curves.o \
100         cvar.o \
101         dpsoftrast.o \
102         dpvsimpledecode.o \
103         filematch.o \
104         fractalnoise.o \
105         fs.o \
106         ft2.o \
107         utf8lib.o \
108         gl_backend.o \
109         gl_draw.o \
110         gl_rmain.o \
111         gl_rsurf.o \
112         gl_textures.o \
113         hmac.o \
114         host.o \
115         host_cmd.o \
116         image.o \
117         image_png.o \
118         jpeg.o \
119         keys.o \
120         lhnet.o \
121         libcurl.o \
122         mathlib.o \
123         matrixlib.o \
124         mdfour.o \
125         meshqueue.o \
126         mod_skeletal_animatevertices_sse.o \
127         mod_skeletal_animatevertices_generic.o \
128         model_alias.o \
129         model_brush.o \
130         model_shared.o \
131         model_sprite.o \
132         netconn.o \
133         palette.o \
134         polygon.o \
135         portals.o \
136         protocol.o \
137         prvm_cmds.o \
138         prvm_edict.o \
139         prvm_exec.o \
140         r_explosion.o \
141         r_lerpanim.o \
142         r_lightning.o \
143         r_modules.o \
144         r_shadow.o \
145         r_sky.o \
146         r_sprites.o \
147         sbar.o \
148         sv_demo.o \
149         sv_main.o \
150         sv_move.o \
151         sv_phys.o \
152         sv_user.o \
153         svbsp.o \
154         svvm_cmds.o \
155         sys_shared.o \
156         vid_shared.o \
157         view.o \
158         wad.o \
159         world.o \
160         zone.o
161
162 OBJ_MENU= \
163         menu.o \
164         mvm_cmds.o
165
166 # note that builddate.c is very intentionally not compiled to a .o before
167 # being linked, because it should be recompiled every time an executable is
168 # built to give the executable a proper date string
169 OBJ_SV= builddate.c sys_linux.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_COMMON)
170 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMMON) snd_sdl.o $(OBJ_SDLCD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
171
172
173 # Compilation
174 CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
175 CFLAGS_CLIENT=-DCONFIG_MENU -DCONFIG_CD $(CFLAGS_VIDEO_CAPTURE)
176 CFLAGS_SERVER=
177 CFLAGS_DEBUG=-ggdb
178 CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
179 CFLAGS_RELEASE=
180 CFLAGS_RELEASE_PROFILE=-fbranch-probabilities
181 CFLAGS_SDL=
182
183 ifeq ($(DP_SSE),1)
184         CFLAGS_SSE=-msse
185         CFLAGS_SSE2=-msse2
186 else
187         CFLAGS_SSE=
188         CFLAGS_SSE2=
189 endif # ifeq ($(DP_SSE),1)
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; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=debug
204 LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=profile
205 LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=release
206
207
208 ##### UNIX specific variables #####
209
210 OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_pthread.o keysym2ucs.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
211
212 LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
213 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND)
214 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
215 LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
216 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
217 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
218
219 LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS)
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 CMD_UNIXCP=cp -f
229 CMD_UNIXMKDIR=mkdir -p
230
231
232 ##### Linux specific variables #####
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 -framework IOKit $(SDLCONFIG_STATICLIBS) ../../../SDLMain.m
249
250 OBJ_AGL= builddate.c sys_linux.o vid_agl.o thread_null.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(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 # Link
272 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
273 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) 
274 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
275
276
277 ##### Win32 specific variables #####
278
279 WINDRES ?= windres
280
281 OBJ_WGL= builddate.c sys_win.o vid_wgl.o thread_null.o $(OBJ_MENU) $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
282
283 # Link
284 # see LDFLAGS_WINCOMMON in makefile
285 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_Z) $(LIB_JPEG)
286 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
287 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
288 EXE_WINCL=darkplaces.exe
289 EXE_WINSV=darkplaces-dedicated.exe
290 EXE_WINSDL=darkplaces-sdl.exe
291 EXE_WINCLNEXUIZ=nexuiz.exe
292 EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
293 EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
294
295 VPATH := ../../../
296
297 ##### Commands #####
298
299 .PHONY : clean clean-profile help \
300          debug profile release \
301          cl-debug cl-profile cl-release \
302          sv-debug sv-profile sv-release \
303          sdl-debug sdl-profile sdl-release
304
305 help:
306         @echo
307         @echo "===== Choose one ====="
308         @echo "* $(MAKE) clean                : delete all files produced by the build except"
309         @echo "                              profiling information"
310         @echo "* $(MAKE) clean-profile        : delete all files produced by the build, including"
311         @echo "                              profiling informaiton"
312         @echo "* $(MAKE) help                 : this help"
313         @echo "* $(MAKE) debug                : make client and server binaries (debug versions)"
314         @echo "* $(MAKE) profile              : make client and server binaries (profile versions)"
315         @echo "* $(MAKE) release              : make client and server binaries (release versions)"
316         @echo "* $(MAKE) release-profile      : make client and server binaries (release versions)"
317         @echo "                              (with profiling optimizations) The profiled"
318         @echo "                              version of the program must have been"
319         @echo "                              previously compiled"
320         @echo "* $(MAKE) nexuiz               : make client and server binaries with nexuiz icon"
321         @echo "                              (release versions)"
322         @echo "* $(MAKE) cl-debug             : make client (debug version)"
323         @echo "* $(MAKE) cl-profile           : make client (profile version)"
324         @echo "* $(MAKE) cl-release-profile   : make client (release profile version)"
325         @echo "* $(MAKE) cl-release           : make client (release version)"
326         @echo "* $(MAKE) cl-nexuiz            : make client with nexuiz icon (release version)"
327         @echo "* $(MAKE) sv-debug             : make dedicated server (debug version)"
328         @echo "* $(MAKE) sv-profile           : make dedicated server (profile version)"
329         @echo "* $(MAKE) sv-release-profile   : make dedicated server (release profile version)"
330         @echo "* $(MAKE) sv-release           : make dedicated server (release version)"
331         @echo "* $(MAKE) sv-nexuiz            : make dedicated server with nexuiz icon"
332         @echo "                              (release version)"
333         @echo "* $(MAKE) sdl-debug            : make SDL client (debug version)"
334         @echo "* $(MAKE) sdl-profile          : make SDL client (profile version)"
335         @echo "* $(MAKE) sdl-release-profile  : make SDL client (release version)"
336         @echo "* $(MAKE) sdl-release          : make SDL client (release version)"
337         @echo "* $(MAKE) sdl-nexuiz           : make SDL client with nexuiz icon (release version)"
338         @echo
339
340 debug :
341         $(MAKE) $(TARGETS_DEBUG)
342
343 profile :
344         $(MAKE) $(TARGETS_PROFILE)
345
346 release :
347         $(MAKE) $(TARGETS_RELEASE)
348
349 release-profile :
350         $(MAKE) $(TARGETS_RELEASE_PROFILE)
351
352 nexuiz :
353         $(MAKE) $(TARGETS_NEXUIZ)
354
355 cl-debug :
356         $(MAKE) bin-debug \
357                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
358                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
359
360 cl-profile :
361         $(MAKE) bin-profile \
362                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
363                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
364
365 cl-release :
366         $(MAKE) bin-release \
367                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
368                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
369
370 cl-release-profile :
371         $(MAKE) bin-release-profile \
372                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
373                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
374
375 cl-nexuiz :
376         $(MAKE) bin-release \
377                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
378                 EXE='$(EXE_CLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
379
380 sv-debug :
381         $(MAKE) bin-debug \
382                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
383                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
384
385 sv-profile :
386         $(MAKE) bin-profile \
387                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
388                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
389
390 sv-release :
391         $(MAKE) bin-release \
392                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
393                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
394
395 sv-release-profile :
396         $(MAKE) bin-release-profile \
397                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
398                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
399
400 sv-nexuiz :
401         $(MAKE) bin-release \
402                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
403                 EXE='$(EXE_SVNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
404
405 sdl-debug :
406         $(MAKE) bin-debug \
407                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
408                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
409
410 sdl-profile :
411         $(MAKE) bin-profile \
412                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
413                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
414
415 sdl-release :
416         $(MAKE) bin-release \
417                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
418                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
419
420 sdl-release-profile :
421         $(MAKE) bin-release-profile \
422                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
423                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
424
425 sdl-nexuiz :
426         $(MAKE) bin-release \
427                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
428                 EXE='$(EXE_SDLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
429
430 bin-debug :
431         $(CHECKLEVEL1)
432         @echo
433         @echo '========== $(EXE) (debug) =========='
434         $(MAKE) prepare BUILD_DIR=build-obj/debug/$(EXE)
435         $(MAKE) -C build-obj/debug/$(EXE) $(EXE) \
436                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
437                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)'\
438                 LDFLAGS='$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)' LEVEL=2
439
440 bin-profile :
441         $(CHECKLEVEL1)
442         @echo
443         @echo '========== $(EXE) (profile) =========='
444         $(MAKE) prepare BUILD_DIR=build-obj/profile/$(EXE)
445         $(MAKE) -C build-obj/profile/$(EXE) $(EXE) \
446                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
447                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)'\
448                 LDFLAGS='$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)' LEVEL=2
449
450 bin-release :
451         $(CHECKLEVEL1)
452         @echo
453         @echo '========== $(EXE) (release) =========='
454         $(MAKE) prepare BUILD_DIR=build-obj/release/$(EXE)
455         $(MAKE) -C build-obj/release/$(EXE) $(EXE) \
456                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
457                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(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) prepare BUILD_DIR=build-obj/release-profile/$(EXE)
466         $(MAKE) -C build-obj/release-profile/$(EXE) $(EXE) \
467                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
468                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)'\
469                 LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
470         $(STRIP) $(EXE)
471
472 prepare :
473         $(CMD_MKDIR) $(BUILD_DIR)
474         $(CMD_CP) makefile.inc $(BUILD_DIR)/
475         $(CMD_CP) $(MAKEFILE) $(BUILD_DIR)/
476
477 #this checks USEODE when compiling so it needs the ODE flags as well
478 prvm_cmds.o: prvm_cmds.c
479         $(CHECKLEVEL2)
480         $(DO_CC) $(CFLAGS_ODE)
481
482 world.o: world.c
483         $(CHECKLEVEL2)
484         $(DO_CC) $(CFLAGS_ODE)
485
486 vid_glx.o: vid_glx.c
487         $(CHECKLEVEL2)
488         $(DO_CC) -I/usr/X11R6/include
489
490 keysym2ucs.o: keysym2ucs.c
491         $(CHECKLEVEL2)
492         $(DO_CC) -I/usr/X11R6/include
493
494 crypto.o: crypto.c
495         $(CHECKLEVEL2)
496         $(DO_CC) $(CFLAGS_CRYPTO) $(CFLAGS_CRYPTO_RIJNDAEL)
497
498 mod_skeletal_animatevertices_sse.o: mod_skeletal_animatevertices_sse.c
499         $(CHECKLEVEL2)
500         $(DO_CC) $(CFLAGS_SSE)
501
502 dpsoftrast.o: dpsoftrast.c
503         $(CHECKLEVEL2)
504         $(DO_CC) $(CFLAGS_SSE2)
505
506 darkplaces.o: %.o : %.rc
507         $(CHECKLEVEL2)
508         $(WINDRES) -o $@ $<
509
510 nexuiz.o: %.o : %.rc
511         $(CHECKLEVEL2)
512         $(WINDRES) -o $@ $<
513
514 .c.o:
515         $(CHECKLEVEL2)
516         $(DO_CC)
517
518 $(EXE_CL): $(OBJ_CL) $(OBJ_ICON)
519         $(CHECKLEVEL2)
520         $(DO_LD)
521
522 $(EXE_SV): $(OBJ_SV) $(OBJ_ICON)
523         $(CHECKLEVEL2)
524         $(DO_LD)
525
526 $(EXE_SDL): $(OBJ_SDL) $(OBJ_ICON)
527         $(CHECKLEVEL2)
528         $(DO_LD)
529
530 $(EXE_CLNEXUIZ): $(OBJ_CL) $(OBJ_ICON_NEXUIZ)
531         $(CHECKLEVEL2)
532         $(DO_LD)
533
534 $(EXE_SVNEXUIZ): $(OBJ_SV) $(OBJ_ICON_NEXUIZ)
535         $(CHECKLEVEL2)
536         $(DO_LD)
537
538 $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ)
539         $(CHECKLEVEL2)
540         $(DO_LD)
541
542 clean:
543         -$(CMD_RM) $(EXE_CL)
544         -$(CMD_RM) $(EXE_SV)
545         -$(CMD_RM) $(EXE_SDL)
546         -$(CMD_RM) $(EXE_CLNEXUIZ)
547         -$(CMD_RM) $(EXE_SVNEXUIZ)
548         -$(CMD_RM) $(EXE_SDLNEXUIZ)
549         -$(CMD_RM) *.o
550         -$(CMD_RM) *.d
551         -$(CMD_RM) build-obj/
552
553 clean-profile: clean
554         -$(CMD_RM) *.gcda
555         -$(CMD_RM) *.gcno