diff -r 208d6d14c2a3 Makefile.pre.in
--- a/Makefile.pre.in	Thu Aug 13 21:52:56 2015 -0700
+++ b/Makefile.pre.in	Fri Aug 21 17:45:21 2015 +0300
@@ -204,8 +204,8 @@
 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
 
 # === Definitions added by makesetup ===
 
@@ -417,35 +417,38 @@
 # Rules
 
 # Default target
-all:		build_all
+all:		profile-opt
+disable-profile-opt: build_all
 build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
 
 # Compile a binary with gcc profile guided optimization.
-profile-opt:
+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
+	$(MAKE) run_profile_task	
 	@echo "Rebuilding with profile guided optimizations:"
 	$(MAKE) clean
 	$(MAKE) build_all_use_profile
+	$(MAKE) profile-removal
 
 build_all_generate_profile:
-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
+	$(MAKE) build_all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
 
 run_profile_task:
 	: # FIXME: can't run for a cross build
-	./$(BUILDPYTHON) $(PROFILE_TASK)
+	./$(BUILDPYTHON) $(PROFILE_TASK) || true
 
 build_all_use_profile:
-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
+	$(MAKE) build_all CFLAGS="$(CFLAGS) -fprofile-use -fprofile-correction"
 
 coverage:
 	@echo "Building with support for coverage checking:"
 	$(MAKE) clean
-	$(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"
 
 
 # Build the interpreter
