components/python/python35/patches/05-studio-profile.patch
changeset 4912 0b79e9575718
child 5184 6c2a9525f3a4
equal deleted inserted replaced
4911:6590570733a1 4912:0b79e9575718
       
     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.  As it is Solaris-specific, it is not suitable for upstream.
       
     6 
       
     7 --- Python-3.5.0rc2/Makefile.pre.in.~2~	2015-09-02 11:35:43.321886346 -0700
       
     8 +++ Python-3.5.0rc2/Makefile.pre.in	2015-09-02 11:35:43.430843102 -0700
       
     9 @@ -488,30 +488,39 @@
       
    10  profile-opt:
       
    11  	@echo "Building with support for profile generation:"
       
    12  	$(MAKE) clean
       
    13 +	$(MAKE) profile-removal
       
    14  	$(MAKE) build_all_generate_profile
       
    15  	@echo "Running benchmark to generate profile data:"
       
    16 -	$(MAKE) profile-removal
       
    17  	$(MAKE) run_profile_task
       
    18  	@echo "Rebuilding with profile guided optimizations:"
       
    19  	$(MAKE) clean
       
    20  	$(MAKE) build_all_use_profile
       
    21  
       
    22  build_all_generate_profile:
       
    23 -	$(MAKE) all CFLAGS_NODIST="$(CFLAGS) -fprofile-generate" LDFLAGS="-fprofile-generate" LIBS="$(LIBS) -lgcov"
       
    24 +	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
       
    25 +	    CFLAGS_NODIST="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
       
    26 +	    LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
       
    27 +	    BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
       
    28  
       
    29  run_profile_task:
       
    30  	: # FIXME: can't run for a cross build
       
    31 -	$(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
       
    32 +	LD_LIBRARY_PATH=. $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
       
    33  
       
    34  build_all_use_profile:
       
    35 -	$(MAKE) all CFLAGS_NODIST="$(CFLAGS) -fprofile-use -fprofile-correction"
       
    36 +	$(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
       
    37 +	    CFLAGS_NODIST="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
       
    38 +	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
       
    39 +	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
       
    40  
       
    41  # Compile and run with gcov
       
    42  .PHONY=coverage coverage-lcov coverage-report
       
    43  coverage:
       
    44  	@echo "Building with support for coverage checking:"
       
    45  	$(MAKE) clean profile-removal
       
    46 -	$(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
       
    47 +	$(MAKE) all CC="$(CC) -xprofile=tcov" \
       
    48 +	    CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
       
    49 +	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
       
    50 +	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
       
    51  
       
    52  coverage-lcov:
       
    53  	@echo "Creating Coverage HTML report with LCOV:"
       
    54 @@ -583,13 +592,9 @@
       
    55  # -s, --silent or --quiet is always the first char.
       
    56  # Under BSD make, MAKEFLAGS might be " -s -v x=y".
       
    57  sharedmods: $(BUILDPYTHON) pybuilddir.txt
       
    58 -	@case "$$MAKEFLAGS" in \
       
    59 -	    *\ -s*|s*) quiet="-q";; \
       
    60 -	    *) quiet="";; \
       
    61 -	esac; \
       
    62  	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
       
    63  		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
       
    64 -		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
       
    65 +		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py build
       
    66  
       
    67  # Build static library
       
    68  # avoid long command lines, same as LIBRARY_OBJS
       
    69 @@ -1627,7 +1632,7 @@
       
    70  	-rm -f Programs/_testembed Programs/_freeze_importlib
       
    71  
       
    72  profile-removal:
       
    73 -	find . -name '*.gc??' -exec rm -f {} ';'
       
    74 +	find . -name '*profile' -exec rm -f {} ';'
       
    75  	rm -f $(COVERAGE_INFO)
       
    76  	rm -rf $(COVERAGE_REPORT)
       
    77