Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-106259: add minimal help target to Makefile #106260

Merged
merged 17 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 103 additions & 26 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -987,32 +987,99 @@ Main build steps
Main Makefile targets
---------------------

* ``make``: Build Python with the standard library.
* ``make platform:``: build the ``python`` program, but don't build the
standard library extension modules.
* ``make profile-opt``: build Python using Profile Guided Optimization (PGO).
You can use the configure :option:`--enable-optimizations` option to make
this the default target of the ``make`` command (``make all`` or just
``make``).

* ``make test``: Build Python and run the Python test suite with ``--fast-ci``
option. Variables:

* ``TESTOPTS``: additional regrtest command line options.
* ``TESTPYTHONOPTS``: additional Python command line options.
* ``TESTTIMEOUT``: timeout in seconds (default: 20 minutes).

* ``make buildbottest``: Similar to ``make test``, but use ``--slow-ci``
option and default timeout of 20 minutes, instead of ``--fast-ci`` option
and a default timeout of 10 minutes.

* ``make install``: Build and install Python.
* ``make regen-all``: Regenerate (almost) all generated files;
``make regen-stdlib-module-names`` and ``autoconf`` must be run separately
for the remaining generated files.
* ``make clean``: Remove built files.
* ``make distclean``: Same than ``make clean``, but remove also files created
by the configure script.
make [all]
^^^^^^^^^^
smontanaro marked this conversation as resolved.
Show resolved Hide resolved

For the most part, when rebuilding after editing some code or
refreshing your checkout from upstream, all you need to do is execute
``make``, which (per Make's semantics) builds the default target, the
first one defined in the Makefile. By tradition (including in the
CPython project) this is usually the ``all`` target. The
``configure`` script expands an ``autoconf`` variable,
``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make
all`` will build. The three choices are
smontanaro marked this conversation as resolved.
Show resolved Hide resolved

* ``profile-opt`` (configured with ``--enable-optimizations``)
* ``build_wasm`` (configured with ``--with-emscripten-target``)
* ``build_all`` (configured without explicitly using either of the others)

Depending on the most recent source file changes, Make will rebuild
any targets (object files and executables) deemed out-of-date,
including running ``configure`` again if necessary, Source/target
smontanaro marked this conversation as resolved.
Show resolved Hide resolved
dependencies are many and maintained manually however, so Make
sometimes doesn't have all the information necessary to correctly
detect all targets which need to be rebuilt. Depending on which
targets aren't rebuilt, you might experience a number of problems. If
you have build or test problems which you can't otherwise explain,
``make clean && make`` should work around most dependency problems, at
the expense of longer build times.


make platform
^^^^^^^^^^^^^

Build the ``python`` program, but don't build the standard library
extension modules. This generates a file named ``platform`` which
contains a single line describing the details of the build platform,
e.g., ``macosx-14.3-arm64-3.12`` or ``linux-x86_64-3.13``.


make profile-opt
^^^^^^^^^^^^^^^^

Build Python using Profile Guided Optimization (PGO). You can use the
smontanaro marked this conversation as resolved.
Show resolved Hide resolved
configure :option:`--enable-optimizations` option to make this the
default target of the ``make`` command (``make all`` or just
``make``).



make clean
^^^^^^^^^^

Remove built files.


make distclean
^^^^^^^^^^^^^^

In addition to the the work done by ``make clean``, remove files
created by the configure script. ``configure`` will have to be run
before building again. [#]_


make install
^^^^^^^^^^^^

Build the ``all`` target and install Python.


make test
^^^^^^^^^

Build the ``all`` target and run the Python test suite with the
``--fast-ci`` option. Variables:

* ``TESTOPTS``: additional regrtest command line options.
* ``TESTPYTHONOPTS``: additional Python command line options.
smontanaro marked this conversation as resolved.
Show resolved Hide resolved
* ``TESTTIMEOUT``: timeout in seconds (default: 10 minutes).


make buildbottest
^^^^^^^^^^^^^^^^^

This is similar to ``make test``, but uses the ``--slow-ci``
option and default timeout of 20 minutes, instead of ``--fast-ci`` option.


make regen-all
^^^^^^^^^^^^^^

Regenerate (almost) all generated files. These include (but are not
limited to) bytecode cases, parser generator files, and SBOM file.
smontanaro marked this conversation as resolved.
Show resolved Hide resolved
``make regen-stdlib-module-names`` and ``autoconf`` must be run
separately for the remaining generated files.
smontanaro marked this conversation as resolved.
Show resolved Hide resolved


C extensions
------------
Expand Down Expand Up @@ -1303,3 +1370,13 @@ Linker flags
Linker flags used for building the interpreter object files.

.. versionadded:: 3.8


.. rubric:: Footnotes

.. [#] ``git clean -fdx`` removes all files not known to Git.
When bug hunting using ``git bisect``, this is
`recommended between probes <https://github.com/python/cpython/issues/114505#issuecomment-1907021718>`_
to guarantee a completely clean build. **Use with care**, as it
will delete all files not checked into Git, including your
uncommitted work.
14 changes: 14 additions & 0 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,20 @@ all: @DEF_MAKE_ALL_RULE@
# all.
.PHONY: all

# Provide quick help for common Makefile targets.
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " clean to remove build files"
smontanaro marked this conversation as resolved.
Show resolved Hide resolved
@echo " distclean 'clean' + remove other generated files (patch, exe, etc)"
@echo " clinic run Argument Clinic over source files"
@echo " install install built files"
@echo " recheck rerun configure with last cmdline options"
@echo " regen-all regenerate a number of generated source files"
@echo " reindent reindent .py files in Lib directory"
@echo " tags build a tags file (useful for Emacs and other editors)"
@echo " test run the test suite"
smontanaro marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: build_all
build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
gdbhooks Programs/_testembed scripts checksharedmods rundsymutil
Expand Down
Loading