Fix a missing newline in system vars mismatch warning.
[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_input.o \
87         cl_main.o \
88         cl_parse.o \
89         cl_particles.o \
90         cl_screen.o \
91         cl_video.o \
92         clvm_cmds.o \
93         cmd.o \
94         collision.o \
95         common.o \
96         console.o \
97         csprogs.o \
98         curves.o \
99         cvar.o \
100         dpvsimpledecode.o \
101         filematch.o \
102         fractalnoise.o \
103         fs.o \
104         ft2.o \
105         utf8lib.o \
106         gl_backend.o \
107         gl_draw.o \
108         gl_rmain.o \
109         gl_rsurf.o \
110         gl_textures.o \
111         hmac.o \
112         host.o \
113         host_cmd.o \
114         image.o \
115         image_png.o \
116         jpeg.o \
117         keys.o \
118         lhnet.o \
119         libcurl.o \
120         mathlib.o \
121         matrixlib.o \
122         mdfour.o \
123         meshqueue.o \
124         mod_skeletal_animatevertices_sse.o \
125         mod_skeletal_animatevertices_generic.o \
126         model_alias.o \
127         model_brush.o \
128         model_shared.o \
129         model_sprite.o \
130         netconn.o \
131         palette.o \
132         polygon.o \
133         portals.o \
134         protocol.o \
135         prvm_cmds.o \
136         prvm_edict.o \
137         prvm_exec.o \
138         r_explosion.o \
139         r_lerpanim.o \
140         r_lightning.o \
141         r_modules.o \
142         r_shadow.o \
143         r_sky.o \
144         r_sprites.o \
145         sbar.o \
146         sv_demo.o \
147         sv_main.o \
148         sv_move.o \
149         sv_phys.o \
150         sv_user.o \
151         svbsp.o \
152         svvm_cmds.o \
153         sys_shared.o \
154         vid_shared.o \
155         view.o \
156         wad.o \
157         world.o \
158         zone.o
159
160 OBJ_MENU= \
161         menu.o \
162         mvm_cmds.o
163
164 # note that builddate.c is very intentionally not compiled to a .o before
165 # being linked, because it should be recompiled every time an executable is
166 # built to give the executable a proper date string
167 OBJ_SV= builddate.c sys_linux.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_COMMON)
168 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)
169
170
171 # Compilation
172 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../../../
173 CFLAGS_CLIENT=-DCONFIG_MENU -DCONFIG_CD $(CFLAGS_VIDEO_CAPTURE)
174 CFLAGS_SERVER=
175 CFLAGS_DEBUG=-ggdb
176 CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
177 CFLAGS_RELEASE=
178 CFLAGS_RELEASE_PROFILE=-fbranch-probabilities
179 CFLAGS_SDL=
180
181 ifeq ($(DP_SSE),1)
182         CFLAGS_SSE=-msse
183         CFLAGS_SSE2=-msse2
184 else
185         CFLAGS_SSE=
186         CFLAGS_SSE2=
187 endif # ifeq ($(DP_SSE),1)
188
189 OPTIM_DEBUG=$(CPUOPTIMIZATIONS)
190 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
191 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS)
192 #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS)
193 #OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
194 OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS)
195 # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag
196
197 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
198
199
200 # Link
201 LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=debug
202 LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=profile
203 LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=release
204
205
206 ##### UNIX specific variables #####
207
208 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)
209
210 LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
211 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND)
212 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
213 LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
214 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
215 CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD
216
217 LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS)
218 EXE_UNIXCL=darkplaces-glx
219 EXE_UNIXSV=darkplaces-dedicated
220 EXE_UNIXSDL=darkplaces-sdl
221 EXE_UNIXCLNEXUIZ=nexuiz-glx
222 EXE_UNIXSVNEXUIZ=nexuiz-dedicated
223 EXE_UNIXSDLNEXUIZ=nexuiz-sdl
224
225 CMD_UNIXRM=rm -rf
226 CMD_UNIXCP=cp -f
227 CMD_UNIXMKDIR=mkdir -p
228
229
230 ##### Linux specific variables #####
231
232 # Link
233 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXCL)
234 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl
235 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXSDL)
236
237
238 ##### Mac OS X specific variables #####
239
240 # No CD support available
241 OBJ_MACOSXCD=$(OBJ_NOCD)
242
243 # Link
244 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit -framework Carbon $(LIB_SOUND)
245 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
246 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit $(SDLCONFIG_STATICLIBS) ../../../SDLMain.m
247
248 OBJ_AGL= builddate.c sys_linux.o vid_agl.o thread_null.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
249
250 EXE_MACOSXCL=darkplaces-agl
251 EXE_MACOSXCLNEXUIZ=nexuiz-agl
252
253
254 ##### SunOS specific variables #####
255
256 # No CD support available
257 OBJ_SUNOSCD=$(OBJ_NOCD)
258
259 CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP -DSUNOS
260
261 # Link
262 LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl -R$(UNIX_X11LIBPATH) -L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm $(LIB_SOUND)
263 LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl
264 LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
265
266
267 ##### BSD specific variables #####
268
269 # Link
270 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
271 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) 
272 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
273
274
275 ##### Win32 specific variables #####
276
277 WINDRES ?= windres
278
279 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)
280
281 # Link
282 # see LDFLAGS_WINCOMMON in makefile
283 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_Z) $(LIB_JPEG)
284 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
285 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG)
286 EXE_WINCL=darkplaces.exe
287 EXE_WINSV=darkplaces-dedicated.exe
288 EXE_WINSDL=darkplaces-sdl.exe
289 EXE_WINCLNEXUIZ=nexuiz.exe
290 EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
291 EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
292
293 VPATH := ../../../
294
295 ##### Commands #####
296
297 .PHONY : clean clean-profile help \
298          debug profile release \
299          cl-debug cl-profile cl-release \
300          sv-debug sv-profile sv-release \
301          sdl-debug sdl-profile sdl-release
302
303 help:
304         @echo
305         @echo "===== Choose one ====="
306         @echo "* $(MAKE) clean                : delete all files produced by the build except"
307         @echo "                              profiling information"
308         @echo "* $(MAKE) clean-profile        : delete all files produced by the build, including"
309         @echo "                              profiling informaiton"
310         @echo "* $(MAKE) help                 : this help"
311         @echo "* $(MAKE) debug                : make client and server binaries (debug versions)"
312         @echo "* $(MAKE) profile              : make client and server binaries (profile versions)"
313         @echo "* $(MAKE) release              : make client and server binaries (release versions)"
314         @echo "* $(MAKE) release-profile      : make client and server binaries (release versions)"
315         @echo "                              (with profiling optimizations) The profiled"
316         @echo "                              version of the program must have been"
317         @echo "                              previously compiled"
318         @echo "* $(MAKE) nexuiz               : make client and server binaries with nexuiz icon"
319         @echo "                              (release versions)"
320         @echo "* $(MAKE) cl-debug             : make client (debug version)"
321         @echo "* $(MAKE) cl-profile           : make client (profile version)"
322         @echo "* $(MAKE) cl-release-profile   : make client (release profile version)"
323         @echo "* $(MAKE) cl-release           : make client (release version)"
324         @echo "* $(MAKE) cl-nexuiz            : make client with nexuiz icon (release version)"
325         @echo "* $(MAKE) sv-debug             : make dedicated server (debug version)"
326         @echo "* $(MAKE) sv-profile           : make dedicated server (profile version)"
327         @echo "* $(MAKE) sv-release-profile   : make dedicated server (release profile version)"
328         @echo "* $(MAKE) sv-release           : make dedicated server (release version)"
329         @echo "* $(MAKE) sv-nexuiz            : make dedicated server with nexuiz icon"
330         @echo "                              (release version)"
331         @echo "* $(MAKE) sdl-debug            : make SDL client (debug version)"
332         @echo "* $(MAKE) sdl-profile          : make SDL client (profile version)"
333         @echo "* $(MAKE) sdl-release-profile  : make SDL client (release version)"
334         @echo "* $(MAKE) sdl-release          : make SDL client (release version)"
335         @echo "* $(MAKE) sdl-nexuiz           : make SDL client with nexuiz icon (release version)"
336         @echo
337
338 debug :
339         $(MAKE) $(TARGETS_DEBUG)
340
341 profile :
342         $(MAKE) $(TARGETS_PROFILE)
343
344 release :
345         $(MAKE) $(TARGETS_RELEASE)
346
347 release-profile :
348         $(MAKE) $(TARGETS_RELEASE_PROFILE)
349
350 nexuiz :
351         $(MAKE) $(TARGETS_NEXUIZ)
352
353 cl-debug :
354         $(MAKE) bin-debug \
355                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
356                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
357
358 cl-profile :
359         $(MAKE) bin-profile \
360                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
361                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
362
363 cl-release :
364         $(MAKE) bin-release \
365                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
366                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
367
368 cl-release-profile :
369         $(MAKE) bin-release-profile \
370                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
371                 EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
372
373 cl-nexuiz :
374         $(MAKE) bin-release \
375                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
376                 EXE='$(EXE_CLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
377
378 sv-debug :
379         $(MAKE) bin-debug \
380                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
381                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
382
383 sv-profile :
384         $(MAKE) bin-profile \
385                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
386                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
387
388 sv-release :
389         $(MAKE) bin-release \
390                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
391                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
392
393 sv-release-profile :
394         $(MAKE) bin-release-profile \
395                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
396                 EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
397
398 sv-nexuiz :
399         $(MAKE) bin-release \
400                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
401                 EXE='$(EXE_SVNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
402
403 sdl-debug :
404         $(MAKE) bin-debug \
405                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
406                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
407
408 sdl-profile :
409         $(MAKE) bin-profile \
410                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
411                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
412
413 sdl-release :
414         $(MAKE) bin-release \
415                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
416                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
417
418 sdl-release-profile :
419         $(MAKE) bin-release-profile \
420                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
421                 EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
422
423 sdl-nexuiz :
424         $(MAKE) bin-release \
425                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
426                 EXE='$(EXE_SDLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' CFLAGS_SDL='$(SDLCONFIG_CFLAGS)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
427
428 bin-debug :
429         $(CHECKLEVEL1)
430         @echo
431         @echo '========== $(EXE) (debug) =========='
432         $(MAKE) prepare BUILD_DIR=build-obj/debug/$(EXE)
433         $(MAKE) -C build-obj/debug/$(EXE) $(EXE) \
434                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
435                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)'\
436                 LDFLAGS='$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)' LEVEL=2
437
438 bin-profile :
439         $(CHECKLEVEL1)
440         @echo
441         @echo '========== $(EXE) (profile) =========='
442         $(MAKE) prepare BUILD_DIR=build-obj/profile/$(EXE)
443         $(MAKE) -C build-obj/profile/$(EXE) $(EXE) \
444                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
445                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)'\
446                 LDFLAGS='$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)' LEVEL=2
447
448 bin-release :
449         $(CHECKLEVEL1)
450         @echo
451         @echo '========== $(EXE) (release) =========='
452         $(MAKE) prepare BUILD_DIR=build-obj/release/$(EXE)
453         $(MAKE) -C build-obj/release/$(EXE) $(EXE) \
454                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
455                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)'\
456                 LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
457         $(STRIP) $(EXE)
458
459 bin-release-profile :
460         $(CHECKLEVEL1)
461         @echo
462         @echo '========== $(EXE) (release) =========='
463         $(MAKE) prepare BUILD_DIR=build-obj/release-profile/$(EXE)
464         $(MAKE) -C build-obj/release-profile/$(EXE) $(EXE) \
465                 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
466                 CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)'\
467                 LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
468         $(STRIP) $(EXE)
469
470 prepare :
471         $(CMD_MKDIR) $(BUILD_DIR)
472         $(CMD_CP) makefile.inc $(BUILD_DIR)/
473         $(CMD_CP) $(MAKEFILE) $(BUILD_DIR)/
474
475 #this checks USEODE when compiling so it needs the ODE flags as well
476 prvm_cmds.o: prvm_cmds.c
477         $(CHECKLEVEL2)
478         $(DO_CC) $(CFLAGS_ODE)
479
480 world.o: world.c
481         $(CHECKLEVEL2)
482         $(DO_CC) $(CFLAGS_ODE)
483
484 vid_glx.o: vid_glx.c
485         $(CHECKLEVEL2)
486         $(DO_CC) -I/usr/X11R6/include
487
488 keysym2ucs.o: keysym2ucs.c
489         $(CHECKLEVEL2)
490         $(DO_CC) -I/usr/X11R6/include
491
492 crypto.o: crypto.c
493         $(CHECKLEVEL2)
494         $(DO_CC) $(CFLAGS_CRYPTO) $(CFLAGS_CRYPTO_RIJNDAEL)
495
496 mod_skeletal_animatevertices_sse.o: mod_skeletal_animatevertices_sse.c
497         $(CHECKLEVEL2)
498         $(DO_CC) $(CFLAGS_SSE)
499
500 darkplaces.o: %.o : %.rc
501         $(CHECKLEVEL2)
502         $(WINDRES) -o $@ $<
503
504 nexuiz.o: %.o : %.rc
505         $(CHECKLEVEL2)
506         $(WINDRES) -o $@ $<
507
508 .c.o:
509         $(CHECKLEVEL2)
510         $(DO_CC)
511
512 $(EXE_CL): $(OBJ_CL) $(OBJ_ICON)
513         $(CHECKLEVEL2)
514         $(DO_LD)
515
516 $(EXE_SV): $(OBJ_SV) $(OBJ_ICON)
517         $(CHECKLEVEL2)
518         $(DO_LD)
519
520 $(EXE_SDL): $(OBJ_SDL) $(OBJ_ICON)
521         $(CHECKLEVEL2)
522         $(DO_LD)
523
524 $(EXE_CLNEXUIZ): $(OBJ_CL) $(OBJ_ICON_NEXUIZ)
525         $(CHECKLEVEL2)
526         $(DO_LD)
527
528 $(EXE_SVNEXUIZ): $(OBJ_SV) $(OBJ_ICON_NEXUIZ)
529         $(CHECKLEVEL2)
530         $(DO_LD)
531
532 $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ)
533         $(CHECKLEVEL2)
534         $(DO_LD)
535
536 clean:
537         -$(CMD_RM) $(EXE_CL)
538         -$(CMD_RM) $(EXE_SV)
539         -$(CMD_RM) $(EXE_SDL)
540         -$(CMD_RM) $(EXE_CLNEXUIZ)
541         -$(CMD_RM) $(EXE_SVNEXUIZ)
542         -$(CMD_RM) $(EXE_SDLNEXUIZ)
543         -$(CMD_RM) *.o
544         -$(CMD_RM) *.d
545         -$(CMD_RM) build-obj/
546
547 clean-profile: clean
548         -$(CMD_RM) *.gcda
549         -$(CMD_RM) *.gcno