@@ -461,7 +461,7 @@ check-clean-src:
461
461
462
462
# Profile generation build must start from a clean tree.
463
463
profile-clean-stamp:
464
- $(MAKE) clean profile-removal
464
+ $(MAKE) clean
465
465
touch $@
466
466
467
467
# Compile with profile generation enabled.
@@ -485,7 +485,7 @@ profile-run-stamp:
485
485
$(MAKE) run_profile_task
486
486
$(MAKE) build_all_merge_profile
487
487
# Remove profile generation binary since we are done with it.
488
- $(MAKE) clean
488
+ $(MAKE) clean-retain-profile
489
489
# This is an expensive target to build and it does not have proper
490
490
# makefile dependency information. So, we create a "stamp" file
491
491
# to record its completion and avoid re-running it.
@@ -512,7 +512,7 @@ profile-opt: profile-run-stamp
512
512
.PHONY=coverage coverage-lcov coverage-report
513
513
coverage:
514
514
@echo "Building with support for coverage checking:"
515
- $(MAKE) clean profile-removal
515
+ $(MAKE) clean
516
516
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
517
517
518
518
coverage-lcov:
@@ -1752,7 +1752,9 @@ docclean:
1752
1752
-rm -rf Doc/build
1753
1753
-rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1754
1754
1755
- clean: pycremoval
1755
+ # like the 'clean' target but retain the profile guided optimization (PGO)
1756
+ # data. The PGO data is only valid if source code remains unchanged.
1757
+ clean-retain-profile: pycremoval
1756
1758
find . -name '*.[oa]' -exec rm -f {} ';'
1757
1759
find . -name '*.s[ol]' -exec rm -f {} ';'
1758
1760
find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
@@ -1774,14 +1776,19 @@ profile-removal:
1774
1776
rm -rf $(COVERAGE_REPORT)
1775
1777
rm -f profile-run-stamp
1776
1778
1777
- clobber: clean profile-removal
1779
+ clean: clean-retain-profile
1780
+ @if test @DEF_MAKE_ALL_RULE@ = profile-opt; then \
1781
+ rm -f profile-gen-stamp profile-clean-stamp; \
1782
+ $(MAKE) profile-removal; \
1783
+ fi
1784
+
1785
+ clobber: clean
1778
1786
-rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1779
1787
tags TAGS \
1780
1788
config.cache config.log pyconfig.h Modules/config.c
1781
1789
-rm -rf build platform
1782
1790
-rm -rf $(PYTHONFRAMEWORKDIR)
1783
1791
-rm -f python-config.py python-config
1784
- -rm -f profile-gen-stamp profile-clean-stamp
1785
1792
1786
1793
# Make things extra clean, before making a distribution:
1787
1794
# remove all generated files, even Makefile[.pre]
@@ -1855,6 +1862,8 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
1855
1862
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1856
1863
.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
1857
1864
.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
1865
+ .PHONY: clean-retain-profile profile-removal run_profile_task
1866
+ .PHONY: build_all_generate_profile build_all_merge_profile
1858
1867
.PHONY: gdbhooks
1859
1868
1860
1869
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
0 commit comments