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
107 # note that builddate.c is very intentionally not compiled to a .o before
108 # being linked, because it should be recompiled every time an executable is
109 # built to give the executable a proper date string
110 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
111 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_COMMONSOUND) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
115 # CFLAGS_COMMON=-MD -Wall -Werror
116 CFLAGS_COMMON=-MD -Wall
118 CFLAGS_PROFILE=-g -pg -ggdb
122 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
124 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
128 LDFLAGS_DEBUG=-g -ggdb
129 LDFLAGS_PROFILE=-g -pg
133 ##### UNIX specific variables #####
135 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
137 LDFLAGS_UNIXCOMMON=-lm
138 #LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
139 LDFLAGS_UNIXCL=$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
140 LDFLAGS_UNIXSDL=`sdl-config --libs`
141 EXE_UNIXCL=darkplaces-glx
142 EXE_UNIXSV=darkplaces-dedicated
143 EXE_UNIXSDL=darkplaces-sdl
148 ##### Linux specific variables #####
150 # Recommended for: anyone not using ALSA
151 OBJ_LINUXSOUND=$(OBJ_OSSSOUND)
152 LIB_LINUXSOUND=$(LIB_OSSSOUND)
153 # Recommended for: anyone using ALSA
154 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa.o
155 #LIB_LINUXSOUND=-lasound
156 # Recommended for: anyone who can't use the above drivers
157 #OBJ_LINUXSOUND=$(OBJ_NOSOUND)
160 # If you want CD sound in Linux
161 OBJ_LINUXCD=cd_linux.o
162 # If you want no CD audio
163 #OBJ_LINUXCD=$(OBJ_NOCD)
166 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
167 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
168 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
171 ##### Mac OS X specific variables #####
173 #OBJ_MACOSXSOUND=$(OBJ_COMMONSOUND) snd_coreaudio.c
174 OBJ_MACOSXSOUND=$(OBJ_NOSOUND)
177 # If you want CD sound in Mac OS X
178 #OBJ_MACOSXCD=cd_macosx.o
179 # If you want no CD audio
180 OBJ_MACOSXCD=$(OBJ_NOCD)
183 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
184 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
185 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
187 OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
190 ##### BSD specific variables #####
192 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
193 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
196 #if you want CD sound in BSD
198 #if you want no CD audio
199 #OBJ_BSDCD=$(OBJ_NOCD)
202 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
203 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
204 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
207 ##### Win32 specific variables #####
209 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
210 #OBJ_WINSOUND=$(OBJ_NOSOUND)
213 #if you want CD sound in Win32
215 #if you want no CD audio
216 #OBJ_WINCD=$(OBJ_NOCD)
218 OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
221 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
222 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
223 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole
224 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) `sdl-config --libs`
225 EXE_WINCL=darkplaces.exe
226 EXE_WINSV=darkplaces-dedicated.exe
227 EXE_WINSDL=darkplaces-sdl.exe
232 .PHONY : clean help \
233 debug profile release \
234 cl-debug cl-profile cl-release \
235 sv-debug sv-profile sv-release \
236 sdl-debug sdl-profile sdl-release
240 @echo "===== Choose one ====="
241 @echo "* $(MAKE) clean : delete all files produced by the build"
242 @echo "* $(MAKE) help : this help"
243 @echo "* $(MAKE) debug : make client and server binaries (debug versions)"
244 @echo "* $(MAKE) profile : make client and server binaries (profile versions)"
245 @echo "* $(MAKE) release : make client and server binaries (release versions)"
246 @echo "* $(MAKE) cl-debug : make client (debug version)"
247 @echo "* $(MAKE) cl-profile : make client (profile version)"
248 @echo "* $(MAKE) cl-release : make client (release version)"
249 @echo "* $(MAKE) sv-debug : make dedicated server (debug version)"
250 @echo "* $(MAKE) sv-profile : make dedicated server (profile version)"
251 @echo "* $(MAKE) sv-release : make dedicated server (release version)"
252 @echo "* $(MAKE) sdl-debug : make SDL client (debug version)"
253 @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
254 @echo "* $(MAKE) sdl-release : make SDL client (release version)"
258 $(MAKE) sdl-debug cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
261 $(MAKE) sdl-profile cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
264 $(MAKE) sdl-release cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
267 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
268 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
271 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
272 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
275 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
276 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
279 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
280 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
283 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
284 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
287 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
288 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
291 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
292 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
295 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
296 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
299 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
300 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
304 @echo "========== $(EXE) (debug) =========="
305 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
306 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
307 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
311 @echo "========== $(EXE) (profile) =========="
312 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
313 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
314 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
318 @echo "========== $(EXE) (release) =========="
319 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
320 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
321 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
325 $(DO_CC) -I/usr/X11R6/include
328 $(DO_CC) `sdl-config --cflags`
331 $(DO_CC) `sdl-config --cflags`
334 $(DO_CC) `sdl-config --cflags`
337 $(DO_CC) `sdl-config --cflags`
339 darkplaces.o: %.o : %.rc
351 $(EXE_SDL): $(OBJ_SDL)
357 -$(CMD_RM) $(EXE_SDL)