]> git.ipfire.org Git - thirdparty/Python/cpython.git/blame - Makefile.pre.in
GH-111843: Tier 2 exponential backoff (GH-111850)
[thirdparty/Python/cpython.git] / Makefile.pre.in
CommitLineData
85515ad9 1# Top-level Makefile for Python
7cb32ae7 2#
85515ad9
NS
3# As distributed, this file is called Makefile.pre.in; it is processed
4# into the real Makefile by running the script ./configure, which
5# replaces things like @spam@ with values appropriate for your system.
6# This means that if you edit Makefile, your changes get lost the next
7# time you run the configure script. Ideally, you can do:
7cb32ae7 8#
85515ad9
NS
9# ./configure
10# make
11# make test
12# make install
7cb32ae7 13#
85515ad9
NS
14# If you have a previous version of Python installed that you don't
15# want to overwrite, you can use "make altinstall" instead of "make
2b2681ac
NS
16# install". Refer to the "Installing" section in the README file for
17# additional details.
7cb32ae7 18#
85515ad9
NS
19# See also the section "Build instructions" in the README file.
20
21# === Variables set by makesetup ===
22
c0364fc7 23MODBUILT_NAMES= _MODBUILT_NAMES_
b5ee7949 24MODSHARED_NAMES= _MODSHARED_NAMES_
c0364fc7 25MODDISABLED_NAMES= _MODDISABLED_NAMES_
26MODOBJS= _MODOBJS_
27MODLIBS= _MODLIBS_
85515ad9
NS
28
29# === Variables set by configure
30VERSION= @VERSION@
31srcdir= @srcdir@
32VPATH= @srcdir@
739fc541
TN
33abs_srcdir= @abs_srcdir@
34abs_builddir= @abs_builddir@
9effe699 35
85515ad9
NS
36
37CC= @CC@
38CXX= @CXX@
39LINKCC= @LINKCC@
40AR= @AR@
5d9762e7 41READELF= @READELF@
0d169ea4 42SOABI= @SOABI@
8cf4eae5 43LDVERSION= @LDVERSION@
254b309c 44LIBPYTHON= @LIBPYTHON@
5c4b0d06
ND
45GITVERSION= @GITVERSION@
46GITTAG= @GITTAG@
47GITBRANCH= @GITBRANCH@
7188a3ef
BC
48PGO_PROF_GEN_FLAG=@PGO_PROF_GEN_FLAG@
49PGO_PROF_USE_FLAG=@PGO_PROF_USE_FLAG@
50LLVM_PROF_MERGER=@LLVM_PROF_MERGER@
51LLVM_PROF_FILE=@LLVM_PROF_FILE@
52LLVM_PROF_ERR=@LLVM_PROF_ERR@
a785c87d
ŁL
53DTRACE= @DTRACE@
54DFLAGS= @DFLAGS@
55DTRACE_HEADERS= @DTRACE_HEADERS@
56DTRACE_OBJS= @DTRACE_OBJS@
5b070c0d
PGS
57DSYMUTIL= @DSYMUTIL@
58DSYMUTIL_PATH= @DSYMUTIL_PATH@
85515ad9 59
0d169ea4 60GNULD= @GNULD@
be720e03 61
85515ad9 62# Shell used by make (some versions default to the login shell, which is bad)
a90863c9 63SHELL= /bin/sh -e
85515ad9
NS
64
65# Use this to make a link between python$(VERSION) and python in $(BINDIR)
66LN= @LN@
67
68# Portable install script (configure doesn't always guess right)
69INSTALL= @INSTALL@
70INSTALL_PROGRAM=@INSTALL_PROGRAM@
3f5cc208 71INSTALL_SCRIPT= @INSTALL_SCRIPT@
85515ad9
NS
72INSTALL_DATA= @INSTALL_DATA@
73# Shared libraries must be installed with executable mode on some systems;
74# rather than figuring out exactly which, we always give them executable mode.
25648d05 75INSTALL_SHARED= ${INSTALL} -m 755
85515ad9 76
93a0ef16
MK
77MKDIR_P= @MKDIR_P@
78
85515ad9
NS
79MAKESETUP= $(srcdir)/Modules/makesetup
80
81# Compiler options
82OPT= @OPT@
decc6a47 83BASECFLAGS= @BASECFLAGS@
9effe699 84BASECPPFLAGS= @BASECPPFLAGS@
d4fcdb1e 85CONFIGURE_CFLAGS= @CFLAGS@
acb8c523
BP
86# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions.
87# Use it when a compiler flag should _not_ be part of the distutils CFLAGS
88# once Python is installed (Issue #21121).
89CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@
cf10a750 90# LDFLAGS_NODIST is used in the same manner as CFLAGS_NODIST.
91# Use it when a linker flag should _not_ be part of the distutils LDFLAGS
92# once Python is installed (bpo-35257)
93CONFIGURE_LDFLAGS_NODIST=@LDFLAGS_NODIST@
84ca1232
CH
94# LDFLAGS_NOLTO is an extra flag to disable lto. It is used to speed up building
95# of _bootstrap_python and _freeze_module tools, which don't need LTO.
96CONFIGURE_LDFLAGS_NOLTO=@LDFLAGS_NOLTO@
d4fcdb1e
JY
97CONFIGURE_CPPFLAGS= @CPPFLAGS@
98CONFIGURE_LDFLAGS= @LDFLAGS@
99# Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
100# command line to append to these values without stomping the pre-set
101# values.
102PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
05f2f0ac 103PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal -I$(srcdir)/Include/internal/mimalloc
516592f4
BC
104# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
105# be able to build extension modules using the directories specified in the
106# environment variables
13419263 107PY_CPPFLAGS= $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
d4fcdb1e 108PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
cf10a750 109PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
84ca1232 110PY_LDFLAGS_NOLTO=$(PY_LDFLAGS) $(CONFIGURE_LDFLAGS_NOLTO) $(LDFLAGS_NODIST)
48e14d3f 111NO_AS_NEEDED= @NO_AS_NEEDED@
7ac954b7 112CCSHARED= @CCSHARED@
e65f01f7
VS
113# LINKFORSHARED are the flags passed to the $(CC) command that links
114# the python executable -- this is only needed for a few systems
7ac954b7 115LINKFORSHARED= @LINKFORSHARED@
5662d3e6 116ARFLAGS= @ARFLAGS@
7ac954b7
NS
117# Extra C flags added for building the interpreter object files.
118CFLAGSFORSHARED=@CFLAGSFORSHARED@
119# C flags used for building the interpreter object files
063db62a 120PY_STDMODULE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED)
da324d53 121PY_BUILTIN_MODULE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN
063db62a 122PY_CORE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE
cf10a750 123# Linker flags used for building the interpreter object files
124PY_CORE_LDFLAGS=$(PY_LDFLAGS) $(PY_LDFLAGS_NODIST)
826f83f1
VS
125# Strict or non-strict aliasing flags used to compile dtoa.c, see above
126CFLAGS_ALIASING=@CFLAGS_ALIASING@
7ac954b7 127
85515ad9
NS
128
129# Machine-dependent subdirectories
130MACHDEP= @MACHDEP@
131
3e6e2ac3 132# Multiarch directory (may be empty)
133MULTIARCH= @MULTIARCH@
5553231b 134MULTIARCH_CPPFLAGS = @MULTIARCH_CPPFLAGS@
3e6e2ac3 135
85515ad9
NS
136# Install prefix for architecture-independent files
137prefix= @prefix@
138
139# Install prefix for architecture-dependent files
140exec_prefix= @exec_prefix@
141
bca54806
TW
142# Install prefix for data files
143datarootdir= @datarootdir@
144
85515ad9 145# Expanded directories
7a61ba9f
AP
146BINDIR= @bindir@
147LIBDIR= @libdir@
d429ab6d
ML
148MANDIR= @mandir@
149INCLUDEDIR= @includedir@
85515ad9 150CONFINCLUDEDIR= $(exec_prefix)/include
8510f430
VS
151PLATLIBDIR= @PLATLIBDIR@
152SCRIPTDIR= $(prefix)/$(PLATLIBDIR)
8cf4eae5 153ABIFLAGS= @ABIFLAGS@
44fa03d7
CH
154# executable name for shebangs
155EXENAME= $(BINDIR)/python$(LDVERSION)$(EXE)
75e59a97
VS
156# Variable used by ensurepip
157WHEEL_PKG_DIR= @WHEEL_PKG_DIR@
85515ad9
NS
158
159# Detailed destination directories
51ae31e5 160BINLIBDEST= @BINLIBDEST@
85515ad9 161LIBDEST= $(SCRIPTDIR)/python$(VERSION)
14d98ac3
BW
162INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
163CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
85515ad9
NS
164
165# Symbols used for using shared libraries
d5537d07 166SHLIB_SUFFIX= @SHLIB_SUFFIX@
167EXT_SUFFIX= @EXT_SUFFIX@
dbec780a 168LDSHARED= @LDSHARED@ $(PY_LDFLAGS)
44a3ee07 169BLDSHARED= @BLDSHARED@ $(PY_CORE_LDFLAGS)
03d788dc 170LDCXXSHARED= @LDCXXSHARED@
85515ad9
NS
171DESTSHARED= $(BINLIBDEST)/lib-dynload
172
e6dcd371
SK
173# List of exported symbols for AIX
174EXPORTSYMS= @EXPORTSYMS@
175EXPORTSFROM= @EXPORTSFROM@
176
85515ad9 177# Executable suffix (.exe on Windows and Mac OS X)
cf9926ca 178EXE= @EXEEXT@
1999ef49 179BUILDEXE= @BUILDEXEEXT@
85515ad9 180
b6e9cad3 181# Short name and location for Mac OS X Python framework
477c8d5e 182UNIVERSALSDK=@UNIVERSALSDK@
b6e9cad3
JJ
183PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
184PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
185PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
186PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
6b08a404 187# Deployment target selected during configure, to be checked
477c8d5e
TW
188# by distutils. The export statement is needed to ensure that the
189# deployment target is active during build.
190MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
191@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
192
b8f944f0
ND
193# Option to install to strip binaries
194STRIPFLAG=-s
195
196# Flags to lipo to produce a 32-bit-only universal executable
197LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
198
0cb33da1
ND
199# Flags to lipo to produce an intel-64-only universal executable
200LIPO_INTEL64_FLAGS=@LIPO_INTEL64_FLAGS@
201
1142de3f
ML
202# Environment to run shared python without installed libraries
203RUNSHARED= @RUNSHARED@
204
322f5ba0
ND
205# ensurepip options
206ENSUREPIP= @ENSUREPIP@
207
25ecc040
CH
208# Internal static libraries
209LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
210LIBEXPAT_A= Modules/expat/libexpat.a
160321e5 211LIBHACL_SHA2_A= Modules/_hacl/libHacl_Hash_SHA2.a
25ecc040 212
f36c69a2
CH
213# Module state, compiler flags and linker flags
214# Empty CFLAGS and LDFLAGS are omitted.
215# states:
216# * yes: module is available
217# * missing: build dependency is missing
218# * disabled: module is disabled
219# * n/a: module is not available on the current platform
71868a00 220# MODULE_EGG_STATE=yes # yes, missing, disabled, n/a
25ecc040
CH
221# MODULE_EGG_CFLAGS=
222# MODULE_EGG_LDFLAGS=
223@MODULE_BLOCK@
224
62972d9d
PG
225# Default zoneinfo.TZPATH. Added here to expose it in sysconfig.get_config_var
226TZPATH=@TZPATH@
ff5be6e8 227
85515ad9
NS
228# Modes for directories, executables and data files created by the
229# install process. Default to user-only-writable for all file types.
230DIRMODE= 755
231EXEMODE= 755
232FILEMODE= 644
233
64b1b686
NS
234# configure script arguments
235CONFIG_ARGS= @CONFIG_ARGS@
85515ad9
NS
236
237
238# Subdirectories with code
239SRCDIRS= @SRCDIRS@
240
241# Other subdirectories
59b44721 242SUBDIRSTOO= Include Lib Misc
85515ad9 243
43839ba4 244# assets for Emscripten browser builds
7a2cc35e
CH
245WASM_ASSETS_DIR=.$(prefix)
246WASM_STDLIB=$(WASM_ASSETS_DIR)/lib/python$(VERSION)/os.py
43839ba4 247
85515ad9 248# Files and directories to be distributed
0f4c16e2 249CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
d783b01f 250DISTFILES= README.rst ChangeLog $(CONFIGFILES)
85515ad9
NS
251DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
252DIST= $(DISTFILES) $(DISTDIRS)
253
254
7ac954b7 255LIBRARY= @LIBRARY@
85515ad9 256LDLIBRARY= @LDLIBRARY@
b6e9cad3 257BLDLIBRARY= @BLDLIBRARY@
d1fc34d5 258PY3LIBRARY= @PY3LIBRARY@
85515ad9 259DLLLIBRARY= @DLLLIBRARY@
b6e9cad3 260LDLIBRARYDIR= @LDLIBRARYDIR@
1142de3f 261INSTSONAME= @INSTSONAME@
801bb0b5 262LIBRARY_DEPS= @LIBRARY_DEPS@
6be84892 263LINK_PYTHON_DEPS=@LINK_PYTHON_DEPS@
801bb0b5
VS
264PY_ENABLE_SHARED= @PY_ENABLE_SHARED@
265STATIC_LIBPYTHON= @STATIC_LIBPYTHON@
85515ad9
NS
266
267
268LIBS= @LIBS@
269LIBM= @LIBM@
270LIBC= @LIBC@
271SYSLIBS= $(LIBM) $(LIBC)
f90ae203 272SHLIBS= @SHLIBS@
85515ad9 273
85515ad9
NS
274DLINCLDIR= @DLINCLDIR@
275DYNLOADFILE= @DYNLOADFILE@
c49e5b73 276MACHDEP_OBJS= @MACHDEP_OBJS@
32fbe599
CH
277LIBOBJDIR= Python/
278LIBOBJS= @LIBOBJS@
85515ad9 279
cf9926ca 280PYTHON= python$(EXE)
1999ef49 281BUILDPYTHON= python$(BUILDEXE)
85515ad9 282
d1de1078
ES
283HOSTRUNNER= @HOSTRUNNER@
284
c5fc1568 285PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
1863302d 286UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/update_file.py
1abe1c5f 287PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
084023cc
CH
288# Single-platform builds depend on $(BUILDPYTHON). Cross builds use an
289# external "build Python" and have an empty PYTHON_FOR_BUILD_DEPS.
290PYTHON_FOR_BUILD_DEPS=@PYTHON_FOR_BUILD_DEPS@
eb483c46 291
084023cc 292# Single-platform builds use Programs/_freeze_module.c for bootstrapping and
eb483c46
CH
293# ./_bootstrap_python Programs/_freeze_module.py for remaining modules
294# Cross builds use an external "build Python" for all modules.
295PYTHON_FOR_FREEZE=@PYTHON_FOR_FREEZE@
296FREEZE_MODULE_BOOTSTRAP=@FREEZE_MODULE_BOOTSTRAP@
297FREEZE_MODULE_BOOTSTRAP_DEPS=@FREEZE_MODULE_BOOTSTRAP_DEPS@
298FREEZE_MODULE=@FREEZE_MODULE@
299FREEZE_MODULE_DEPS=@FREEZE_MODULE_DEPS@
300
1abe1c5f 301_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
a10e4a9a 302BUILD_GNU_TYPE= @build@
303HOST_GNU_TYPE= @host@
1abe1c5f 304
ad45ab87 305# The task to run while instrumented when building the profile-opt target.
4e16a4a3
NS
306# To speed up profile generation, we don't run the full unit test suite
307# by default. The default is "-m test --pgo". To run more tests, use
308# PROFILE_TASK="-m test --pgo-extended"
309PROFILE_TASK= @PROFILE_TASK@
33fe8093 310
49e52f93
CH
311# report files for gcov / lcov coverage report
312COVERAGE_INFO= $(abs_builddir)/coverage.info
313COVERAGE_REPORT=$(abs_builddir)/lcov-report
f5c02afa
CH
314COVERAGE_LCOV_OPTIONS=--rc lcov_branch_coverage=1
315COVERAGE_REPORT_OPTIONS=--rc lcov_branch_coverage=1 --branch-coverage --title "CPython $(VERSION) LCOV report [commit $(shell $(GITVERSION))]"
49e52f93
CH
316
317
85515ad9
NS
318# === Definitions added by makesetup ===
319
320
321##########################################################################
322# Modules
323MODULE_OBJS= \
324 Modules/config.o \
9c63e6d6
NS
325 Modules/main.o \
326 Modules/gcmodule.o
85515ad9 327
8d8d6300 328IO_H= Modules/_io/_iomodule.h
4fa88fa0
BP
329
330IO_OBJS= \
8d8d6300
AV
331 Modules/_io/_iomodule.o \
332 Modules/_io/iobase.o \
333 Modules/_io/fileio.o \
334 Modules/_io/bufferedio.o \
335 Modules/_io/textio.o \
336 Modules/_io/bytesio.o \
337 Modules/_io/stringio.o
85515ad9 338
05f2f0ac
DV
339
340##########################################################################
341# mimalloc
342
343MIMALLOC_HEADERS= \
344 $(srcdir)/Include/internal/pycore_mimalloc.h \
345 $(srcdir)/Include/internal/mimalloc/mimalloc.h \
346 $(srcdir)/Include/internal/mimalloc/mimalloc/atomic.h \
347 $(srcdir)/Include/internal/mimalloc/mimalloc/internal.h \
348 $(srcdir)/Include/internal/mimalloc/mimalloc/prim.h \
349 $(srcdir)/Include/internal/mimalloc/mimalloc/track.h \
350 $(srcdir)/Include/internal/mimalloc/mimalloc/types.h
351
352
85515ad9
NS
353##########################################################################
354# Parser
c5fc1568
PG
355
356PEGEN_OBJS= \
1ed83adb 357 Parser/pegen.o \
c9c4444d
PGS
358 Parser/pegen_errors.o \
359 Parser/action_helpers.o \
1ed83adb
PG
360 Parser/parser.o \
361 Parser/string_parser.o \
362 Parser/peg_api.o
c5fc1568 363
01481f2d
LN
364TOKENIZER_OBJS= \
365 Parser/lexer/buffer.o \
366 Parser/lexer/lexer.o \
367 Parser/lexer/state.o \
368 Parser/tokenizer/file_tokenizer.o \
369 Parser/tokenizer/readline_tokenizer.o \
370 Parser/tokenizer/string_tokenizer.o \
371 Parser/tokenizer/utf8_tokenizer.o \
372 Parser/tokenizer/helpers.o
c5fc1568
PG
373
374PEGEN_HEADERS= \
57364ce3 375 $(srcdir)/Include/internal/pycore_parser.h \
1ed83adb
PG
376 $(srcdir)/Parser/pegen.h \
377 $(srcdir)/Parser/string_parser.h
c5fc1568 378
01481f2d
LN
379TOKENIZER_HEADERS= \
380 Parser/lexer/buffer.h \
381 Parser/lexer/lexer.h \
382 Parser/lexer/state.h \
383 Parser/tokenizer/tokenizer.h \
384 Parser/tokenizer/helpers.h
385
85515ad9 386POBJS= \
8ac65811 387 Parser/token.o \
85515ad9 388
01481f2d 389PARSER_OBJS= $(POBJS) $(PEGEN_OBJS) $(TOKENIZER_OBJS) Parser/myreadline.o
85515ad9 390
86def6cb 391PARSER_HEADERS= \
c5fc1568 392 $(PEGEN_HEADERS) \
01481f2d 393 $(TOKENIZER_HEADERS)
86def6cb 394
85515ad9
NS
395##########################################################################
396# Python
b52ec78b 397
85515ad9 398PYTHON_OBJS= \
33fe8093 399 Python/_warnings.o \
3e0055f8 400 Python/Python-ast.o \
a24676be 401 Python/Python-tokenize.o \
3e0055f8 402 Python/asdl.o \
33822d03 403 Python/assemble.o \
3e0055f8 404 Python/ast.o \
7ea143ae 405 Python/ast_opt.o \
95e4d589 406 Python/ast_unparse.o \
85515ad9 407 Python/bltinmodule.o \
85515ad9 408 Python/ceval.o \
85515ad9 409 Python/codecs.o \
6c785c0e 410 Python/compile.o \
331a6a56 411 Python/context.o \
31c90d58 412 Python/critical_section.o \
c6fe0869 413 Python/crossinterp.o \
39370830 414 Python/dynamic_annotations.o \
85515ad9 415 Python/errors.o \
33822d03 416 Python/flowgraph.o \
ae0a2b75 417 Python/frame.o \
85515ad9 418 Python/frozenmain.o \
4db62b1e 419 Python/future.o \
85515ad9
NS
420 Python/getargs.o \
421 Python/getcompiler.o \
422 Python/getcopyright.o \
85515ad9
NS
423 Python/getplatform.o \
424 Python/getversion.o \
a4a9f2e8 425 Python/ceval_gil.o \
331a6a56 426 Python/hamt.o \
b617993b 427 Python/hashtable.o \
85515ad9
NS
428 Python/import.o \
429 Python/importdl.o \
331a6a56 430 Python/initconfig.o \
411b1692 431 Python/instrumentation.o \
28187141 432 Python/intrinsics.o \
411b1692 433 Python/legacy_tracing.o \
0c89056f 434 Python/lock.o \
85515ad9
NS
435 Python/marshal.o \
436 Python/modsupport.o \
13badcbc 437 Python/mysnprintf.o \
31a8393c 438 Python/mystrtoul.o \
4bfa01b9 439 Python/optimizer.o \
e28b0dc8 440 Python/optimizer_analysis.o \
0c89056f 441 Python/parking_lot.o \
31a8393c 442 Python/pathconfig.o \
91b9ecf8 443 Python/preconfig.o \
adb69fcd 444 Python/pyarena.o \
6dc46f5e 445 Python/pyctype.o \
85515ad9 446 Python/pyfpe.o \
985ecdcf 447 Python/pyhash.o \
d6009517 448 Python/pylifecycle.o \
53876d9c 449 Python/pymath.o \
85515ad9
NS
450 Python/pystate.o \
451 Python/pythonrun.o \
6fc4ade2 452 Python/pytime.o \
6b4be195 453 Python/bootstrap_hash.o \
001eb520 454 Python/specialize.o \
85515ad9 455 Python/structmember.o \
cb17ae8b 456 Python/symtable.o \
85515ad9 457 Python/sysmodule.o \
a6a4dc81 458 Python/thread.o \
85515ad9 459 Python/traceback.o \
f7df1739 460 Python/tracemalloc.o \
85515ad9 461 Python/getopt.o \
99170a5d 462 Python/pystrcmp.o \
737ea82a 463 Python/pystrtod.o \
8cb6569f 464 Python/pystrhex.o \
b08a53a9 465 Python/dtoa.o \
8c663263 466 Python/formatter_unicode.o \
4e31443c 467 Python/fileutils.o \
37494b44 468 Python/suggestions.o \
1f737edb 469 Python/perf_trampoline.o \
85515ad9 470 Python/$(DYNLOADFILE) \
32fbe599 471 $(LIBOBJS) \
c49e5b73 472 $(MACHDEP_OBJS) \
087d0fa5
HC
473 $(DTRACE_OBJS) \
474 @PLATFORM_OBJS@
85515ad9
NS
475
476
477##########################################################################
478# Objects
479OBJECT_OBJS= \
480 Objects/abstract.o \
77f6a65e 481 Objects/boolobject.o \
60d241f1 482 Objects/bytes_methods.o \
2c9c7a5f 483 Objects/bytearrayobject.o \
4dfe8a11 484 Objects/bytesobject.o \
c22bfaae 485 Objects/call.o \
91f4380c 486 Objects/capsule.o \
fbd849f2 487 Objects/cellobject.o \
85515ad9 488 Objects/classobject.o \
3e0055f8 489 Objects/codeobject.o \
85515ad9 490 Objects/complexobject.o \
6d6c1a35 491 Objects/descrobject.o \
7dab2426 492 Objects/enumobject.o \
477c8d5e 493 Objects/exceptions.o \
48b069a0 494 Objects/genericaliasobject.o \
e440e47e 495 Objects/genobject.o \
85515ad9
NS
496 Objects/fileobject.o \
497 Objects/floatobject.o \
498 Objects/frameobject.o \
499 Objects/funcobject.o \
c11183cd 500 Objects/interpreteridobject.o \
59d1d2b4 501 Objects/iterobject.o \
85515ad9
NS
502 Objects/listobject.o \
503 Objects/longobject.o \
504 Objects/dictobject.o \
96c6af9b 505 Objects/odictobject.o \
b99f762f 506 Objects/memoryobject.o \
85515ad9
NS
507 Objects/methodobject.o \
508 Objects/moduleobject.o \
409da157 509 Objects/namespaceobject.o \
85515ad9 510 Objects/object.o \
1221c0a4 511 Objects/obmalloc.o \
91f4380c 512 Objects/picklebufobject.o \
85515ad9 513 Objects/rangeobject.o \
69f55cc0 514 Objects/setobject.o \
85515ad9 515 Objects/sliceobject.o \
98bf58f1 516 Objects/structseq.o \
85515ad9
NS
517 Objects/tupleobject.o \
518 Objects/typeobject.o \
24d8b884 519 Objects/typevarobject.o \
52d168a9
GB
520 Objects/unicodeobject.o \
521 Objects/unicodectype.o \
1b4552c5 522 Objects/unionobject.o \
6d791a97 523 Objects/weakrefobject.o \
6d791a97 524 @PERF_TRAMPOLINE_OBJ@
85515ad9 525
85515ad9
NS
526##########################################################################
527# objects that get linked into the Python library
e67f48ce 528LIBRARY_OBJS_OMIT_FROZEN= \
18821823 529 Modules/getbuildinfo.o \
85515ad9
NS
530 $(PARSER_OBJS) \
531 $(OBJECT_OBJS) \
532 $(PYTHON_OBJS) \
533 $(MODULE_OBJS) \
85515ad9
NS
534 $(MODOBJS)
535
e67f48ce
AP
536LIBRARY_OBJS= \
537 $(LIBRARY_OBJS_OMIT_FROZEN) \
99fcf150 538 Modules/getpath.o \
e67f48ce
AP
539 Python/frozen.o
540
6be84892
VS
541LINK_PYTHON_OBJS=@LINK_PYTHON_OBJS@
542
a785c87d
ŁL
543##########################################################################
544# DTrace
545
546# On some systems, object files that reference DTrace probes need to be modified
547# in-place by dtrace(1).
548DTRACE_DEPS = \
8a8b59c9 549 Python/ceval.o Python/import.o Python/sysmodule.o Modules/gcmodule.o
a785c87d 550
0486570f
CH
551##########################################################################
552# decimal's libmpdec
553
554LIBMPDEC_OBJS= \
555 Modules/_decimal/libmpdec/basearith.o \
556 Modules/_decimal/libmpdec/constants.o \
557 Modules/_decimal/libmpdec/context.o \
558 Modules/_decimal/libmpdec/convolute.o \
559 Modules/_decimal/libmpdec/crt.o \
560 Modules/_decimal/libmpdec/difradix2.o \
561 Modules/_decimal/libmpdec/fnt.o \
562 Modules/_decimal/libmpdec/fourstep.o \
563 Modules/_decimal/libmpdec/io.o \
564 Modules/_decimal/libmpdec/mpalloc.o \
565 Modules/_decimal/libmpdec/mpdecimal.o \
566 Modules/_decimal/libmpdec/numbertheory.o \
567 Modules/_decimal/libmpdec/sixstep.o \
568 Modules/_decimal/libmpdec/transpose.o
569 # _decimal does not use signaling API
570 # Modules/_decimal/libmpdec/mpsignal.o
571
572LIBMPDEC_HEADERS= \
573 $(srcdir)/Modules/_decimal/libmpdec/basearith.h \
574 $(srcdir)/Modules/_decimal/libmpdec/bits.h \
575 $(srcdir)/Modules/_decimal/libmpdec/constants.h \
576 $(srcdir)/Modules/_decimal/libmpdec/convolute.h \
577 $(srcdir)/Modules/_decimal/libmpdec/crt.h \
578 $(srcdir)/Modules/_decimal/libmpdec/difradix2.h \
579 $(srcdir)/Modules/_decimal/libmpdec/fnt.h \
580 $(srcdir)/Modules/_decimal/libmpdec/fourstep.h \
581 $(srcdir)/Modules/_decimal/libmpdec/io.h \
582 $(srcdir)/Modules/_decimal/libmpdec/mpalloc.h \
583 $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.h \
584 $(srcdir)/Modules/_decimal/libmpdec/numbertheory.h \
585 $(srcdir)/Modules/_decimal/libmpdec/sixstep.h \
586 $(srcdir)/Modules/_decimal/libmpdec/transpose.h \
587 $(srcdir)/Modules/_decimal/libmpdec/typearith.h \
588 $(srcdir)/Modules/_decimal/libmpdec/umodarith.h
589
464e6616
CH
590##########################################################################
591# pyexpat's expat library
592
593LIBEXPAT_OBJS= \
594 Modules/expat/xmlparse.o \
595 Modules/expat/xmlrole.o \
596 Modules/expat/xmltok.o
597
598LIBEXPAT_HEADERS= \
599 Modules/expat/ascii.h \
600 Modules/expat/asciitab.h \
601 Modules/expat/expat.h \
602 Modules/expat/expat_config.h \
603 Modules/expat/expat_external.h \
604 Modules/expat/iasciitab.h \
605 Modules/expat/internal.h \
606 Modules/expat/latin1tab.h \
607 Modules/expat/nametab.h \
608 Modules/expat/pyexpatns.h \
609 Modules/expat/siphash.h \
610 Modules/expat/utf8tab.h \
611 Modules/expat/xmlrole.h \
612 Modules/expat/xmltok.h \
613 Modules/expat/xmltok_impl.h
614
d777790b
GS
615##########################################################################
616# hashlib's HACL* library
617
0b13575e 618LIBHACL_SHA2_OBJS= \
160321e5 619 Modules/_hacl/Hacl_Hash_SHA2.o
d777790b 620
fcadc7e4 621LIBHACL_HEADERS= \
d777790b
GS
622 Modules/_hacl/include/krml/FStar_UInt128_Verified.h \
623 Modules/_hacl/include/krml/FStar_UInt_8_16_32_64.h \
624 Modules/_hacl/include/krml/fstar_uint128_struct_endianness.h \
625 Modules/_hacl/include/krml/internal/target.h \
626 Modules/_hacl/include/krml/lowstar_endianness.h \
627 Modules/_hacl/include/krml/types.h \
fcadc7e4 628 Modules/_hacl/Hacl_Streaming_Types.h \
d777790b
GS
629 Modules/_hacl/python_hacl_namespaces.h
630
fcadc7e4 631LIBHACL_SHA2_HEADERS= \
160321e5
JP
632 Modules/_hacl/Hacl_Hash_SHA2.h \
633 Modules/_hacl/internal/Hacl_Hash_SHA2.h \
fcadc7e4
JP
634 $(LIBHACL_HEADERS)
635
85515ad9
NS
636#########################################################################
637# Rules
638
639# Default target
63d98bcd 640all: @DEF_MAKE_ALL_RULE@
a6bcc8fb
GS
641
642# First target in Makefile is implicit default. So .PHONY needs to come after
643# all.
644.PHONY: all
645
646.PHONY: build_all
81dca70d 647build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
5b070c0d 648 gdbhooks Programs/_testembed scripts checksharedmods rundsymutil
a6bcc8fb
GS
649
650.PHONY: build_wasm
81dca70d
CH
651build_wasm: check-clean-src $(BUILDPYTHON) platform sharedmods \
652 python-config checksharedmods
0de92859 653
654# Check that the source is clean when building out of source.
a6bcc8fb 655.PHONY: check-clean-src
0de92859 656check-clean-src:
765b2a3a 657 @if test -n "$(VPATH)" -a \( \
a155f9f3
VS
658 -f "$(srcdir)/$(BUILDPYTHON)" \
659 -o -f "$(srcdir)/Programs/python.o" \
765b2a3a
CH
660 -o -f "$(srcdir)\Python/frozen_modules/importlib._bootstrap.h" \
661 \); then \
0de92859 662 echo "Error: The source directory ($(srcdir)) is not clean" ; \
663 echo "Building Python out of the source tree (in $(abs_builddir)) requires a clean source tree ($(abs_srcdir))" ; \
664 echo "Try to run: make -C \"$(srcdir)\" clean" ; \
665 exit 1; \
666 fi
85515ad9 667
4e38d71a
NS
668# Profile generation build must start from a clean tree.
669profile-clean-stamp:
c6bbcd25 670 $(MAKE) clean
4e38d71a
NS
671 touch $@
672
673# Compile with profile generation enabled.
674profile-gen-stamp: profile-clean-stamp
3a56b775 675 @if [ $(LLVM_PROF_ERR) = yes ]; then \
7188a3ef
BC
676 echo "Error: Cannot perform PGO build because llvm-profdata was not found in PATH" ;\
677 echo "Please add it to PATH and run ./configure again" ;\
678 exit 1;\
679 fi
33fe8093 680 @echo "Building with support for profile generation:"
9084e1b0 681 $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"
4e38d71a
NS
682 touch $@
683
684# Run task with profile generation build to create profile information.
685profile-run-stamp:
7188a3ef 686 @echo "Running code to generate profile data (this can take a while):"
4e38d71a
NS
687 # First, we need to create a clean build with profile generation
688 # enabled.
689 $(MAKE) profile-gen-stamp
690 # Next, run the profile task to generate the profile information.
9084e1b0 691 @ # FIXME: can't run for a cross build
6ab60400 692 $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
9084e1b0 693 $(LLVM_PROF_MERGER)
4e38d71a 694 # Remove profile generation binary since we are done with it.
c6bbcd25 695 $(MAKE) clean-retain-profile
4e38d71a 696 # This is an expensive target to build and it does not have proper
a5293b4f 697 # makefile dependency information. So, we create a "stamp" file
4e38d71a
NS
698 # to record its completion and avoid re-running it.
699 touch $@
33fe8093 700
4e38d71a
NS
701# Compile Python binary with profile guided optimization.
702# To force re-running of the profile task, remove the profile-run-stamp file.
a6bcc8fb 703.PHONY: profile-opt
4e38d71a
NS
704profile-opt: profile-run-stamp
705 @echo "Rebuilding with profile guided optimizations:"
706 -rm -f profile-clean-stamp
cf10a750 707 $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_USE_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST)"
33fe8093 708
5360cb3d
GS
709# List of binaries that BOLT runs on.
710BOLT_BINARIES := @BOLT_BINARIES@
711
712BOLT_INSTRUMENT_FLAGS := @BOLT_INSTRUMENT_FLAGS@
713BOLT_APPLY_FLAGS := @BOLT_APPLY_FLAGS@
714
715.PHONY: clean-bolt
716clean-bolt:
717 # Profile data.
214eb2cc 718 rm -f *.fdata
5360cb3d
GS
719 # Pristine binaries before BOLT optimization.
720 rm -f *.prebolt
721 # BOLT instrumented binaries.
722 rm -f *.bolt_inst
723
724profile-bolt-stamp: $(BUILDPYTHON)
725 # Ensure a pristine, pre-BOLT copy of the binary and no profile data from last run.
726 for bin in $(BOLT_BINARIES); do \
727 prebolt="$${bin}.prebolt"; \
728 if [ -e "$${prebolt}" ]; then \
729 echo "Restoring pre-BOLT binary $${prebolt}"; \
730 mv "$${bin}.prebolt" "$${bin}"; \
731 fi; \
732 cp "$${bin}" "$${prebolt}"; \
733 rm -f $${bin}.bolt.*.fdata $${bin}.fdata; \
734 done
735 # Instrument each binary.
736 for bin in $(BOLT_BINARIES); do \
737 @LLVM_BOLT@ "$${bin}" -instrument -instrumentation-file-append-pid -instrumentation-file=$(abspath $${bin}.bolt) -o $${bin}.bolt_inst $(BOLT_INSTRUMENT_FLAGS); \
738 mv "$${bin}.bolt_inst" "$${bin}"; \
739 done
740 # Run instrumented binaries to collect data.
6ab60400 741 $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
5360cb3d
GS
742 # Merge all the data files together.
743 for bin in $(BOLT_BINARIES); do \
744 @MERGE_FDATA@ $${bin}.*.fdata > "$${bin}.fdata"; \
745 rm -f $${bin}.*.fdata; \
746 done
747 # Run bolt against the merged data to produce an optimized binary.
748 for bin in $(BOLT_BINARIES); do \
749 @LLVM_BOLT@ "$${bin}.prebolt" -o "$${bin}.bolt" -data="$${bin}.fdata" $(BOLT_APPLY_FLAGS); \
750 mv "$${bin}.bolt" "$${bin}"; \
751 done
752 touch $@
5d9762e7 753
5360cb3d
GS
754.PHONY: bolt-opt
755bolt-opt:
756 $(MAKE) @PREBOLT_RULE@
757 $(MAKE) profile-bolt-stamp
214eb2cc 758
49e52f93 759# Compile and run with gcov
a6bcc8fb 760.PHONY: coverage
b533e26d
GB
761coverage:
762 @echo "Building with support for coverage checking:"
c6bbcd25 763 $(MAKE) clean
f5c02afa 764 $(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LDFLAGS="$(LDFLAGS) --coverage"
b533e26d 765
a6bcc8fb 766.PHONY: coverage-lcov
49e52f93
CH
767coverage-lcov:
768 @echo "Creating Coverage HTML report with LCOV:"
769 @rm -f $(COVERAGE_INFO)
770 @rm -rf $(COVERAGE_REPORT)
f5c02afa
CH
771 @lcov $(COVERAGE_LCOV_OPTIONS) --capture \
772 --directory $(abs_builddir) \
49e52f93
CH
773 --base-directory $(realpath $(abs_builddir)) \
774 --path $(realpath $(abs_srcdir)) \
775 --output-file $(COVERAGE_INFO)
adab00fb
MP
776 @ # remove 3rd party modules, system headers and internal files with
777 @ # debug, test or dummy functions.
f5c02afa 778 @lcov $(COVERAGE_LCOV_OPTIONS) --remove $(COVERAGE_INFO) \
79f9d4ff 779 '*/Modules/_blake2/impl/*' \
49e52f93 780 '*/Modules/_ctypes/libffi*/*' \
49e52f93
CH
781 '*/Modules/_decimal/libmpdec/*' \
782 '*/Modules/expat/*' \
79f9d4ff 783 '*/Modules/xx*.c' \
79f9d4ff
CH
784 '*/Python/pyfpe.c' \
785 '*/Python/pystrcmp.c' \
49e52f93
CH
786 '/usr/include/*' \
787 '/usr/local/include/*' \
79f9d4ff 788 '/usr/lib/gcc/*' \
49e52f93 789 --output-file $(COVERAGE_INFO)
f5c02afa
CH
790 @genhtml $(COVERAGE_INFO) \
791 --output-directory $(COVERAGE_REPORT) \
49e52f93
CH
792 $(COVERAGE_REPORT_OPTIONS)
793 @echo
794 @echo "lcov report at $(COVERAGE_REPORT)/index.html"
795 @echo
796
044e8d86 797# Force regeneration of parser and frozen modules
a6bcc8fb 798.PHONY: coverage-report
044e8d86 799coverage-report: regen-token regen-frozen
adab00fb 800 @ # build with coverage info
49e52f93 801 $(MAKE) coverage
adab00fb 802 @ # run tests, ignore failures
859618c8 803 $(TESTRUNNER) --fast-ci --timeout=$(TESTTIMEOUT) $(TESTOPTS) || true
adab00fb 804 @ # build lcov report
49e52f93 805 $(MAKE) coverage-lcov
b533e26d 806
dcd340ee 807# Run "Argument Clinic" over all source files
a6bcc8fb 808.PHONY: clinic
d6ff8a70 809clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
0be3743f 810 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --exclude Lib/test/clinic.test.c --srcdir $(srcdir)
dcd340ee 811
0be3743f
EA
812.PHONY: clinic-tests
813clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c
814 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $(srcdir)/Lib/test/clinic.test.c
815
85515ad9 816# Build the interpreter
6be84892
VS
817$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS)
818 $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
85515ad9 819
084023cc 820platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt
885bdc49 821 $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
85515ad9 822
c101bf32
TN
823# Create build directory and generate the sysconfig build-time data there.
824# pybuilddir.txt contains the name of the build dir and is used for
825# sys.path fixup -- see Modules/getpath.c.
fcbc246e 826# Since this step runs before shared modules are built, try to avoid bootstrap
ec7aaf5d 827# problems by creating a dummy pybuilddir.txt just to allow interpreter
fcbc246e
ND
828# initialization to succeed. It will be overwritten by generate-posix-vars
829# or removed in case of failure.
084023cc 830pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS)
fcbc246e 831 @echo "none" > ./pybuilddir.txt
5be98e57 832 $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
fcbc246e
ND
833 if test $$? -ne 0 ; then \
834 echo "generate-posix-vars failed" ; \
835 rm -f ./pybuilddir.txt ; \
836 exit 1 ; \
837 fi
85515ad9 838
121b9487 839# blake2s is auto-generated from blake2b
d6ff8a70
ZW
840$(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py
841 $(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py
842 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@
121b9487 843
85515ad9
NS
844# Build static library
845$(LIBRARY): $(LIBRARY_OBJS)
846 -rm -f $@
6fb0e4a6 847 $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS)
85515ad9 848
5c8f5376 849libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
bc122625 850 if test $(INSTSONAME) != $(LDLIBRARY); then \
65ed12cb 851 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
45ec95d4 852 $(LN) -f $(INSTSONAME) $@; \
b1441c7e 853 else \
65ed12cb 854 $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
45ec95d4 855 fi
1142de3f 856
d1fc34d5 857libpython3.so: libpython$(LDVERSION).so
48e14d3f 858 $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
d1fc34d5 859
6e8d17c0 860libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
5c8f5376 861 $(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
4e31443c 862
b1441c7e 863
1142de3f 864libpython$(VERSION).sl: $(LIBRARY_OBJS)
65ed12cb 865 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM)
85515ad9 866
e6dcd371
SK
867# List of exported symbols for AIX
868Modules/python.exp: $(LIBRARY)
869 $(srcdir)/Modules/makexp_aix $@ "$(EXPORTSFROM)" $?
870
6a6666ab
BP
871# Copy up the gdb python hooks into a position where they can be automatically
872# loaded by gdb during Lib/test/test_gdb.py
873#
874# Distributors are likely to want to install this somewhere else e.g. relative
875# to the stripped DWARF data for the shared library.
a6bcc8fb 876.PHONY: gdbhooks
6a6666ab
BP
877gdbhooks: $(BUILDPYTHON)-gdb.py
878
879SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
880$(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
881 $(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
882
ea0c3828
JJ
883# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
884# minimal framework (not including the Lib directory and such) in the current
885# directory.
81ee3efe 886RESSRCDIR=Mac/Resources/framework
ea0c3828
JJ
887$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
888 $(LIBRARY) \
81ee3efe 889 $(RESSRCDIR)/Info.plist
246debbb 890 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
cf10a750 891 $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
25032495
RO
892 -all_load $(LIBRARY) -Wl,-single_module \
893 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
894 -compatibility_version $(VERSION) \
895 -current_version $(VERSION) \
dfb866d1 896 -framework CoreFoundation $(LIBS);
ea0c3828
JJ
897 $(INSTALL) -d -m $(DIRMODE) \
898 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
899 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
900 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
c736b8df 901 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
b36687a4 902 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
c736b8df 903 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
85515ad9 904
3076559e
JT
905# This rule builds the Cygwin Python DLL and import library if configured
906# for a shared core library; otherwise, this rule is a noop.
3839d99b 907$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
3076559e 908 if test -n "$(DLLLIBRARY)"; then \
dbec780a 909 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
65ed12cb 910 $(LIBS) $(MODLIBS) $(SYSLIBS); \
3076559e
JT
911 else true; \
912 fi
85515ad9 913
96e09837 914# wasm32-emscripten browser build
03394348
CH
915# wasm assets directory is relative to current build dir, e.g. "./usr/local".
916# --preload-file turns a relative asset path into an absolute path.
03394348 917
6087f491
CH
918.PHONY: wasm_stdlib
919wasm_stdlib: $(WASM_STDLIB)
03394348 920$(WASM_STDLIB): $(srcdir)/Lib/*.py $(srcdir)/Lib/*/*.py \
defbbd68 921 $(srcdir)/Tools/wasm/wasm_assets.py \
6087f491 922 Makefile pybuilddir.txt Modules/Setup.local
03394348 923 $(PYTHON_FOR_BUILD) $(srcdir)/Tools/wasm/wasm_assets.py \
7a2cc35e 924 --buildroot . --prefix $(prefix)
03394348 925
96e09837
CH
926python.html: $(srcdir)/Tools/wasm/python.html python.worker.js
927 @cp $(srcdir)/Tools/wasm/python.html $@
928
929python.worker.js: $(srcdir)/Tools/wasm/python.worker.js
930 @cp $(srcdir)/Tools/wasm/python.worker.js $@
931
0486570f
CH
932##########################################################################
933# Build static libmpdec.a
6485c3c7 934LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
0486570f 935
0486570f
CH
936# "%.o: %c" is not portable
937Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
938 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/basearith.c
939
940Modules/_decimal/libmpdec/constants.o: $(srcdir)/Modules/_decimal/libmpdec/constants.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
941 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/constants.c
942
943Modules/_decimal/libmpdec/context.o: $(srcdir)/Modules/_decimal/libmpdec/context.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
944 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/context.c
945
946Modules/_decimal/libmpdec/convolute.o: $(srcdir)/Modules/_decimal/libmpdec/convolute.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
947 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/convolute.c
948
949Modules/_decimal/libmpdec/crt.o: $(srcdir)/Modules/_decimal/libmpdec/crt.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
950 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/crt.c
951
952Modules/_decimal/libmpdec/difradix2.o: $(srcdir)/Modules/_decimal/libmpdec/difradix2.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
953 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/difradix2.c
954
955Modules/_decimal/libmpdec/fnt.o: $(srcdir)/Modules/_decimal/libmpdec/fnt.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
956 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/fnt.c
957
958Modules/_decimal/libmpdec/fourstep.o: $(srcdir)/Modules/_decimal/libmpdec/fourstep.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
959 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/fourstep.c
960
961Modules/_decimal/libmpdec/io.o: $(srcdir)/Modules/_decimal/libmpdec/io.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
962 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/io.c
963
964Modules/_decimal/libmpdec/mpalloc.o: $(srcdir)/Modules/_decimal/libmpdec/mpalloc.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
965 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpalloc.c
966
967Modules/_decimal/libmpdec/mpdecimal.o: $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
968 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.c
969
970Modules/_decimal/libmpdec/mpsignal.o: $(srcdir)/Modules/_decimal/libmpdec/mpsignal.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
971 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpsignal.c
972
973Modules/_decimal/libmpdec/numbertheory.o: $(srcdir)/Modules/_decimal/libmpdec/numbertheory.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
974 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/numbertheory.c
975
976Modules/_decimal/libmpdec/sixstep.o: $(srcdir)/Modules/_decimal/libmpdec/sixstep.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
977 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/sixstep.c
978
979Modules/_decimal/libmpdec/transpose.o: $(srcdir)/Modules/_decimal/libmpdec/transpose.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
980 $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/transpose.c
981
982$(LIBMPDEC_A): $(LIBMPDEC_OBJS)
983 -rm -f $@
984 $(AR) $(ARFLAGS) $@ $(LIBMPDEC_OBJS)
85515ad9 985
464e6616
CH
986##########################################################################
987# Build static libexpat.a
6485c3c7 988LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
464e6616 989
464e6616
CH
990Modules/expat/xmlparse.o: $(srcdir)/Modules/expat/xmlparse.c $(LIBEXPAT_HEADERS) $(PYTHON_HEADERS)
991 $(CC) -c $(LIBEXPAT_CFLAGS) -o $@ $(srcdir)/Modules/expat/xmlparse.c
992
993Modules/expat/xmlrole.o: $(srcdir)/Modules/expat/xmlrole.c $(LIBEXPAT_HEADERS) $(PYTHON_HEADERS)
994 $(CC) -c $(LIBEXPAT_CFLAGS) -o $@ $(srcdir)/Modules/expat/xmlrole.c
995
996Modules/expat/xmltok.o: $(srcdir)/Modules/expat/xmltok.c $(LIBEXPAT_HEADERS) $(PYTHON_HEADERS)
997 $(CC) -c $(LIBEXPAT_CFLAGS) -o $@ $(srcdir)/Modules/expat/xmltok.c
998
999$(LIBEXPAT_A): $(LIBEXPAT_OBJS)
1000 -rm -f $@
1001 $(AR) $(ARFLAGS) $@ $(LIBEXPAT_OBJS)
1002
d777790b 1003##########################################################################
160321e5 1004# Build HACL* static libraries for hashlib: libHacl_Hash_SHA2.a
d777790b
GS
1005LIBHACL_CFLAGS=-I$(srcdir)/Modules/_hacl/include -D_BSD_SOURCE -D_DEFAULT_SOURCE $(PY_STDMODULE_CFLAGS) $(CCSHARED)
1006
160321e5
JP
1007Modules/_hacl/Hacl_Hash_SHA2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c $(LIBHACL_SHA2_HEADERS)
1008 $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c
d777790b 1009
0b13575e 1010$(LIBHACL_SHA2_A): $(LIBHACL_SHA2_OBJS)
d777790b 1011 -rm -f $@
0b13575e 1012 $(AR) $(ARFLAGS) $@ $(LIBHACL_SHA2_OBJS)
d777790b 1013
f0150ac9
CH
1014# create relative links from build/lib.platform/egg.so to Modules/egg.so
1015# pybuilddir.txt is created too late. We cannot use it in Makefile
1016# targets. ln --relative is not portable.
a6bcc8fb 1017.PHONY: sharedmods
81dca70d 1018sharedmods: $(SHAREDMODS) pybuilddir.txt
f0150ac9
CH
1019 @target=`cat pybuilddir.txt`; \
1020 $(MKDIR_P) $$target; \
1021 for mod in X $(SHAREDMODS); do \
1022 if test $$mod != X; then \
1023 $(LN) -sf ../../$$mod $$target/`basename $$mod`; \
1024 fi; \
1025 done
85515ad9 1026
81dca70d 1027# dependency on BUILDPYTHON ensures that the target is run last
a6bcc8fb 1028.PHONY: checksharedmods
81dca70d 1029checksharedmods: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
1863302d 1030 @$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/check_extension_modules.py
7bd67d1d 1031
a6bcc8fb 1032.PHONY: rundsymutil
5b070c0d
PGS
1033rundsymutil: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
1034 @if [ ! -z $(DSYMUTIL) ] ; then \
1035 echo $(DSYMUTIL_PATH) $(BUILDPYTHON); \
1036 $(DSYMUTIL_PATH) $(BUILDPYTHON); \
1037 if test -f $(LDLIBRARY); then \
1038 echo $(DSYMUTIL_PATH) $(LDLIBRARY); \
1039 $(DSYMUTIL_PATH) $(LDLIBRARY); \
1040 fi; \
1041 for mod in X $(SHAREDMODS); do \
1042 if test $$mod != X; then \
1043 echo $(DSYMUTIL_PATH) $$mod; \
1044 $(DSYMUTIL_PATH) $$mod; \
1045 fi; \
1046 done \
1047 fi
1048
e4bb22fa
CH
1049Modules/Setup.local:
1050 @# Create empty Setup.local when file was deleted by user
1051 echo "# Edit this file for local setup changes" > $@
1052
ca9689f8
CH
1053Modules/Setup.bootstrap: $(srcdir)/Modules/Setup.bootstrap.in config.status
1054 ./config.status $@
1055
e4bb22fa
CH
1056Modules/Setup.stdlib: $(srcdir)/Modules/Setup.stdlib.in config.status
1057 ./config.status $@
1058
85515ad9
NS
1059Makefile Modules/config.c: Makefile.pre \
1060 $(srcdir)/Modules/config.c.in \
1061 $(MAKESETUP) \
961d54c5 1062 $(srcdir)/Modules/Setup \
e4bb22fa 1063 Modules/Setup.local \
ca9689f8 1064 Modules/Setup.bootstrap \
e4bb22fa 1065 Modules/Setup.stdlib
ed948e01 1066 $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
85515ad9 1067 -s Modules \
85515ad9 1068 Modules/Setup.local \
81dca70d 1069 Modules/Setup.stdlib \
ca9689f8 1070 Modules/Setup.bootstrap \
961d54c5 1071 $(srcdir)/Modules/Setup
85515ad9
NS
1072 @mv config.c Modules
1073 @echo "The Makefile was updated, you may need to re-run make."
1074
834498e1 1075.PHONY: regen-test-frozenmain
eaede0de
VS
1076regen-test-frozenmain: $(BUILDPYTHON)
1077 # Regenerate Programs/test_frozenmain.h
1078 # from Programs/test_frozenmain.py
1079 # using Programs/freeze_test_frozenmain.py
41551ee7 1080 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Programs/freeze_test_frozenmain.py Programs/test_frozenmain.h
eaede0de 1081
bbc7cd64
ŁL
1082.PHONY: regen-test-levenshtein
1083regen-test-levenshtein:
1084 # Regenerate Lib/test/levenshtein_examples.json
5a8c4b94 1085 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_levenshtein_examples.py $(srcdir)/Lib/test/levenshtein_examples.json
bbc7cd64 1086
f912cc0e
SS
1087.PHONY: regen-re
1088regen-re: $(BUILDPYTHON)
1089 # Regenerate Lib/re/_casefix.py
1863302d
VS
1090 # using Tools/build/generate_re_casefix.py
1091 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/generate_re_casefix.py $(srcdir)/Lib/re/_casefix.py
f912cc0e 1092
6be84892 1093Programs/_testembed: Programs/_testembed.o $(LINK_PYTHON_DEPS)
467abfe1 1094 $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)
aed97733 1095
84ca1232
CH
1096############################################################################
1097# "Bootstrap Python" used to run deepfreeze.py
1098
1099BOOTSTRAP_HEADERS = \
1100 Python/frozen_modules/importlib._bootstrap.h \
228c92eb
KZ
1101 Python/frozen_modules/importlib._bootstrap_external.h \
1102 Python/frozen_modules/zipimport.h
84ca1232
CH
1103
1104Programs/_bootstrap_python.o: Programs/_bootstrap_python.c $(BOOTSTRAP_HEADERS) $(PYTHON_HEADERS)
1105
06c4ae8b 1106_bootstrap_python: $(LIBRARY_OBJS_OMIT_FROZEN) Programs/_bootstrap_python.o Modules/getpath.o Modules/Setup.local
84ca1232 1107 $(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \
06c4ae8b 1108 Programs/_bootstrap_python.o Modules/getpath.o $(LIBS) $(MODLIBS) $(SYSLIBS)
84ca1232 1109
1cbaa505 1110
fd074155 1111############################################################################
044e8d86 1112# frozen modules (including importlib)
eb483c46
CH
1113#
1114# Freezing is a multi step process. It works differently for standard builds
1115# and cross builds. Standard builds use Programs/_freeze_module and
1116# _bootstrap_python for freezing and deepfreezing, so users can build Python
1117# without an existing Python installation. Cross builds cannot execute
1118# compiled binaries and therefore rely on an external build Python
1119# interpreter. The build interpreter must have same version and same bytecode
1120# as the host (target) binary.
1121#
1122# Standard build process:
1123# 1) compile minimal core objects for Py_Compile*() and PyMarshal_Write*().
1124# 2) build Programs/_freeze_module binary.
1125# 3) create frozen module headers for importlib and getpath.
1126# 4) build _bootstrap_python binary.
1127# 5) create remaining frozen module headers with
1128# ``./_bootstrap_python Programs/_freeze_module.py``. The pure Python
1129# script is used to test the cross compile code path.
1130# 6) deepfreeze modules with _bootstrap_python
1131#
1132# Cross compile process:
1133# 1) create all frozen module headers with external build Python and
1134# Programs/_freeze_module.py script.
1135# 2) deepfreeze modules with external build Python.
1136#
8e605776 1137
1863302d 1138# FROZEN_FILES_* are auto-generated by Tools/build/freeze_modules.py.
7c801e0f
ES
1139FROZEN_FILES_IN = \
1140 Lib/importlib/_bootstrap.py \
1141 Lib/importlib/_bootstrap_external.py \
1142 Lib/zipimport.py \
1143 Lib/abc.py \
1144 Lib/codecs.py \
1145 Lib/io.py \
1146 Lib/_collections_abc.py \
1147 Lib/_sitebuiltins.py \
1148 Lib/genericpath.py \
1149 Lib/ntpath.py \
1150 Lib/posixpath.py \
1151 Lib/os.py \
1152 Lib/site.py \
1153 Lib/stat.py \
44b0e76f
KA
1154 Lib/importlib/util.py \
1155 Lib/importlib/machinery.py \
1156 Lib/runpy.py \
7e5c1075
ES
1157 Lib/__hello__.py \
1158 Lib/__phello__/__init__.py \
1159 Lib/__phello__/ham/__init__.py \
1160 Lib/__phello__/ham/eggs.py \
1161 Lib/__phello__/spam.py \
1162 Tools/freeze/flag.py
7c801e0f
ES
1163# End FROZEN_FILES_IN
1164FROZEN_FILES_OUT = \
1165 Python/frozen_modules/importlib._bootstrap.h \
1166 Python/frozen_modules/importlib._bootstrap_external.h \
1167 Python/frozen_modules/zipimport.h \
1168 Python/frozen_modules/abc.h \
1169 Python/frozen_modules/codecs.h \
1170 Python/frozen_modules/io.h \
1171 Python/frozen_modules/_collections_abc.h \
1172 Python/frozen_modules/_sitebuiltins.h \
1173 Python/frozen_modules/genericpath.h \
1174 Python/frozen_modules/ntpath.h \
1175 Python/frozen_modules/posixpath.h \
1176 Python/frozen_modules/os.h \
1177 Python/frozen_modules/site.h \
1178 Python/frozen_modules/stat.h \
44b0e76f
KA
1179 Python/frozen_modules/importlib.util.h \
1180 Python/frozen_modules/importlib.machinery.h \
1181 Python/frozen_modules/runpy.h \
7e5c1075
ES
1182 Python/frozen_modules/__hello__.h \
1183 Python/frozen_modules/__phello__.h \
1184 Python/frozen_modules/__phello__.ham.h \
1185 Python/frozen_modules/__phello__.ham.eggs.h \
1186 Python/frozen_modules/__phello__.spam.h \
1187 Python/frozen_modules/frozen_only.h
7c801e0f
ES
1188# End FROZEN_FILES_OUT
1189
044e8d86 1190Programs/_freeze_module.o: Programs/_freeze_module.c Makefile
895ce149 1191
99fcf150 1192Modules/getpath_noop.o: $(srcdir)/Modules/getpath_noop.c Makefile
99fcf150 1193
ccb73a0d 1194Programs/_freeze_module: Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN)
467abfe1 1195 $(LINKCC) $(PY_CORE_LDFLAGS) -o $@ Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS)
e67f48ce 1196
eb483c46
CH
1197# We manually freeze getpath.py rather than through freeze_modules
1198Python/frozen_modules/getpath.h: Modules/getpath.py $(FREEZE_MODULE_BOOTSTRAP_DEPS)
1199 $(FREEZE_MODULE_BOOTSTRAP) getpath $(srcdir)/Modules/getpath.py Python/frozen_modules/getpath.h
1200
044e8d86
ES
1201# BEGIN: freezing modules
1202
eb483c46
CH
1203Python/frozen_modules/importlib._bootstrap.h: Lib/importlib/_bootstrap.py $(FREEZE_MODULE_BOOTSTRAP_DEPS)
1204 $(FREEZE_MODULE_BOOTSTRAP) importlib._bootstrap $(srcdir)/Lib/importlib/_bootstrap.py Python/frozen_modules/importlib._bootstrap.h
044e8d86 1205
eb483c46
CH
1206Python/frozen_modules/importlib._bootstrap_external.h: Lib/importlib/_bootstrap_external.py $(FREEZE_MODULE_BOOTSTRAP_DEPS)
1207 $(FREEZE_MODULE_BOOTSTRAP) importlib._bootstrap_external $(srcdir)/Lib/importlib/_bootstrap_external.py Python/frozen_modules/importlib._bootstrap_external.h
044e8d86 1208
eb483c46
CH
1209Python/frozen_modules/zipimport.h: Lib/zipimport.py $(FREEZE_MODULE_BOOTSTRAP_DEPS)
1210 $(FREEZE_MODULE_BOOTSTRAP) zipimport $(srcdir)/Lib/zipimport.py Python/frozen_modules/zipimport.h
cbeb8197 1211
eb483c46 1212Python/frozen_modules/abc.h: Lib/abc.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1213 $(FREEZE_MODULE) abc $(srcdir)/Lib/abc.py Python/frozen_modules/abc.h
cbeb8197 1214
eb483c46 1215Python/frozen_modules/codecs.h: Lib/codecs.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1216 $(FREEZE_MODULE) codecs $(srcdir)/Lib/codecs.py Python/frozen_modules/codecs.h
09059163 1217
eb483c46 1218Python/frozen_modules/io.h: Lib/io.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1219 $(FREEZE_MODULE) io $(srcdir)/Lib/io.py Python/frozen_modules/io.h
cbeb8197 1220
eb483c46 1221Python/frozen_modules/_collections_abc.h: Lib/_collections_abc.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1222 $(FREEZE_MODULE) _collections_abc $(srcdir)/Lib/_collections_abc.py Python/frozen_modules/_collections_abc.h
cbeb8197 1223
eb483c46 1224Python/frozen_modules/_sitebuiltins.h: Lib/_sitebuiltins.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1225 $(FREEZE_MODULE) _sitebuiltins $(srcdir)/Lib/_sitebuiltins.py Python/frozen_modules/_sitebuiltins.h
cbeb8197 1226
eb483c46 1227Python/frozen_modules/genericpath.h: Lib/genericpath.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1228 $(FREEZE_MODULE) genericpath $(srcdir)/Lib/genericpath.py Python/frozen_modules/genericpath.h
cbeb8197 1229
eb483c46 1230Python/frozen_modules/ntpath.h: Lib/ntpath.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1231 $(FREEZE_MODULE) ntpath $(srcdir)/Lib/ntpath.py Python/frozen_modules/ntpath.h
cbeb8197 1232
eb483c46 1233Python/frozen_modules/posixpath.h: Lib/posixpath.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1234 $(FREEZE_MODULE) posixpath $(srcdir)/Lib/posixpath.py Python/frozen_modules/posixpath.h
cbeb8197 1235
eb483c46 1236Python/frozen_modules/os.h: Lib/os.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1237 $(FREEZE_MODULE) os $(srcdir)/Lib/os.py Python/frozen_modules/os.h
09059163 1238
eb483c46 1239Python/frozen_modules/site.h: Lib/site.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1240 $(FREEZE_MODULE) site $(srcdir)/Lib/site.py Python/frozen_modules/site.h
09059163 1241
eb483c46 1242Python/frozen_modules/stat.h: Lib/stat.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1243 $(FREEZE_MODULE) stat $(srcdir)/Lib/stat.py Python/frozen_modules/stat.h
044e8d86 1244
eb483c46 1245Python/frozen_modules/importlib.util.h: Lib/importlib/util.py $(FREEZE_MODULE_DEPS)
44b0e76f
KA
1246 $(FREEZE_MODULE) importlib.util $(srcdir)/Lib/importlib/util.py Python/frozen_modules/importlib.util.h
1247
eb483c46 1248Python/frozen_modules/importlib.machinery.h: Lib/importlib/machinery.py $(FREEZE_MODULE_DEPS)
44b0e76f
KA
1249 $(FREEZE_MODULE) importlib.machinery $(srcdir)/Lib/importlib/machinery.py Python/frozen_modules/importlib.machinery.h
1250
eb483c46 1251Python/frozen_modules/runpy.h: Lib/runpy.py $(FREEZE_MODULE_DEPS)
44b0e76f
KA
1252 $(FREEZE_MODULE) runpy $(srcdir)/Lib/runpy.py Python/frozen_modules/runpy.h
1253
eb483c46 1254Python/frozen_modules/__hello__.h: Lib/__hello__.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1255 $(FREEZE_MODULE) __hello__ $(srcdir)/Lib/__hello__.py Python/frozen_modules/__hello__.h
044e8d86 1256
eb483c46 1257Python/frozen_modules/__phello__.h: Lib/__phello__/__init__.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1258 $(FREEZE_MODULE) __phello__ $(srcdir)/Lib/__phello__/__init__.py Python/frozen_modules/__phello__.h
7e5c1075 1259
eb483c46 1260Python/frozen_modules/__phello__.ham.h: Lib/__phello__/ham/__init__.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1261 $(FREEZE_MODULE) __phello__.ham $(srcdir)/Lib/__phello__/ham/__init__.py Python/frozen_modules/__phello__.ham.h
7e5c1075 1262
eb483c46 1263Python/frozen_modules/__phello__.ham.eggs.h: Lib/__phello__/ham/eggs.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1264 $(FREEZE_MODULE) __phello__.ham.eggs $(srcdir)/Lib/__phello__/ham/eggs.py Python/frozen_modules/__phello__.ham.eggs.h
7e5c1075 1265
eb483c46 1266Python/frozen_modules/__phello__.spam.h: Lib/__phello__/spam.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1267 $(FREEZE_MODULE) __phello__.spam $(srcdir)/Lib/__phello__/spam.py Python/frozen_modules/__phello__.spam.h
7e5c1075 1268
eb483c46 1269Python/frozen_modules/frozen_only.h: Tools/freeze/flag.py $(FREEZE_MODULE_DEPS)
dd8ce9ea 1270 $(FREEZE_MODULE) frozen_only $(srcdir)/Tools/freeze/flag.py Python/frozen_modules/frozen_only.h
7e5c1075 1271
044e8d86
ES
1272# END: freezing modules
1273
1863302d 1274Tools/build/freeze_modules.py: $(FREEZE_MODULE)
99fcf150 1275
7c801e0f 1276.PHONY: regen-frozen
1863302d 1277regen-frozen: Tools/build/freeze_modules.py $(FROZEN_FILES_IN)
19e4f757 1278 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/freeze_modules.py --frozen-modules
7c801e0f
ES
1279 @echo "The Makefile was updated, you may need to re-run make."
1280
ef3ef6fa
KA
1281############################################################################
1282# Deepfreeze targets
1283
e260087a 1284DEEPFREEZE_C = Python/deepfreeze/deepfreeze.c
a2a4b9f1 1285DEEPFREEZE_DEPS=$(srcdir)/Tools/build/deepfreeze.py Include/internal/pycore_global_strings.h $(FREEZE_MODULE_DEPS) $(FROZEN_FILES_OUT)
ef3ef6fa
KA
1286
1287# BEGIN: deepfreeze modules
db1ee6a1 1288$(DEEPFREEZE_C): $(DEEPFREEZE_DEPS)
1863302d 1289 $(PYTHON_FOR_FREEZE) $(srcdir)/Tools/build/deepfreeze.py \
ef3ef6fa
KA
1290 Python/frozen_modules/importlib._bootstrap.h:importlib._bootstrap \
1291 Python/frozen_modules/importlib._bootstrap_external.h:importlib._bootstrap_external \
1292 Python/frozen_modules/zipimport.h:zipimport \
1293 Python/frozen_modules/abc.h:abc \
1294 Python/frozen_modules/codecs.h:codecs \
1295 Python/frozen_modules/io.h:io \
1296 Python/frozen_modules/_collections_abc.h:_collections_abc \
1297 Python/frozen_modules/_sitebuiltins.h:_sitebuiltins \
1298 Python/frozen_modules/genericpath.h:genericpath \
1299 Python/frozen_modules/ntpath.h:ntpath \
1300 Python/frozen_modules/posixpath.h:posixpath \
1301 Python/frozen_modules/os.h:os \
1302 Python/frozen_modules/site.h:site \
1303 Python/frozen_modules/stat.h:stat \
1304 Python/frozen_modules/importlib.util.h:importlib.util \
1305 Python/frozen_modules/importlib.machinery.h:importlib.machinery \
1306 Python/frozen_modules/runpy.h:runpy \
1307 Python/frozen_modules/__hello__.h:__hello__ \
1308 Python/frozen_modules/__phello__.h:__phello__ \
1309 Python/frozen_modules/__phello__.ham.h:__phello__.ham \
1310 Python/frozen_modules/__phello__.ham.eggs.h:__phello__.ham.eggs \
1311 Python/frozen_modules/__phello__.spam.h:__phello__.spam \
1312 Python/frozen_modules/frozen_only.h:frozen_only \
1313 -o Python/deepfreeze/deepfreeze.c
ef3ef6fa
KA
1314# END: deepfreeze modules
1315
044e8d86 1316# We keep this renamed target around for folks with muscle memory.
a5c62a8e 1317.PHONY: regen-importlib
044e8d86 1318regen-importlib: regen-frozen
a5c62a8e 1319
247480a2
ES
1320############################################################################
1321# Global objects
1322
db1ee6a1 1323# Dependencies which can add and/or remove _Py_ID() identifiers:
db1ee6a1 1324# - "make clinic"
db4dada5 1325.PHONY: regen-global-objects
e260087a 1326regen-global-objects: $(srcdir)/Tools/build/generate_global_objects.py clinic
1863302d 1327 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_global_objects.py
db4dada5 1328
044e8d86
ES
1329############################################################################
1330# ABI
a5c62a8e 1331
a6bcc8fb 1332.PHONY: regen-abidump
dd39e29c
PGS
1333regen-abidump: all
1334 @$(MKDIR_P) $(srcdir)/Doc/data/
1335 abidw "libpython$(LDVERSION).so" --no-architecture --out-file $(srcdir)/Doc/data/python$(LDVERSION).abi.new
8e6eccab 1336 @$(UPDATE_FILE) --create $(srcdir)/Doc/data/python$(LDVERSION).abi $(srcdir)/Doc/data/python$(LDVERSION).abi.new
dd39e29c 1337
a6bcc8fb 1338.PHONY: check-abidump
dd39e29c
PGS
1339check-abidump: all
1340 abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms
1341
a6bcc8fb 1342.PHONY: regen-limited-abi
85f1dedb 1343regen-limited-abi: all
1863302d 1344 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/stable_abi.py --generate-all $(srcdir)/Misc/stable_abi.toml
85f1dedb 1345
9573d142
CBT
1346############################################################################
1347# Regenerate Unicode Data
1348
1349.PHONY: regen-unicodedata
1350regen-unicodedata:
1351 $(PYTHON_FOR_REGEN) Tools/unicode/makeunicodedata.py
1352
1353
a5c62a8e
VS
1354############################################################################
1355# Regenerate all generated files
e67f48ce 1356
db1ee6a1 1357# "clinic" is regenerated implicitly via "regen-global-objects".
a6bcc8fb 1358.PHONY: regen-all
72119d16 1359regen-all: regen-cases regen-typeslots \
db1ee6a1 1360 regen-token regen-ast regen-keyword regen-sre regen-frozen \
247480a2 1361 regen-pegen-metaparser regen-pegen regen-test-frozenmain \
9573d142 1362 regen-test-levenshtein regen-global-objects regen-unicodedata
cad8020c 1363 @echo
ec0082ca
VS
1364 @echo "Note: make regen-stdlib-module-names, make regen-limited-abi"
1365 @echo "and make regen-configure should be run manually"
aed97733 1366
85515ad9
NS
1367############################################################################
1368# Special rules for object files
1369
dea59e57
ML
1370Modules/getbuildinfo.o: $(PARSER_OBJS) \
1371 $(OBJECT_OBJS) \
1372 $(PYTHON_OBJS) \
1373 $(MODULE_OBJS) \
dea59e57 1374 $(MODOBJS) \
5c8f5376 1375 $(DTRACE_OBJS) \
dea59e57 1376 $(srcdir)/Modules/getbuildinfo.c
13039c87 1377 $(CC) -c $(PY_CORE_CFLAGS) \
5c4b0d06
ND
1378 -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
1379 -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
1380 -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
1ca2e796 1381 -o $@ $(srcdir)/Modules/getbuildinfo.c
03184e28 1382
ccb73a0d 1383Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)
d4fcdb1e 1384 $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
7ac954b7
NS
1385 -DPREFIX='"$(prefix)"' \
1386 -DEXEC_PREFIX='"$(exec_prefix)"' \
1387 -DVERSION='"$(VERSION)"' \
1388 -DVPATH='"$(VPATH)"' \
99fcf150 1389 -DPLATLIBDIR='"$(PLATLIBDIR)"' \
6aaf4cd8 1390 -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' \
30be8708 1391 -o $@ $(srcdir)/Modules/getpath.c
85515ad9 1392
973fe0ba 1393Programs/python.o: $(srcdir)/Programs/python.c
398ed84d 1394 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c
85515ad9 1395
eaede0de 1396Programs/_testembed.o: $(srcdir)/Programs/_testembed.c Programs/test_frozenmain.h
398ed84d 1397 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/_testembed.c
69f55cc0 1398
1578f06c 1399Modules/_sre/sre.o: $(srcdir)/Modules/_sre/sre.c $(srcdir)/Modules/_sre/sre.h $(srcdir)/Modules/_sre/sre_constants.h $(srcdir)/Modules/_sre/sre_lib.h
8444ebbd 1400
7cf55993
SS
1401Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c $(srcdir)/Modules/posixmodule.h
1402
1403Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule.h
1404
1405Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h
1406
1407Modules/signalmodule.o: $(srcdir)/Modules/signalmodule.c $(srcdir)/Modules/posixmodule.h
1408
35f3a2cb
BW
1409Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
1410 $(CC) -c $(PY_CORE_CFLAGS) \
1411 -DSOABI='"$(SOABI)"' \
1412 -o $@ $(srcdir)/Python/dynload_shlib.c
1413
d5537d07 1414Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile
1415 $(CC) -c $(PY_CORE_CFLAGS) \
1416 -DSHLIB_EXT='"$(EXT_SUFFIX)"' \
1417 -o $@ $(srcdir)/Python/dynload_hpux.c
1418
8a8b59c9 1419Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h
8cf4eae5
BW
1420 $(CC) -c $(PY_CORE_CFLAGS) \
1421 -DABIFLAGS='"$(ABIFLAGS)"' \
5553231b 1422 $(MULTIARCH_CPPFLAGS) \
8cf4eae5
BW
1423 -o $@ $(srcdir)/Python/sysmodule.c
1424
4fa88fa0 1425$(IO_OBJS): $(IO_H)
85515ad9 1426
d2baff43
PG
1427.PHONY: regen-pegen-metaparser
1428regen-pegen-metaparser:
b7226eb0 1429 @$(MKDIR_P) $(srcdir)/Tools/peg_generator/pegen
d2baff43
PG
1430 PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q python \
1431 $(srcdir)/Tools/peg_generator/pegen/metagrammar.gram \
1432 -o $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new
1433 $(UPDATE_FILE) $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py \
1434 $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new
1435
c5fc1568
PG
1436.PHONY: regen-pegen
1437regen-pegen:
1ed83adb 1438 @$(MKDIR_P) $(srcdir)/Parser
01481f2d
LN
1439 @$(MKDIR_P) $(srcdir)/Parser/tokenizer
1440 @$(MKDIR_P) $(srcdir)/Parser/lexer
5b9f4988
PG
1441 PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q c \
1442 $(srcdir)/Grammar/python.gram \
1443 $(srcdir)/Grammar/Tokens \
fb6c4ed2
VS
1444 -o $(srcdir)/Parser/parser.c.new
1445 $(UPDATE_FILE) $(srcdir)/Parser/parser.c $(srcdir)/Parser/parser.c.new
c5fc1568 1446
a6bcc8fb 1447.PHONY: regen-ast
a5c62a8e 1448regen-ast:
94faa072
VS
1449 # Regenerate 3 files using using Parser/asdl_c.py:
1450 # - Include/internal/pycore_ast.h
1451 # - Include/internal/pycore_ast_state.h
1452 # - Python/Python-ast.c
a5c62a8e 1453 $(MKDIR_P) $(srcdir)/Include
a5c62a8e
VS
1454 $(MKDIR_P) $(srcdir)/Python
1455 $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
63b8e0cb 1456 $(srcdir)/Parser/Python.asdl \
94faa072 1457 -H $(srcdir)/Include/internal/pycore_ast.h.new \
b4536e1c 1458 -I $(srcdir)/Include/internal/pycore_ast_state.h.new \
63b8e0cb
BT
1459 -C $(srcdir)/Python/Python-ast.c.new
1460
94faa072 1461 $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast.h $(srcdir)/Include/internal/pycore_ast.h.new
b4536e1c 1462 $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast_state.h $(srcdir)/Include/internal/pycore_ast_state.h.new
b091bec8 1463 $(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new
a5c62a8e 1464
8ac65811
SS
1465.PHONY: regen-token
1466regen-token:
1467 # Regenerate Doc/library/token-list.inc from Grammar/Tokens
1863302d
VS
1468 # using Tools/build/generate_token.py
1469 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_token.py rst \
8ac65811
SS
1470 $(srcdir)/Grammar/Tokens \
1471 $(srcdir)/Doc/library/token-list.inc
da5727a1 1472 # Regenerate Include/internal/pycore_token.h from Grammar/Tokens
1863302d
VS
1473 # using Tools/build/generate_token.py
1474 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_token.py h \
8ac65811 1475 $(srcdir)/Grammar/Tokens \
da5727a1 1476 $(srcdir)/Include/internal/pycore_token.h
8ac65811 1477 # Regenerate Parser/token.c from Grammar/Tokens
1863302d
VS
1478 # using Tools/build/generate_token.py
1479 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_token.py c \
8ac65811
SS
1480 $(srcdir)/Grammar/Tokens \
1481 $(srcdir)/Parser/token.c
1482 # Regenerate Lib/token.py from Grammar/Tokens
1863302d
VS
1483 # using Tools/build/generate_token.py
1484 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_token.py py \
8ac65811
SS
1485 $(srcdir)/Grammar/Tokens \
1486 $(srcdir)/Lib/token.py
1487
91759d98
PG
1488.PHONY: regen-keyword
1489regen-keyword:
9727694f
LN
1490 # Regenerate Lib/keyword.py from Grammar/python.gram and Grammar/Tokens
1491 # using Tools/peg_generator/pegen
1492 PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen.keywordgen \
1493 $(srcdir)/Grammar/python.gram \
91759d98
PG
1494 $(srcdir)/Grammar/Tokens \
1495 $(srcdir)/Lib/keyword.py.new
1496 $(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
1497
9852cb38 1498.PHONY: regen-stdlib-module-names
d1de1078 1499regen-stdlib-module-names: all Programs/_testembed
9852cb38 1500 # Regenerate Python/stdlib_module_names.h
1863302d 1501 # using Tools/build/generate_stdlib_module_names.py
cad8020c 1502 $(RUNSHARED) ./$(BUILDPYTHON) \
1863302d 1503 $(srcdir)/Tools/build/generate_stdlib_module_names.py \
9852cb38
VS
1504 > $(srcdir)/Python/stdlib_module_names.h.new
1505 $(UPDATE_FILE) $(srcdir)/Python/stdlib_module_names.h $(srcdir)/Python/stdlib_module_names.h.new
cad8020c 1506
a6bcc8fb 1507.PHONY: regen-sre
474fdbe9 1508regen-sre:
1b34b568 1509 # Regenerate Modules/_sre/sre_constants.h and Modules/_sre/sre_targets.h
1863302d
VS
1510 # from Lib/re/_constants.py using Tools/build/generate_sre_constants.py
1511 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_sre_constants.py \
474fdbe9 1512 $(srcdir)/Lib/re/_constants.py \
1b34b568
BB
1513 $(srcdir)/Modules/_sre/sre_constants.h \
1514 $(srcdir)/Modules/_sre/sre_targets.h
474fdbe9 1515
94faa072 1516Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o: $(srcdir)/Include/internal/pycore_ast.h
40417746 1517
85515ad9 1518Python/getplatform.o: $(srcdir)/Python/getplatform.c
d4fcdb1e 1519 $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
85515ad9
NS
1520
1521Python/importdl.o: $(srcdir)/Python/importdl.c
d4fcdb1e 1522 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
85515ad9 1523
85515ad9
NS
1524Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
1525 $(srcdir)/Objects/unicodetype_db.h
1526
da996837 1527BYTESTR_DEPS = \
da996837
CH
1528 $(srcdir)/Objects/stringlib/count.h \
1529 $(srcdir)/Objects/stringlib/ctype.h \
da996837
CH
1530 $(srcdir)/Objects/stringlib/fastsearch.h \
1531 $(srcdir)/Objects/stringlib/find.h \
74375fc0 1532 $(srcdir)/Objects/stringlib/join.h \
da996837 1533 $(srcdir)/Objects/stringlib/partition.h \
f2c5484f 1534 $(srcdir)/Objects/stringlib/split.h \
da996837 1535 $(srcdir)/Objects/stringlib/stringdefs.h \
05aba6ce 1536 $(srcdir)/Objects/stringlib/transmogrify.h
3e623243 1537
05aba6ce 1538UNICODE_DEPS = \
3e623243 1539 $(srcdir)/Objects/stringlib/asciilib.h \
0a3229de 1540 $(srcdir)/Objects/stringlib/codecs.h \
05aba6ce
SS
1541 $(srcdir)/Objects/stringlib/count.h \
1542 $(srcdir)/Objects/stringlib/fastsearch.h \
1543 $(srcdir)/Objects/stringlib/find.h \
1544 $(srcdir)/Objects/stringlib/find_max_char.h \
1545 $(srcdir)/Objects/stringlib/localeutil.h \
1546 $(srcdir)/Objects/stringlib/partition.h \
e2cef885 1547 $(srcdir)/Objects/stringlib/replace.h \
05aba6ce 1548 $(srcdir)/Objects/stringlib/split.h \
3e623243
AP
1549 $(srcdir)/Objects/stringlib/ucs1lib.h \
1550 $(srcdir)/Objects/stringlib/ucs2lib.h \
1551 $(srcdir)/Objects/stringlib/ucs4lib.h \
05aba6ce 1552 $(srcdir)/Objects/stringlib/undef.h \
f9c9354a 1553 $(srcdir)/Objects/stringlib/unicode_format.h
60d241f1 1554
3d40e378 1555Objects/bytes_methods.o: $(srcdir)/Objects/bytes_methods.c $(BYTESTR_DEPS)
9ae3220c 1556Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
4e31443c 1557Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS)
60d241f1 1558
3e623243 1559Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS)
8c663263 1560
e117c028 1561Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h
6fb44728
ML
1562Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
1563
05f2f0ac
DV
1564Objects/obmalloc.o: $(srcdir)/Objects/mimalloc/alloc.c \
1565 $(srcdir)/Objects/mimalloc/alloc-aligned.c \
1566 $(srcdir)/Objects/mimalloc/alloc-posix.c \
1567 $(srcdir)/Objects/mimalloc/arena.c \
1568 $(srcdir)/Objects/mimalloc/bitmap.c \
1569 $(srcdir)/Objects/mimalloc/heap.c \
1570 $(srcdir)/Objects/mimalloc/init.c \
1571 $(srcdir)/Objects/mimalloc/options.c \
1572 $(srcdir)/Objects/mimalloc/os.c \
1573 $(srcdir)/Objects/mimalloc/page.c \
1574 $(srcdir)/Objects/mimalloc/random.c \
1575 $(srcdir)/Objects/mimalloc/segment.c \
1576 $(srcdir)/Objects/mimalloc/segment-map.c \
1577 $(srcdir)/Objects/mimalloc/stats.c \
1578 $(srcdir)/Objects/mimalloc/prim/prim.c
1579
1580Objects/mimalloc/page.o: $(srcdir)/Objects/mimalloc/page-queue.c
b52ec78b 1581
41bc101d
GR
1582.PHONY: regen-cases
1583regen-cases:
51fc7251 1584 # Regenerate various files from Python/bytecodes.c
7f55f58b 1585 # Pass CASESFLAG=-l to insert #line directives in the output
41bc101d 1586 PYTHONPATH=$(srcdir)/Tools/cases_generator \
48d5d32b
GR
1587 $(PYTHON_FOR_REGEN) \
1588 $(srcdir)/Tools/cases_generator/generate_cases.py \
7f55f58b 1589 $(CASESFLAG) \
48d5d32b 1590 -o $(srcdir)/Python/generated_cases.c.h.new \
665a4391
IK
1591 -n $(srcdir)/Include/opcode_ids.h.new \
1592 -t $(srcdir)/Python/opcode_targets.h.new \
2ca008e2 1593 -m $(srcdir)/Include/internal/pycore_opcode_metadata.h.new \
48d5d32b
GR
1594 -e $(srcdir)/Python/executor_cases.c.h.new \
1595 -p $(srcdir)/Lib/_opcode_metadata.py.new \
e28b0dc8 1596 -a $(srcdir)/Python/abstract_interp_cases.c.h.new \
48d5d32b
GR
1597 $(srcdir)/Python/bytecodes.c
1598 $(UPDATE_FILE) $(srcdir)/Python/generated_cases.c.h $(srcdir)/Python/generated_cases.c.h.new
665a4391
IK
1599 $(UPDATE_FILE) $(srcdir)/Include/opcode_ids.h $(srcdir)/Include/opcode_ids.h.new
1600 $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
2ca008e2 1601 $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_opcode_metadata.h $(srcdir)/Include/internal/pycore_opcode_metadata.h.new
48d5d32b 1602 $(UPDATE_FILE) $(srcdir)/Python/executor_cases.c.h $(srcdir)/Python/executor_cases.c.h.new
e28b0dc8 1603 $(UPDATE_FILE) $(srcdir)/Python/abstract_interp_cases.c.h $(srcdir)/Python/abstract_interp_cases.c.h.new
48d5d32b 1604 $(UPDATE_FILE) $(srcdir)/Lib/_opcode_metadata.py $(srcdir)/Lib/_opcode_metadata.py.new
41bc101d 1605
2ca008e2 1606Python/compile.o: $(srcdir)/Include/internal/pycore_opcode_metadata.h
65b7b6bd 1607
1f0d0a43
GR
1608Python/ceval.o: \
1609 $(srcdir)/Python/ceval_macros.h \
1610 $(srcdir)/Python/condvar.h \
1611 $(srcdir)/Python/generated_cases.c.h \
1f0d0a43 1612 $(srcdir)/Python/opcode_targets.h
b52ec78b 1613
51fc7251 1614Python/flowgraph.o: \
2ca008e2 1615 $(srcdir)/Include/internal/pycore_opcode_metadata.h
51fc7251
GR
1616
1617Python/optimizer.o: \
1618 $(srcdir)/Python/executor_cases.c.h \
e28b0dc8
KJ
1619 $(srcdir)/Include/internal/pycore_opcode_metadata.h \
1620 $(srcdir)/Include/internal/pycore_optimizer.h
1621
1622Python/optimizer_analysis.o: \
1623 $(srcdir)/Include/internal/pycore_opcode_metadata.h \
1624 $(srcdir)/Include/internal/pycore_optimizer.h
51fc7251 1625
7c801e0f 1626Python/frozen.o: $(FROZEN_FILES_OUT)
a4932353 1627
a785c87d
ŁL
1628# Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to
1629# follow our naming conventions. dtrace(1) uses the output filename to generate
1630# an include guard, so we can't use a pipeline to transform its output.
1631Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
f6eae5bf 1632 $(MKDIR_P) Include
a785c87d
ŁL
1633 $(DTRACE) $(DFLAGS) -o $@ -h -s $<
1634 : sed in-place edit with POSIX-only tools
1635 sed 's/PYTHON_/PyDTrace_/' $@ > $@.tmp
1636 mv $@.tmp $@
1637
8a8b59c9
CH
1638Python/ceval.o: $(srcdir)/Include/pydtrace.h
1639Python/import.o: $(srcdir)/Include/pydtrace.h
1640Modules/gcmodule.o: $(srcdir)/Include/pydtrace.h
5c8f5376 1641
a785c87d
ŁL
1642Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
1643 $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
1644
9effe699 1645Objects/typeobject.o: Objects/typeslots.inc
a5c62a8e
VS
1646
1647.PHONY: regen-typeslots
1648regen-typeslots:
1649 # Regenerate Objects/typeslots.inc from Include/typeslotsh
1650 # using Objects/typeslots.py
1651 $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \
1652 < $(srcdir)/Include/typeslots.h \
b091bec8
AP
1653 $(srcdir)/Objects/typeslots.inc.new
1654 $(UPDATE_FILE) $(srcdir)/Objects/typeslots.inc $(srcdir)/Objects/typeslots.inc.new
8c663263 1655
85515ad9
NS
1656############################################################################
1657# Header files
1658
f65e5005 1659PYTHON_HEADERS= \
69f55cc0
VS
1660 $(srcdir)/Include/Python.h \
1661 $(srcdir)/Include/abstract.h \
b4612f5d 1662 $(srcdir)/Include/bltinmodule.h \
69f55cc0 1663 $(srcdir)/Include/boolobject.h \
69f55cc0
VS
1664 $(srcdir)/Include/bytearrayobject.h \
1665 $(srcdir)/Include/bytesobject.h \
69f55cc0 1666 $(srcdir)/Include/ceval.h \
69f55cc0
VS
1667 $(srcdir)/Include/codecs.h \
1668 $(srcdir)/Include/compile.h \
1669 $(srcdir)/Include/complexobject.h \
1670 $(srcdir)/Include/descrobject.h \
1671 $(srcdir)/Include/dictobject.h \
69f55cc0
VS
1672 $(srcdir)/Include/dynamic_annotations.h \
1673 $(srcdir)/Include/enumobject.h \
1674 $(srcdir)/Include/errcode.h \
69f55cc0
VS
1675 $(srcdir)/Include/fileobject.h \
1676 $(srcdir)/Include/fileutils.h \
1677 $(srcdir)/Include/floatobject.h \
1678 $(srcdir)/Include/frameobject.h \
69f55cc0 1679 $(srcdir)/Include/import.h \
8bdae142 1680 $(srcdir)/Include/interpreteridobject.h \
69f55cc0
VS
1681 $(srcdir)/Include/intrcheck.h \
1682 $(srcdir)/Include/iterobject.h \
1683 $(srcdir)/Include/listobject.h \
69f55cc0
VS
1684 $(srcdir)/Include/longobject.h \
1685 $(srcdir)/Include/marshal.h \
1686 $(srcdir)/Include/memoryobject.h \
69f55cc0
VS
1687 $(srcdir)/Include/methodobject.h \
1688 $(srcdir)/Include/modsupport.h \
1689 $(srcdir)/Include/moduleobject.h \
69f55cc0
VS
1690 $(srcdir)/Include/object.h \
1691 $(srcdir)/Include/objimpl.h \
a5c62a8e 1692 $(srcdir)/Include/opcode.h \
72119d16 1693 $(srcdir)/Include/opcode_ids.h \
69f55cc0 1694 $(srcdir)/Include/osdefs.h \
82029ac1 1695 $(srcdir)/Include/osmodule.h \
69f55cc0 1696 $(srcdir)/Include/patchlevel.h \
66b3cd70 1697 $(srcdir)/Include/pybuffer.h \
69f55cc0 1698 $(srcdir)/Include/pycapsule.h \
a785c87d 1699 $(srcdir)/Include/pydtrace.h \
69f55cc0 1700 $(srcdir)/Include/pyerrors.h \
7c59d7c9 1701 $(srcdir)/Include/pyframe.h \
985ecdcf 1702 $(srcdir)/Include/pyhash.h \
d6009517 1703 $(srcdir)/Include/pylifecycle.h \
b4612f5d 1704 $(srcdir)/Include/pymacconfig.h \
69f55cc0 1705 $(srcdir)/Include/pymacro.h \
b4612f5d 1706 $(srcdir)/Include/pymath.h \
69f55cc0
VS
1707 $(srcdir)/Include/pymem.h \
1708 $(srcdir)/Include/pyport.h \
1709 $(srcdir)/Include/pystate.h \
fa2b8b75 1710 $(srcdir)/Include/pystats.h \
69f55cc0 1711 $(srcdir)/Include/pystrcmp.h \
b4612f5d 1712 $(srcdir)/Include/pystrtod.h \
69f55cc0
VS
1713 $(srcdir)/Include/pythonrun.h \
1714 $(srcdir)/Include/pythread.h \
ec091bd4 1715 $(srcdir)/Include/pytypedefs.h \
69f55cc0
VS
1716 $(srcdir)/Include/rangeobject.h \
1717 $(srcdir)/Include/setobject.h \
1718 $(srcdir)/Include/sliceobject.h \
1719 $(srcdir)/Include/structmember.h \
1720 $(srcdir)/Include/structseq.h \
69f55cc0
VS
1721 $(srcdir)/Include/sysmodule.h \
1722 $(srcdir)/Include/traceback.h \
1723 $(srcdir)/Include/tupleobject.h \
69f55cc0
VS
1724 $(srcdir)/Include/unicodeobject.h \
1725 $(srcdir)/Include/warnings.h \
1726 $(srcdir)/Include/weakrefobject.h \
e421106b 1727 \
86def6cb 1728 pyconfig.h \
46c686fc 1729 $(PARSER_HEADERS) \
e421106b 1730 \
54ba556c 1731 $(srcdir)/Include/cpython/abstract.h \
98921aea
VS
1732 $(srcdir)/Include/cpython/bytearrayobject.h \
1733 $(srcdir)/Include/cpython/bytesobject.h \
77b24ba5 1734 $(srcdir)/Include/cpython/cellobject.h \
f4b1e3d7 1735 $(srcdir)/Include/cpython/ceval.h \
8e5de40f 1736 $(srcdir)/Include/cpython/classobject.h \
b8f704d2 1737 $(srcdir)/Include/cpython/code.h \
56f031ec 1738 $(srcdir)/Include/cpython/compile.h \
ca219f6d 1739 $(srcdir)/Include/cpython/complexobject.h \
8e5de40f 1740 $(srcdir)/Include/cpython/context.h \
d4a85f10 1741 $(srcdir)/Include/cpython/descrobject.h \
54ba556c 1742 $(srcdir)/Include/cpython/dictobject.h \
b82e17e6 1743 $(srcdir)/Include/cpython/fileobject.h \
8c3aee65 1744 $(srcdir)/Include/cpython/fileutils.h \
0a883a76 1745 $(srcdir)/Include/cpython/floatobject.h \
a6879d94 1746 $(srcdir)/Include/cpython/frameobject.h \
37b1d607 1747 $(srcdir)/Include/cpython/funcobject.h \
8e5de40f 1748 $(srcdir)/Include/cpython/genobject.h \
01b63eca 1749 $(srcdir)/Include/cpython/import.h \
331a6a56 1750 $(srcdir)/Include/cpython/initconfig.h \
8bdae142 1751 $(srcdir)/Include/cpython/interpreteridobject.h \
bec4186c 1752 $(srcdir)/Include/cpython/listobject.h \
8e5de40f 1753 $(srcdir)/Include/cpython/longintrepr.h \
5f09bb02 1754 $(srcdir)/Include/cpython/longobject.h \
55bad199 1755 $(srcdir)/Include/cpython/memoryobject.h \
e1becf46 1756 $(srcdir)/Include/cpython/methodobject.h \
54ba556c 1757 $(srcdir)/Include/cpython/object.h \
e421106b 1758 $(srcdir)/Include/cpython/objimpl.h \
4a6bf276 1759 $(srcdir)/Include/cpython/odictobject.h \
319de0b5 1760 $(srcdir)/Include/cpython/optimizer.h \
4a6bf276 1761 $(srcdir)/Include/cpython/picklebufobject.h \
0fe645d6 1762 $(srcdir)/Include/cpython/pthread_stubs.h \
2bd960b5
VS
1763 $(srcdir)/Include/cpython/pyatomic.h \
1764 $(srcdir)/Include/cpython/pyatomic_gcc.h \
1765 $(srcdir)/Include/cpython/pyatomic_std.h \
366dc3a1 1766 $(srcdir)/Include/cpython/pyctype.h \
4a6bf276 1767 $(srcdir)/Include/cpython/pydebug.h \
54ba556c 1768 $(srcdir)/Include/cpython/pyerrors.h \
4a6bf276 1769 $(srcdir)/Include/cpython/pyfpe.h \
27b98940 1770 $(srcdir)/Include/cpython/pyframe.h \
54ba556c 1771 $(srcdir)/Include/cpython/pylifecycle.h \
aba7d662 1772 $(srcdir)/Include/cpython/pymem.h \
54ba556c 1773 $(srcdir)/Include/cpython/pystate.h \
a0773b89 1774 $(srcdir)/Include/cpython/pystats.h \
fe6e5e7c 1775 $(srcdir)/Include/cpython/pythonrun.h \
8a4e519e 1776 $(srcdir)/Include/cpython/pythread.h \
5c4d1f6e 1777 $(srcdir)/Include/cpython/setobject.h \
b82e17e6 1778 $(srcdir)/Include/cpython/sysmodule.h \
fd1e0e93 1779 $(srcdir)/Include/cpython/traceback.h \
feb51f3a 1780 $(srcdir)/Include/cpython/tracemalloc.h \
54ba556c
VS
1781 $(srcdir)/Include/cpython/tupleobject.h \
1782 $(srcdir)/Include/cpython/unicodeobject.h \
aad88d33
VS
1783 $(srcdir)/Include/cpython/warnings.h \
1784 $(srcdir)/Include/cpython/weakrefobject.h \
e421106b 1785 \
05f2f0ac
DV
1786 @MIMALLOC_HEADERS@ \
1787 \
a15e260b 1788 $(srcdir)/Include/internal/pycore_abstract.h \
94faa072 1789 $(srcdir)/Include/internal/pycore_asdl.h \
526fdeb2 1790 $(srcdir)/Include/internal/pycore_ast.h \
b4536e1c 1791 $(srcdir)/Include/internal/pycore_ast_state.h \
03089fdc 1792 $(srcdir)/Include/internal/pycore_atexit.h \
c6b292cd 1793 $(srcdir)/Include/internal/pycore_bitutils.h \
45876a90 1794 $(srcdir)/Include/internal/pycore_bytes_methods.h \
c8749b57 1795 $(srcdir)/Include/internal/pycore_bytesobject.h \
4d231bcc 1796 $(srcdir)/Include/internal/pycore_call.h \
39506ee5 1797 $(srcdir)/Include/internal/pycore_capsule.h \
27e2d1f2 1798 $(srcdir)/Include/internal/pycore_ceval.h \
bc8cdf8c 1799 $(srcdir)/Include/internal/pycore_ceval_state.h \
91234a16 1800 $(srcdir)/Include/internal/pycore_code.h \
0b514638 1801 $(srcdir)/Include/internal/pycore_codecs.h \
a81fca6e 1802 $(srcdir)/Include/internal/pycore_compile.h \
c38c6668 1803 $(srcdir)/Include/internal/pycore_complexobject.h \
621cebe8 1804 $(srcdir)/Include/internal/pycore_condvar.h \
27e2d1f2 1805 $(srcdir)/Include/internal/pycore_context.h \
31c90d58 1806 $(srcdir)/Include/internal/pycore_critical_section.h \
c6fe0869 1807 $(srcdir)/Include/internal/pycore_crossinterp.h \
e117c028 1808 $(srcdir)/Include/internal/pycore_dict.h \
9db1e17c 1809 $(srcdir)/Include/internal/pycore_dict_state.h \
a51742ab 1810 $(srcdir)/Include/internal/pycore_descrobject.h \
e9e7d284 1811 $(srcdir)/Include/internal/pycore_dtoa.h \
c8749b57 1812 $(srcdir)/Include/internal/pycore_exceptions.h \
53d9cd95 1813 $(srcdir)/Include/internal/pycore_faulthandler.h \
984061ee 1814 $(srcdir)/Include/internal/pycore_fileutils.h \
0a883a76 1815 $(srcdir)/Include/internal/pycore_floatobject.h \
2ad93821 1816 $(srcdir)/Include/internal/pycore_format.h \
0cd597fe 1817 $(srcdir)/Include/internal/pycore_frame.h \
135cabd3 1818 $(srcdir)/Include/internal/pycore_function.h \
c8749b57 1819 $(srcdir)/Include/internal/pycore_genobject.h \
27e2d1f2
VS
1820 $(srcdir)/Include/internal/pycore_getopt.h \
1821 $(srcdir)/Include/internal/pycore_gil.h \
121f1f89 1822 $(srcdir)/Include/internal/pycore_global_objects.h \
52f91c64 1823 $(srcdir)/Include/internal/pycore_global_objects_fini_generated.h \
621cebe8 1824 $(srcdir)/Include/internal/pycore_hamt.h \
b617993b 1825 $(srcdir)/Include/internal/pycore_hashtable.h \
4fb96a11 1826 $(srcdir)/Include/internal/pycore_identifier.h \
01b63eca 1827 $(srcdir)/Include/internal/pycore_import.h \
331a6a56 1828 $(srcdir)/Include/internal/pycore_initconfig.h \
0c13e1f9 1829 $(srcdir)/Include/internal/pycore_interp.h \
28187141 1830 $(srcdir)/Include/internal/pycore_intrinsics.h \
c45dbe93 1831 $(srcdir)/Include/internal/pycore_list.h \
0c89056f
SG
1832 $(srcdir)/Include/internal/pycore_llist.h \
1833 $(srcdir)/Include/internal/pycore_lock.h \
8e3b9f92 1834 $(srcdir)/Include/internal/pycore_long.h \
35963da4 1835 $(srcdir)/Include/internal/pycore_modsupport.h \
cdad2724 1836 $(srcdir)/Include/internal/pycore_moduleobject.h \
354c3522 1837 $(srcdir)/Include/internal/pycore_namespace.h \
984061ee 1838 $(srcdir)/Include/internal/pycore_object.h \
ad77d16a 1839 $(srcdir)/Include/internal/pycore_object_state.h \
67807cfc
ES
1840 $(srcdir)/Include/internal/pycore_obmalloc.h \
1841 $(srcdir)/Include/internal/pycore_obmalloc_init.h \
72119d16 1842 $(srcdir)/Include/internal/pycore_opcode_metadata.h \
80163e17 1843 $(srcdir)/Include/internal/pycore_opcode_utils.h \
e28b0dc8 1844 $(srcdir)/Include/internal/pycore_optimizer.h \
0c89056f 1845 $(srcdir)/Include/internal/pycore_parking_lot.h \
a1c249c4 1846 $(srcdir)/Include/internal/pycore_pathconfig.h \
8370e07e 1847 $(srcdir)/Include/internal/pycore_pyarena.h \
7bd560ce 1848 $(srcdir)/Include/internal/pycore_pybuffer.h \
438a12dd 1849 $(srcdir)/Include/internal/pycore_pyerrors.h \
621cebe8
VS
1850 $(srcdir)/Include/internal/pycore_pyhash.h \
1851 $(srcdir)/Include/internal/pycore_pylifecycle.h \
1852 $(srcdir)/Include/internal/pycore_pymem.h \
67807cfc 1853 $(srcdir)/Include/internal/pycore_pymem_init.h \
621cebe8 1854 $(srcdir)/Include/internal/pycore_pystate.h \
a0773b89 1855 $(srcdir)/Include/internal/pycore_pystats.h \
15c5a507 1856 $(srcdir)/Include/internal/pycore_pythonrun.h \
1160001b 1857 $(srcdir)/Include/internal/pycore_pythread.h \
5fcfdd87 1858 $(srcdir)/Include/internal/pycore_range.h \
1c4cbdf9 1859 $(srcdir)/Include/internal/pycore_runtime.h \
71697664 1860 $(srcdir)/Include/internal/pycore_runtime_init_generated.h \
bc02eac9 1861 $(srcdir)/Include/internal/pycore_runtime_init.h \
0c89056f 1862 $(srcdir)/Include/internal/pycore_semaphore.h \
5e4af2a3 1863 $(srcdir)/Include/internal/pycore_setobject.h \
20cc6952 1864 $(srcdir)/Include/internal/pycore_signal.h \
c8749b57 1865 $(srcdir)/Include/internal/pycore_sliceobject.h \
bbe7497c 1866 $(srcdir)/Include/internal/pycore_strhex.h \
c2931d31 1867 $(srcdir)/Include/internal/pycore_structseq.h \
28ad12f8 1868 $(srcdir)/Include/internal/pycore_symtable.h \
08faf001 1869 $(srcdir)/Include/internal/pycore_sysmodule.h \
8a3f06c5 1870 $(srcdir)/Include/internal/pycore_time.h \
da5727a1 1871 $(srcdir)/Include/internal/pycore_token.h \
fd1e0e93 1872 $(srcdir)/Include/internal/pycore_traceback.h \
8790d4d3 1873 $(srcdir)/Include/internal/pycore_tracemalloc.h \
384621c4 1874 $(srcdir)/Include/internal/pycore_tuple.h \
c8749b57 1875 $(srcdir)/Include/internal/pycore_typeobject.h \
24d8b884 1876 $(srcdir)/Include/internal/pycore_typevarobject.h \
47e1afd2 1877 $(srcdir)/Include/internal/pycore_ucnhash.h \
1b4552c5 1878 $(srcdir)/Include/internal/pycore_unionobject.h \
c8749b57 1879 $(srcdir)/Include/internal/pycore_unicodeobject.h \
52f91c64 1880 $(srcdir)/Include/internal/pycore_unicodeobject_generated.h \
2028a4f6 1881 $(srcdir)/Include/internal/pycore_uops.h \
27e2d1f2 1882 $(srcdir)/Include/internal/pycore_warnings.h \
cb388c9a 1883 $(srcdir)/Include/internal/pycore_weakref.h \
cad8020c 1884 $(DTRACE_HEADERS) \
087d0fa5 1885 @PLATFORM_HEADERS@ \
cad8020c 1886 \
9852cb38 1887 $(srcdir)/Python/stdlib_module_names.h
85515ad9 1888
973fe0ba 1889$(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
f65e5005 1890
85515ad9
NS
1891
1892######################################################################
1893
4fbff6c6 1894TESTOPTS= $(EXTRATESTOPTS)
d1de1078 1895TESTPYTHON= $(RUNSHARED) $(PYTHON_FOR_BUILD) $(TESTPYTHONOPTS)
53eb9a67 1896TESTRUNNER= $(TESTPYTHON) -m test
859618c8 1897TESTTIMEOUT=
3c01d16e 1898
47fbc4e4
VS
1899# Remove "test_python_*" directories of previous failed test jobs.
1900# Pass TESTOPTS options because it can contain --tempdir option.
a6bcc8fb 1901.PHONY: cleantest
d1de1078 1902cleantest: all
47fbc4e4
VS
1903 $(TESTRUNNER) $(TESTOPTS) --cleanup
1904
3c01d16e
NV
1905# Run a basic set of regression tests.
1906# This excludes some tests that are particularly resource-intensive.
859618c8 1907# Similar to buildbottest, but use --fast-ci option, instead of --slow-ci.
a6bcc8fb 1908.PHONY: test
243ed543 1909test: all
859618c8 1910 $(TESTRUNNER) --fast-ci --timeout=$(TESTTIMEOUT) $(TESTOPTS)
85515ad9 1911
ecd3e38f
NV
1912# Run the test suite for both architectures in a Universal build on OSX.
1913# Must be run on an Intel box.
a6bcc8fb 1914.PHONY: testuniversal
243ed543 1915testuniversal: all
859618c8
VS
1916 @if [ `arch` != 'i386' ]; then \
1917 echo "This can only be used on OSX/i386" ;\
1918 exit 1 ;\
1919 fi
1920 $(TESTRUNNER) --slow-ci --timeout=$(TESTTIMEOUT) $(TESTOPTS)
1921 $(RUNSHARED) /usr/libexec/oah/translate \
1922 ./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS)
477c8d5e 1923
9c91141f
VS
1924# Like test, but using --slow-ci which enables all test resources and use
1925# longer timeout. Run an optional pybuildbot.identify script to include
1926# information about the build environment.
a6bcc8fb 1927.PHONY: buildbottest
243ed543 1928buildbottest: all
859618c8
VS
1929 -@if which pybuildbot.identify >/dev/null 2>&1; then \
1930 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
1931 fi
1932 $(TESTRUNNER) --slow-ci --timeout=$(TESTTIMEOUT) $(TESTOPTS)
bfa8bd7b 1933
a6bcc8fb 1934.PHONY: pythoninfo
d1de1078
ES
1935pythoninfo: all
1936 $(RUNSHARED) $(HOSTRUNNER) ./$(BUILDPYTHON) -m test.pythoninfo
a3a01a2f 1937
859618c8 1938QUICKTESTOPTS= -x test_subprocess test_io \
fdd6dee6 1939 test_multibytecodec test_urllib2_localnet test_itertools \
84ed9a68
RO
1940 test_multiprocessing_fork test_multiprocessing_spawn \
1941 test_multiprocessing_forkserver \
ded5f1f2 1942 test_mailbox test_socket test_poll \
3c01d16e 1943 test_select test_zipfile test_concurrent_futures
a6bcc8fb
GS
1944
1945.PHONY: quicktest
243ed543 1946quicktest: all
859618c8 1947 $(TESTRUNNER) --fast-ci --timeout=$(TESTTIMEOUT) $(TESTOPTS) $(QUICKTESTOPTS)
2a850d91 1948
d3b9f97e 1949# SSL tests
a6bcc8fb 1950.PHONY: multisslcompile
d1de1078 1951multisslcompile: all
512dbf6f 1952 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py --steps=modules
d3b9f97e 1953
a6bcc8fb 1954.PHONY: multissltest
d1de1078 1955multissltest: all
512dbf6f 1956 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py
42119254 1957
243ed543
CH
1958# All install targets use the "all" target as synchronization point to
1959# prevent race conditions with PGO builds. PGO builds use recursive make,
1960# which can lead to two parallel `./python setup.py build` processes that
1961# step on each others toes.
a6bcc8fb 1962.PHONY: install
322f5ba0
ND
1963install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
1964 if test "x$(ENSUREPIP)" != "xno" ; then \
1965 case $(ENSUREPIP) in \
1966 upgrade) ensurepip="--upgrade" ;; \
1967 install|*) ensurepip="" ;; \
1968 esac; \
1969 $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
1970 $$ensurepip --root=$(DESTDIR)/ ; \
1971 fi
1972
a6bcc8fb 1973.PHONY: altinstall
322f5ba0
ND
1974altinstall: commoninstall
1975 if test "x$(ENSUREPIP)" != "xno" ; then \
1976 case $(ENSUREPIP) in \
1977 upgrade) ensurepip="--altinstall --upgrade" ;; \
1978 install|*) ensurepip="--altinstall" ;; \
1979 esac; \
1980 $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
1981 $$ensurepip --root=$(DESTDIR)/ ; \
1982 fi
932073a1 1983
a6bcc8fb 1984.PHONY: commoninstall
0de92859 1985commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
322f5ba0 1986 altbininstall libinstall inclinstall libainstall \
9c382069 1987 sharedinstall altmaninstall @FRAMEWORKALTINSTALLLAST@
85515ad9
NS
1988
1989# Install shared libraries enabled by Setup
1990DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
1991
a6bcc8fb 1992.PHONY: sharedinstall
2a8bf258
MG
1993sharedinstall: all
1994 @for i in $(DESTDIRS); \
1995 do \
1996 if test ! -d $(DESTDIR)$$i; then \
1997 echo "Creating directory $$i"; \
1998 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1999 else true; \
2000 fi; \
2001 done
85515ad9 2002 @for i in X $(SHAREDMODS); do \
ac959779
NS
2003 if test $$i != X; then \
2004 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
3b8ee087 2005 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
5b070c0d
PGS
2006 if test -d "$$i.dSYM"; then \
2007 echo $(DSYMUTIL_PATH) $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
2008 $(DSYMUTIL_PATH) $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
2009 fi; \
ac959779 2010 fi; \
85515ad9
NS
2011 done
2012
85515ad9
NS
2013# Install the interpreter with $(VERSION) affixed
2014# This goes into $(exec_prefix)
a6bcc8fb 2015.PHONY: altbininstall
b8f944f0 2016altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
d8a20d21 2017 @for i in $(BINDIR) $(LIBDIR); \
85515ad9 2018 do \
3b8ee087 2019 if test ! -d $(DESTDIR)$$i; then \
85515ad9 2020 echo "Creating directory $$i"; \
3b8ee087 2021 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
85515ad9
NS
2022 else true; \
2023 fi; \
2024 done
b8f944f0
ND
2025 if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
2026 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
2027 else \
2028 $(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
2029 fi
771d33e1 2030 -if test "$(VERSION)" != "$(LDVERSION)"; then \
4fcad3c7 2031 if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
771d33e1
BW
2032 then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
2033 fi; \
2034 (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
ad6f877f 2035 fi
801bb0b5
VS
2036 @if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \
2037 if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
2038 if test -n "$(DLLLIBRARY)" ; then \
2039 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
2040 else \
2041 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
2042 if test $(LDLIBRARY) != $(INSTSONAME); then \
2043 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
2044 fi \
2045 fi; \
2046 if test -n "$(PY3LIBRARY)"; then \
2047 $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
2048 fi; \
2049 else true; \
d1fc34d5 2050 fi; \
85515ad9 2051 fi
b8f944f0 2052 if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
417faa69 2053 rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE); \
b8f944f0
ND
2054 lipo $(LIPO_32BIT_FLAGS) \
2055 -output $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE) \
2056 $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
2057 fi
0cb33da1 2058 if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \
417faa69 2059 rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE); \
0cb33da1
ND
2060 lipo $(LIPO_INTEL64_FLAGS) \
2061 -output $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE) \
2062 $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
2063 fi
5b070c0d
PGS
2064 # Install macOS debug information (if available)
2065 if test -d "$(BUILDPYTHON).dSYM"; then \
2066 echo $(DSYMUTIL_PATH) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
2067 $(DSYMUTIL_PATH) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
2068 fi
2069 if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
2070 if test -d "$(LDLIBRARY).dSYM"; then \
2071 echo $(DSYMUTIL_PATH) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
2072 $(DSYMUTIL_PATH) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
2073 fi \
2074 else \
2075 if test -d "$(LDLIBRARY).dSYM"; then \
2076 echo $(DSYMUTIL_PATH) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(INSTSONAME); \
2077 $(DSYMUTIL_PATH) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(INSTSONAME); \
2078 fi \
2079 fi
46eecc3b 2080
a6bcc8fb 2081.PHONY: bininstall
990cb367
JT
2082# We depend on commoninstall here to make sure the installation is already usable
2083# before we possibly overwrite the global 'python3' symlink to avoid causing
2084# problems for anything else trying to run 'python3' while we install, particularly
2085# if we're installing in parallel with -j.
2086bininstall: commoninstall altbininstall
8de795f4 2087 if test ! -d $(DESTDIR)$(LIBPC); then \
c2021558
VS
2088 echo "Creating directory $(LIBPC)"; \
2089 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \
2090 fi
4fcad3c7
NC
2091 -if test -f $(DESTDIR)$(BINDIR)/python3$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(EXE); \
2092 then rm -f $(DESTDIR)$(BINDIR)/python3$(EXE); \
f4841e2d
BP
2093 else true; \
2094 fi
4fcad3c7 2095 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE))
771d33e1
BW
2096 -if test "$(VERSION)" != "$(LDVERSION)"; then \
2097 rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \
2098 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
2099 rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \
2100 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \
bc66facc
VS
2101 rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION)-embed.pc; \
2102 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python-$(LDVERSION)-embed.pc); \
771d33e1 2103 fi
f4841e2d
BP
2104 -rm -f $(DESTDIR)$(BINDIR)/python3-config
2105 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
2032722e
AP
2106 -rm -f $(DESTDIR)$(LIBPC)/python3.pc
2107 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
0a8e5724
VS
2108 -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
2109 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
ff52f760
GB
2110 -rm -f $(DESTDIR)$(BINDIR)/idle3
2111 (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
2112 -rm -f $(DESTDIR)$(BINDIR)/pydoc3
2113 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
b8f944f0
ND
2114 if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
2115 rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
2116 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
2117 fi
0cb33da1
ND
2118 if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \
2119 rm -f $(DESTDIR)$(BINDIR)/python3-intel64$(EXE); \
2120 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-intel64$(EXE) python3-intel64$(EXE)) \
2121 fi
85515ad9 2122
a48b61f8 2123# Install the versioned manual page
a6bcc8fb 2124.PHONY: altmaninstall
a48b61f8 2125altmaninstall:
85515ad9
NS
2126 @for i in $(MANDIR) $(MANDIR)/man1; \
2127 do \
3b8ee087 2128 if test ! -d $(DESTDIR)$$i; then \
85515ad9 2129 echo "Creating directory $$i"; \
3b8ee087 2130 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
85515ad9
NS
2131 else true; \
2132 fi; \
2133 done
2134 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
1a6e0d08 2135 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
85515ad9 2136
a48b61f8 2137# Install the unversioned manual page
a6bcc8fb 2138.PHONY: maninstall
a48b61f8
ND
2139maninstall: altmaninstall
2140 -rm -f $(DESTDIR)$(MANDIR)/man1/python3.1
2141 (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python3.1)
2142
85515ad9 2143# Install the library
0e3f591a 2144XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
277ce306 2145LIBSUBDIRS= asyncio \
2146 collections \
2147 concurrent concurrent/futures \
2148 csv \
2149 ctypes ctypes/macholib \
2150 curses \
2151 dbm \
277ce306 2152 email email/mime \
2153 encodings \
2154 ensurepip ensurepip/_bundled \
2155 html \
2156 http \
2157 idlelib idlelib/Icons \
35628e4c 2158 importlib importlib/resources importlib/metadata \
277ce306 2159 json \
277ce306 2160 logging \
2161 multiprocessing multiprocessing/dummy \
2162 pydoc_data \
1be3260a 2163 re \
277ce306 2164 site-packages \
2165 sqlite3 \
b883cad0 2166 sysconfig \
277ce306 2167 tkinter \
23dcea5d 2168 tomllib \
277ce306 2169 turtledemo \
2170 unittest \
2171 urllib \
2172 venv venv/scripts venv/scripts/common venv/scripts/posix \
2173 wsgiref \
2174 $(XMLLIBSUBDIRS) \
2175 xmlrpc \
03185f0c 2176 zipfile zipfile/_path \
3e1c5d98
ES
2177 zoneinfo \
2178 __phello__
0faa0ba2 2179TESTSUBDIRS= idlelib/idle_test \
bf0b8a9f
EA
2180 test \
2181 test/audiodata \
890ef1b0 2182 test/archivetestdata \
e57ecf6b
NS
2183 test/certdata \
2184 test/certdata/capath \
bf0b8a9f
EA
2185 test/cjkencodings \
2186 test/crashers \
2187 test/data \
2188 test/decimaltestdata \
2189 test/dtracedata \
2190 test/encoded_modules \
bf0b8a9f
EA
2191 test/leakers \
2192 test/libregrtest \
ed587be0 2193 test/mathdata \
bf0b8a9f
EA
2194 test/subprocessdata \
2195 test/support \
b7597dab 2196 test/support/_hypothesis_stubs \
277ce306 2197 test/test_asyncio \
bf0b8a9f 2198 test/test_capi \
21dda096 2199 test/test_cppext \
d82e0bfe 2200 test/test_ctypes \
14d6e197 2201 test/test_dataclasses \
bf0b8a9f
EA
2202 test/test_email \
2203 test/test_email/data \
82505dc3 2204 test/test_future_stmt \
8f324b7e 2205 test/test_gdb \
732532b0 2206 test/test_inspect \
7c562f67
ND
2207 test/test_import \
2208 test/test_import/data \
2209 test/test_import/data/circular_imports \
2210 test/test_import/data/circular_imports/subpkg \
0a8ae8a5
FL
2211 test/test_import/data/circular_imports/subpkg2 \
2212 test/test_import/data/circular_imports/subpkg2/parent \
d5ed47de
SS
2213 test/test_import/data/package \
2214 test/test_import/data/package2 \
2528a6c3 2215 test/test_import/data/unwritable \
ca0c5f26
ND
2216 test/test_importlib \
2217 test/test_importlib/builtin \
f7fba6cf 2218 test/test_importlib/data \
ca0c5f26
ND
2219 test/test_importlib/extension \
2220 test/test_importlib/frozen \
2221 test/test_importlib/import_ \
490e53b8
ND
2222 test/test_importlib/namespace_pkgs \
2223 test/test_importlib/namespace_pkgs/both_portions \
2224 test/test_importlib/namespace_pkgs/both_portions/foo \
ca0c5f26
ND
2225 test/test_importlib/namespace_pkgs/module_and_namespace_package \
2226 test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
490e53b8
ND
2227 test/test_importlib/namespace_pkgs/not_a_namespace_pkg \
2228 test/test_importlib/namespace_pkgs/not_a_namespace_pkg/foo \
2229 test/test_importlib/namespace_pkgs/portion1 \
2230 test/test_importlib/namespace_pkgs/portion1/foo \
2231 test/test_importlib/namespace_pkgs/portion2 \
2232 test/test_importlib/namespace_pkgs/portion2/foo \
2233 test/test_importlib/namespace_pkgs/project1 \
2234 test/test_importlib/namespace_pkgs/project1/parent \
2235 test/test_importlib/namespace_pkgs/project1/parent/child \
2236 test/test_importlib/namespace_pkgs/project2 \
2237 test/test_importlib/namespace_pkgs/project2/parent \
2238 test/test_importlib/namespace_pkgs/project2/parent/child \
2239 test/test_importlib/namespace_pkgs/project3 \
2240 test/test_importlib/namespace_pkgs/project3/parent \
2241 test/test_importlib/namespace_pkgs/project3/parent/child \
66c8adfa 2242 test/test_importlib/partial \
e63e6311 2243 test/test_importlib/resources \
3e718cf8
JC
2244 test/test_importlib/resources/data01 \
2245 test/test_importlib/resources/data01/subdirectory \
2246 test/test_importlib/resources/data02 \
2247 test/test_importlib/resources/data02/one \
07293595
JC
2248 test/test_importlib/resources/data02/subdirectory \
2249 test/test_importlib/resources/data02/subdirectory/subsubdir \
3e718cf8
JC
2250 test/test_importlib/resources/data02/two \
2251 test/test_importlib/resources/data03 \
2252 test/test_importlib/resources/data03/namespace \
2253 test/test_importlib/resources/data03/namespace/portion1 \
2254 test/test_importlib/resources/data03/namespace/portion2 \
2255 test/test_importlib/resources/namespacedata01 \
2256 test/test_importlib/resources/zipdata01 \
2257 test/test_importlib/resources/zipdata02 \
ca0c5f26 2258 test/test_importlib/source \
277ce306 2259 test/test_json \
adfc118f 2260 test/test_module \
277ce306 2261 test/test_peg_generator \
bf0b8a9f 2262 test/test_sqlite3 \
c1fb12e5 2263 test/test_tkinter \
bf0b8a9f
EA
2264 test/test_tomllib \
2265 test/test_tomllib/data \
2266 test/test_tomllib/data/invalid \
2267 test/test_tomllib/data/invalid/array \
2268 test/test_tomllib/data/invalid/array-of-tables \
2269 test/test_tomllib/data/invalid/boolean \
2270 test/test_tomllib/data/invalid/dates-and-times \
2271 test/test_tomllib/data/invalid/dotted-keys \
2272 test/test_tomllib/data/invalid/inline-table \
2273 test/test_tomllib/data/invalid/keys-and-vals \
2274 test/test_tomllib/data/invalid/literal-str \
2275 test/test_tomllib/data/invalid/multiline-basic-str \
2276 test/test_tomllib/data/invalid/multiline-literal-str \
2277 test/test_tomllib/data/invalid/table \
2278 test/test_tomllib/data/valid \
2279 test/test_tomllib/data/valid/array \
2280 test/test_tomllib/data/valid/dates-and-times \
2281 test/test_tomllib/data/valid/multiline-basic-str \
277ce306 2282 test/test_tools \
c1fb12e5 2283 test/test_ttk \
bf0b8a9f
EA
2284 test/test_unittest \
2285 test/test_unittest/testmock \
2286 test/test_warnings \
2287 test/test_warnings/data \
003f341e 2288 test/test_zipfile \
03185f0c 2289 test/test_zipfile/_path \
bf0b8a9f
EA
2290 test/test_zoneinfo \
2291 test/test_zoneinfo/data \
e399f46a 2292 test/tkinterdata \
42ab2cbd 2293 test/tokenizedata \
277ce306 2294 test/tracedmodules \
a54a6998 2295 test/typinganndata \
bf0b8a9f 2296 test/xmltestdata \
890ef1b0 2297 test/xmltestdata/c14n-20
277ce306 2298
9a7e9f99
VS
2299COMPILEALL_OPTS=-j0
2300
277ce306 2301TEST_MODULES=@TEST_MODULES@
a6bcc8fb
GS
2302
2303.PHONY: libinstall
d1de1078 2304libinstall: all $(srcdir)/Modules/xxmodule.c
85515ad9
NS
2305 @for i in $(SCRIPTDIR) $(LIBDEST); \
2306 do \
3b8ee087 2307 if test ! -d $(DESTDIR)$$i; then \
85515ad9 2308 echo "Creating directory $$i"; \
3b8ee087 2309 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
85515ad9
NS
2310 else true; \
2311 fi; \
2312 done
277ce306 2313 @if test "$(TEST_MODULES)" = yes; then \
2314 subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
2315 else \
2316 subdirs="$(LIBSUBDIRS)"; \
2317 fi; \
2318 for d in $$subdirs; \
85515ad9
NS
2319 do \
2320 a=$(srcdir)/Lib/$$d; \
2321 if test ! -d $$a; then continue; else true; fi; \
2322 b=$(LIBDEST)/$$d; \
3b8ee087 2323 if test ! -d $(DESTDIR)$$b; then \
85515ad9 2324 echo "Creating directory $$b"; \
3b8ee087 2325 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
85515ad9
NS
2326 else true; \
2327 fi; \
2328 done
5553231b 2329 @for i in $(srcdir)/Lib/*.py; \
85515ad9
NS
2330 do \
2331 if test -x $$i; then \
3b8ee087 2332 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
3f5cc208 2333 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
85515ad9 2334 else \
3b8ee087 2335 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
85515ad9
NS
2336 echo $(INSTALL_DATA) $$i $(LIBDEST); \
2337 fi; \
2338 done
277ce306 2339 @if test "$(TEST_MODULES)" = yes; then \
2340 subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
2341 else \
2342 subdirs="$(LIBSUBDIRS)"; \
2343 fi; \
2344 for d in $$subdirs; \
85515ad9
NS
2345 do \
2346 a=$(srcdir)/Lib/$$d; \
2347 if test ! -d $$a; then continue; else true; fi; \
49fd7fa4 2348 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
85515ad9
NS
2349 b=$(LIBDEST)/$$d; \
2350 for i in $$a/*; \
2351 do \
2352 case $$i in \
2353 *CVS) ;; \
2354 *.py[co]) ;; \
2355 *.orig) ;; \
2356 *~) ;; \
2357 *) \
2358 if test -d $$i; then continue; fi; \
2359 if test -x $$i; then \
3f5cc208 2360 echo $(INSTALL_SCRIPT) $$i $$b; \
3b8ee087 2361 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
85515ad9
NS
2362 else \
2363 echo $(INSTALL_DATA) $$i $$b; \
3b8ee087 2364 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
85515ad9
NS
2365 fi;; \
2366 esac; \
2367 done; \
2368 done
c4b53afc
ZW
2369 $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
2370 $(DESTDIR)$(LIBDEST); \
3b8ee087 2371 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
9a7e9f99 2372 @ # Build PYC files for the 3 optimization levels (0, 1, 2)
f299abda 2373 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
9a7e9f99
VS
2374 $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
2375 -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \
ae00b810 2376 -x 'bad_coding|badsyntax|site-packages' \
f299abda
BC
2377 $(DESTDIR)$(LIBDEST)
2378 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1abe1c5f 2379 $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
9a7e9f99 2380 -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
f299abda 2381 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
85515ad9 2382
01f073f5
VS
2383# bpo-21536: Misc/python-config.sh is generated in the build directory
2384# from $(srcdir)Misc/python-config.sh.in.
2385python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
adab00fb
MP
2386 @ # Substitution happens here, as the completely-expanded BINDIR
2387 @ # is not available in configure
44fa03d7 2388 sed -e "s,@EXENAME@,$(EXENAME)," < $(srcdir)/Misc/python-config.in >python-config.py
adab00fb 2389 @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
80bc7dc5 2390 LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config
adab00fb
MP
2391 @ # On Darwin, always use the python version of the script, the shell
2392 @ # version doesn't use the compiler customizations that are provided
2393 @ # in python (_osx_support.py).
2394 @if test `uname -s` = Darwin; then \
0df35b0a 2395 cp python-config.py python-config; \
2396 fi
2397
44fa03d7
CH
2398# macOS' make seems to ignore a dependency on a
2399# "$(BUILD_SCRIPTS_DIR): $(MKDIR_P) $@" rule.
2400BUILD_SCRIPTS_DIR=build/scripts-$(VERSION)
44fa03d7
CH
2401SCRIPT_IDLE=$(BUILD_SCRIPTS_DIR)/idle$(VERSION)
2402SCRIPT_PYDOC=$(BUILD_SCRIPTS_DIR)/pydoc$(VERSION)
2403
44fa03d7
CH
2404$(SCRIPT_IDLE): $(srcdir)/Tools/scripts/idle3
2405 @$(MKDIR_P) $(BUILD_SCRIPTS_DIR)
2406 sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/idle3 > $@
2407 @chmod +x $@
2408
2409$(SCRIPT_PYDOC): $(srcdir)/Tools/scripts/pydoc3
2410 @$(MKDIR_P) $(BUILD_SCRIPTS_DIR)
2411 sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/pydoc3 > $@
2412 @chmod +x $@
2413
a6bcc8fb 2414.PHONY: scripts
ae00b810 2415scripts: $(SCRIPT_IDLE) $(SCRIPT_PYDOC) python-config
bf19907e 2416
85515ad9
NS
2417# Install the include files
2418INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
a6bcc8fb
GS
2419
2420.PHONY: inclinstall
85515ad9
NS
2421inclinstall:
2422 @for i in $(INCLDIRSTOMAKE); \
2423 do \
3b8ee087 2424 if test ! -d $(DESTDIR)$$i; then \
85515ad9 2425 echo "Creating directory $$i"; \
3b8ee087 2426 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
85515ad9
NS
2427 else true; \
2428 fi; \
2429 done
e421106b
VS
2430 @if test ! -d $(DESTDIR)$(INCLUDEPY)/cpython; then \
2431 echo "Creating directory $(DESTDIR)$(INCLUDEPY)/cpython"; \
2432 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/cpython; \
2433 else true; \
2434 fi
f653fd4d
VS
2435 @if test ! -d $(DESTDIR)$(INCLUDEPY)/internal; then \
2436 echo "Creating directory $(DESTDIR)$(INCLUDEPY)/internal"; \
2437 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/internal; \
2438 else true; \
2439 fi
85515ad9
NS
2440 @for i in $(srcdir)/Include/*.h; \
2441 do \
2442 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
3b8ee087 2443 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
85515ad9 2444 done
e421106b
VS
2445 @for i in $(srcdir)/Include/cpython/*.h; \
2446 do \
2447 echo $(INSTALL_DATA) $$i $(INCLUDEPY)/cpython; \
2448 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/cpython; \
2449 done
f653fd4d
VS
2450 @for i in $(srcdir)/Include/internal/*.h; \
2451 do \
2452 echo $(INSTALL_DATA) $$i $(INCLUDEPY)/internal; \
2453 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/internal; \
2454 done
3b8ee087 2455 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
85515ad9
NS
2456
2457# Install the library and miscellaneous stuff needed for extending/embedding
2458# This goes into $(exec_prefix)
100aa185 2459LIBPL= @LIBPL@
2032722e
AP
2460
2461# pkgconfig directory
2462LIBPC= $(LIBDIR)/pkgconfig
2463
a6bcc8fb 2464.PHONY: libainstall
44fa03d7 2465libainstall: all scripts
80d250d6 2466 @for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \
85515ad9 2467 do \
3b8ee087 2468 if test ! -d $(DESTDIR)$$i; then \
85515ad9 2469 echo "Creating directory $$i"; \
3b8ee087 2470 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
85515ad9
NS
2471 else true; \
2472 fi; \
2473 done
801bb0b5
VS
2474 @if test "$(STATIC_LIBPYTHON)" = 1; then \
2475 if test -d $(LIBRARY); then :; else \
2476 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2477 if test "$(SHLIB_SUFFIX)" = .dll; then \
2478 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
2479 else \
2480 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
2481 fi; \
c0f1e774 2482 else \
801bb0b5 2483 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
c0f1e774 2484 fi; \
b6e9cad3 2485 fi; \
801bb0b5 2486 $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o; \
85515ad9 2487 fi
3b8ee087 2488 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
3b8ee087
ML
2489 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
2490 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
961d54c5 2491 $(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
ca9689f8 2492 $(INSTALL_DATA) Modules/Setup.bootstrap $(DESTDIR)$(LIBPL)/Setup.bootstrap
e4bb22fa 2493 $(INSTALL_DATA) Modules/Setup.stdlib $(DESTDIR)$(LIBPL)/Setup.stdlib
3b8ee087 2494 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
2032722e 2495 $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
0a8e5724 2496 $(INSTALL_DATA) Misc/python-embed.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc
3b8ee087
ML
2497 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
2498 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
87421197 2499 $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
14d98ac3 2500 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
44fa03d7
CH
2501 $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
2502 $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
5401e87b 2503 @if [ -s Modules/python.exp -a \
85515ad9
NS
2504 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
2505 echo; echo "Installing support files for building shared extension modules on AIX:"; \
5401e87b 2506 $(INSTALL_DATA) Modules/python.exp \
3b8ee087 2507 $(DESTDIR)$(LIBPL)/python.exp; \
85515ad9 2508 echo; echo "$(LIBPL)/python.exp"; \
3f5cc208 2509 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
3b8ee087 2510 $(DESTDIR)$(LIBPL)/makexp_aix; \
85515ad9 2511 echo "$(LIBPL)/makexp_aix"; \
395733d4 2512 $(INSTALL_SCRIPT) Modules/ld_so_aix \
3b8ee087 2513 $(DESTDIR)$(LIBPL)/ld_so_aix; \
85515ad9 2514 echo "$(LIBPL)/ld_so_aix"; \
c79667ff 2515 echo; echo "See Misc/README.AIX for details."; \
85515ad9
NS
2516 else true; \
2517 fi
85515ad9 2518
cb4321eb
JJ
2519# Here are a couple of targets for MacOSX again, to install a full
2520# framework-based Python. frameworkinstall installs everything, the
2521# subtargets install specific parts. Much of the actual work is offloaded to
73e5a5b6 2522# the Makefile in Mac
cb4321eb 2523#
477c8d5e 2524#
46f50726 2525# This target is here for backward compatibility, previous versions of Python
477c8d5e 2526# hadn't integrated framework installation in the normal install process.
a6bcc8fb 2527.PHONY: frameworkinstall
477c8d5e 2528frameworkinstall: install
ed2f725f 2529
b6e9cad3
JJ
2530# On install, we re-make the framework
2531# structure in the install location, /Library/Frameworks/ or the argument to
2532# --enable-framework. If --enable-framework has been specified then we have
2533# automatically set prefix to the location deep down in the framework, so we
2534# only have to cater for the structural bits of the framework.
2535
a6bcc8fb 2536.PHONY: frameworkinstallframework
cb4321eb
JJ
2537frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2538
a6bcc8fb 2539.PHONY: frameworkinstallstructure
cb4321eb 2540frameworkinstallstructure: $(LDLIBRARY)
127e56e5 2541 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
b6e9cad3 2542 echo Not configured with --enable-framework; \
127e56e5 2543 exit 1; \
b6e9cad3
JJ
2544 else true; \
2545 fi
cb4321eb 2546 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
3b8ee087 2547 if test ! -d $(DESTDIR)$$i; then \
9592fe9a
JJ
2548 echo "Creating directory $(DESTDIR)$$i"; \
2549 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
b6e9cad3
JJ
2550 else true; \
2551 fi; \
2552 done
0499d0b0 2553 $(LN) -fsn include/python$(LDVERSION) $(DESTDIR)$(prefix)/Headers
4c29b47d 2554 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
9592fe9a 2555 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
81ee3efe 2556 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
9592fe9a
JJ
2557 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
2558 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
4735b234 2559 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
7cb32ae7 2560
cb4321eb 2561# This installs Mac/Lib into the framework
0e3f591a
TW
2562# Install a number of symlinks to keep software that expects a normal unix
2563# install (which includes python-config) happy.
a6bcc8fb 2564.PHONY: frameworkinstallmaclib
cb4321eb 2565frameworkinstallmaclib:
b8d3e405
ND
2566 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).a"
2567 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).dylib"
2568 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).a"
2569 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).dylib"
ae6275d8
CH
2570 $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(LDVERSION).dylib"
2571 $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
cb4321eb
JJ
2572
2573# This installs the IDE, the Launcher and other apps into /Applications
a6bcc8fb 2574.PHONY: frameworkinstallapps
cb4321eb 2575frameworkinstallapps:
73e5a5b6 2576 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
cb4321eb 2577
b8f944f0
ND
2578# Build the bootstrap executable that will spawn the interpreter inside
2579# an app bundle within the framework. This allows the interpreter to
2580# run OS X GUI APIs.
a6bcc8fb 2581.PHONY: frameworkpythonw
b8f944f0
ND
2582frameworkpythonw:
2583 cd Mac && $(MAKE) pythonw
2584
2585# This installs the python* and other bin symlinks in $prefix/bin or in
2586# a bin directory relative to the framework root
a6bcc8fb 2587.PHONY: frameworkinstallunixtools
cb4321eb 2588frameworkinstallunixtools:
73e5a5b6
TW
2589 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
2590
a6bcc8fb 2591.PHONY: frameworkaltinstallunixtools
73e5a5b6
TW
2592frameworkaltinstallunixtools:
2593 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
0b06be7b 2594
59b44721 2595# This installs the Tools into the applications directory.
a1b77584 2596# It is not part of a normal frameworkinstall
a6bcc8fb 2597.PHONY: frameworkinstallextras
a1b77584 2598frameworkinstallextras:
09027aac 2599 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
a1b77584 2600
85515ad9 2601# Build the toplevel Makefile
69f55cc0 2602Makefile.pre: $(srcdir)/Makefile.pre.in config.status
ed948e01 2603 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
85515ad9
NS
2604 $(MAKE) -f Makefile.pre Makefile
2605
64b1b686 2606# Run the configure script.
85515ad9 2607config.status: $(srcdir)/configure
ed948e01 2608 $(srcdir)/configure $(CONFIG_ARGS)
85515ad9 2609
1999ef49 2610.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
85515ad9 2611
1f737edb 2612Python/asm_trampoline.o: $(srcdir)/Python/asm_trampoline.S
6d791a97
PGS
2613 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
2614
85515ad9
NS
2615# Some make's put the object file in the current directory
2616.c.o:
d4fcdb1e 2617 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
85515ad9 2618
826f83f1
VS
2619# bpo-30104: dtoa.c uses union to cast double to unsigned long[2]. clang 4.0
2620# with -O2 or higher and strict aliasing miscompiles the ratio() function
2621# causing rounding issues. Compile dtoa.c using -fno-strict-aliasing on clang.
2622# https://bugs.llvm.org//show_bug.cgi?id=31928
2623Python/dtoa.o: Python/dtoa.c
2624 $(CC) -c $(PY_CORE_CFLAGS) $(CFLAGS_ALIASING) -o $@ $<
2625
49fd7fa4 2626# Run reindent on the library
a6bcc8fb 2627.PHONY: reindent
49fd7fa4 2628reindent:
0895c2a0 2629 ./$(BUILDPYTHON) $(srcdir)/Tools/patchcheck/reindent.py -r $(srcdir)/Lib
49fd7fa4 2630
85515ad9
NS
2631# Rerun configure with the same options as it was run last time,
2632# provided the config.status script exists
a6bcc8fb 2633.PHONY: recheck
85515ad9 2634recheck:
ed948e01
ZW
2635 ./config.status --recheck
2636 ./config.status
85515ad9 2637
a5c62a8e
VS
2638# Regenerate configure and pyconfig.h.in
2639.PHONY: autoconf
85515ad9 2640autoconf:
434ffb7f
CH
2641 (cd $(srcdir); autoreconf -ivf -Werror)
2642
db1ee6a1 2643# See https://github.com/tiran/cpython_autoconf container
434ffb7f
CH
2644.PHONY: regen-configure
2645regen-configure:
2646 @if command -v podman >/dev/null; then RUNTIME="podman"; else RUNTIME="docker"; fi; \
2647 if ! command -v $$RUNTIME; then echo "$@ needs either Podman or Docker container runtime." >&2; exit 1; fi; \
2648 if command -v selinuxenabled >/dev/null && selinuxenabled; then OPT=":Z"; fi; \
8a8ebf2e 2649 CMD="$$RUNTIME run --rm --pull=always -v $(abs_srcdir):/src$$OPT quay.io/tiran/cpython_autoconf:271"; \
434ffb7f
CH
2650 echo $$CMD; \
2651 $$CMD || exit $?
85515ad9
NS
2652
2653# Create a tags file for vi
2654tags::
48083380 2655 ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/cpython/*.h $(srcdir)/Include/internal/*.h
3be3b97a
VS
2656 for i in $(SRCDIRS); do ctags -f tags -w -a $(srcdir)/$$i/*.[ch]; done
2657 ctags -f tags -w -a $(srcdir)/Modules/_ctypes/*.[ch]
ef7eaafc 2658 find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | ctags -f tags -w -a -L -
cf0ac6a7 2659 LC_ALL=C sort -o tags tags
85515ad9
NS
2660
2661# Create a tags file for GNU Emacs
2662TAGS::
2663 cd $(srcdir); \
48083380 2664 etags Include/*.h Include/cpython/*.h Include/internal/*.h; \
85515ad9 2665 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
ef7eaafc
AS
2666 etags -a $(srcdir)/Modules/_ctypes/*.[ch]
2667 find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | etags - -a
85515ad9
NS
2668
2669# Sanitation targets -- clean leaves libraries, executables and tags
067b38ee 2670# files, which clobber removes as well
a6bcc8fb 2671.PHONY: pycremoval
49fd7fa4 2672pycremoval:
bc74ee03 2673 -find $(srcdir) -depth -name '__pycache__' -exec rm -rf {} ';'
5f2347d8 2674 -find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
85515ad9 2675
a6bcc8fb 2676.PHONY: rmtestturds
77b5e33e
GR
2677rmtestturds:
2678 -rm -f *BAD *GOOD *SKIPPED
2679 -rm -rf OUT
2680 -rm -f *.TXT
2681 -rm -f *.txt
2682 -rm -f gb-18030-2000.xml
2683
a6bcc8fb 2684.PHONY: docclean
8188e634 2685docclean:
22bab74c 2686 $(MAKE) -C $(srcdir)/Doc clean
8188e634 2687
c6bbcd25
NS
2688# like the 'clean' target but retain the profile guided optimization (PGO)
2689# data. The PGO data is only valid if source code remains unchanged.
a6bcc8fb 2690.PHONY: clean-retain-profile
c6bbcd25 2691clean-retain-profile: pycremoval
241bdab7 2692 find . -name '*.[oa]' -exec rm -f {} ';'
cd0ed971 2693 find . -name '*.s[ol]' -exec rm -f {} ';'
241bdab7 2694 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
5b070c0d 2695 find . -name '*.lto' -exec rm -f {} ';'
d224e769 2696 find . -name '*.wasm' -exec rm -f {} ';'
1b6b0e78 2697 find . -name '*.lst' -exec rm -f {} ';'
6ab91487 2698 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
c101bf32
TN
2699 find build -name '*.py' -exec rm -f {} ';' || true
2700 find build -name '*.py[co]' -exec rm -f {} ';' || true
2701 -rm -f pybuilddir.txt
84ca1232 2702 -rm -f _bootstrap_python
deeaac49 2703 -rm -f python.html python*.js python.data python*.symbols python*.map
7a2cc35e 2704 -rm -f $(WASM_STDLIB)
5be98e57 2705 -rm -f Programs/_testembed Programs/_freeze_module
1cbaa505 2706 -rm -f Python/deepfreeze/*.[co]
765b2a3a
CH
2707 -rm -f Python/frozen_modules/*.h
2708 -rm -f Python/frozen_modules/MANIFEST
653c8509 2709 -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
a785c87d 2710 -rm -f Include/pydtrace_probes.h
4e38d71a 2711 -rm -f profile-gen-stamp
85515ad9 2712
a6bcc8fb 2713.PHONY: profile-removal
33fe8093
CH
2714profile-removal:
2715 find . -name '*.gc??' -exec rm -f {} ';'
7188a3ef 2716 find . -name '*.profclang?' -exec rm -f {} ';'
5af85640 2717 find . -name '*.dyn' -exec rm -f {} ';'
49e52f93
CH
2718 rm -f $(COVERAGE_INFO)
2719 rm -rf $(COVERAGE_REPORT)
4e38d71a 2720 rm -f profile-run-stamp
5360cb3d 2721 rm -f profile-bolt-stamp
33fe8093 2722
a6bcc8fb 2723.PHONY: clean
5360cb3d
GS
2724clean: clean-retain-profile clean-bolt
2725 @if test @DEF_MAKE_ALL_RULE@ = profile-opt -o @DEF_MAKE_ALL_RULE@ = bolt-opt; then \
c6bbcd25
NS
2726 rm -f profile-gen-stamp profile-clean-stamp; \
2727 $(MAKE) profile-removal; \
2728 fi
2729
a6bcc8fb 2730.PHONY: clobber
c6bbcd25 2731clobber: clean
1f24a719 2732 -rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
597e6b4c 2733 tags TAGS \
7cb32ae7 2734 config.cache config.log pyconfig.h Modules/config.c
1d88c59f 2735 -rm -rf build platform
c6096892 2736 -rm -rf $(PYTHONFRAMEWORKDIR)
87421197 2737 -rm -f python-config.py python-config
85515ad9
NS
2738
2739# Make things extra clean, before making a distribution:
2740# remove all generated files, even Makefile[.pre]
1a196b5d 2741# Keep configure and Python-ast.[ch], it's possible they can't be generated
a6bcc8fb 2742.PHONY: distclean
46eecc3b 2743distclean: clobber docclean
f8471862
CH
2744 for file in $(srcdir)/Lib/test/data/* ; do \
2745 if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \
de802be0 2746 done
47cca049 2747 -rm -f core Makefile Makefile.pre config.status Modules/Setup.local \
ca9689f8
CH
2748 Modules/Setup.bootstrap Modules/Setup.stdlib \
2749 Modules/ld_so_aix Modules/python.exp Misc/python.pc \
0a8e5724 2750 Misc/python-embed.pc Misc/python-config.sh
6a6666ab 2751 -rm -f python*-gdb.py
8d50d628
VS
2752 # Issue #28258: set LC_ALL to avoid issues with Estonian locale.
2753 # Expansion is performed here by shell (spawned by make) itself before
2754 # arguments are passed to find. So LC_ALL=C must be set as a separate
2755 # command.
80bc7dc5 2756 LC_ALL=C; find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
f4c47b5a
ES
2757 -o -name '[@,#]*' -o -name '*.old' \
2758 -o -name '*.orig' -o -name '*.rej' \
2759 -o -name '*.bak' ')' \
2760 -exec rm -f {} ';'
85515ad9 2761
87d332dc 2762# Check that all symbols exported by libpython start with "Py" or "_Py"
a6bcc8fb 2763.PHONY: smelly
243ed543 2764smelly: all
1863302d 2765 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/smelly.py
85515ad9 2766
1ff81c0c 2767# Check if any unsupported C global variables have been added.
a6bcc8fb 2768.PHONY: check-c-globals
1ff81c0c
ES
2769check-c-globals:
2770 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/c-analyzer/check-c-globals.py \
2771 --format summary \
2772 --traceback
2773
85515ad9 2774# Find files with funny names
a6bcc8fb 2775.PHONY: funny
85515ad9 2776funny:
1c608e38 2777 find $(SUBDIRS) $(SUBDIRSTOO) \
e9715b90 2778 -type d \
85515ad9
NS
2779 -o -name '*.[chs]' \
2780 -o -name '*.py' \
4c9aa451 2781 -o -name '*.pyw' \
85515ad9
NS
2782 -o -name '*.dat' \
2783 -o -name '*.el' \
2784 -o -name '*.fd' \
2785 -o -name '*.in' \
77b5e33e
GR
2786 -o -name '*.gif' \
2787 -o -name '*.txt' \
2788 -o -name '*.xml' \
2789 -o -name '*.xbm' \
2790 -o -name '*.xpm' \
2791 -o -name '*.uue' \
2792 -o -name '*.decTest' \
4c9aa451
GB
2793 -o -name '*.tmCommand' \
2794 -o -name '*.tmSnippet' \
85515ad9
NS
2795 -o -name 'Setup' \
2796 -o -name 'Setup.*' \
2797 -o -name README \
4c9aa451
GB
2798 -o -name NEWS \
2799 -o -name HISTORY \
85515ad9
NS
2800 -o -name Makefile \
2801 -o -name ChangeLog \
4c9aa451 2802 -o -name .hgignore \
85515ad9 2803 -o -name MANIFEST \
b5da6e9e 2804 -o -print
85515ad9 2805
ada8c3b0 2806# Perform some verification checks on any modified files.
a6bcc8fb 2807.PHONY: patchcheck
243ed543 2808patchcheck: all
0895c2a0 2809 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/patchcheck/patchcheck.py
ada8c3b0 2810
a6bcc8fb 2811.PHONY: check-limited-abi
85f1dedb 2812check-limited-abi: all
1863302d 2813 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/build/stable_abi.py --all $(srcdir)/Misc/stable_abi.toml
85f1dedb 2814
dfcc6ff3
CH
2815.PHONY: update-config
2816update-config:
2817 curl -sL -o config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
2818 curl -sL -o config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
2819 chmod +x config.guess config.sub
2820
9454ad72
GR
2821# Dependencies
2822
001fee14 2823Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
9454ad72 2824
81669d1b 2825##########################################################################
bb8b9313 2826# Module dependencies and platform-specific files
81669d1b 2827
33f42c26
CH
2828# force rebuild when header file or module build flavor (static/shared) is changed
2829MODULE_DEPS_STATIC=Modules/config.c
2830MODULE_DEPS_SHARED=$(MODULE_DEPS_STATIC) $(EXPORTSYMS)
8c1dbad3 2831
b5ee7949
CH
2832MODULE_CMATH_DEPS=$(srcdir)/Modules/_math.h
2833MODULE_MATH_DEPS=$(srcdir)/Modules/_math.h
6abec1ca 2834MODULE_PYEXPAT_DEPS=@LIBEXPAT_INTERNAL@
81669d1b 2835MODULE_UNICODEDATA_DEPS=$(srcdir)/Modules/unicodedata_db.h $(srcdir)/Modules/unicodename_db.h
b16b6bb8 2836MODULE__BLAKE2_DEPS=$(srcdir)/Modules/_blake2/impl/blake2-config.h $(srcdir)/Modules/_blake2/impl/blake2-impl.h $(srcdir)/Modules/_blake2/impl/blake2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2b-ref.c $(srcdir)/Modules/_blake2/impl/blake2b-round.h $(srcdir)/Modules/_blake2/impl/blake2b.c $(srcdir)/Modules/_blake2/impl/blake2s-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2s-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2s-load-xop.h $(srcdir)/Modules/_blake2/impl/blake2s-ref.c $(srcdir)/Modules/_blake2/impl/blake2s-round.h $(srcdir)/Modules/_blake2/impl/blake2s.c $(srcdir)/Modules/_blake2/blake2module.h $(srcdir)/Modules/hashlib.h
2df82db4 2837MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h
bb8b9313 2838MODULE__CTYPES_MALLOC_CLOSURE=@MODULE__CTYPES_MALLOC_CLOSURE@
6abec1ca
MH
2839MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h @LIBMPDEC_INTERNAL@
2840MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c @LIBEXPAT_INTERNAL@
81669d1b
CH
2841MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h
2842MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h
fcadc7e4
JP
2843MODULE__MD5_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_HEADERS) Modules/_hacl/Hacl_Hash_MD5.h Modules/_hacl/Hacl_Hash_MD5.c
2844MODULE__SHA1_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_HEADERS) Modules/_hacl/Hacl_Hash_SHA1.h Modules/_hacl/Hacl_Hash_SHA1.c
0b13575e 2845MODULE__SHA2_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA2_HEADERS) $(LIBHACL_SHA2_A)
15665d89 2846MODULE__SHA3_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_HEADERS) Modules/_hacl/Hacl_Hash_SHA3.h Modules/_hacl/Hacl_Hash_SHA3.c
41a5b84e 2847MODULE__SOCKET_DEPS=$(srcdir)/Modules/socketmodule.h $(srcdir)/Modules/addrinfo.h $(srcdir)/Modules/getaddrinfo.c $(srcdir)/Modules/getnameinfo.c
81669d1b 2848MODULE__SSL_DEPS=$(srcdir)/Modules/_ssl.h $(srcdir)/Modules/_ssl/cert.c $(srcdir)/Modules/_ssl/debughelpers.c $(srcdir)/Modules/_ssl/misc.c $(srcdir)/Modules/_ssl_data.h $(srcdir)/Modules/_ssl_data_111.h $(srcdir)/Modules/_ssl_data_300.h $(srcdir)/Modules/socketmodule.h
0e01fac3 2849MODULE__TESTCAPI_DEPS=$(srcdir)/Modules/_testcapi/testcapi_long.h $(srcdir)/Modules/_testcapi/parts.h $(srcdir)/Modules/_testcapi/util.h
aa52888e 2850MODULE__TESTINTERNALCAPI_DEPS=$(srcdir)/Modules/_testinternalcapi/parts.h
29e5874d 2851MODULE__SQLITE3_DEPS=$(srcdir)/Modules/_sqlite/connection.h $(srcdir)/Modules/_sqlite/cursor.h $(srcdir)/Modules/_sqlite/microprotocols.h $(srcdir)/Modules/_sqlite/module.h $(srcdir)/Modules/_sqlite/prepare_protocol.h $(srcdir)/Modules/_sqlite/row.h $(srcdir)/Modules/_sqlite/util.h
a210cac7
EA
2852
2853CODECS_COMMON_HEADERS=$(srcdir)/Modules/cjkcodecs/multibytecodec.h $(srcdir)/Modules/cjkcodecs/cjkcodecs.h
2854MODULE__CODECS_CN_DEPS=$(srcdir)/Modules/cjkcodecs/mappings_cn.h $(CODECS_COMMON_HEADERS)
2855MODULE__CODECS_HK_DEPS=$(srcdir)/Modules/cjkcodecs/mappings_hk.h $(CODECS_COMMON_HEADERS)
2856MODULE__CODECS_ISO2022_DEPS=$(srcdir)/Modules/cjkcodecs/mappings_jisx0213_pair.h $(srcdir)/Modules/cjkcodecs/alg_jisx0201.h $(srcdir)/Modules/cjkcodecs/emu_jisx0213_2000.h $(CODECS_COMMON_HEADERS)
2857MODULE__CODECS_JP_DEPS=$(srcdir)/Modules/cjkcodecs/mappings_jisx0213_pair.h $(srcdir)/Modules/cjkcodecs/alg_jisx0201.h $(srcdir)/Modules/cjkcodecs/emu_jisx0213_2000.h $(srcdir)/Modules/cjkcodecs/mappings_jp.h $(CODECS_COMMON_HEADERS)
2858MODULE__CODECS_KR_DEPS=$(srcdir)/Modules/cjkcodecs/mappings_kr.h $(CODECS_COMMON_HEADERS)
2859MODULE__CODECS_TW_DEPS=$(srcdir)/Modules/cjkcodecs/mappings_tw.h $(CODECS_COMMON_HEADERS)
3d71b5ec 2860MODULE__MULTIBYTECODEC_DEPS=$(srcdir)/Modules/cjkcodecs/multibytecodec.h
81669d1b 2861
85515ad9 2862# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
771d33e1
BW
2863# Local Variables:
2864# mode: makefile
2865# End: