X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=makefile;h=dd547b342a81772c50133ba8ec9d9ac7acd9a891;hp=ec3105c2766eaf735a2cbb09f1487f16e6176242;hb=e86a872dd937facf8ccd8eaf815a6a732bc7acad;hpb=dbce962f09403fd5888d0bd858ceefc90bc3ea2b diff --git a/makefile b/makefile index ec3105c2..dd547b34 100644 --- a/makefile +++ b/makefile @@ -1,28 +1,25 @@ +##### Variables that you may want to modify ##### - -#uncomment these according to your sound driver +#choose the compiler you want to use +CC=gcc #recommended for: anyone not using ALSA 0.5 -SND=snd_oss.o snd_dma.o snd_mix.o snd_mem.o +OBJ_SND=snd_oss.o snd_dma.o snd_mix.o snd_mem.o SOUNDLIB= #recommended for: anyone using ALSA 0.5 -#SND=snd_alsa_0_5.o snd_dma.o snd_mix.o snd_mem.o +#OBJ_SND=snd_alsa_0_5.o snd_dma.o snd_mix.o snd_mem.o #SOUNDLIB=-lasound #recommended for: no one (this driver needs to be updated, it doesn't compile anymore) -#SND=snd_alsa_0_9.o snd_dma.o snd_mix.o snd_mem.o +#OBJ_SND=snd_alsa_0_9.o snd_dma.o snd_mix.o snd_mem.o #SOUNDLIB=-lasound #recommended for: anyone who can't use the above drivers -#SND=snd_null.o +#OBJ_SND=snd_null.o #SOUNDLIB= - -#uncomment your preference #if you want CD sound in Linux -#CD=cd_linux.o +OBJ_CD=cd_linux.o #if you want no CD audio -CD=cd_null.o - -OBJECTS= builddate.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o r_sky.o gl_rmain.o gl_rsurf.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_udp.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_explosion.o sbar.o sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o sys_linux.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o protocol.o quakeio.o ui.o portals.o sys_shared.o cl_light.o gl_backend.o cl_particles.o cl_screen.o cgamevm.o cgame.o filematch.o collision.o cl_collision.o matrixlib.o cl_video.o dpvsimpledecode.o wavefile.o meshqueue.o +#OBJ_CD=cd_null.o #K6/athlon optimizations #CPUOPTIMIZATIONS=-march=k6 @@ -35,44 +32,162 @@ OBJECTS= builddate.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o #no specific CPU CPUOPTIMIZATIONS= -#use this line for profiling -PROFILEOPTION=-pg -g -NOPROFILEOPTIMIZATIONS= -#use this line for no profiling -#PROFILEOPTION= -#NOPROFILEOPTIMIZATIONS=-fomit-frame-pointer -#use these lines for debugging without profiling -#PROFILEOPTION= -#NOPROFILEOPTIMIZATIONS= - -#note: -#the -Werror can be removed to compile even if there are warnings, -#this is used to ensure that all released versions are free of warnings. - -#normal compile -#OPTIMIZATIONS= -O6 -fno-strict-aliasing -ffast-math -funroll-loops $(NOPROFILEOPTIMIZATIONS) -fexpensive-optimizations $(CPUOPTIMIZATIONS) -#CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include $(OPTIMIZATIONS) $(PROFILEOPTION) -#debug compile -OPTIMIZATIONS= -CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION) -LDFLAGS= -L/usr/X11R6/lib -lm -lX11 -lXext -lXxf86dga -lXxf86vm -ldl $(SOUNDLIB) $(PROFILEOPTION) +##### Variables that you shouldn't care about ##### -all: builddate darkplaces-glx +# Objects +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 \ + jpeg.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.o +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 +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 world.o wad.o zone.o + +OBJ_COMMON= $(CLIENTOBJECTS) $(SERVEROBJECTS) $(SHAREDOBJECTS) +OBJ_GLX= vid_glx.o $(OBJ_CD) $(OBJ_SND) +OBJ_DED= vid_null.o cd_null.o snd_null.o + + +# Compilation +CFLAGS_COMMON=-MD -Wall -Werror +CFLAGS_DEBUG=-ggdb +CFLAGS_PROFILE=-g -pg -ggdb +CFLAGS_RELEASE= + +OPTIM_DEBUG= +OPTIM_RELEASE= -O6 -fno-strict-aliasing -ffast-math -funroll-loops \ + -fexpensive-optimizations $(CPUOPTIMIZATIONS) + +DO_CC=$(CC) $(CFLAGS) -c $< -o $@ + + +# Link +LDFLAGS_COMMON=-lm -ldl +LDFLAGS_DEBUG=-g -ggdb +LDFLAGS_PROFILE=-g -pg +LDFLAGS_RELEASE= + +EXE_GLX=darkplaces-glx +EXE_DED=darkplaces-dedicated + +GLX_LIB=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(SOUNDLIB) + +DO_LD=$(CC) -o $@ $^ $(LDFLAGS) + + +##### Commands ##### + +.PHONY : clean help \ + debug profile release \ + glx-debug glx-profile glx-release \ + ded-debug ded-profile ded-release \ + +help: + @echo + @echo "===== Choose one =====" + @echo "* $(MAKE) clean : delete the binaries, and .o and .d files" + @echo "* $(MAKE) help : this help" + @echo "* $(MAKE) debug : make GLX and dedicated binaries (debug versions)" + @echo "* $(MAKE) profile : make GLX and dedicated binaries (profile versions)" + @echo "* $(MAKE) release : make GLX and dedicated binaries (release versions)" + @echo "* $(MAKE) glx-debug : make GLX binary (debug version)" + @echo "* $(MAKE) glx-profile : make GLX binary (profile version)" + @echo "* $(MAKE) glx-release : make GLX binary (release version)" + @echo "* $(MAKE) ded-debug : make dedicated server (debug version)" + @echo "* $(MAKE) ded-profile : make dedicated server (profile version)" + @echo "* $(MAKE) ded-release : make dedicated server (release version)" + @echo + +debug : + $(MAKE) glx-debug ded-debug + +profile : + $(MAKE) glx-profile ded-profile + +release : + $(MAKE) glx-release ded-release + +glx-debug : + $(MAKE) bin-debug EXE="$(EXE_GLX)" + +glx-profile : + $(MAKE) bin-profile EXE="$(EXE_GLX)" + +glx-release : + $(MAKE) bin-release EXE="$(EXE_GLX)" + +ded-debug : + $(MAKE) bin-debug EXE="$(EXE_DED)" + +ded-profile : + $(MAKE) bin-profile EXE="$(EXE_DED)" + +ded-release : + $(MAKE) bin-release EXE="$(EXE_DED)" + +bin-debug : + @echo + @echo "========== $(EXE) (debug) ==========" +# @echo Using compiler $(CC) +# @echo Compiling with flags: $(CFLAGS_COMMON) $(CFLAGS_DEBUG) \ +# $(OPTIM_DEBUG) +# @echo + $(MAKE) $(EXE) \ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\ + LDFLAGS="$(LDFLAGS_COMMON) $(LDFLAGS_DEBUG)" + +bin-profile : + @echo + @echo "========== $(EXE) (profile) ==========" +# @echo Using compiler $(CC) +# @echo Compiling with flags: $(CFLAGS_COMMON) $(CFLAGS_PROFILE) \ +# $(OPTIM_RELEASE) +# @echo + $(MAKE) $(EXE) \ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\ + LDFLAGS="$(LDFLAGS_COMMON) $(LDFLAGS_PROFILE)" + +bin-release : + @echo + @echo "========== $(EXE) (release) ==========" +# @echo Using compiler $(CC) +# @echo Compiling with flags: $(CFLAGS_COMMON) $(CFLAGS_RELEASE) \ +# $(OPTIM_RELEASE) +# @echo + $(MAKE) $(EXE) \ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\ + LDFLAGS="$(LDFLAGS_COMMON) $(LDFLAGS_RELEASE)" builddate: touch builddate.c +vid_glx.o: vid_glx.c +# @echo " Compiling" $< + $(DO_CC) -I/usr/X11R6/include + .c.o: - gcc $(CFLAGS) -c $*.c +# @echo " Compiling" $< + $(DO_CC) -darkplaces-glx: vid_glx.o $(CD) $(SND) $(OBJECTS) - gcc -o $@ $^ $(LDFLAGS) +$(EXE_GLX): $(OBJ_COMMON) $(OBJ_GLX) +# @echo " Linking " $@ + $(DO_LD) $(GLX_LIB) -clean: - -rm -f darkplaces-glx *.o *.d +$(EXE_DED): $(OBJ_COMMON) $(OBJ_DED) +# @echo " Linking " $@ + $(DO_LD) -.PHONY: clean builddate +clean: + rm -f $(EXE_GLX) $(EXE_DED) *.o *.d -include *.d -