Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9ccde2

Browse filesBrowse files
smontanaroerlend-aaslandhugovkvstinner
authored
gh-106259: Add minimal help target to Makefile (#106260)
Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 41457c7 commit d9ccde2
Copy full SHA for d9ccde2

File tree

Expand file treeCollapse file tree

2 files changed

+128
-26
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+128
-26
lines changed

‎Doc/using/configure.rst

Copy file name to clipboardExpand all lines: Doc/using/configure.rst
+104-26Lines changed: 104 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -991,32 +991,99 @@ Main build steps
991991
Main Makefile targets
992992
---------------------
993993

994-
* ``make``: Build Python with the standard library.
995-
* ``make platform:``: build the ``python`` program, but don't build the
996-
standard library extension modules.
997-
* ``make profile-opt``: build Python using Profile Guided Optimization (PGO).
998-
You can use the configure :option:`--enable-optimizations` option to make
999-
this the default target of the ``make`` command (``make all`` or just
1000-
``make``).
1001-
1002-
* ``make test``: Build Python and run the Python test suite with ``--fast-ci``
1003-
option. Variables:
1004-
1005-
* ``TESTOPTS``: additional regrtest command line options.
1006-
* ``TESTPYTHONOPTS``: additional Python command line options.
1007-
* ``TESTTIMEOUT``: timeout in seconds (default: 20 minutes).
1008-
1009-
* ``make buildbottest``: Similar to ``make test``, but use ``--slow-ci``
1010-
option and default timeout of 20 minutes, instead of ``--fast-ci`` option
1011-
and a default timeout of 10 minutes.
1012-
1013-
* ``make install``: Build and install Python.
1014-
* ``make regen-all``: Regenerate (almost) all generated files;
1015-
``make regen-stdlib-module-names`` and ``autoconf`` must be run separately
1016-
for the remaining generated files.
1017-
* ``make clean``: Remove built files.
1018-
* ``make distclean``: Same than ``make clean``, but remove also files created
1019-
by the configure script.
994+
make
995+
^^^^
996+
997+
For the most part, when rebuilding after editing some code or
998+
refreshing your checkout from upstream, all you need to do is execute
999+
``make``, which (per Make's semantics) builds the default target, the
1000+
first one defined in the Makefile. By tradition (including in the
1001+
CPython project) this is usually the ``all`` target. The
1002+
``configure`` script expands an ``autoconf`` variable,
1003+
``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make
1004+
all`` will build. The three choices are:
1005+
1006+
* ``profile-opt`` (configured with ``--enable-optimizations``)
1007+
* ``build_wasm`` (configured with ``--with-emscripten-target``)
1008+
* ``build_all`` (configured without explicitly using either of the others)
1009+
1010+
Depending on the most recent source file changes, Make will rebuild
1011+
any targets (object files and executables) deemed out-of-date,
1012+
including running ``configure`` again if necessary. Source/target
1013+
dependencies are many and maintained manually however, so Make
1014+
sometimes doesn't have all the information necessary to correctly
1015+
detect all targets which need to be rebuilt. Depending on which
1016+
targets aren't rebuilt, you might experience a number of problems. If
1017+
you have build or test problems which you can't otherwise explain,
1018+
``make clean && make`` should work around most dependency problems, at
1019+
the expense of longer build times.
1020+
1021+
1022+
make platform
1023+
^^^^^^^^^^^^^
1024+
1025+
Build the ``python`` program, but don't build the standard library
1026+
extension modules. This generates a file named ``platform`` which
1027+
contains a single line describing the details of the build platform,
1028+
e.g., ``macosx-14.3-arm64-3.12`` or ``linux-x86_64-3.13``.
1029+
1030+
1031+
make profile-opt
1032+
^^^^^^^^^^^^^^^^
1033+
1034+
Build Python using profile-guided optimization (PGO). You can use the
1035+
configure :option:`--enable-optimizations` option to make this the
1036+
default target of the ``make`` command (``make all`` or just
1037+
``make``).
1038+
1039+
1040+
1041+
make clean
1042+
^^^^^^^^^^
1043+
1044+
Remove built files.
1045+
1046+
1047+
make distclean
1048+
^^^^^^^^^^^^^^
1049+
1050+
In addition to the the work done by ``make clean``, remove files
1051+
created by the configure script. ``configure`` will have to be run
1052+
before building again. [#]_
1053+
1054+
1055+
make install
1056+
^^^^^^^^^^^^
1057+
1058+
Build the ``all`` target and install Python.
1059+
1060+
1061+
make test
1062+
^^^^^^^^^
1063+
1064+
Build the ``all`` target and run the Python test suite with the
1065+
``--fast-ci`` option. Variables:
1066+
1067+
* ``TESTOPTS``: additional regrtest command-line options.
1068+
* ``TESTPYTHONOPTS``: additional Python command-line options.
1069+
* ``TESTTIMEOUT``: timeout in seconds (default: 10 minutes).
1070+
1071+
1072+
make buildbottest
1073+
^^^^^^^^^^^^^^^^^
1074+
1075+
This is similar to ``make test``, but uses the ``--slow-ci``
1076+
option and default timeout of 20 minutes, instead of ``--fast-ci`` option.
1077+
1078+
1079+
make regen-all
1080+
^^^^^^^^^^^^^^
1081+
1082+
Regenerate (almost) all generated files. These include (but are not
1083+
limited to) bytecode cases, and parser generator file.
1084+
``make regen-stdlib-module-names`` and ``autoconf`` must be run
1085+
separately for the remaining `generated files <#generated-files>`_.
1086+
10201087

10211088
C extensions
10221089
------------
@@ -1311,3 +1378,14 @@ Linker flags
13111378
Linker flags used for building the interpreter object files.
13121379

13131380
.. versionadded:: 3.8
1381+
1382+
1383+
.. rubric:: Footnotes
1384+
1385+
.. [#] ``git clean -fdx`` is an even more extreme way to "clean" your
1386+
checkout. It removes all files not known to Git.
1387+
When bug hunting using ``git bisect``, this is
1388+
`recommended between probes <https://github.com/python/cpython/issues/114505#issuecomment-1907021718>`_
1389+
to guarantee a completely clean build. **Use with care**, as it
1390+
will delete all files not checked into Git, including your
1391+
new, uncommitted work.

‎Makefile.pre.in

Copy file name to clipboardExpand all lines: Makefile.pre.in
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,30 @@ all: @DEF_MAKE_ALL_RULE@
653653
# all.
654654
.PHONY: all
655655

656+
# Provide quick help for common Makefile targets.
657+
.PHONY: help
658+
help:
659+
@echo "Run 'make' to build the Python executable and extension modules"
660+
@echo ""
661+
@echo "or 'make <target>' where <target> is one of:"
662+
@echo " test run the test suite"
663+
@echo " install install built files"
664+
@echo " regen-all regenerate a number of generated source files"
665+
@echo " clinic run Argument Clinic over source files"
666+
@echo ""
667+
@echo " clean to remove build files"
668+
@echo " distclean 'clean' + remove other generated files (patch, exe, etc)"
669+
@echo ""
670+
@echo " recheck rerun configure with last cmdline options"
671+
@echo " reindent reindent .py files in Lib directory"
672+
@echo " tags build a tags file (useful for Emacs and other editors)"
673+
@echo " list-targets list all targets in the Makefile"
674+
675+
# Display a full list of Makefile targets
676+
.PHONY: list-targets
677+
list-targets:
678+
@grep -E '^[A-Za-z][-A-Za-z0-9]+:' Makefile | awk -F : '{print $$1}'
679+
656680
.PHONY: build_all
657681
build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
658682
gdbhooks Programs/_testembed scripts checksharedmods rundsymutil

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.