@@ -410,8 +410,6 @@ OBJECT_OBJS= \
410410 Objects/unicodectype.o \
411411 Objects/weakrefobject.o
412412
413- SYSCONFIGDATA=$(srcdir)/Lib/_sysconfigdata.py
414-
415413##########################################################################
416414# objects that get linked into the Python library
417415LIBRARY_OBJS_OMIT_FROZEN= \
@@ -432,7 +430,7 @@ LIBRARY_OBJS= \
432430
433431# Default target
434432all: build_all
435- build_all: $(BUILDPYTHON) $(SYSCONFIGDATA) oldsharedmods sharedmods gdbhooks Modules/_testembed
433+ build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed
436434
437435# Compile a binary with gcc profile guided optimization.
438436profile-opt:
@@ -466,17 +464,19 @@ coverage:
466464$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
467465 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
468466
469- platform: $(BUILDPYTHON) $(SYSCONFIGDATA)
467+ platform: $(BUILDPYTHON) pybuilddir.txt
470468 $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
471469
472- # Generate the sysconfig build-time data
473- $(SYSCONFIGDATA): $(BUILDPYTHON)
470+ # Create build directory and generate the sysconfig build-time data there.
471+ # pybuilddir.txt contains the name of the build dir and is used for
472+ # sys.path fixup -- see Modules/getpath.c.
473+ pybuilddir.txt: $(BUILDPYTHON)
474474 $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
475475
476476# Build the shared modules
477477# MAKEFLAGS are sorted and normalized. Under GNU make the 's' for
478478# -s, --silent or --quiet is always the first char.
479- sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA)
479+ sharedmods: $(BUILDPYTHON) pybuilddir.txt
480480 @case "$$MAKEFLAGS" in \
481481 s*) quiet="-q";; \
482482 *) quiet="";; \
@@ -1043,7 +1043,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
10431043 else true; \
10441044 fi; \
10451045 done
1046- @for i in $(srcdir)/Lib/*.py ; \
1046+ @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py ; \
10471047 do \
10481048 if test -x $$i; then \
10491049 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
@@ -1203,6 +1203,8 @@ sharedinstall: sharedmods
12031203 --install-scripts=$(BINDIR) \
12041204 --install-platlib=$(DESTSHARED) \
12051205 --root=$(DESTDIR)/
1206+ -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py
1207+ -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
12061208
12071209# Here are a couple of targets for MacOSX again, to install a full
12081210# framework-based Python. frameworkinstall installs everything, the
@@ -1348,9 +1350,10 @@ clean: pycremoval
13481350 find . -name '*.s[ol]' -exec rm -f {} ';'
13491351 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
13501352 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1351- find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1353+ find build -name '*.py' -exec rm -f {} ';' || true
1354+ find build -name '*.py[co]' -exec rm -f {} ';' || true
1355+ -rm -f pybuilddir.txt
13521356 -rm -f Lib/lib2to3/*Grammar*.pickle
1353- -rm -f $(SYSCONFIGDATA)
13541357 -rm -f Modules/_testembed Modules/_freeze_importlib
13551358
13561359profile-removal:
@@ -1374,7 +1377,6 @@ distclean: clobber
13741377 Modules/Setup Modules/Setup.local Modules/Setup.config \
13751378 Modules/ld_so_aix Modules/python.exp Misc/python.pc
13761379 -rm -f python*-gdb.py
1377- -rm -f pybuilddir.txt
13781380 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
13791381 -o -name '[@,#]*' -o -name '*.old' \
13801382 -o -name '*.orig' -o -name '*.rej' \
0 commit comments