1 ##### Variables that you may want to modify #####
3 #choose the compiler you want to use
6 #recommended for: anyone not using ALSA 0.5
7 OBJ_LINUXSOUND=snd_oss.o snd_dma.o snd_mix.o snd_mem.o
9 #recommended for: anyone using ALSA 0.5
10 #OBJ_LINUXSOUND=snd_alsa_0_5.o snd_dma.o snd_mix.o snd_mem.o
11 #LINUXSOUNDLIB=-lasound
12 #recommended for: no one (this driver needs to be updated, it doesn't compile anymore)
13 #OBJ_LINUXSOUND=snd_alsa_0_9.o snd_dma.o snd_mix.o snd_mem.o
14 #LINUXSOUNDLIB=-lasound
15 #recommended for: anyone who can't use the above drivers
16 #OBJ_LINUXSOUND=snd_null.o
19 #if you want CD sound in Linux
20 OBJ_LINUXCD=cd_linux.o
21 #if you want no CD audio
22 #OBJ_LINUXCD=cd_null.o
24 #K6/athlon optimizations
25 #CPUOPTIMIZATIONS=-march=k6
26 #note: don't use -march=athlon, every gcc which has it currently (2.96-3.1)
27 #have optimizer bugs (like entities disappearing randomly - a bug with
28 #compiling BOX_ON_PLANE_SIDE in mathlib.h)
29 #CPUOPTIMIZATIONS=-march=athlon
31 #CPUOPTIMIZATIONS=-march=i686
36 ##### Variables that you shouldn't care about #####
45 CLIENTOBJECTS= cgame.o cgamevm.o chase.o cl_collision.o cl_demo.o cl_input.o \
46 cl_main.o cl_parse.o cl_particles.o cl_screen.o cl_video.o \
47 console.o dpvsimpledecode.o fractalnoise.o gl_backend.o \
48 gl_draw.o gl_models.o gl_rmain.o gl_rsurf.o gl_textures.o \
49 jpeg.o keys.o menu.o meshqueue.o r_crosshairs.o r_explosion.o \
50 r_lerpanim.o r_light.o r_lightning.o r_modules.o r_sky.o \
51 r_sprites.o sbar.o ui.o vid_shared.o view.o wavefile.o \
53 SERVEROBJECTS= pr_cmds.o pr_edict.o pr_exec.o sv_main.o sv_move.o \
55 SHAREDOBJECTS= cmd.o collision.o common.o crc.o cvar.o \
56 filematch.o host.o host_cmd.o image.o mathlib.o matrixlib.o \
57 model_alias.o model_brush.o model_shared.o model_sprite.o \
58 netconn.o lhnet.o palette.o portals.o protocol.o fs.o \
59 sys_shared.o winding.o world.o wad.o zone.o
60 COMMONOBJECTS= $(CLIENTOBJECTS) $(SERVEROBJECTS) $(SHAREDOBJECTS)
62 # note that builddate.c is very intentionally not compiled to a .o before
63 # being linked, because it should be recompiled every time an executable is
64 # built to give the executable a proper date string
65 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_LINUXCD) $(OBJ_LINUXSOUND) $(COMMONOBJECTS)
66 OBJ_DED= builddate.c sys_linux.o vid_null.o cd_null.o snd_null.o $(COMMONOBJECTS)
67 OBJ_WGL_EXE= builddate.c sys_win.o vid_wgl.o conproc.o cd_win.o snd_win.o snd_dma.o snd_mix.o snd_mem.o $(COMMONOBJECTS)
68 OBJ_DED_EXE= builddate.c sys_linux.o vid_null.o cd_null.o snd_null.o $(COMMONOBJECTS)
72 # CFLAGS_NONEXECOMMON=-MD -Wall -Werror
73 CFLAGS_NONEXECOMMON=-MD -Wall
74 CFLAGS_EXECOMMON=-MD -Wall
76 CFLAGS_PROFILE=-g -pg -ggdb
80 OPTIM_RELEASE= -O2 -fno-strict-aliasing -ffast-math -fexpensive-optimizations $(CPUOPTIMIZATIONS)
82 DO_CC=$(CC) $(CFLAGS) -c $< -o $@
86 # LordHavoc note: I have been informed that system libraries must come last
87 # on the linker line, and that -lm must always be last
90 LDFLAGS_WGL_EXE=-mwindows -lwinmm -lwsock32 -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32
91 LDFLAGS_DED_EXE=-mconsole -lwinmm -lwsock32
92 LDFLAGS_DEBUG=-g -ggdb
93 LDFLAGS_PROFILE=-g -pg
96 EXE_GLX=darkplaces-glx
97 EXE_DED=darkplaces-dedicated
98 EXE_WGL_EXE=darkplaces.exe
99 EXE_DED_EXE=darkplaces-dedicated.exe
101 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
106 .PHONY : clean help \
107 debug profile release \
108 glx-debug glx-profile glx-release \
109 ded-debug ded-profile ded-release \
110 exedebug exeprofile exerelease \
111 exewgl-debug exewgl-profile exewgl-release \
112 exeded-debug exeded-profile exeded-release \
116 @echo "===== Choose one ====="
117 @echo "* $(MAKE) clean : delete the binaries, and .o and .d files"
118 @echo "* $(MAKE) help : this help"
119 @echo "* $(MAKE) debug : make GLX and dedicated binaries (debug versions)"
120 @echo "* $(MAKE) profile : make GLX and dedicated binaries (profile versions)"
121 @echo "* $(MAKE) release : make GLX and dedicated binaries (release versions)"
122 @echo "* $(MAKE) glx-debug : make GLX client (debug version)"
123 @echo "* $(MAKE) glx-profile : make GLX client (profile version)"
124 @echo "* $(MAKE) glx-release : make GLX client (release version)"
125 @echo "* $(MAKE) ded-debug : make dedicated server (debug version)"
126 @echo "* $(MAKE) ded-profile : make dedicated server (profile version)"
127 @echo "* $(MAKE) ded-release : make dedicated server (release version)"
128 @echo "* $(MAKE) exedebug : make WGL and dedicated binaries (debug versions)"
129 @echo "* $(MAKE) exeprofile : make WGL and dedicated binaries (profile versions)"
130 @echo "* $(MAKE) exerelease : make WGL and dedicated binaries (release versions)"
131 @echo "* $(MAKE) exewgl-debug : make WGL client (debug version)"
132 @echo "* $(MAKE) exewgl-profile : make WGL client (profile version)"
133 @echo "* $(MAKE) exewgl-release : make WGL client (release version)"
134 @echo "* $(MAKE) exeded-debug : make dedicated server (debug version)"
135 @echo "* $(MAKE) exeded-profile : make dedicated server (profile version)"
136 @echo "* $(MAKE) exeded-release : make dedicated server (release version)"
140 $(MAKE) glx-debug ded-debug
143 $(MAKE) glx-profile ded-profile
146 $(MAKE) glx-release ded-release
149 $(MAKE) wglexe-debug dedexe-debug
152 $(MAKE) wglexe-profile dedexe-profile
155 $(MAKE) wglexe-release dedexe-release
158 $(MAKE) bin-debug EXE="$(EXE_GLX)" LDFLAGS_COMMON="$(LDFLAGS_GLX)" CFLAGS_COMMON="$(CFLAGS_NONEXECOMMON)"
161 $(MAKE) bin-profile EXE="$(EXE_GLX)" LDFLAGS_COMMON="$(LDFLAGS_GLX)" CFLAGS_COMMON="$(CFLAGS_NONEXECOMMON)"
164 $(MAKE) bin-release EXE="$(EXE_GLX)" LDFLAGS_COMMON="$(LDFLAGS_GLX)" CFLAGS_COMMON="$(CFLAGS_NONEXECOMMON)"
167 $(MAKE) bin-debug EXE="$(EXE_DED)" LDFLAGS_COMMON="$(LDFLAGS_DED)" CFLAGS_COMMON="$(CFLAGS_NONEXECOMMON)"
170 $(MAKE) bin-profile EXE="$(EXE_DED)" LDFLAGS_COMMON="$(LDFLAGS_DED)" CFLAGS_COMMON="$(CFLAGS_NONEXECOMMON)"
173 $(MAKE) bin-release EXE="$(EXE_DED)" LDFLAGS_COMMON="$(LDFLAGS_DED)" CFLAGS_COMMON="$(CFLAGS_NONEXECOMMON)"
176 $(MAKE) bin-debug EXE="$(EXE_WGL_EXE)" LDFLAGS_COMMON="$(LDFLAGS_WGL_EXE)" CFLAGS_COMMON="$(CFLAGS_EXECOMMON)"
179 $(MAKE) bin-profile EXE="$(EXE_WGL_EXE)" LDFLAGS_COMMON="$(LDFLAGS_WGL_EXE)" CFLAGS_COMMON="$(CFLAGS_EXECOMMON)"
182 $(MAKE) bin-release EXE="$(EXE_WGL_EXE)" LDFLAGS_COMMON="$(LDFLAGS_WGL_EXE)" CFLAGS_COMMON="$(CFLAGS_EXECOMMON)"
185 $(MAKE) bin-debug EXE="$(EXE_DED_EXE)" LDFLAGS_COMMON="$(LDFLAGS_DED_EXE)" CFLAGS_COMMON="$(CFLAGS_EXECOMMON)"
188 $(MAKE) bin-profile EXE="$(EXE_DED_EXE)" LDFLAGS_COMMON="$(LDFLAGS_DED_EXE)" CFLAGS_COMMON="$(CFLAGS_EXECOMMON)"
191 $(MAKE) bin-release EXE="$(EXE_DED_EXE)" LDFLAGS_COMMON="$(LDFLAGS_DED_EXE)" CFLAGS_COMMON="$(CFLAGS_EXECOMMON)"
195 @echo "========== $(EXE) (debug) =========="
197 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
198 LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)"
202 @echo "========== $(EXE) (profile) =========="
204 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
205 LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)"
209 @echo "========== $(EXE) (release) =========="
211 CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
212 LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)"
216 $(DO_CC) -I/usr/X11R6/include
221 $(EXE_GLX): $(OBJ_GLX)
222 $(DO_LD) -L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LINUXSOUNDLIB)
224 $(EXE_DED): $(OBJ_DED)
227 $(EXE_WGL_EXE): $(OBJ_WGL_EXE)
230 $(EXE_DED_EXE): $(OBJ_DED_EXE)
235 -$(CMD_RM) $(EXE_GLX)
236 -$(CMD_RM) $(EXE_DED)
237 -$(CMD_RM) $(EXE_WGL_EXE)
238 -$(CMD_RM) $(EXE_DED_EXE)