Skip to content

Commit a473a73

Browse files
torsavavstinner
authored andcommitted
[2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478) (#1522)
* 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 a1054c3)
1 parent 453a685 commit a473a73

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Makefile.pre.in

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,12 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
844844
TESTOPTS= -l $(EXTRATESTOPTS)
845845
TESTPROG= $(srcdir)/Lib/test/regrtest.py
846846
TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
847-
test: all platform
847+
test: @DEF_MAKE_RULE@ platform
848848
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
849849
-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
850850
$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
851851

852-
testall: all platform
852+
testall: @DEF_MAKE_RULE@ platform
853853
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
854854
$(TESTPYTHON) $(srcdir)/Lib/compileall.py
855855
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
@@ -858,7 +858,7 @@ testall: all platform
858858

859859
# Run the unitests for both architectures in a Universal build on OSX
860860
# Must be run on an Intel box.
861-
testuniversal: all platform
861+
testuniversal: @DEF_MAKE_RULE@ platform
862862
if [ `arch` != 'i386' ];then \
863863
echo "This can only be used on OSX/i386" ;\
864864
exit 1 ;\
@@ -881,14 +881,14 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
881881
test_multibytecodec test_urllib2_localnet test_itertools \
882882
test_multiprocessing test_mailbox test_socket test_poll \
883883
test_select test_zipfile
884-
quicktest: all platform
884+
quicktest: @DEF_MAKE_RULE@ platform
885885
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
886886
-$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
887887
$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
888888

889889
MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
890890
test_longexp
891-
memtest: all platform
891+
memtest: @DEF_MAKE_RULE@ platform
892892
-rm -f $(srcdir)/Lib/test/*.py[co]
893893
-$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
894894
$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
@@ -1179,7 +1179,7 @@ LIBPL= $(LIBP)/config
11791179
# pkgconfig directory
11801180
LIBPC= $(LIBDIR)/pkgconfig
11811181

1182-
libainstall: all python-config
1182+
libainstall: @DEF_MAKE_RULE@ python-config
11831183
@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
11841184
do \
11851185
if test ! -d $(DESTDIR)$$i; then \
@@ -1417,7 +1417,7 @@ distclean: clobber
14171417
-exec rm -f {} ';'
14181418

14191419
# Check for smelly exported symbols (not starting with Py/_Py)
1420-
smelly: all
1420+
smelly: @DEF_MAKE_RULE@
14211421
nm -p $(LIBRARY) | \
14221422
sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
14231423

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ Jason Orendorff
10261026
Douglas Orr
10271027
William Orr
10281028
Michele Orrù
1029+
Tomáš Orsava
10291030
Oleg Oshmyan
10301031
Denis S. Otkidach
10311032
Peter Otten

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ Documentation
139139
Build
140140
-----
141141

142+
bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``,
143+
``make install`` and some other make targets when configured with
144+
``--enable-optimizations``.
145+
142146
- bpo-23404: Don't regenerate generated files based on file modification time
143147
anymore: the action is now explicit. Replace ``make touch`` with
144148
``make regen-all``.

0 commit comments

Comments
 (0)