]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - makefile.inc
Modified the sound code so it can handle sounds outside of a "sound" subdirectory.
[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_NOCD=cd_null.o
26
27 # Common objects
28 OBJ_COMMON= \
29         cd_shared.o \
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         winding.o \
101         world.o \
102         zone.o
103
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)
109
110
111 # Compilation
112 # CFLAGS_COMMON=-MD -Wall -Werror
113 CFLAGS_COMMON=-MD -Wall
114 CFLAGS_DEBUG=-ggdb
115 CFLAGS_PROFILE=-g -pg -ggdb
116 CFLAGS_RELEASE=
117
118 OPTIM_DEBUG=
119 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
120
121 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
122
123
124 # Link
125 LDFLAGS_DEBUG=-g -ggdb
126 LDFLAGS_PROFILE=-g -pg
127 LDFLAGS_RELEASE=
128
129
130 ##### UNIX specific variables #####
131
132 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
133
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
140
141 CMD_UNIXRM=rm -rf
142
143
144 ##### Linux specific variables #####
145
146 # Recommended for: anyone not using ALSA
147 OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_oss.o
148 LIB_LINUXSOUND=
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)
154 #LIB_LINUXSOUND=
155
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)
160
161 # Link
162 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
163 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -ldl
164 LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
165
166
167 ##### BSD specific variables #####
168
169 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
170 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
171 LIB_BSDSOUND=
172
173 #if you want CD sound in BSD
174 OBJ_BSDCD=cd_bsd.o
175 #if you want no CD audio
176 #OBJ_BSDCD=$(OBJ_NOCD)
177
178 # Link
179 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
180 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
181 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
182
183
184 ##### Win32 specific variables #####
185
186 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
187 #OBJ_WINSOUND=$(OBJ_NOSOUND)
188 LIB_WINSOUND=
189
190 #if you want CD sound in Win32
191 OBJ_WINCD=cd_win.o
192 #if you want no CD audio
193 #OBJ_WINCD=$(OBJ_NOCD)
194
195 OBJ_WGL= builddate.c sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
196
197 # Link
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
205
206
207 ##### Commands #####
208
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
214
215 help:
216         @echo
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)"
232         @echo
233
234 debug :
235         $(MAKE) cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
236
237 profile :
238         $(MAKE) cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
239
240 release :
241         $(MAKE) cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
242
243 cl-debug :
244         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
245                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
246
247 cl-profile :
248         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
249                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
250
251 cl-release :
252         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
253                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
254
255 sv-debug :
256         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
257                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
258
259 sv-profile :
260         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
261                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
262
263 sv-release :
264         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
265                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
266
267 sdl-debug :
268         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
269                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
270
271 sdl-profile :
272         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
273                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
274
275 sdl-release :
276         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
277                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
278
279 bin-debug :
280         @echo
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)"
285
286 bin-profile :
287         @echo
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)"
292
293 bin-release :
294         @echo
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)"
299         strip $(EXE)
300
301 vid_glx.o: vid_glx.c
302         $(DO_CC) -I/usr/X11R6/include
303
304 vid_sdl.o: vid_sdl.c
305         $(DO_CC) `sdl-config --cflags`
306
307 sys_sdl.o: sys_sdl.c
308         $(DO_CC) `sdl-config --cflags`
309
310 .c.o:
311         $(DO_CC)
312
313 $(EXE_CL): $(OBJ_CL)
314         $(DO_LD)
315
316 $(EXE_SV): $(OBJ_SV)
317         $(DO_LD)
318
319 $(EXE_SDL): $(OBJ_SDL)
320         $(DO_LD)
321
322 clean:
323         -$(CMD_RM) $(EXE_CL)
324         -$(CMD_RM) $(EXE_SV)
325         -$(CMD_RM) $(EXE_SDL)
326         -$(CMD_RM) *.o
327         -$(CMD_RM) *.d