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.orig Thu Nov 3 15:14:03 2011 |
6 --- Python-2.7.6/Makefile.pre.in.~2~ 2014-05-14 13:29:26.322546831 -0700 |
7 +++ Python-2.6.4/Makefile.pre.in Thu Nov 3 15:14:11 2011 |
7 +++ Python-2.7.6/Makefile.pre.in 2014-05-14 13:32:23.601766216 -0700 |
8 @@ -360,9 +360,9 @@ |
8 @@ -413,28 +413,37 @@ |
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)" \ |
25 + CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \ |
24 + CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \ |
26 + LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \ |
25 + LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \ |
27 + BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)" |
26 + BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)" |
28 |
27 |
29 run_profile_task: |
28 run_profile_task: |
|
29 : # FIXME: can't run for a cross build |
30 - ./$(BUILDPYTHON) $(PROFILE_TASK) |
30 - ./$(BUILDPYTHON) $(PROFILE_TASK) |
31 + LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK) |
31 + LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK) |
32 |
32 |
33 build_all_use_profile: |
33 build_all_use_profile: |
34 - $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use" |
34 - $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use" |
46 + LDFLAGS="$(LDFLAGS) -xprofile=tcov" \ |
46 + LDFLAGS="$(LDFLAGS) -xprofile=tcov" \ |
47 + BLDSHARED="$(BLDSHARED) -xprofile=tcov" |
47 + BLDSHARED="$(BLDSHARED) -xprofile=tcov" |
48 |
48 |
49 |
49 |
50 # Build the interpreter |
50 # Build the interpreter |
51 @@ -395,10 +404,7 @@ |
51 @@ -1293,7 +1302,7 @@ |
52 |
|
53 # Build the shared modules |
|
54 sharedmods: $(BUILDPYTHON) |
|
55 - @case $$MAKEFLAGS in \ |
|
56 - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ |
|
57 - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ |
|
58 - esac |
|
59 + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build |
|
60 |
|
61 # Build static library |
|
62 # avoid long command lines, same as LIBRARY_OBJS |
|
63 @@ -1173,7 +1179,7 @@ |
|
64 -rm -f Lib/lib2to3/*Grammar*.pickle |
52 -rm -f Lib/lib2to3/*Grammar*.pickle |
65 |
53 |
66 profile-removal: |
54 profile-removal: |
67 - find . -name '*.gc??' -exec rm -f {} ';' |
55 - find . -name '*.gc??' -exec rm -f {} ';' |
68 + find . -name '.profile' -exec rm -rf {} ';' |
56 + find . -name '.profile' -exec rm -rf {} ';' |