author | John Beck <John.Beck@Oracle.COM> |
Mon, 06 Feb 2017 13:54:36 -0800 | |
changeset 7648 | 20e09cf3cfaa |
parent 6447 | 56a2f066191a |
permissions | -rw-r--r-- |
4912 | 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 |
||
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
7 |
--- Python-3.5.3/Makefile.pre.in.~2~ 2017-01-17 11:10:49.856824159 +0000 |
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
8 |
+++ Python-3.5.3/Makefile.pre.in 2017-01-17 11:10:49.919768587 +0000 |
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
9 |
@@ -242,7 +242,7 @@ |
6447
56a2f066191a
23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents:
5184
diff
changeset
|
10 |
# The task to run while instrumented when building the profile-opt target. |
56a2f066191a
23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents:
5184
diff
changeset
|
11 |
# We exclude unittests with -x that take a rediculious amount of time to |
56a2f066191a
23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents:
5184
diff
changeset
|
12 |
# run in the instrumented training build or do not provide much value. |
56a2f066191a
23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents:
5184
diff
changeset
|
13 |
-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess |
5184
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
14 |
+PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck |
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
15 |
|
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
16 |
# report files for gcov / lcov coverage report |
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
17 |
COVERAGE_INFO= $(abs_builddir)/coverage.info |
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
18 |
@@ -513,24 +513,33 @@ |
5184
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
19 |
$(MAKE) profile-removal |
4912 | 20 |
|
21 |
build_all_generate_profile: |
|
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
22 |
- $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)" |
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
23 |
+ $(MAKE) @DEF_MAKE_RULE@ CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \ |
4912 | 24 |
+ CFLAGS_NODIST="$(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 |
: # FIXME: can't run for a cross build |
|
5184
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
30 |
- $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true |
4912 | 31 |
+ LD_LIBRARY_PATH=. $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) |
32 |
||
5184
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
33 |
build_all_merge_profile: |
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
34 |
$(LLVM_PROF_MERGER) |
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
35 |
|
4912 | 36 |
build_all_use_profile: |
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
37 |
- $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@" |
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
38 |
+ $(MAKE) @DEF_MAKE_RULE@ CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \ |
4912 | 39 |
+ CFLAGS_NODIST="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \ |
40 |
+ LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \ |
|
41 |
+ BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)" |
|
42 |
||
43 |
# Compile and run with gcov |
|
44 |
.PHONY=coverage coverage-lcov coverage-report |
|
45 |
coverage: |
|
46 |
@echo "Building with support for coverage checking:" |
|
47 |
$(MAKE) clean profile-removal |
|
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
48 |
- $(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov" |
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
49 |
+ $(MAKE) @DEF_MAKE_RULE@ CC="$(CC) -xprofile=tcov" \ |
4912 | 50 |
+ CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \ |
51 |
+ LDFLAGS="$(LDFLAGS) -xprofile=tcov" \ |
|
52 |
+ BLDSHARED="$(BLDSHARED) -xprofile=tcov" |
|
53 |
||
54 |
coverage-lcov: |
|
55 |
@echo "Creating Coverage HTML report with LCOV:" |
|
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
56 |
@@ -606,13 +615,9 @@ |
4912 | 57 |
# -s, --silent or --quiet is always the first char. |
58 |
# Under BSD make, MAKEFLAGS might be " -s -v x=y". |
|
6447
56a2f066191a
23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents:
5184
diff
changeset
|
59 |
sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o |
4912 | 60 |
- @case "$$MAKEFLAGS" in \ |
61 |
- *\ -s*|s*) quiet="-q";; \ |
|
62 |
- *) quiet="";; \ |
|
63 |
- esac; \ |
|
64 |
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ |
|
65 |
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ |
|
66 |
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build |
|
67 |
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build |
|
68 |
||
69 |
# Build static library |
|
70 |
# avoid long command lines, same as LIBRARY_OBJS |
|
7648
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
71 |
@@ -1656,9 +1661,7 @@ |
20e09cf3cfaa
25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents:
6447
diff
changeset
|
72 |
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';' |
4912 | 73 |
|
74 |
profile-removal: |
|
75 |
- find . -name '*.gc??' -exec rm -f {} ';' |
|
5184
6c2a9525f3a4
22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents:
4912
diff
changeset
|
76 |
- find . -name '*.profclang?' -exec rm -f {} ';' |
6447
56a2f066191a
23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents:
5184
diff
changeset
|
77 |
- find . -name '*.dyn' -exec rm -f {} ';' |
4912 | 78 |
+ find . -name '*profile' -exec rm -f {} ';' |
79 |
rm -f $(COVERAGE_INFO) |
|
80 |
rm -rf $(COVERAGE_REPORT) |
|
81 |