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
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 -funroll-loops $(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_UNIXCL=$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
138 LDFLAGS_UNIXSDL=`sdl-config --libs`
139 EXE_UNIXCL=darkplaces-glx
140 EXE_UNIXSV=darkplaces-dedicated
141 EXE_UNIXSDL=darkplaces-sdl
146 ##### Linux specific variables #####
148 # Recommended for: anyone not using ALSA
149 OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_oss.o
151 # Recommended for: anyone using ALSA
152 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa.o
153 #LIB_LINUXSOUND=-lasound
154 # Recommended for: anyone who can't use the above drivers
155 #OBJ_LINUXSOUND=$(OBJ_NOSOUND)
158 # If you want CD sound in Linux
159 OBJ_LINUXCD=cd_linux.o
160 # If you want no CD audio
161 #OBJ_LINUXCD=$(OBJ_NOCD)
164 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
165 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
166 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
169 ##### BSD specific variables #####
171 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
172 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
175 #if you want CD sound in BSD
177 #if you want no CD audio
178 #OBJ_BSDCD=$(OBJ_NOCD)
181 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
182 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
183 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
186 ##### Win32 specific variables #####
188 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
189 #OBJ_WINSOUND=$(OBJ_NOSOUND)
192 #if you want CD sound in Win32
194 #if you want no CD audio
195 #OBJ_WINCD=$(OBJ_NOCD)
197 OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
200 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
201 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
202 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole -lwinmm -lwsock32
203 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
204 EXE_WINCL=darkplaces.exe
205 EXE_WINSV=darkplaces-dedicated.exe
206 EXE_WINSDL=darkplaces-sdl.exe
211 .PHONY : clean help \
212 debug profile release \
213 cl-debug cl-profile cl-release \
214 sv-debug sv-profile sv-release \
215 sdl-debug sdl-profile sdl-release
219 @echo "===== Choose one ====="
220 @echo "* $(MAKE) clean : delete all files produced by the build"
221 @echo "* $(MAKE) help : this help"
222 @echo "* $(MAKE) debug : make client and server binaries (debug versions)"
223 @echo "* $(MAKE) profile : make client and server binaries (profile versions)"
224 @echo "* $(MAKE) release : make client and server binaries (release versions)"
225 @echo "* $(MAKE) cl-debug : make client (debug version)"
226 @echo "* $(MAKE) cl-profile : make client (profile version)"
227 @echo "* $(MAKE) cl-release : make client (release version)"
228 @echo "* $(MAKE) sv-debug : make dedicated server (debug version)"
229 @echo "* $(MAKE) sv-profile : make dedicated server (profile version)"
230 @echo "* $(MAKE) sv-release : make dedicated server (release version)"
231 @echo "* $(MAKE) sdl-debug : make SDL client (debug version)"
232 @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
233 @echo "* $(MAKE) sdl-release : make SDL client (release version)"
237 $(MAKE) cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
240 $(MAKE) cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
243 $(MAKE) cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
246 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
247 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
250 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
251 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
254 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
255 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
258 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
259 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
262 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
263 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
266 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
267 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
270 $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
271 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
274 $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
275 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
278 $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
279 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
283 @echo "========== $(EXE) (debug) =========="
284 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
285 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
286 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
290 @echo "========== $(EXE) (profile) =========="
291 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
292 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
293 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
297 @echo "========== $(EXE) (release) =========="
298 $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
299 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
300 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
304 $(DO_CC) -I/usr/X11R6/include
307 $(DO_CC) `sdl-config --cflags`
310 $(DO_CC) `sdl-config --cflags`
312 darkplaces.o: %.o : %.rc
324 $(EXE_SDL): $(OBJ_SDL)
330 -$(CMD_RM) $(EXE_SDL)