@@ -150,6 +150,8 @@ CONFINCLUDEDIR= $(exec_prefix)/include
150
150
PLATLIBDIR= @PLATLIBDIR@
151
151
SCRIPTDIR= $(prefix)/$(PLATLIBDIR)
152
152
ABIFLAGS= @ABIFLAGS@
153
+ # executable name for shebangs
154
+ EXENAME= $(BINDIR)/python$(LDVERSION)$(EXE)
153
155
# Variable used by ensurepip
154
156
WHEEL_PKG_DIR= @WHEEL_PKG_DIR@
155
157
@@ -580,7 +582,7 @@ LIBEXPAT_HEADERS= \
580
582
# Default target
581
583
all: @DEF_MAKE_ALL_RULE@
582
584
build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \
583
- gdbhooks Programs/_testembed python-config
585
+ gdbhooks Programs/_testembed scripts
584
586
build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
585
587
586
588
# Check that the source is clean when building out of source.
@@ -2111,7 +2113,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
2111
2113
python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
2112
2114
@ # Substitution happens here, as the completely-expanded BINDIR
2113
2115
@ # 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
2115
2117
@ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
2116
2118
LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config
2117
2119
@ # 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
2121
2123
cp python-config.py python-config; \
2122
2124
fi
2123
2125
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
2124
2149
2125
2150
# Install the include files
2126
2151
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
@@ -2167,7 +2192,7 @@ LIBPL= @LIBPL@
2167
2192
# pkgconfig directory
2168
2193
LIBPC= $(LIBDIR)/pkgconfig
2169
2194
2170
- libainstall: all python-config
2195
+ libainstall: all scripts
2171
2196
@for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \
2172
2197
do \
2173
2198
if test ! -d $(DESTDIR)$$i; then \
@@ -2203,6 +2228,9 @@ libainstall: all python-config
2203
2228
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
2204
2229
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
2205
2230
$(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)
2206
2234
@if [ -s Modules/python.exp -a \
2207
2235
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
2208
2236
echo; echo "Installing support files for building shared extension modules on AIX:"; \
@@ -2512,7 +2540,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
2512
2540
.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
2513
2541
.PHONY: clean-retain-profile profile-removal run_profile_task
2514
2542
.PHONY: build_all_generate_profile build_all_merge_profile
2515
- .PHONY: gdbhooks
2543
+ .PHONY: gdbhooks scripts
2516
2544
2517
2545
##########################################################################
2518
2546
# Module dependencies and platform-specific files
0 commit comments