diff -r f5c40ab9e233 Makefile.pre.in
--- a/Makefile.pre.in	Tue Aug 18 22:25:16 2015 -0700
+++ b/Makefile.pre.in	Fri Aug 21 17:45:49 2015 +0300
@@ -226,8 +226,9 @@
 TCLTK_LIBS=	@TCLTK_LIBS@
 
 # The task to run while instrument when building the profile-opt target
-PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
-#PROFILE_TASK=	$(srcdir)/Lib/test/regrtest.py
+#PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
+PROFILE_TASK=	$(srcdir)/Lib/test/regrtest.py -x test_hashlib
+
 
 # report files for gcov / lcov coverage report
 COVERAGE_INFO=	$(abs_builddir)/coverage.info
@@ -474,13 +475,15 @@
 # Rules
 
 # Default target
-all:		build_all
+all:		profile-opt
+disable-profile-opt: build_all
 build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config
 
 # Compile a binary with gcc profile guided optimization.
 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
@@ -488,23 +491,24 @@
 	@echo "Rebuilding with profile guided optimizations:"
 	$(MAKE) clean
 	$(MAKE) build_all_use_profile
+	$(MAKE) profile-removal
 
 build_all_generate_profile:
-	$(MAKE) all CFLAGS_NODIST="$(CFLAGS) -fprofile-generate" LDFLAGS="-fprofile-generate" LIBS="$(LIBS) -lgcov"
+	$(MAKE) build_all CFLAGS_NODIST="$(CFLAGS) -fprofile-generate" LDFLAGS="-fprofile-generate" LIBS="$(LIBS) -lgcov"
 
 run_profile_task:
 	: # FIXME: can't run for a cross build
-	$(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
+	$(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
 
 build_all_use_profile:
-	$(MAKE) all CFLAGS_NODIST="$(CFLAGS) -fprofile-use -fprofile-correction"
+	$(MAKE) build_all CFLAGS_NODIST="$(CFLAGS) -fprofile-use -fprofile-correction"
 
 # 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) build_all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
 
 coverage-lcov:
 	@echo "Creating Coverage HTML report with LCOV:"
