[3.5] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478) (#1520)
* bpo-29243: Fix Makefile with respect to --enable-optimizations
When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.
Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.
* !squash.
(cherry picked from commit
a1054c3b0037d4c2a5492e79fc193f36245366c7)