@@ -7,7 +7,7 @@ Configure Python
77
88.. _build-requirements :
99
10- Build Requirements
10+ Build requirements
1111==================
1212
1313To build CPython, you will need:
@@ -171,6 +171,8 @@ platform-specific modules like :mod:`winreg` are not listed here.
171171 SQLite 3.15.2 is now required for :mod: `sqlite3 `.
172172
173173
174+ .. _generated-files :
175+
174176Generated files
175177===============
176178
@@ -181,9 +183,11 @@ files. Commands to regenerate all generated files::
181183 make regen-stdlib-module-names
182184 make regen-limited-abi
183185 make regen-configure
186+ make regen-sbom
187+ make regen-unicodedata
184188
185- The `` Makefile.pre.in `` file documents generated files, their inputs, and tools used
186- to regenerate them. Search for ``regen-* `` make targets.
189+ The :source: ` Makefile.pre.in ` file documents generated files, their inputs, and
190+ tools used to regenerate them. Search for ``regen-* `` make targets.
187191
188192configure script
189193----------------
@@ -214,7 +218,7 @@ and `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ 1.8.1.
214218
215219.. _configure-options :
216220
217- Configure Options
221+ Configure options
218222=================
219223
220224List all :file: `configure ` script options using::
@@ -223,7 +227,7 @@ List all :file:`configure` script options using::
223227
224228See also the :file: `Misc/SpecialBuilds.txt ` in the Python source distribution.
225229
226- General Options
230+ General options
227231---------------
228232
229233.. option :: --enable-loadable-sqlite-extensions
@@ -628,7 +632,7 @@ Options for third-party dependencies
628632 overriding ``pkg-config ``.
629633
630634
631- WebAssembly Options
635+ WebAssembly options
632636-------------------
633637
634638.. option :: --enable-wasm-dynamic-linking
@@ -647,7 +651,7 @@ WebAssembly Options
647651 .. versionadded :: 3.11
648652
649653
650- Install Options
654+ Install options
651655---------------
652656
653657.. option :: --prefix=PREFIX
@@ -934,7 +938,7 @@ also be used to improve performance.
934938
935939.. _debug-build :
936940
937- Python Debug Build
941+ Python debug build
938942------------------
939943
940944A debug build is Python built with the :option: `--with-pydebug ` configure
@@ -1248,7 +1252,7 @@ Libraries options
12481252 .. versionadded :: 3.10
12491253
12501254
1251- Security Options
1255+ Security options
12521256----------------
12531257
12541258.. option :: --with-hash-algorithm=[fnv|siphash13|siphash24]
@@ -1326,7 +1330,7 @@ Security Options
13261330 .. versionadded :: 3.14
13271331
13281332
1329- macOS Options
1333+ macOS options
13301334-------------
13311335
13321336See :source: `Mac/README.rst `.
@@ -1381,7 +1385,7 @@ See :source:`Mac/README.rst`.
13811385
13821386 .. versionadded :: 3.13
13831387
1384- iOS Options
1388+ iOS options
13851389-----------
13861390
13871391See :source: `Platforms/Apple/iOS/README.md `.
@@ -1406,7 +1410,7 @@ rejects :option:`--enable-shared`. See
14061410 iOS builds may be configured without a framework.
14071411
14081412
1409- Cross Compiling Options
1413+ Cross compiling options
14101414-----------------------
14111415
14121416Cross compiling, also known as cross building, can be used to build Python
@@ -1456,7 +1460,7 @@ Cross compiling example::
14561460 --with-build-python=../x86_64/python
14571461
14581462
1459- Python Build System
1463+ Python build system
14601464===================
14611465
14621466Main files of the build system
@@ -1480,107 +1484,88 @@ Main build steps
14801484Main Makefile targets
14811485---------------------
14821486
1483- make
1484- ^^^^
1485-
1486- For the most part, when rebuilding after editing some code or
1487- refreshing your checkout from upstream, all you need to do is execute
1488- ``make ``, which (per Make's semantics) builds the default target, the
1489- first one defined in the Makefile. By tradition (including in the
1490- CPython project) this is usually the ``all `` target. The
1491- ``configure `` script expands an ``autoconf `` variable,
1492- ``@DEF_MAKE_ALL_RULE@ `` to describe precisely which targets ``make
1493- all `` will build. The three choices are:
1494-
1495- * ``profile-opt `` (configured with ``--enable-optimizations ``)
1496- * ``build_wasm `` (chosen if the host platform matches ``wasm32-wasi* `` or
1497- ``wasm32-emscripten ``)
1498- * ``build_all `` (configured without explicitly using either of the others)
1499-
1500- Depending on the most recent source file changes, Make will rebuild
1501- any targets (object files and executables) deemed out-of-date,
1502- including running ``configure `` again if necessary. Source/target
1503- dependencies are many and maintained manually however, so Make
1504- sometimes doesn't have all the information necessary to correctly
1505- detect all targets which need to be rebuilt. Depending on which
1506- targets aren't rebuilt, you might experience a number of problems. If
1507- you have build or test problems which you can't otherwise explain,
1508- ``make clean && make `` should work around most dependency problems, at
1509- the expense of longer build times.
1510-
1511-
1512- make platform
1513- ^^^^^^^^^^^^^
1487+ .. make-target :: make
15141488
1515- Build the ``python `` program, but don't build the standard library
1516- extension modules. This generates a file named ``platform `` which
1517- contains a single line describing the details of the build platform,
1518- e.g., ``macosx-14.3-arm64-3.12 `` or ``linux-x86_64-3.13 ``.
1489+ For the most part, when rebuilding after editing some code or
1490+ refreshing your checkout from upstream, all you need to do is execute
1491+ ``make ``, which (per Make's semantics) builds the default target, the
1492+ first one defined in the Makefile. By tradition (including in the
1493+ CPython project) this is usually the ``all `` target. The
1494+ ``configure `` script expands an ``autoconf `` variable,
1495+ ``@DEF_MAKE_ALL_RULE@ `` to describe precisely which targets ``make
1496+ all `` will build. The choices are:
15191497
1498+ * ``profile-opt `` (configured with ``--enable-optimizations ``)
1499+ * ``bolt-opt `` (configured with ``--enable-bolt ``)
1500+ * ``build_emscripten `` (chosen if the host platform matches
1501+ ``wasm32-emscripten ``)
1502+ * ``build_wasm `` (chosen if the host platform matches ``wasm32-wasi* ``)
1503+ * ``build_all `` (configured without explicitly using any of the others)
15201504
1521- make profile-opt
1522- ^^^^^^^^^^^^^^^^
1505+ Depending on the most recent source file changes, Make will rebuild
1506+ any targets (object files and executables) deemed out-of-date,
1507+ including running ``configure `` again if necessary. Source/target
1508+ dependencies are many and maintained manually however, so Make
1509+ sometimes doesn't have all the information necessary to correctly
1510+ detect all targets which need to be rebuilt. Depending on which
1511+ targets aren't rebuilt, you might experience a number of problems. If
1512+ you have build or test problems which you can't otherwise explain,
1513+ ``make clean && make `` should work around most dependency problems, at
1514+ the expense of longer build times.
15231515
1524- Build Python using profile-guided optimization (PGO). You can use the
1525- configure :option: `--enable-optimizations ` option to make this the
1526- default target of the ``make `` command (``make all `` or just
1527- ``make ``).
1516+ .. make-target :: make platform
15281517
1518+ Build the ``python `` program, but don't build the standard library
1519+ extension modules. This generates a file named ``platform `` which
1520+ contains a single line describing the details of the build platform,
1521+ for example, ``macosx-14.3-arm64-3.12 `` or ``linux-x86_64-3.13 ``.
15291522
1523+ .. make-target :: make profile-opt
15301524
1531- make clean
1532- ^^^^^^^^^^
1525+ Build Python using profile-guided optimization (PGO). You can use the
1526+ configure :option: `--enable-optimizations ` option to make this the
1527+ default target of the ``make `` command (``make all `` or just
1528+ ``make ``).
15331529
1534- Remove built files.
1530+ .. make-target :: make clean
15351531
1532+ Remove built files.
15361533
1537- make distclean
1538- ^^^^^^^^^^^^^^
1534+ .. make-target :: make distclean
15391535
1540- In addition to the work done by ``make clean ``, remove files
1541- created by the configure script. ``configure `` will have to be run
1542- before building again. [# ]_
1536+ In addition to the work done by ``make clean ``, remove files
1537+ created by the configure script. ``configure `` will have to be run
1538+ before building again. [# ]_
15431539
1540+ .. make-target :: make install
15441541
1545- make install
1546- ^^^^^^^^^^^^
1542+ Build the ``all `` target and install Python.
15471543
1548- Build the `` all `` target and install Python.
1544+ .. make- target:: make test
15491545
1546+ Build the ``all `` target and run the Python test suite with the
1547+ ``--fast-ci `` option without GUI tests. Variables:
15501548
1551- make test
1552- ^^^^^^^^^
1549+ * ``TESTOPTS ``: additional regrtest command-line options.
1550+ * ``TESTPYTHONOPTS ``: additional Python command-line options.
1551+ * ``TESTTIMEOUT ``: timeout in seconds (default: 10 minutes).
15531552
1554- Build the ``all `` target and run the Python test suite with the
1555- ``--fast-ci `` option without GUI tests. Variables:
1553+ .. make-target :: make ci
15561554
1557- * ``TESTOPTS ``: additional regrtest command-line options.
1558- * ``TESTPYTHONOPTS ``: additional Python command-line options.
1559- * ``TESTTIMEOUT ``: timeout in seconds (default: 10 minutes).
1555+ This is similar to ``make test ``, but uses the ``-ugui `` to also run GUI tests.
15601556
1557+ .. versionadded :: 3.14
15611558
1562- make ci
1563- ^^^^^^^
1564-
1565- This is similar to ``make test ``, but uses the ``-ugui `` to also run GUI tests.
1566-
1567- .. versionadded :: 3.14
1568-
1569-
1570- make buildbottest
1571- ^^^^^^^^^^^^^^^^^
1572-
1573- This is similar to ``make test ``, but uses the ``--slow-ci ``
1574- option and default timeout of 20 minutes, instead of ``--fast-ci `` option.
1559+ .. make-target :: make buildbottest
15751560
1561+ This is similar to ``make test ``, but uses the ``--slow-ci ``
1562+ option and default timeout of 20 minutes, instead of ``--fast-ci `` option.
15761563
1577- make regen-all
1578- ^^^^^^^^^^^^^^
1564+ .. make-target :: make regen-all
15791565
1580- Regenerate (almost) all generated files. These include (but are not
1581- limited to) bytecode cases, and parser generator file.
1582- ``make regen-stdlib-module-names `` and ``autoconf `` must be run
1583- separately for the remaining `generated files <#generated-files >`_.
1566+ Regenerate (almost) all generated files. These include (but are not
1567+ limited to) bytecode cases, and parser generator files. See
1568+ :ref: `generated-files ` for the targets that must be run separately.
15841569
15851570
15861571C extensions
@@ -1600,23 +1585,23 @@ Built-in modules have no ``__file__`` attribute:
16001585 File "<stdin>", line 1, in <module>
16011586 AttributeError: module 'sys' has no attribute '__file__'
16021587
1603- Other C extensions are built as dynamic libraries, like the ``_asyncio `` module.
1588+ Other C extensions are built as dynamic libraries, like the ``_zoneinfo `` module.
16041589They are built with the ``Py_BUILD_CORE_MODULE `` macro defined.
1605- Example on Linux x86-64:
1590+ For example on Linux x86-64:
16061591
16071592.. code-block :: pycon
16081593
1609- >>> import _asyncio
1610- >>> _asyncio
1611- <module '_asyncio ' from '/usr/lib64/python3.9 /lib-dynload/_asyncio .cpython-39 -x86_64-linux-gnu.so'>
1612- >>> _asyncio .__file__
1613- '/usr/lib64/python3.9 /lib-dynload/_asyncio .cpython-39 -x86_64-linux-gnu.so'
1594+ >>> import _zoneinfo
1595+ >>> _zoneinfo
1596+ <module '_zoneinfo ' from '/... /lib.linux-x86_64-3.16/_zoneinfo .cpython-316d -x86_64-linux-gnu.so'>
1597+ >>> _zoneinfo .__file__
1598+ '/... /lib.linux-x86_64-3.16/_zoneinfo .cpython-316d -x86_64-linux-gnu.so'
16141599
16151600:file: `Modules/Setup ` is used to generate Makefile targets to build C extensions.
16161601At the beginning of the files, C extensions are built as built-in modules.
16171602Extensions defined after the ``*shared* `` marker are built as dynamic libraries.
16181603
1619- The :c:macro: `! PyAPI_FUNC() `, :c:macro: `! PyAPI_DATA() ` and
1604+ The :c:macro: `PyAPI_FUNC() `, :c:macro: `PyAPI_DATA() ` and
16201605:c:macro: `PyMODINIT_FUNC ` macros of :file: `Include/exports.h ` are defined
16211606differently depending if the ``Py_BUILD_CORE_MODULE `` macro is defined:
16221607
0 commit comments