Made a few changes to makefile so we can switch compiler more easily
[divverent/darkplaces.git] / makefile
1 #choose the compiler you want here
2 CC=gcc
3
4 #uncomment these according to your sound driver
5
6 #recommended for: anyone not using ALSA 0.5
7 SND=snd_oss.o snd_dma.o snd_mix.o snd_mem.o
8 SOUNDLIB=
9 #recommended for: anyone using ALSA 0.5
10 #SND=snd_alsa_0_5.o snd_dma.o snd_mix.o snd_mem.o
11 #SOUNDLIB=-lasound
12 #recommended for: no one (this driver needs to be updated, it doesn't compile anymore)
13 #SND=snd_alsa_0_9.o snd_dma.o snd_mix.o snd_mem.o
14 #SOUNDLIB=-lasound
15 #recommended for: anyone who can't use the above drivers
16 #SND=snd_null.o
17 #SOUNDLIB=
18
19
20 #uncomment your preference
21 #if you want CD sound in Linux
22 #CD=cd_linux.o
23 #if you want no CD audio
24 CD=cd_null.o
25
26 CLIENTOBJECTS= cgame.o cgamevm.o chase.o cl_collision.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_particles.o cl_screen.o cl_video.o console.o dpvsimpledecode.o fractalnoise.o gl_backend.o gl_draw.o gl_models.o gl_rmain.o gl_rsurf.o gl_textures.o keys.o menu.o meshqueue.o r_crosshairs.o r_explosion.o r_explosion.o r_lerpanim.o r_light.o r_modules.o r_sky.o r_sprites.o sbar.o ui.o vid_shared.o view.o wavefile.o r_shadow.c
27 SERVEROBJECTS= pr_cmds.o pr_edict.o pr_exec.o sv_light.o sv_main.o sv_move.o sv_phys.o sv_user.o
28 SHAREDOBJECTS= builddate.o cmd.o collision.o common.o crc.o cvar.o filematch.o host.o host_cmd.o image.o mathlib.o matrixlib.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_dgrm.o net_loop.o net_main.o net_master.o net_udp.o palette.o portals.o protocol.o quakeio.o sys_linux.o sys_shared.o transform.o world.o wad.o zone.o $(NETOBJECTS) $(SERVEROBJECTS)
29
30
31 #K6/athlon optimizations
32 #CPUOPTIMIZATIONS=-march=k6
33 #note: don't use -march=athlon, every gcc which has it currently (2.96-3.1)
34 #have optimizer bugs (like entities disappearing randomly - a bug with
35 #compiling BOX_ON_PLANE_SIDE in mathlib.h)
36 #CPUOPTIMIZATIONS=-march=athlon
37 #686 optimizations
38 #CPUOPTIMIZATIONS=-march=i686
39 #no specific CPU
40 CPUOPTIMIZATIONS=
41
42 #use this line for profiling
43 PROFILEOPTION=-pg -g
44 #use this line for no profiling
45 #PROFILEOPTION=
46
47 #note:
48 #the -Werror can be removed to compile even if there are warnings,
49 #this is used to ensure that all released versions are free of warnings.
50
51 #normal compile
52 OPTIMIZATIONS= -O6 -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS)
53 CFLAGS= -MD -Wall -Werror $(OPTIMIZATIONS) $(PROFILEOPTION)
54 #debug compile
55 #OPTIMIZATIONS=
56 #CFLAGS= -MD -Wall -Werror -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
57
58 LDFLAGS= $(PROFILEOPTION) -lm -ldl
59
60 all: builddate darkplaces-dedicated darkplaces-glx
61
62 builddate:
63         touch builddate.c
64
65 vid_glx.o: vid_glx.c
66         $(CC) $(CFLAGS) -c vid_glx.c -I/usr/X11R6/include
67
68 .c.o:
69         $(CC) $(CFLAGS) -c $*.c
70
71 darkplaces-glx:  $(SHAREDOBJECTS) $(CLIENTOBJECTS) $(SERVEROBJECTS) vid_glx.o $(CD) $(SND)
72         $(CC) -o $@ $^ $(LDFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(SOUNDLIB)
73
74 darkplaces-dedicated: $(SHAREDOBJECTS) $(CLIENTOBJECTS) $(SERVEROBJECTS) vid_null.o cd_null.o snd_null.o
75         $(CC) -o $@ $^ $(LDFLAGS)
76
77 clean:
78         -rm -f darkplaces-glx darkplaces-dedicated *.o *.d
79
80 .PHONY: clean builddate
81
82 -include *.d
83