@@ -150,6 +150,8 @@ CONFINCLUDEDIR= $(exec_prefix)/include
150150PLATLIBDIR= @PLATLIBDIR@
151151SCRIPTDIR= $(prefix)/$(PLATLIBDIR)
152152ABIFLAGS= @ABIFLAGS@
153+ # executable name for shebangs
154+ EXENAME= $(BINDIR)/python$(LDVERSION)$(EXE)
153155# Variable used by ensurepip
154156WHEEL_PKG_DIR= @WHEEL_PKG_DIR@
155157
@@ -580,7 +582,7 @@ LIBEXPAT_HEADERS= \
580582# Default target
581583all: @DEF_MAKE_ALL_RULE@
582584build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \
583- gdbhooks Programs/_testembed python-config
585+ gdbhooks Programs/_testembed scripts
584586build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
585587
586588# Check that the source is clean when building out of source.
@@ -2111,7 +2113,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
21112113python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
21122114 @ # Substitution happens here, as the completely-expanded BINDIR
21132115 @ # is not available in configure
2114- sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE )," < $(srcdir)/Misc/python-config.in >python-config.py
2116+ sed -e "s,@EXENAME@,$(EXENAME )," < $(srcdir)/Misc/python-config.in >python-config.py
21152117 @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
21162118 LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config
21172119 @ # On Darwin, always use the python version of the script, the shell
@@ -2121,6 +2123,29 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
21212123 cp python-config.py python-config; \
21222124 fi
21232125
2126+ # macOS' make seems to ignore a dependency on a
2127+ # "$(BUILD_SCRIPTS_DIR): $(MKDIR_P) $@" rule.
2128+ BUILD_SCRIPTS_DIR=build/scripts-$(VERSION)
2129+ SCRIPT_2TO3=$(BUILD_SCRIPTS_DIR)/2to3-$(VERSION)
2130+ SCRIPT_IDLE=$(BUILD_SCRIPTS_DIR)/idle$(VERSION)
2131+ SCRIPT_PYDOC=$(BUILD_SCRIPTS_DIR)/pydoc$(VERSION)
2132+
2133+ $(SCRIPT_2TO3): $(srcdir)/Tools/scripts/2to3
2134+ @$(MKDIR_P) $(BUILD_SCRIPTS_DIR)
2135+ sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/2to3 > $@
2136+ @chmod +x $@
2137+
2138+ $(SCRIPT_IDLE): $(srcdir)/Tools/scripts/idle3
2139+ @$(MKDIR_P) $(BUILD_SCRIPTS_DIR)
2140+ sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/idle3 > $@
2141+ @chmod +x $@
2142+
2143+ $(SCRIPT_PYDOC): $(srcdir)/Tools/scripts/pydoc3
2144+ @$(MKDIR_P) $(BUILD_SCRIPTS_DIR)
2145+ sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/pydoc3 > $@
2146+ @chmod +x $@
2147+
2148+ scripts: $(SCRIPT_2TO3) $(SCRIPT_IDLE) $(SCRIPT_PYDOC) python-config
21242149
21252150# Install the include files
21262151INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
@@ -2167,7 +2192,7 @@ LIBPL= @LIBPL@
21672192# pkgconfig directory
21682193LIBPC= $(LIBDIR)/pkgconfig
21692194
2170- libainstall: all python-config
2195+ libainstall: all scripts
21712196 @for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \
21722197 do \
21732198 if test ! -d $(DESTDIR)$$i; then \
@@ -2203,6 +2228,9 @@ libainstall: all python-config
22032228 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
22042229 $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
22052230 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
2231+ $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION)
2232+ $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
2233+ $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
22062234 @if [ -s Modules/python.exp -a \
22072235 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
22082236 echo; echo "Installing support files for building shared extension modules on AIX:"; \
@@ -2512,7 +2540,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
25122540.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
25132541.PHONY: clean-retain-profile profile-removal run_profile_task
25142542.PHONY: build_all_generate_profile build_all_merge_profile
2515- .PHONY: gdbhooks
2543+ .PHONY: gdbhooks scripts
25162544
25172545##########################################################################
25182546# Module dependencies and platform-specific files
0 commit comments