components/python/python26/patches/Python26-25-studio-profile.patch
changeset 841 1a62cefa636d
parent 634 bd9c94f9f6e0
child 2213 b87f3edd5dd7
equal deleted inserted replaced
840:926eb95ceab3 841:1a62cefa636d
     1 This changes Python's standard profile-guided build target to work with
     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
     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
     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
     4 that the profiling options be used at all steps of the build -- not just
     5 compilation.
     5 compilation.
     6 --- Python-2.6.4/Makefile.pre.in.old	Thu Nov  3 15:14:03 2011
     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	Thu Nov  3 15:14:11 2011
     7 +++ Python-2.6.4/Makefile.pre.in	2012-05-14 06:41:08.439443308 -0700
     8 @@ -360,9 +360,9 @@
     8 @@ -361,27 +361,36 @@
     9  profile-opt:
     9  profile-opt:
    10  	@echo "Building with support for profile generation:"
    10  	@echo "Building with support for profile generation:"
    11  	$(MAKE) clean
    11  	$(MAKE) clean
    12 +	$(MAKE) profile-removal
    12 +	$(MAKE) profile-removal
    13  	$(MAKE) build_all_generate_profile
    13  	$(MAKE) build_all_generate_profile
    14  	@echo "Running benchmark to generate profile data:"
    14  	@echo "Running benchmark to generate profile data:"
    15 -	$(MAKE) profile-removal
    15 -	$(MAKE) profile-removal
    16  	$(MAKE) run_profile_task
    16  	$(MAKE) run_profile_task
    17  	@echo "Rebuilding with profile guided optimizations:"
    17  	@echo "Rebuilding with profile guided optimizations:"
    18  	$(MAKE) clean
    18  	$(MAKE) clean
    19 @@ -369,18 +369,27 @@
       
    20  	$(MAKE) build_all_use_profile
    19  	$(MAKE) build_all_use_profile
    21  
    20  
    22  build_all_generate_profile:
    21  build_all_generate_profile:
    23 -	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
    22 -	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
    24 +	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
    23 +	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
    46 +	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
    45 +	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
    47 +	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
    46 +	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
    48  
    47  
    49  
    48  
    50  # Build the interpreter
    49  # Build the interpreter
    51 @@ -395,10 +404,7 @@
    50 @@ -396,10 +405,7 @@
    52  
    51  
    53  # Build the shared modules
    52  # Build the shared modules
    54  sharedmods: $(BUILDPYTHON)
    53  sharedmods: $(BUILDPYTHON)
    55 -	@case $$MAKEFLAGS in \
    54 -	@case $$MAKEFLAGS in \
    56 -	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
    55 -	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
    57 -	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
    56 -	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
    58 -	esac
    57 -	esac
    59 +	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build
    58 +	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build
    60  
    59  
    61  # Build static library
    60  # Build static library
    62  # avoid long command lines, same as LIBRARY_OBJS
    61  # avoid long command lines, same as LIBRARY_OBJS
    63 @@ -1168,12 +1174,13 @@
    62 @@ -1170,6 +1176,7 @@
    64  clean: pycremoval
    63  clean: pycremoval
    65  	find . -name '*.o' -exec rm -f {} ';'
    64  	find . -name '*.[oa]' -exec rm -f {} ';'
    66  	find . -name '*.s[ol]' -exec rm -f {} ';'
    65  	find . -name '*.s[ol]' -exec rm -f {} ';'
    67 +	find . -name '*.s[ol].*' -exec rm -f {} ';'
    66 +	find . -name '*.s[ol].*' -exec rm -f {} ';'
    68  	find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
    67  	find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
    69  	find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
    68  	find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
    70  	-rm -f Lib/lib2to3/*Grammar*.pickle
    69  	find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
       
    70 @@ -1177,6 +1184,7 @@
    71  
    71  
    72  profile-removal:
    72  profile-removal:
    73 -	find . -name '*.gc??' -exec rm -f {} ';'
    73  	find . -name '*.gc??' -exec rm -f {} ';'
    74 +	find . -name '.profile' -exec rm -rf {} ';'
    74 +	find . -name '.profile' -exec rm -rf {} ';'
    75  
    75  
    76  clobber: clean profile-removal
    76  clobber: clean profile-removal
    77  	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
    77  	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \