@@ -90,6 +90,9 @@ CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@
90
90
# Use it when a linker flag should _not_ be part of the distutils LDFLAGS
91
91
# once Python is installed (bpo-35257)
92
92
CONFIGURE_LDFLAGS_NODIST=@LDFLAGS_NODIST@
93
+ # LDFLAGS_NOLTO is an extra flag to disable lto. It is used to speed up building
94
+ # of _bootstrap_python and _freeze_module tools, which don't need LTO.
95
+ CONFIGURE_LDFLAGS_NOLTO=@LDFLAGS_NOLTO@
93
96
CONFIGURE_CPPFLAGS= @CPPFLAGS@
94
97
CONFIGURE_LDFLAGS= @LDFLAGS@
95
98
# Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
@@ -103,6 +106,7 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include
103
106
PY_CPPFLAGS= $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
104
107
PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
105
108
PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
109
+ PY_LDFLAGS_NOLTO=$(PY_LDFLAGS) $(CONFIGURE_LDFLAGS_NOLTO) $(LDFLAGS_NODIST)
106
110
NO_AS_NEEDED= @NO_AS_NEEDED@
107
111
CCSHARED= @CCSHARED@
108
112
# LINKFORSHARED are the flags passed to the $(CC) command that links
@@ -279,6 +283,9 @@ BUILDPYTHON= python$(BUILDEXE)
279
283
PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
280
284
UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
281
285
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
286
+ # Standard builds use _bootstrap_python for freezing, cross compiling
287
+ # uses build Python, which must have the same version and bytecode,
288
+ PYTHON_FOR_FREEZE?=@PYTHON_FOR_FREEZE@
282
289
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
283
290
BUILD_GNU_TYPE= @build@
284
291
HOST_GNU_TYPE= @host@
@@ -938,75 +945,88 @@ regen-test-frozenmain: $(BUILDPYTHON)
938
945
Programs/_testembed: Programs/_testembed.o $(LIBRARY_DEPS)
939
946
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
940
947
948
+ ############################################################################
949
+ # "Bootstrap Python" used to run deepfreeze.py
950
+
951
+ BOOTSTRAP_HEADERS = \
952
+ Python/frozen_modules/importlib._bootstrap.h \
953
+ Python/frozen_modules/importlib._bootstrap_external.h
954
+
955
+ Programs/_bootstrap_python.o: Programs/_bootstrap_python.c $(BOOTSTRAP_HEADERS) $(PYTHON_HEADERS)
956
+
957
+ _bootstrap_python: $(LIBRARY_OBJS_OMIT_FROZEN) Programs/_bootstrap_python.o Modules/getpath.o Modules/Setup.local
958
+ $(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \
959
+ Programs/_bootstrap_python.o Modules/getpath.o $(LIBS) $(MODLIBS) $(SYSLIBS)
960
+
941
961
############################################################################
942
962
# Deepfreeze targets
943
963
944
964
.PHONY: regen-deepfreeze
945
965
regen-deepfreeze: $(DEEPFREEZE_OBJS)
946
966
947
- DEEPFREEZE_DEPS=$(srcdir)/Tools/scripts/deepfreeze.py
967
+ DEEPFREEZE_DEPS=$(srcdir)/Tools/scripts/deepfreeze.py _bootstrap_python
948
968
949
969
# BEGIN: deepfreeze modules
950
970
951
971
Python/deepfreeze/importlib._bootstrap.c: Python/frozen_modules/importlib._bootstrap.h $(DEEPFREEZE_DEPS)
952
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib._bootstrap.h -m importlib._bootstrap -o Python/deepfreeze/importlib._bootstrap.c
972
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib._bootstrap.h -m importlib._bootstrap -o Python/deepfreeze/importlib._bootstrap.c
953
973
954
974
Python/deepfreeze/importlib._bootstrap_external.c: Python/frozen_modules/importlib._bootstrap_external.h $(DEEPFREEZE_DEPS)
955
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib._bootstrap_external.h -m importlib._bootstrap_external -o Python/deepfreeze/importlib._bootstrap_external.c
975
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/importlib._bootstrap_external.h -m importlib._bootstrap_external -o Python/deepfreeze/importlib._bootstrap_external.c
956
976
957
977
Python/deepfreeze/zipimport.c: Python/frozen_modules/zipimport.h $(DEEPFREEZE_DEPS)
958
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/zipimport.h -m zipimport -o Python/deepfreeze/zipimport.c
978
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/zipimport.h -m zipimport -o Python/deepfreeze/zipimport.c
959
979
960
980
Python/deepfreeze/abc.c: Python/frozen_modules/abc.h $(DEEPFREEZE_DEPS)
961
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/abc.h -m abc -o Python/deepfreeze/abc.c
981
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/abc.h -m abc -o Python/deepfreeze/abc.c
962
982
963
983
Python/deepfreeze/codecs.c: Python/frozen_modules/codecs.h $(DEEPFREEZE_DEPS)
964
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/codecs.h -m codecs -o Python/deepfreeze/codecs.c
984
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/codecs.h -m codecs -o Python/deepfreeze/codecs.c
965
985
966
986
Python/deepfreeze/io.c: Python/frozen_modules/io.h $(DEEPFREEZE_DEPS)
967
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/io.h -m io -o Python/deepfreeze/io.c
987
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/io.h -m io -o Python/deepfreeze/io.c
968
988
969
989
Python/deepfreeze/_collections_abc.c: Python/frozen_modules/_collections_abc.h $(DEEPFREEZE_DEPS)
970
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/_collections_abc.h -m _collections_abc -o Python/deepfreeze/_collections_abc.c
990
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/_collections_abc.h -m _collections_abc -o Python/deepfreeze/_collections_abc.c
971
991
972
992
Python/deepfreeze/_sitebuiltins.c: Python/frozen_modules/_sitebuiltins.h $(DEEPFREEZE_DEPS)
973
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/_sitebuiltins.h -m _sitebuiltins -o Python/deepfreeze/_sitebuiltins.c
993
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/_sitebuiltins.h -m _sitebuiltins -o Python/deepfreeze/_sitebuiltins.c
974
994
975
995
Python/deepfreeze/genericpath.c: Python/frozen_modules/genericpath.h $(DEEPFREEZE_DEPS)
976
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/genericpath.h -m genericpath -o Python/deepfreeze/genericpath.c
996
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/genericpath.h -m genericpath -o Python/deepfreeze/genericpath.c
977
997
978
998
Python/deepfreeze/ntpath.c: Python/frozen_modules/ntpath.h $(DEEPFREEZE_DEPS)
979
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/ntpath.h -m ntpath -o Python/deepfreeze/ntpath.c
999
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/ntpath.h -m ntpath -o Python/deepfreeze/ntpath.c
980
1000
981
1001
Python/deepfreeze/posixpath.c: Python/frozen_modules/posixpath.h $(DEEPFREEZE_DEPS)
982
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/posixpath.h -m posixpath -o Python/deepfreeze/posixpath.c
1002
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/posixpath.h -m posixpath -o Python/deepfreeze/posixpath.c
983
1003
984
1004
Python/deepfreeze/os.c: Python/frozen_modules/os.h $(DEEPFREEZE_DEPS)
985
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/os.h -m os -o Python/deepfreeze/os.c
1005
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/os.h -m os -o Python/deepfreeze/os.c
986
1006
987
1007
Python/deepfreeze/site.c: Python/frozen_modules/site.h $(DEEPFREEZE_DEPS)
988
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/site.h -m site -o Python/deepfreeze/site.c
1008
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/site.h -m site -o Python/deepfreeze/site.c
989
1009
990
1010
Python/deepfreeze/stat.c: Python/frozen_modules/stat.h $(DEEPFREEZE_DEPS)
991
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/stat.h -m stat -o Python/deepfreeze/stat.c
1011
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/stat.h -m stat -o Python/deepfreeze/stat.c
992
1012
993
1013
Python/deepfreeze/__hello__.c: Python/frozen_modules/__hello__.h $(DEEPFREEZE_DEPS)
994
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__hello__.h -m __hello__ -o Python/deepfreeze/__hello__.c
1014
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__hello__.h -m __hello__ -o Python/deepfreeze/__hello__.c
995
1015
996
1016
Python/deepfreeze/__phello__.c: Python/frozen_modules/__phello__.h $(DEEPFREEZE_DEPS)
997
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.h -m __phello__ -o Python/deepfreeze/__phello__.c
1017
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.h -m __phello__ -o Python/deepfreeze/__phello__.c
998
1018
999
1019
Python/deepfreeze/__phello__.ham.c: Python/frozen_modules/__phello__.ham.h $(DEEPFREEZE_DEPS)
1000
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.ham.h -m __phello__.ham -o Python/deepfreeze/__phello__.ham.c
1020
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.ham.h -m __phello__.ham -o Python/deepfreeze/__phello__.ham.c
1001
1021
1002
1022
Python/deepfreeze/__phello__.ham.eggs.c: Python/frozen_modules/__phello__.ham.eggs.h $(DEEPFREEZE_DEPS)
1003
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.ham.eggs.h -m __phello__.ham.eggs -o Python/deepfreeze/__phello__.ham.eggs.c
1023
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.ham.eggs.h -m __phello__.ham.eggs -o Python/deepfreeze/__phello__.ham.eggs.c
1004
1024
1005
1025
Python/deepfreeze/__phello__.spam.c: Python/frozen_modules/__phello__.spam.h $(DEEPFREEZE_DEPS)
1006
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.spam.h -m __phello__.spam -o Python/deepfreeze/__phello__.spam.c
1026
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/__phello__.spam.h -m __phello__.spam -o Python/deepfreeze/__phello__.spam.c
1007
1027
1008
1028
Python/deepfreeze/frozen_only.c: Python/frozen_modules/frozen_only.h $(DEEPFREEZE_DEPS)
1009
- $(PYTHON_FOR_REGEN ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/frozen_only.h -m frozen_only -o Python/deepfreeze/frozen_only.c
1029
+ $(PYTHON_FOR_FREEZE ) $(srcdir)/Tools/scripts/deepfreeze.py Python/frozen_modules/frozen_only.h -m frozen_only -o Python/deepfreeze/frozen_only.c
1010
1030
1011
1031
# END: deepfreeze modules
1012
1032
@@ -2295,6 +2315,7 @@ clean-retain-profile: pycremoval
2295
2315
find build -name '*.py[co]' -exec rm -f {} ';' || true
2296
2316
-rm -f pybuilddir.txt
2297
2317
-rm -f Lib/lib2to3/*Grammar*.pickle
2318
+ -rm -f _bootstrap_python
2298
2319
-rm -f Programs/_testembed Programs/_freeze_module
2299
2320
-rm -f Python/deepfreeze/*.[co]
2300
2321
-rm -f Python/frozen_modules/*.h
0 commit comments