]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - makefile.inc
removed GL_NV_blend_square detection because it is no longer used
[xonotic/darkplaces.git] / makefile.inc
index f5e3e6280765717cf495b8da889ebdb4b0ba7bf2..d666be9bdf752ac22212a6de2b15239b9a0bcb10 100644 (file)
@@ -23,6 +23,11 @@ CPUOPTIMIZATIONS?=
 #CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fassociative-math -freciprocal-math -fno-signed-zeros -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`
+
+
 SDL_CONFIG?=sdl-config
 SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags`
 SDLCONFIG_UNIXLIBS?=`$(SDL_CONFIG) --libs`
@@ -164,10 +169,11 @@ 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 -Wdeclaration-after-statement
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) -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)
@@ -182,7 +188,7 @@ 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
 
 
@@ -190,7 +196,7 @@ LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || ec
 
 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
 
-LDFLAGS_UNIXCOMMON=-lm
+LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE)
 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug
 LDFLAGS_UNIXSV_PRELOAD=-lz -lcurl
@@ -289,7 +295,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 \
@@ -298,24 +304,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 :
@@ -327,6 +345,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
 
@@ -345,6 +366,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) \
@@ -365,6 +391,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) \
@@ -385,6 +416,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) \
@@ -418,10 +454,25 @@ 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
@@ -491,3 +542,8 @@ clean:
        -$(CMD_RM) $(EXE_SDLNEXUIZ)
        -$(CMD_RM) *.o
        -$(CMD_RM) *.d
+
+clean-profile: clean
+       -$(CMD_RM) *.gcda
+       -$(CMD_RM) *.gcno
+