--- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -474,7 +475,9 @@ all: @DEF_MAKE_ALL_RULE@ build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config # Compile a binary with profile guided optimization. -profile-opt: +profile-opt: profile-opt.stamp + +profile-opt.stamp: @if [ $(LLVM_PROF_ERR) = yes ]; then \ echo "Error: Cannot perform PGO build because llvm-profdata was not found in PATH" ;\ echo "Please add it to PATH and run ./configure again" ;\ @@ -492,6 +495,11 @@ profile-opt: $(MAKE) clean $(MAKE) build_all_use_profile $(MAKE) profile-removal + # This is an expensive target to build and it does not have proper + # dependancy information for "make" to figure out if it needs to + # get re-built. Instead, create a stamp file to remember that is + # is complete. Need to run "make clean" before this will be re-built. + touch $@ build_all_generate_profile: $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)" @@ -506,6 +514,10 @@ build_all_merge_profile: build_all_use_profile: $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@" +.PHONY: profile-opt build_all_generate_profile run_profile_task +.PHONY: build_all_merge_profile build_all_use_profile + + # Compile and run with gcov .PHONY=coverage coverage-lcov coverage-report coverage: @@ -1596,7 +1608,7 @@ clean: pycremoval find build -name 'fficonfig.h' -exec rm -f {} ';' || true find build -name '*.py' -exec rm -f {} ';' || true find build -name '*.py[co]' -exec rm -f {} ';' || true - -rm -f pybuilddir.txt + -rm -f pybuilddir.txt profile-opt.stamp -rm -f Lib/lib2to3/*Grammar*.pickle -rm -f Programs/_testembed Programs/_freeze_importlib -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'