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=ogg.o snd_dma.o snd_mem.o snd_mix.o
22 OBJ_NOSOUND=snd_null.o
25 OBJ_COMMONCD=cd_shared.o
105 # note that builddate.c is very intentionally not compiled to a .o before
106 # being linked, because it should be recompiled every time an executable is
107 # built to give the executable a proper date string
108 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
109 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
113 # CFLAGS_COMMON=-MD -Wall -Werror
114 CFLAGS_COMMON=-MD -Wall
116 CFLAGS_PROFILE=-g -pg -ggdb
120 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -fexpensive-optimizations $(CPUOPTIMIZATIONS)
122 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
126 LDFLAGS_DEBUG=-g -ggdb
127 LDFLAGS_PROFILE=-g -pg
131 ##### UNIX specific variables #####
133 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
135 LDFLAGS_UNIXCOMMON=-lm
136 LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
137 LDFLAGS_UNIXSDL=`sdl-config --libs`
138 EXE_UNIXCL=darkplaces-glx
139 EXE_UNIXSV=darkplaces-dedicated
140 EXE_UNIXSDL=darkplaces-sdl
145 ##### Linux specific variables #####
147 # Recommended for: anyone not using ALSA 0.5
148 OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_oss.o
150 # Recommended for: anyone using ALSA 0.5
151 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa_0_5.o
152 #LIB_LINUXSOUND=-lasound
153 # Recommended for: no one (this driver needs to be updated, it doesn't compile anymore)
154 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa_0_9.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=$(OBJ_COMMONCD) 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 ##### BSD specific variables #####
173 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
174 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
177 #if you want CD sound in BSD
178 OBJ_BSDCD=$(OBJ_COMMONCD) cd_bsd.o
179 #if you want no CD audio
180 #OBJ_BSDCD=$(OBJ_NOCD)
183 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
184 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
185 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
188 ##### Win32 specific variables #####
190 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
191 #OBJ_WINSOUND=$(OBJ_NOSOUND)
194 #if you want CD sound in Win32
195 OBJ_WINCD=$(OBJ_COMMONCD) cd_win.o
196 #if you want no CD audio
197 #OBJ_WINCD=$(OBJ_NOCD)
199 OBJ_WGL= builddate.c sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
202 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
203 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
204 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole -lwinmm -lwsock32
205 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
206 EXE_WINCL=darkplaces.exe
207 EXE_WINSV=darkplaces-dedicated.exe
208 EXE_WINSDL=darkplaces-sdl.exe
213 .PHONY : clean help \
214 debug profile release \
215 cl-debug cl-profile cl-release \
216 sv-debug sv-profile sv-release \
217 sdl-debug sdl-profile sdl-release
221 @echo "===== Choose one ====="
222 @echo "* $(MAKE) clean : delete all files produced by the build"
223 @echo "* $(MAKE) help : this help"
224 @echo "* $(MAKE) debug : make client and server binaries (debug versions)"
225 @echo "* $(MAKE) profile : make client and server binaries (profile versions)"
226 @echo "* $(MAKE) release : make client and server binaries (release versions)"
227 @echo "* $(MAKE) cl-debug : make client (debug version)"
228 @echo "* $(MAKE) cl-profile : make client (profile version)"
229 @echo "* $(MAKE) cl-release : make client (release version)"
230 @echo "* $(MAKE) sv-debug : make dedicated server (debug version)"
231 @echo "* $(MAKE) sv-profile : make dedicated server (profile version)"
232 @echo "* $(MAKE) sv-release : make dedicated server (release version)"
233 @echo "* $(MAKE) sdl-debug : make SDL client (debug version)"
234 @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
235 @echo "* $(MAKE) sdl-release : make SDL client (release version)"
239 $(MAKE) cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
242 $(MAKE) cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
245 $(MAKE) cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
248 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
249 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
252 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
253 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
256 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
257 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
260 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
261 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
264 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
265 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
268 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
269 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
272 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
273 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
276 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
277 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
280 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
281 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
285 @echo "========== $(EXE) (debug) =========="
286 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
287 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
288 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
292 @echo "========== $(EXE) (profile) =========="
293 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
294 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
295 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
299 @echo "========== $(EXE) (release) =========="
300 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
301 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
302 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
306 $(DO_CC) -I/usr/X11R6/include
309 $(DO_CC) `sdl-config --cflags`
312 $(DO_CC) `sdl-config --cflags`
323 $(EXE_SDL): $(OBJ_SDL)
329 -$(CMD_RM) $(EXE_SDL)