[LTP] [PATCH 3/7] doc/Makefile: Improve make targets
Andrea Cervesato
andrea.cervesato@suse.com
Thu Feb 6 15:59:19 CET 2025
Hi Petr,
On 2/6/25 15:34, Petr Vorel wrote:
> * add _static/syscalls.rst into clean target)
> * add targets:
> - .venv
> - distclean target (for .venv)
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> doc/Makefile | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/doc/Makefile b/doc/Makefile
> index e536e95db6..0f67721ef5 100644
> --- a/doc/Makefile
> +++ b/doc/Makefile
> @@ -1,8 +1,20 @@
> -all:
> - sphinx-build -b html . html
> +PYTHON := python3
> +
> +# install sphinx only if needed
> +INSTALL_SPHINX := $(shell $(PYTHON) -c "import sphinx" 2>/dev/null && echo "true" || echo "pip install sphinx")
> +
> +.venv:
> + $(PYTHON) -m virtualenv .venv
> + . .venv/bin/activate && pip install -r requirements.txt && $(INSTALL_SPHINX)
> +
> +all: .venv
> + . .venv/bin/activate && sphinx-build -b html . html
>
The reason why we didn't have virtualenv dependency in the makefie is
that every distro has their own python packages as well.
virtualenv requires pip, but it's not strictly needed. For example, that
could be don't inside a container for development reasons and the venv
activation wouldn't be possible.
I would suggest to keep the previous version, without the virtualenv
dependency for this reason.
> spelling:
> - sphinx-build -b spelling -d build/doctree . build/spelling
> + . .venv/bin/activate && sphinx-build -b spelling -d build/doctree . build/spelling
>
> clean:
> - rm -rf html/
> + rm -rf html/ _static/syscalls.rst
Good idea, maybe also _static/tests.rst since we added it.
> +
> +distclean: clean
> + rm -rf .venv/
Andrea
More information about the ltp
mailing list