Ticket #9115: patch.diff

File patch.diff, 4.6 KB (added by bluddy, 14 years ago)

Updated patch works globally

  • configure

     
    126126# Default option behaviour yes/no
    127127_debug_build=auto
    128128_release_build=auto
     129_gprof_build=no
    129130_text_console=no
    130131_mt32emu=yes
    131132_build_hq_scalers=yes
     
    643644
    644645  --with-readline-prefix=DIR    Prefix where readline is installed (optional)
    645646  --disable-readline       disable readline support in text console [autodetect]
     647 
     648  --enable-gprof           enable gprof support for profiling Scummvm
    646649
    647650Some influential environment variables:
    648651  LDFLAGS        linker flags, e.g. -L<lib dir> if you have libraries in a
     
    754757        --disable-debug)
    755758                _debug_build=no
    756759                ;;
     760        --enable-gprof)
     761                _gprof_build=yes
     762                ;;
    757763        --enable-Werror)
    758764                CXXFLAGS="$CXXFLAGS -Werror"
    759765                ;;
     
    959965        CXXFLAGS="$CXXFLAGS -O2 -Wuninitialized"
    960966fi
    961967
    962 
    963968#
    964969# Determine extension used for executables
    965970#
     
    13171322                DEFINES="$DEFINES -D__DS__ -DNDS -DARM9 -DARM -DNONSTANDARD_PORT"
    13181323                ;;
    13191324        psp)
    1320                 CXXFLAGS="$CXXFLAGS -O3 -I$PSPSDK/include -D_PSP_FW_VERSION=150"
     1325                if test "$_gprof_build" = yes; then
     1326                        CXXFLAGS="$CXXFLAGS -G0 -O0 -I$PSPSDK/include -D_PSP_FW_VERSION=150"
     1327                else
     1328                        CXXFLAGS="$CXXFLAGS -O3 -I$PSPSDK/include -D_PSP_FW_VERSION=150"
     1329                fi
    13211330                ;;
    13221331        ps2)
    13231332                # TODO ps2
     
    21822191add_to_config_mk_if_yes $_nasm 'HAVE_NASM = 1'
    21832192
    21842193#
     2194# Determine extra build flags for gprof build
     2195#
     2196
     2197if test "$_gprof_build" = yes; then
     2198        echo "Configuring for gprof..."
     2199        _debug_build=yes
     2200        CXXFLAGS="$CXXFLAGS -pg -g"
     2201        DEFINES="$DEFINES -DUSE_GPROF" 
     2202fi     
     2203
     2204#
    21852205# Enable vkeybd / keymapper
    21862206#
    21872207if test "$_vkeybd" = yes ; then
     
    23192339                then
    23202340                        LIBS="$LIBS -lGL"
    23212341                fi
     2342                if test "$_gprof_build" = yes; then
     2343                        LIBS="$LIBS -pg -lpspprof"
     2344                fi
    23222345                ;;
    23232346        ps2)
    23242347                # TODO ps2
  • backends/platform/psp/psp_main.cpp

     
    4242#include "osys_psp.h"
    4343#include "./trace.h"
    4444
     45#ifdef USE_GPROF
     46#include <pspprof.h>
     47#endif
    4548
    46 
    4749/**
    4850 * Define the module info section
    4951 *
    5052 * 2nd arg must 0x1000 so __init is executed in
    51  * kernelmode for our loaderInit function
     53 * kernelmode for our loaderInit function 
    5254 */
    5355#ifndef USERSPACE_ONLY
    5456PSP_MODULE_INFO("SCUMMVM-PSP", 0x1000, 1, 1);
     
    8385
    8486/**
    8587 * Function that is called from _init in kernelmode before the
    86  * main thread is started in usermode.
     88 * main thread is started in usermode. 
    8789 */
    8890__attribute__ ((constructor))
    8991void loaderInit() {
     
    9496
    9597/* Exit callback */
    9698int exit_callback(void) {
     99#ifdef USE_GPROF
     100        gprof_cleanup();
     101#endif 
    97102        sceKernelExitGame();
    98103        return 0;
    99104}
  • backends/platform/psp/Makefile

     
    4242
    4343#Set to 1 to enable, 0 to disable dynamic modules
    4444DYNAMIC_MODULES = 1
     45#Set to 1 to enable, 0 to disable gprof building
     46ENABLE_GPROF = 0
    4547#Set to 1 to enable, 0 to disable libmad and libogg
    4648USE_LIBMAD = 1
    4749USE_LIBOGG = 1
     
    6163$(error $$(PSPSDK) cannot be obtained.)
    6264endif
    6365
     66#check gprof
     67ifeq ($(ENABLE_GPROF),1)
     68CXX_DEBUG_FLAGS += -g -pg -G0
     69LD_DEBUG_FLAGS += -pg
     70CXX_OPTIMIZE = -O0
     71PSPLIBS += -lpspprof
     72DEFINES += -DUSE_GPROF
     73else
     74CXX_OPTIMIZE = -O3
     75endif
    6476
    6577# Variables for common Scummvm makefile
    6678#CC      = psp-gcc
    6779CXX      = psp-g++
    68 CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti
    69 DEFINES  = -D__PSP__ -DNONSTANDARD_PORT -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_ZLIB
    70 LDFLAGS  :=
     80CXXFLAGS = $(CXX_DEBUG_FLAGS) $(CXX_OPTIMIZE) -Wall -Wno-multichar -fno-exceptions -fno-rtti
     81DEFINES  += -D__PSP__ -DNONSTANDARD_PORT -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_ZLIB
     82LDFLAGS  := $(LD_DEBUG_FLAGS)
    7183INCDIR   := $(srcdir) . $(srcdir)/engines/ $(PSPSDK)/include
    7284INCLUDES := $(addprefix -I, $(INCDIR))
    7385#EXECUTABLE = $(TARGET)
     
    123135SDLFLAGS := $(shell $(PSPBIN)/sdl-config --cflags)
    124136SDLLIBS  := $(shell $(PSPBIN)/sdl-config --libs)
    125137# PSP LIBS
    126 PSPLIBS = -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk \
    127         -lpsputility -lpspuser -lpsppower -lpsphprm -lpspsdk -lpsprtc -lpspaudio
     138PSPLIBS += -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk \
     139        -lpsputility -lpspuser -lpsppower -lpsphprm -lpspsdk -lpsprtc -lpspaudio
    128140
    129141# Add in PSPSDK includes and libraries.
    130142CXXFLAGS += $(SDLFLAGS)