Alexander Pyhalov
2014-06-03 5b32294b234fc458d5c2b191b507ab602273e72a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
This changes Python's standard profile-guided build target to work with
Studio instead of gcc.  The unfortunate repetition of options seen below
is a workaround for build peculiarities and to meet Studio's requirement
that the profiling options be used at all steps of the build -- not just
compilation.  As it is Solaris-specific, it is not suitable for upstream.
 
--- Python-3.4.0/Makefile.pre.in.~2~    2014-03-19 10:42:20.230354945 -0700
+++ Python-3.4.0/Makefile.pre.in    2014-03-19 10:42:20.412767814 -0700
@@ -472,30 +472,39 @@
 profile-opt:
     @echo "Building with support for profile generation:"
     $(MAKE) clean
+    $(MAKE) profile-removal
     $(MAKE) build_all_generate_profile
     @echo "Running benchmark to generate profile data:"
-    $(MAKE) profile-removal
     $(MAKE) run_profile_task
     @echo "Rebuilding with profile guided optimizations:"
     $(MAKE) clean
     $(MAKE) build_all_use_profile
 
 build_all_generate_profile:
-    $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
+    $(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
+        CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
+        LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
+        BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
 
 run_profile_task:
     : # FIXME: can't run for a cross build
-    $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
+    LD_LIBRARY_PATH=. $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
 
 build_all_use_profile:
-    $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use -fprofile-correction"
+    $(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
+        CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
+        LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
+        BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
 
 # Compile and run with gcov
 .PHONY=coverage coverage-lcov coverage-report
 coverage:
     @echo "Building with support for coverage checking:"
     $(MAKE) clean profile-removal
-    $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
+    $(MAKE) all CC="$(CC) -xprofile=tcov" \
+        CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
+        LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
+        BLDSHARED="$(BLDSHARED) -xprofile=tcov"
 
 coverage-lcov:
     @echo "Creating Coverage HTML report with LCOV:"
@@ -556,13 +565,9 @@
 # -s, --silent or --quiet is always the first char.
 # Under BSD make, MAKEFLAGS might be " -s -v x=y".
 sharedmods: $(BUILDPYTHON) pybuilddir.txt
-    @case "$$MAKEFLAGS" in \
-        *\ -s*|s*) quiet="-q";; \
-        *) quiet="";; \
-    esac; \
     $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
         _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
-        $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+        $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build
 
 # Build static library
 # avoid long command lines, same as LIBRARY_OBJS
@@ -1575,7 +1580,7 @@
     -rm -f Modules/_testembed Modules/_freeze_importlib
 
 profile-removal:
-    find . -name '*.gc??' -exec rm -f {} ';'
+    find . -name '*profile' -exec rm -f {} ';'
     rm -f $(COVERAGE_INFO)
     rm -rf $(COVERAGE_REPORT)