1 ##### Variables that you may want to modify #####
3 # Choose the compiler you want to use
7 #CPUOPTIMIZATIONS=-march=athlon
8 # athlon xp optimizations
9 #CPUOPTIMIZATIONS=-march=athlon-xp
10 # Pentium 3 optimizations
11 #CPUOPTIMIZATIONS=-march=pentium3
12 # Pentium 4 optimizations
13 #CPUOPTIMIZATIONS=-march=pentium4
14 # 686 (Pentium Pro/II) optimizations
15 #CPUOPTIMIZATIONS=-march=i686
16 # No specific CPU (386 compatible)
20 ##### Variables that you shouldn't care about #####
23 OBJ_COMMONSOUND=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
24 OBJ_NOSOUND=snd_null.o
25 OBJ_OSSSOUND=$(OBJ_COMMONSOUND) snd_oss.o
110 # note that builddate.c is very intentionally not compiled to a .o before
111 # being linked, because it should be recompiled every time an executable is
112 # built to give the executable a proper date string
113 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
114 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_COMMONSOUND) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
118 # CFLAGS_COMMON=-MD -Wall -Werror
119 CFLAGS_COMMON=-MD -Wall
121 CFLAGS_PROFILE=-g -pg -ggdb
125 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
127 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
131 LDFLAGS_DEBUG=-g -ggdb
132 LDFLAGS_PROFILE=-g -pg
136 ##### UNIX specific variables #####
138 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
140 LDFLAGS_UNIXCOMMON=-lm
141 #LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
142 LDFLAGS_UNIXCL=$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
143 LDFLAGS_UNIXSDL=`sdl-config --libs`
144 EXE_UNIXCL=darkplaces-glx
145 EXE_UNIXSV=darkplaces-dedicated
146 EXE_UNIXSDL=darkplaces-sdl
151 ##### Linux specific variables #####
153 # Recommended for: anyone not using ALSA
154 OBJ_LINUXSOUND=$(OBJ_OSSSOUND)
155 LIB_LINUXSOUND=$(LIB_OSSSOUND)
156 # Recommended for: anyone using ALSA
157 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa.o
158 #LIB_LINUXSOUND=-lasound
159 # Recommended for: anyone who can't use the above drivers
160 #OBJ_LINUXSOUND=$(OBJ_NOSOUND)
163 # If you want CD sound in Linux
164 OBJ_LINUXCD=cd_linux.o
165 # If you want no CD audio
166 #OBJ_LINUXCD=$(OBJ_NOCD)
169 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
170 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
171 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
174 ##### Mac OS X specific variables #####
176 #OBJ_MACOSXSOUND=$(OBJ_COMMONSOUND) snd_coreaudio.c
177 OBJ_MACOSXSOUND=$(OBJ_NOSOUND)
180 # If you want CD sound in Mac OS X
181 #OBJ_MACOSXCD=cd_macosx.o
182 # If you want no CD audio
183 OBJ_MACOSXCD=$(OBJ_NOCD)
186 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
187 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
188 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
190 OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
193 ##### BSD specific variables #####
195 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
196 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
199 #if you want CD sound in BSD
201 #if you want no CD audio
202 #OBJ_BSDCD=$(OBJ_NOCD)
205 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
206 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
207 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
210 ##### Win32 specific variables #####
212 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
213 #OBJ_WINSOUND=$(OBJ_NOSOUND)
216 #if you want CD sound in Win32
218 #if you want no CD audio
219 #OBJ_WINCD=$(OBJ_NOCD)
221 OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
224 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
225 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
226 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole
227 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) `sdl-config --libs`
228 EXE_WINCL=darkplaces.exe
229 EXE_WINSV=darkplaces-dedicated.exe
230 EXE_WINSDL=darkplaces-sdl.exe
235 .PHONY : clean help \
236 debug profile release \
237 cl-debug cl-profile cl-release \
238 sv-debug sv-profile sv-release \
239 sdl-debug sdl-profile sdl-release
243 @echo "===== Choose one ====="
244 @echo "* $(MAKE) clean : delete all files produced by the build"
245 @echo "* $(MAKE) help : this help"
246 @echo "* $(MAKE) debug : make client and server binaries (debug versions)"
247 @echo "* $(MAKE) profile : make client and server binaries (profile versions)"
248 @echo "* $(MAKE) release : make client and server binaries (release versions)"
249 @echo "* $(MAKE) cl-debug : make client (debug version)"
250 @echo "* $(MAKE) cl-profile : make client (profile version)"
251 @echo "* $(MAKE) cl-release : make client (release version)"
252 @echo "* $(MAKE) sv-debug : make dedicated server (debug version)"
253 @echo "* $(MAKE) sv-profile : make dedicated server (profile version)"
254 @echo "* $(MAKE) sv-release : make dedicated server (release version)"
255 @echo "* $(MAKE) sdl-debug : make SDL client (debug version)"
256 @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
257 @echo "* $(MAKE) sdl-release : make SDL client (release version)"
261 $(MAKE) sdl-debug cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
264 $(MAKE) sdl-profile cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
267 $(MAKE) sdl-release cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
270 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
271 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
274 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
275 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
278 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
279 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
282 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
283 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
286 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
287 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
290 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
291 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
294 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
295 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
298 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
299 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
302 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
303 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
307 @echo "========== $(EXE) (debug) =========="
308 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
309 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
310 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
314 @echo "========== $(EXE) (profile) =========="
315 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
316 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
317 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
321 @echo "========== $(EXE) (release) =========="
322 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
323 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
324 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
328 $(DO_CC) -I/usr/X11R6/include
331 $(DO_CC) `sdl-config --cflags`
334 $(DO_CC) `sdl-config --cflags`
337 $(DO_CC) `sdl-config --cflags`
340 $(DO_CC) `sdl-config --cflags`
342 darkplaces.o: %.o : %.rc
354 $(EXE_SDL): $(OBJ_SDL)
360 -$(CMD_RM) $(EXE_SDL)