]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - makefile.inc
Moved the WAV loading code out of "snd_mem.c". Removed a couple of useless definition...
[xonotic/darkplaces.git] / makefile.inc
1 ##### Variables that you may want to modify #####
2
3 # Choose the compiler you want to use
4 CC=gcc
5
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
12 # 686 optimizations
13 #CPUOPTIMIZATIONS=-march=i686
14 # No specific CPU
15 CPUOPTIMIZATIONS=
16
17
18 ##### Variables that you shouldn't care about #####
19
20 # Sound objects
21 OBJ_COMMONSOUND=snd_dma.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
22 OBJ_NOSOUND=snd_null.o
23
24 # CD objects
25 OBJ_COMMONCD=cd_shared.o
26 OBJ_NOCD=cd_null.o
27
28 # Common objects
29 OBJ_COMMON= \
30         cgame.o \
31         cgamevm.o \
32         cl_collision.o \
33         cl_demo.o \
34         cl_input.o \
35         cl_main.o \
36         cl_parse.o \
37         cl_particles.o \
38         cl_screen.o \
39         cl_video.o \
40         cmd.o \
41         collision.o \
42         common.o \
43         console.o \
44         crc.o \
45         curves.o \
46         cvar.o \
47         dpvsimpledecode.o \
48         filematch.o \
49         fractalnoise.o \
50         fs.o \
51         gl_backend.o \
52         gl_draw.o \
53         gl_models.o \
54         gl_rmain.o \
55         gl_rsurf.o \
56         gl_textures.o \
57         host.o \
58         host_cmd.o \
59         image.o \
60         jpeg.o \
61         keys.o \
62         lhnet.o \
63         mathlib.o \
64         matrixlib.o \
65         menu.o \
66         meshqueue.o \
67         model_alias.o \
68         model_brush.o \
69         model_shared.o \
70         model_sprite.o \
71         netconn.o \
72         palette.o \
73         portals.o \
74         pr_cmds.o \
75         pr_edict.o \
76         pr_exec.o \
77         protocol.o \
78         prvm_cmds.o \
79         prvm_edict.o \
80         prvm_exec.o \
81         r_crosshairs.o \
82         r_explosion.o \
83         r_lerpanim.o \
84         r_light.o \
85         r_lightning.o \
86         r_modules.o \
87         r_shadow.o \
88         r_sky.o \
89         r_sprites.o \
90         sbar.o \
91         sv_main.o \
92         sv_move.o \
93         sv_phys.o \
94         sv_user.o \
95         sys_shared.o \
96         ui.o \
97         vid_shared.o \
98         view.o \
99         wad.o \
100         wavefile.o \
101         winding.o \
102         world.o \
103         zone.o
104
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)
110
111
112 # Compilation
113 # CFLAGS_COMMON=-MD -Wall -Werror
114 CFLAGS_COMMON=-MD -Wall
115 CFLAGS_DEBUG=-ggdb
116 CFLAGS_PROFILE=-g -pg -ggdb
117 CFLAGS_RELEASE=
118
119 OPTIM_DEBUG=
120 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
121
122 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
123
124
125 # Link
126 LDFLAGS_DEBUG=-g -ggdb
127 LDFLAGS_PROFILE=-g -pg
128 LDFLAGS_RELEASE=
129
130
131 ##### UNIX specific variables #####
132
133 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
134
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
141
142 CMD_UNIXRM=rm -rf
143
144
145 ##### Linux specific variables #####
146
147 # Recommended for: anyone not using ALSA 0.5
148 OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_oss.o
149 LIB_LINUXSOUND=
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)
158 #LIB_LINUXSOUND=
159
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)
164
165 # Link
166 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
167 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
168 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
169
170
171 ##### BSD specific variables #####
172
173 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
174 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
175 LIB_BSDSOUND=
176
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)
181
182 # Link
183 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
184 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
185 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
186
187
188 ##### Win32 specific variables #####
189
190 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
191 #OBJ_WINSOUND=$(OBJ_NOSOUND)
192 LIB_WINSOUND=
193
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)
198
199 OBJ_WGL= builddate.c sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
200
201 # Link
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
209
210
211 ##### Commands #####
212
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
218
219 help:
220         @echo
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)"
236         @echo
237
238 debug :
239         $(MAKE) cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
240
241 profile :
242         $(MAKE) cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
243
244 release :
245         $(MAKE) cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
246
247 cl-debug :
248         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
249                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
250
251 cl-profile :
252         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
253                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
254
255 cl-release :
256         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
257                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
258
259 sv-debug :
260         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
261                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
262
263 sv-profile :
264         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
265                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
266
267 sv-release :
268         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
269                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
270
271 sdl-debug :
272         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
273                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
274
275 sdl-profile :
276         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
277                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
278
279 sdl-release :
280         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
281                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
282
283 bin-debug :
284         @echo
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)"
289
290 bin-profile :
291         @echo
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)"
296
297 bin-release :
298         @echo
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)"
303         strip $(EXE)
304
305 vid_glx.o: vid_glx.c
306         $(DO_CC) -I/usr/X11R6/include
307
308 vid_sdl.o: vid_sdl.c
309         $(DO_CC) `sdl-config --cflags`
310
311 sys_sdl.o: sys_sdl.c
312         $(DO_CC) `sdl-config --cflags`
313
314 .c.o:
315         $(DO_CC)
316
317 $(EXE_CL): $(OBJ_CL)
318         $(DO_LD)
319
320 $(EXE_SV): $(OBJ_SV)
321         $(DO_LD)
322
323 $(EXE_SDL): $(OBJ_SDL)
324         $(DO_LD)
325
326 clean:
327         -$(CMD_RM) $(EXE_CL)
328         -$(CMD_RM) $(EXE_SV)
329         -$(CMD_RM) $(EXE_SDL)
330         -$(CMD_RM) *.o
331         -$(CMD_RM) *.d