1 # Choose the compiler you want to use
5 #CPUOPTIMIZATIONS=-march=athlon
6 # athlon xp optimizations
7 #CPUOPTIMIZATIONS=-march=athlon-xp
8 # Pentium 3 optimizations
9 #CPUOPTIMIZATIONS=-march=pentium3
10 # Pentium 4 optimizations
11 #CPUOPTIMIZATIONS=-march=pentium4
12 # 686 (Pentium Pro/II) optimizations
13 #CPUOPTIMIZATIONS=-march=i686
14 # No specific CPU (386 compatible)
18 ###### Sound and audio CD #####
20 OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
23 OBJ_SND_NULL=snd_null.o
26 # Open Sound System (Linux, FreeBSD and Solaris)
27 OBJ_SND_OSS=$(OBJ_SND_COMMON) snd_oss.o
30 # Advanced Linux Sound Architecture (Linux)
31 OBJ_SND_ALSA=$(OBJ_SND_COMMON) snd_alsa.o
34 # Core Audio (Mac OS X)
35 OBJ_SND_COREAUDIO=$(OBJ_SND_COMMON) snd_coreaudio.c
38 # BSD / Sun audio API (NetBSD and OpenBSD)
39 OBJ_SND_BSD=$(OBJ_SND_COMMON) snd_bsd.o
42 # DirectX and Win32 WAVE output (Win32)
43 OBJ_SND_WIN=$(OBJ_SND_COMMON) snd_win.o
51 ###### Common objects and flags #####
128 # note that builddate.c is very intentionally not compiled to a .o before
129 # being linked, because it should be recompiled every time an executable is
130 # built to give the executable a proper date string
131 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_SND_NULL) $(OBJ_NOCD) $(OBJ_COMMON)
132 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
136 # CFLAGS_COMMON=-MD -Wall -Werror
137 CFLAGS_COMMON=-MD -Wall
139 CFLAGS_PROFILE=-g -pg -ggdb
142 OPTIM_DEBUG=$(CPUOPTIMIZATIONS)
143 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
145 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
149 LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG)
150 LDFLAGS_PROFILE=-g -pg $(OPTIM_RELEASE)
151 LDFLAGS_RELEASE=$(OPTIM_RELEASE)
154 ##### UNIX specific variables #####
156 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
158 LDFLAGS_UNIXCOMMON=-lm
159 #LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
160 LDFLAGS_UNIXCL=$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
161 LDFLAGS_UNIXSDL=`sdl-config --libs`
162 EXE_UNIXCL=darkplaces-glx
163 EXE_UNIXSV=darkplaces-dedicated
164 EXE_UNIXSDL=darkplaces-sdl
169 ##### Linux specific variables #####
171 # If you want CD sound in Linux
172 OBJ_LINUXCD=cd_linux.o
173 # If you want no CD audio
174 #OBJ_LINUXCD=$(OBJ_NOCD)
177 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
178 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
179 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
182 ##### Mac OS X specific variables #####
184 # If you want CD sound in Mac OS X
185 #OBJ_MACOSXCD=cd_macosx.o
186 # If you want no CD audio
187 OBJ_MACOSXCD=$(OBJ_NOCD)
190 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
191 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
192 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl `sdl-config --static-libs`
194 OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
196 ##### SunOS specific variables #####
198 # No CD support available
199 OBJ_SUNOSCD=$(OBJ_NOCD)
201 CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP
204 LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl $(LDFLAGS_UNIXCL)
205 LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl
206 LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
209 ##### BSD specific variables #####
211 #if you want CD sound in BSD
213 #if you want no CD audio
214 #OBJ_BSDCD=$(OBJ_NOCD)
217 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
218 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
219 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
222 ##### Win32 specific variables #####
224 #if you want CD sound in Win32
226 #if you want no CD audio
227 #OBJ_WINCD=$(OBJ_NOCD)
229 OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_COMMON)
232 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
233 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
234 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole
235 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) `sdl-config --libs`
236 EXE_WINCL=darkplaces.exe
237 EXE_WINSV=darkplaces-dedicated.exe
238 EXE_WINSDL=darkplaces-sdl.exe
243 .PHONY : clean help \
244 debug profile release \
245 cl-debug cl-profile cl-release \
246 sv-debug sv-profile sv-release \
247 sdl-debug sdl-profile sdl-release
251 @echo "===== Choose one ====="
252 @echo "* $(MAKE) clean : delete all files produced by the build"
253 @echo "* $(MAKE) help : this help"
254 @echo "* $(MAKE) debug : make client and server binaries (debug versions)"
255 @echo "* $(MAKE) profile : make client and server binaries (profile versions)"
256 @echo "* $(MAKE) release : make client and server binaries (release versions)"
257 @echo "* $(MAKE) cl-debug : make client (debug version)"
258 @echo "* $(MAKE) cl-profile : make client (profile version)"
259 @echo "* $(MAKE) cl-release : make client (release version)"
260 @echo "* $(MAKE) sv-debug : make dedicated server (debug version)"
261 @echo "* $(MAKE) sv-profile : make dedicated server (profile version)"
262 @echo "* $(MAKE) sv-release : make dedicated server (release version)"
263 @echo "* $(MAKE) sdl-debug : make SDL client (debug version)"
264 @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
265 @echo "* $(MAKE) sdl-release : make SDL client (release version)"
269 $(MAKE) sv-debug cl-debug sdl-debug
272 $(MAKE) sv-profile cl-profile sdl-profile
275 $(MAKE) sv-release cl-release sdl-release
279 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
280 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
283 $(MAKE) bin-profile \
284 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
285 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
288 $(MAKE) bin-release \
289 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
290 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
294 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
295 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
298 $(MAKE) bin-profile \
299 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
300 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
303 $(MAKE) bin-release \
304 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
305 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
309 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
310 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
313 $(MAKE) bin-profile \
314 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
315 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
318 $(MAKE) bin-release \
319 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
320 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
324 @echo "========== $(EXE) (debug) =========="
326 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
327 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
328 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
332 @echo "========== $(EXE) (profile) =========="
334 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
335 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
336 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
340 @echo "========== $(EXE) (release) =========="
342 DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
343 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
344 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
348 $(DO_CC) -I/usr/X11R6/include
351 $(DO_CC) `sdl-config --cflags`
354 $(DO_CC) `sdl-config --cflags`
357 $(DO_CC) `sdl-config --cflags`
360 $(DO_CC) `sdl-config --cflags`
362 darkplaces.o: %.o : %.rc
374 $(EXE_SDL): $(OBJ_SDL)
380 -$(CMD_RM) $(EXE_SDL)