]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - makefile.inc
fixed makefile (it is not possible to comment out lines with \ at the end)
[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 # athlon optimizations
7 #CPUOPTIMIZATIONS=-march=athlon
8 # athlon xp optimizations
9 #CPUOPTIMIZATIONS=-march=athlon-xp
10 # Pentium 3 optimizations
11 #CPUOPTIMIZATIONS=-march=pentium3
12 # Pentium 4 optimizations
13 #CPUOPTIMIZATIONS=-march=pentium4
14 # 686 (Pentium Pro/II) optimizations
15 #CPUOPTIMIZATIONS=-march=i686
16 # No specific CPU (386 compatible)
17 CPUOPTIMIZATIONS=
18
19
20 ##### Variables that you shouldn't care about #####
21
22 # Sound objects
23 OBJ_COMMONSOUND=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o
24 OBJ_NOSOUND=snd_null.o
25 OBJ_OSSSOUND=$(OBJ_COMMONSOUND) snd_oss.o
26 LIB_OSSSOUND=
27
28 # CD objects
29 OBJ_NOCD=cd_null.o
30
31 # Common objects
32 OBJ_COMMON= \
33         cd_shared.o \
34         cgame.o \
35         cgamevm.o \
36         cl_collision.o \
37         cl_demo.o \
38         cl_input.o \
39         cl_main.o \
40         cl_parse.o \
41         cl_particles.o \
42         cl_screen.o \
43         cl_video.o \
44         cmd.o \
45         collision.o \
46         common.o \
47         console.o \
48         curves.o \
49         cvar.o \
50         dpvsimpledecode.o \
51         filematch.o \
52         fractalnoise.o \
53         fs.o \
54         gl_backend.o \
55         gl_draw.o \
56         gl_models.o \
57         gl_rmain.o \
58         gl_rsurf.o \
59         gl_textures.o \
60         host.o \
61         host_cmd.o \
62         image.o \
63         jpeg.o \
64         keys.o \
65         lhnet.o \
66         mathlib.o \
67         matrixlib.o \
68         menu.o \
69         meshqueue.o \
70         model_alias.o \
71         model_brush.o \
72         model_shared.o \
73         model_sprite.o \
74         netconn.o \
75         palette.o \
76         polygon.o \
77         portals.o \
78         protocol.o \
79         mvm_cmds.o \
80         svvm_cmds.o \
81         prvm_cmds.o \
82         prvm_edict.o \
83         prvm_exec.o \
84         r_crosshairs.o \
85         r_explosion.o \
86         r_lerpanim.o \
87         r_light.o \
88         r_lightning.o \
89         r_modules.o \
90         r_shadow.o \
91         r_sky.o \
92         r_sprites.o \
93         sbar.o \
94         sv_main.o \
95         sv_move.o \
96         sv_phys.o \
97         sv_user.o \
98         sys_shared.o \
99         ui.o \
100         vid_shared.o \
101         view.o \
102         wad.o \
103         winding.o \
104         world.o \
105         zone.o
106
107 # note that builddate.c is very intentionally not compiled to a .o before
108 # being linked, because it should be recompiled every time an executable is
109 # built to give the executable a proper date string
110 OBJ_SV= builddate.c sys_linux.o vid_null.o $(OBJ_NOSOUND) $(OBJ_NOCD) $(OBJ_COMMON)
111 OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_COMMONSOUND) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
112
113
114 # Compilation
115 # CFLAGS_COMMON=-MD -Wall -Werror
116 CFLAGS_COMMON=-MD -Wall
117 CFLAGS_DEBUG=-ggdb
118 CFLAGS_PROFILE=-g -pg -ggdb
119 CFLAGS_RELEASE=
120
121 OPTIM_DEBUG=
122 OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS)
123
124 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
125
126
127 # Link
128 LDFLAGS_DEBUG=-g -ggdb
129 LDFLAGS_PROFILE=-g -pg
130 LDFLAGS_RELEASE=
131
132
133 ##### UNIX specific variables #####
134
135 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
136
137 LDFLAGS_UNIXCOMMON=-lm
138 #LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
139 LDFLAGS_UNIXCL=$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
140 LDFLAGS_UNIXSDL=`sdl-config --libs`
141 EXE_UNIXCL=darkplaces-glx
142 EXE_UNIXSV=darkplaces-dedicated
143 EXE_UNIXSDL=darkplaces-sdl
144
145 CMD_UNIXRM=rm -rf
146
147
148 ##### Linux specific variables #####
149
150 # Recommended for: anyone not using ALSA
151 OBJ_LINUXSOUND=$(OBJ_OSSSOUND)
152 LIB_LINUXSOUND=$(LIB_OSSSOUND)
153 # Recommended for: anyone using ALSA
154 #OBJ_LINUXSOUND=$(OBJ_COMMONSOUND) snd_alsa.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=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 ##### Mac OS X specific variables #####
172
173 #OBJ_MACOSXSOUND=$(OBJ_COMMONSOUND) snd_coreaudio.c
174 OBJ_MACOSXSOUND=$(OBJ_NOSOUND)
175 LIB_MACOSXSOUND=
176
177 # If you want CD sound in Mac OS X
178 #OBJ_MACOSXCD=cd_macosx.o
179 # If you want no CD audio
180 OBJ_MACOSXCD=$(OBJ_NOCD)
181
182 # Link
183 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
184 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
185 LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
186
187 OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
188
189
190 ##### BSD specific variables #####
191
192 OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o
193 #OBJ_BSDSOUND=$(OBJ_NOSOUND)
194 LIB_BSDSOUND=
195
196 #if you want CD sound in BSD
197 OBJ_BSDCD=cd_bsd.o
198 #if you want no CD audio
199 #OBJ_BSDCD=$(OBJ_NOCD)
200
201 # Link
202 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
203 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON)
204 LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
205
206
207 ##### Win32 specific variables #####
208
209 OBJ_WINSOUND=$(OBJ_COMMONSOUND) snd_win.o
210 #OBJ_WINSOUND=$(OBJ_NOSOUND)
211 LIB_WINSOUND=
212
213 #if you want CD sound in Win32
214 OBJ_WINCD=cd_win.o
215 #if you want no CD audio
216 #OBJ_WINCD=$(OBJ_NOCD)
217
218 OBJ_WGL= builddate.c darkplaces.o sys_win.o vid_wgl.o conproc.o $(OBJ_WINSOUND) $(OBJ_WINCD) $(OBJ_COMMON)
219
220 # Link
221 LDFLAGS_WINCOMMON=-lwinmm -lwsock32
222 LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
223 LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole
224 LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) `sdl-config --libs`
225 EXE_WINCL=darkplaces.exe
226 EXE_WINSV=darkplaces-dedicated.exe
227 EXE_WINSDL=darkplaces-sdl.exe
228
229
230 ##### Commands #####
231
232 .PHONY : clean help \
233          debug profile release \
234          cl-debug cl-profile cl-release \
235          sv-debug sv-profile sv-release \
236          sdl-debug sdl-profile sdl-release
237
238 help:
239         @echo
240         @echo "===== Choose one ====="
241         @echo "* $(MAKE) clean       : delete all files produced by the build"
242         @echo "* $(MAKE) help        : this help"
243         @echo "* $(MAKE) debug       : make client and server binaries (debug versions)"
244         @echo "* $(MAKE) profile     : make client and server binaries (profile versions)"
245         @echo "* $(MAKE) release     : make client and server binaries (release versions)"
246         @echo "* $(MAKE) cl-debug    : make client (debug version)"
247         @echo "* $(MAKE) cl-profile  : make client (profile version)"
248         @echo "* $(MAKE) cl-release  : make client (release version)"
249         @echo "* $(MAKE) sv-debug    : make dedicated server (debug version)"
250         @echo "* $(MAKE) sv-profile  : make dedicated server (profile version)"
251         @echo "* $(MAKE) sv-release  : make dedicated server (release version)"
252         @echo "* $(MAKE) sdl-debug   : make SDL client (debug version)"
253         @echo "* $(MAKE) sdl-profile : make SDL client (profile version)"
254         @echo "* $(MAKE) sdl-release : make SDL client (release version)"
255         @echo
256
257 debug :
258         $(MAKE) sdl-debug cl-debug sv-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET)
259
260 profile :
261         $(MAKE) sdl-profile cl-profile sv-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET)
262
263 release :
264         $(MAKE) sdl-release cl-release sv-release DP_MAKE_TARGET=$(DP_MAKE_TARGET)
265
266 cl-debug :
267         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
268                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
269
270 cl-profile :
271         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
272                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
273
274 cl-release :
275         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
276                 EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)"
277
278 sv-debug :
279         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
280                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
281
282 sv-profile :
283         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
284                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
285
286 sv-release :
287         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
288                 EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)"
289
290 sdl-debug :
291         $(MAKE) bin-debug DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
292                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
293
294 sdl-profile :
295         $(MAKE) bin-profile DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
296                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
297
298 sdl-release :
299         $(MAKE) bin-release DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
300                 EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)"
301
302 bin-debug :
303         @echo
304         @echo "========== $(EXE) (debug) =========="
305         $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
306                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
307                 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
308
309 bin-profile :
310         @echo
311         @echo "========== $(EXE) (profile) =========="
312         $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
313                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
314                 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
315
316 bin-release :
317         @echo
318         @echo "========== $(EXE) (release) =========="
319         $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \
320                 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
321                 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
322         strip $(EXE)
323
324 vid_glx.o: vid_glx.c
325         $(DO_CC) -I/usr/X11R6/include
326
327 vid_sdl.o: vid_sdl.c
328         $(DO_CC) `sdl-config --cflags`
329
330 sys_sdl.o: sys_sdl.c
331         $(DO_CC) `sdl-config --cflags`
332
333 snd_sdl.o: snd_sdl.c
334         $(DO_CC) `sdl-config --cflags`
335
336 cd_sdl.o: cd_sdl.c
337         $(DO_CC) `sdl-config --cflags`
338
339 darkplaces.o: %.o : %.rc
340         windres -o $@ $<
341
342 .c.o:
343         $(DO_CC)
344
345 $(EXE_CL): $(OBJ_CL)
346         $(DO_LD)
347
348 $(EXE_SV): $(OBJ_SV)
349         $(DO_LD)
350
351 $(EXE_SDL): $(OBJ_SDL)
352         $(DO_LD)
353
354 clean:
355         -$(CMD_RM) $(EXE_CL)
356         -$(CMD_RM) $(EXE_SV)
357         -$(CMD_RM) $(EXE_SDL)
358         -$(CMD_RM) *.o
359         -$(CMD_RM) *.d