X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=makefile.inc;h=aeac6e313e8549f22e2b46965b738e70625d73e0;hb=2f401ea566c4ca2bc4f75e01e49006071fa56e6a;hp=99a66ad1942b9092e6e517955fea02d5bfc0aea2;hpb=27ad2d336694ea2dc50035130bae321316e3936f;p=xonotic%2Fdarkplaces.git diff --git a/makefile.inc b/makefile.inc index 99a66ad1..aeac6e31 100644 --- a/makefile.inc +++ b/makefile.inc @@ -3,7 +3,7 @@ CHECKLEVEL1 = @if [ "$(LEVEL)" != 1 ]; then $(MAKE) help; false; fi CHECKLEVEL2 = @if [ "$(LEVEL)" != 2 ]; then $(MAKE) help; false; fi # Choose the compiler you want to use -CC=gcc +CC?=gcc # athlon optimizations #CPUOPTIMIZATIONS?=-march=athlon @@ -18,18 +18,29 @@ CC=gcc # 686 (Pentium Pro/II) optimizations #CPUOPTIMIZATIONS?=-march=i686 # No specific CPU (386 compatible) -CPUOPTIMIZATIONS?= +#CPUOPTIMIZATIONS?= # Experimental #CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math +# Normal +CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag +# Additional stuff for libode +LIB_ODE=`[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && "$(DP_ODE_STATIC_LIBDIR)/../bin/ode-config" --libs` `[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && echo -lstdc++` +CFLAGS_ODE=`[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && "$(DP_ODE_STATIC_LIBDIR)/../bin/ode-config" --cflags || { [ -n "$(DP_ODE_DYNAMIC)" ] && echo \ -DODE_DYNAMIC; }` `[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && echo -DODE_STATIC` + +# Additional stuff for libCg +LIB_CG= `[ -n "$(DP_CG_LIBDIR)" ] && echo \ -lCg\ -lCgGL -lGL` +CFLAGS_CG= `[ -n "$(DP_CG_LIBDIR)" ] && echo \ -DSUPPORTCG` + + SDL_CONFIG?=sdl-config SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags` SDLCONFIG_UNIXLIBS?=`$(SDL_CONFIG) --libs` SDLCONFIG_UNIXSTATICLIBS?=`$(SDL_CONFIG) --static-libs` -SDLCONFIG_MACOSXCFLAGS=-I/Library/Frameworks/SDL.framework/Headers -SDLCONFIG_MACOSXLIBS=-framework SDL -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS) -SDLCONFIG_MACOSXSTATICLIBS=-framework SDL -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS) +SDLCONFIG_MACOSXCFLAGS=-I/Library/Frameworks/SDL.framework/Headers -I$(HOME)/Library/Frameworks/SDL.framework/Headers +SDLCONFIG_MACOSXLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS) +SDLCONFIG_MACOSXSTATICLIBS=-F$(HOME)/Library/Frameworks/ -framework SDL -framework Cocoa $(SDLCONFIG_MACOSXCFLAGS) STRIP?=strip @@ -77,6 +88,9 @@ OBJ_NOCD=cd_null.o # Common objects OBJ_COMMON= \ + bih.o \ + cap_avi.o \ + cap_ogg.o \ cd_shared.o \ cl_collision.o \ cl_demo.o \ @@ -100,11 +114,14 @@ OBJ_COMMON= \ filematch.o \ fractalnoise.o \ fs.o \ + ft2.o \ + utf8lib.o \ gl_backend.o \ gl_draw.o \ gl_rmain.o \ gl_rsurf.o \ gl_textures.o \ + hmac.o \ host.o \ host_cmd.o \ image.o \ @@ -161,17 +178,19 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $( # Compilation -CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) -Wall -Wsign-compare +CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_CG) -Wall -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement CFLAGS_DEBUG=-ggdb -CFLAGS_PROFILE=-g -pg -ggdb +CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs CFLAGS_RELEASE= +CFLAGS_RELEASE_PROFILE=-fbranch-probabilities CFLAGS_SDL=$(SDLCONFIG_CFLAGS) OPTIM_DEBUG=$(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -ffast-math -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -fno-math-errno -fno-trapping-math -ffinite-math-only -fno-signaling-nans -fcx-limited-range -funroll-loops $(CPUOPTIMIZATIONS) #OPTIM_RELEASE=-O2 -fno-strict-aliasing -funroll-loops $(CPUOPTIMIZATIONS) -OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS) +#OPTIM_RELEASE=-O2 -fno-strict-aliasing $(CPUOPTIMIZATIONS) +OPTIM_RELEASE=-O3 -fno-strict-aliasing $(CPUOPTIMIZATIONS) # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag DO_CC=$(CC) $(CFLAGS) -c $< -o $@ @@ -179,19 +198,19 @@ DO_CC=$(CC) $(CFLAGS) -c $< -o $@ # Link LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=debug -LDFLAGS_PROFILE=-g -pg $(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=profile +LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=profile LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || echo -` -DBUILDTYPE=release ##### UNIX specific variables ##### -OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON) +OBJ_GLX= builddate.c sys_linux.o vid_glx.o keysym2ucs.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON) -LDFLAGS_UNIXCOMMON=-lm +LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_CG) LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND) -LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl -lmodplug -LDFLAGS_UNIXSV_PRELOAD=-lz -lcurl -LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl -lmodplug +LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug +LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl +LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) @@ -272,10 +291,11 @@ OBJ_WGL= builddate.c sys_win.o vid_wgl.o $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_COMMO # Link # Note that Windows Vista users may need --large-address-aware because Vista seems to map over 500MB of application address space for its own purposes, which is a significant chunk taken out of the default 2GB address space, this option raises the limit to 4GB (or 3GB on Vista 32 and older versions of Windows). -LDFLAGS_WINCOMMON=-lws2_32 -Wl,--large-address-aware -LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole -lwinmm -LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) +# if using mingw64 you need to use LDFLAGS_WINCOMMON= on the commandline to get rid of this, otherwise it produces a compile error +LDFLAGS_WINCOMMON=-Wl,--large-address-aware +LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 +LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) -mconsole -lwinmm -lws2_32 +LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 EXE_WINCL=darkplaces.exe EXE_WINSV=darkplaces-dedicated.exe EXE_WINSDL=darkplaces-sdl.exe @@ -286,7 +306,7 @@ EXE_WINSDLNEXUIZ=nexuiz-sdl.exe ##### Commands ##### -.PHONY : clean help \ +.PHONY : clean clean-profile help \ debug profile release \ cl-debug cl-profile cl-release \ sv-debug sv-profile sv-release \ @@ -295,24 +315,36 @@ EXE_WINSDLNEXUIZ=nexuiz-sdl.exe help: @echo @echo "===== Choose one =====" - @echo "* $(MAKE) clean : delete all files produced by the build" - @echo "* $(MAKE) help : this help" - @echo "* $(MAKE) debug : make client and server binaries (debug versions)" - @echo "* $(MAKE) profile : make client and server binaries (profile versions)" - @echo "* $(MAKE) release : make client and server binaries (release versions)" - @echo "* $(MAKE) nexuiz : make client and server binaries with nexuiz icon (release versions)" - @echo "* $(MAKE) cl-debug : make client (debug version)" - @echo "* $(MAKE) cl-profile : make client (profile version)" - @echo "* $(MAKE) cl-release : make client (release version)" - @echo "* $(MAKE) cl-nexuiz : make client with nexuiz icon (release version)" - @echo "* $(MAKE) sv-debug : make dedicated server (debug version)" - @echo "* $(MAKE) sv-profile : make dedicated server (profile version)" - @echo "* $(MAKE) sv-release : make dedicated server (release version)" - @echo "* $(MAKE) sv-nexuiz : make dedicated server with nexuiz icon (release version)" - @echo "* $(MAKE) sdl-debug : make SDL client (debug version)" - @echo "* $(MAKE) sdl-profile : make SDL client (profile version)" - @echo "* $(MAKE) sdl-release : make SDL client (release version)" - @echo "* $(MAKE) sdl-nexuiz : make SDL client with nexuiz icon (release version)" + @echo "* $(MAKE) clean : delete all files produced by the build except" + @echo " profiling information" + @echo "* $(MAKE) clean-profile : delete all files produced by the build, including" + @echo " profiling informaiton" + @echo "* $(MAKE) help : this help" + @echo "* $(MAKE) debug : make client and server binaries (debug versions)" + @echo "* $(MAKE) profile : make client and server binaries (profile versions)" + @echo "* $(MAKE) release : make client and server binaries (release versions)" + @echo "* $(MAKE) release-profile : make client and server binaries (release versions)" + @echo " with profileing optomizations) The profiled" + @echo " version of the program must have been" + @echo " previously compiled" + @echo "* $(MAKE) nexuiz : make client and server binaries with nexuiz icon" + @echo " (release versions)" + @echo "* $(MAKE) cl-debug : make client (debug version)" + @echo "* $(MAKE) cl-profile : make client (profile version)" + @echo "* $(MAKE) cl-release : make client (release version)" + @echo "* $(MAKE) cl-release-profile : make client (release version)" + @echo "* $(MAKE) cl-nexuiz : make client with nexuiz icon (release version)" + @echo "* $(MAKE) sv-debug : make dedicated server (debug version)" + @echo "* $(MAKE) sv-profile : make dedicated server (profile version)" + @echo "* $(MAKE) sv-release : make dedicated server (release version)" + @echo "* $(MAKE) sv-release-profile : make dedicated server (release version)" + @echo "* $(MAKE) sv-nexuiz : make dedicated server with nexuiz icon" + @echo " (release version)" + @echo "* $(MAKE) sdl-debug : make SDL client (debug version)" + @echo "* $(MAKE) sdl-profile : make SDL client (profile version)" + @echo "* $(MAKE) sdl-profile-profile : make SDL client (profile version)" + @echo "* $(MAKE) sdl-release : make SDL client (release version)" + @echo "* $(MAKE) sdl-nexuiz : make SDL client with nexuiz icon (release version)" @echo debug : @@ -324,6 +356,9 @@ profile : release : $(MAKE) sv-release cl-release sdl-release +release-profile : + $(MAKE) sv-release-profile cl-release-profile sdl-release-profile + nexuiz : $(MAKE) sv-nexuiz cl-nexuiz sdl-nexuiz @@ -342,6 +377,11 @@ cl-release : DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1 +cl-release-profile : + $(MAKE) bin-release-profile \ + DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ + EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1 + cl-nexuiz : $(MAKE) bin-release \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ @@ -362,6 +402,11 @@ sv-release : DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1 +sv-release-profile : + $(MAKE) bin-release-profile \ + DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ + EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1 + sv-nexuiz : $(MAKE) bin-release \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ @@ -382,6 +427,11 @@ sdl-release : DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1 +sdl-release-profile : + $(MAKE) bin-release-profile \ + DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ + EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1 + sdl-nexuiz : $(MAKE) bin-release \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ @@ -415,14 +465,33 @@ bin-release : LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2 $(STRIP) $(EXE) +bin-release-profile : + $(CHECKLEVEL1) + @echo + @echo "========== $(EXE) (release) ==========" + $(MAKE) $(EXE) \ + DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)"\ + LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2 + $(STRIP) $(EXE) + + snd_modplug.o: snd_modplug.c $(CHECKLEVEL2) $(DO_CC) $(CFLAGS_SND_MODPLUG) +world.o: world.c + $(CHECKLEVEL2) + $(DO_CC) $(CFLAGS_ODE) + vid_glx.o: vid_glx.c $(CHECKLEVEL2) $(DO_CC) -I/usr/X11R6/include +keysym2ucs.o: keysym2ucs.c + $(CHECKLEVEL2) + $(DO_CC) -I/usr/X11R6/include + vid_sdl.o: vid_sdl.c $(CHECKLEVEL2) $(DO_CC) $(CFLAGS_SDL) @@ -488,3 +557,8 @@ clean: -$(CMD_RM) $(EXE_SDLNEXUIZ) -$(CMD_RM) *.o -$(CMD_RM) *.d + +clean-profile: clean + -$(CMD_RM) *.gcda + -$(CMD_RM) *.gcno +