components/python/python26/patches/Python26-25-studio-profile.patch
changeset 4984 7145b15b7f0d
parent 4983 db2589571faa
child 4985 eed3576cafd0
equal deleted inserted replaced
4983:db2589571faa 4984:7145b15b7f0d
     1 This changes Python's standard profile-guided build target to work with
       
     2 Studio instead of gcc.  The unfortunate repetition of options seen below
       
     3 is a workaround for build peculiarities and to meet Studio's requirement
       
     4 that the profiling options be used at all steps of the build -- not just
       
     5 compilation.
       
     6 --- Python-2.6.4/Makefile.pre.in.orig	2012-05-14 06:37:59.575335093 -0700
       
     7 +++ Python-2.6.4/Makefile.pre.in	2012-05-14 06:41:08.439443308 -0700
       
     8 @@ -361,27 +361,36 @@
       
     9  profile-opt:
       
    10  	@echo "Building with support for profile generation:"
       
    11  	$(MAKE) clean
       
    12 +	$(MAKE) profile-removal
       
    13  	$(MAKE) build_all_generate_profile
       
    14  	@echo "Running benchmark to generate profile data:"
       
    15 -	$(MAKE) profile-removal
       
    16  	$(MAKE) run_profile_task
       
    17  	@echo "Rebuilding with profile guided optimizations:"
       
    18  	$(MAKE) clean
       
    19  	$(MAKE) build_all_use_profile
       
    20  
       
    21  build_all_generate_profile:
       
    22 -	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
       
    23 +	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
       
    24 +	    CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
       
    25 +	    LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
       
    26 +	    BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
       
    27  
       
    28  run_profile_task:
       
    29 -	./$(BUILDPYTHON) $(PROFILE_TASK)
       
    30 +	LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK)
       
    31  
       
    32  build_all_use_profile:
       
    33 -	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
       
    34 +	$(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
       
    35 +	    CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
       
    36 +	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
       
    37 +	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
       
    38  
       
    39  coverage:
       
    40  	@echo "Building with support for coverage checking:"
       
    41  	$(MAKE) clean
       
    42 -	$(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
       
    43 +	$(MAKE) all CC="$(CC) -xprofile=tcov" \
       
    44 +	    CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
       
    45 +	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
       
    46 +	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
       
    47  
       
    48  
       
    49  # Build the interpreter
       
    50 @@ -396,10 +405,7 @@
       
    51  
       
    52  # Build the shared modules
       
    53  sharedmods: $(BUILDPYTHON)
       
    54 -	@case $$MAKEFLAGS in \
       
    55 -	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
       
    56 -	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
       
    57 -	esac
       
    58 +	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build
       
    59  
       
    60  # Build static library
       
    61  # avoid long command lines, same as LIBRARY_OBJS
       
    62 @@ -1166,6 +1172,7 @@
       
    63  clean: pycremoval
       
    64  	find . -name '*.[oa]' -exec rm -f {} ';'
       
    65  	find . -name '*.s[ol]' -exec rm -f {} ';'
       
    66 +	find . -name '*.s[ol].*' -exec rm -f {} ';'
       
    67  	find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
       
    68  	find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
       
    69  	find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
       
    70 @@ -1173,6 +1180,7 @@
       
    71  
       
    72  profile-removal:
       
    73  	find . -name '*.gc??' -exec rm -f {} ';'
       
    74 +	find . -name '.profile' -exec rm -rf {} ';'
       
    75  
       
    76  clobber: clean profile-removal
       
    77  	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \