1 ##### Variables that you may want to modify #####
3 # Choose the compiler you want to use
6 # K6/athlon optimizations
7 #CPUOPTIMIZATIONS=-march=k6
8 # Note: don't use -march=athlon, every gcc which has it currently (2.96-3.1)
9 # have optimizer bugs (like entities disappearing randomly - a bug with
10 # compiling BOX_ON_PLANE_SIDE in mathlib.h)
11 #CPUOPTIMIZATIONS=-march=athlon
13 #CPUOPTIMIZATIONS=-march=i686
18 ##### Variables that you shouldn't care about #####
21 OBJ_COMMONSOUND=snd_dma.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
22 OBJ_NOSOUND=snd_null.o
104 # note that builddate.c is very intentionally not compiled to a .o before
105 # being linked, because it should be recompiled every time an executable is
106 # built to give the executable a proper date string
107 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
108 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
112 # CFLAGS_COMMON=-MD -Wall -Werror
113 CFLAGS_COMMON=-MD -Wall
115 CFLAGS_PROFILE=-g -pg -ggdb
119 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
121 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
125 LDFLAGS_DEBUG=-g -ggdb
126 LDFLAGS_PROFILE=-g -pg
130 ##### UNIX specific variables #####
132 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
134 LDFLAGS_UNIXCOMMON=-lm
135 LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
136 LDFLAGS_UNIXSDL=`sdl-config --libs`
137 EXE_UNIXCL=darkplaces-glx
138 EXE_UNIXSV=darkplaces-dedicated
139 EXE_UNIXSDL=darkplaces-sdl
144 ##### Linux specific variables #####
146 # Recommended for: anyone not using ALSA
147 OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_oss.o
149 # Recommended for: anyone using ALSA
150 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa.o
151 #LIB_LINUXSOUND=-lasound
152 # Recommended for: anyone who can't use the above drivers
153 #OBJ_LINUXSOUND=$(OBJ_NOSOUND)
156 # If you want CD sound in Linux
157 OBJ_LINUXCD=cd_linux.o
158 # If you want no CD audio
159 #OBJ_LINUXCD=$(OBJ_NOCD)
162 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
163 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
164 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
167 ##### BSD specific variables #####
169 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
170 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
173 #if you want CD sound in BSD
175 #if you want no CD audio
176 #OBJ_BSDCD=$(OBJ_NOCD)
179 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
180 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
181 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
184 ##### Win32 specific variables #####
186 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
187 #OBJ_WINSOUND=$(OBJ_NOSOUND)
190 #if you want CD sound in Win32
192 #if you want no CD audio
193 #OBJ_WINCD=$(OBJ_NOCD)
195 OBJ_WGL= builddate.c sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
198 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
199 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
200 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole -lwinmm -lwsock32
201 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
202 EXE_WINCL=darkplaces.exe
203 EXE_WINSV=darkplaces-dedicated.exe
204 EXE_WINSDL=darkplaces-sdl.exe
209 .PHONY : clean help \
210 debug profile release \
211 cl-debug cl-profile cl-release \
212 sv-debug sv-profile sv-release \
213 sdl-debug sdl-profile sdl-release
217 @echo "===== Choose one ====="
218 @echo "* $(MAKE) clean : delete all files produced by the build"
219 @echo "* $(MAKE) help : this help"
220 @echo "* $(MAKE) debug : make client and server binaries (debug versions)"
221 @echo "* $(MAKE) profile : make client and server binaries (profile versions)"
222 @echo "* $(MAKE) release : make client and server binaries (release versions)"
223 @echo "* $(MAKE) cl-debug : make client (debug version)"
224 @echo "* $(MAKE) cl-profile : make client (profile version)"
225 @echo "* $(MAKE) cl-release : make client (release version)"
226 @echo "* $(MAKE) sv-debug : make dedicated server (debug version)"
227 @echo "* $(MAKE) sv-profile : make dedicated server (profile version)"
228 @echo "* $(MAKE) sv-release : make dedicated server (release version)"
229 @echo "* $(MAKE) sdl-debug : make SDL client (debug version)"
230 @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
231 @echo "* $(MAKE) sdl-release : make SDL client (release version)"
235 $(MAKE) cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
238 $(MAKE) cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
241 $(MAKE) cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
244 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
245 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
248 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
249 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
252 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
253 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
256 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
257 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
260 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
261 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
264 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
265 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
268 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
269 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
272 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
273 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
276 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
277 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
281 @echo "========== $(EXE) (debug) =========="
282 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
283 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
284 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
288 @echo "========== $(EXE) (profile) =========="
289 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
290 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
291 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
295 @echo "========== $(EXE) (release) =========="
296 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
297 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
298 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
302 $(DO_CC) -I/usr/X11R6/include
305 $(DO_CC) `sdl-config --cflags`
308 $(DO_CC) `sdl-config --cflags`
319 $(EXE_SDL): $(OBJ_SDL)
325 -$(CMD_RM) $(EXE_SDL)