[LTP] [PATCH 3/7] doc/Makefile: Improve make targets

Petr Vorel pvorel@suse.cz
Thu Feb 6 16:05:08 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.

I hoped using virtualenv would actually help developers. Because doc/ is not
parsed by top level Makefile, therefore rpm/deb packages will not build it.
But OK, let's drop this change, I'll send v2.

Kind regards,
Petr

> >   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.

Now I'll add just _static/, to be always valid. Also, change in tests does not
trigger the need of rebuild, therefore one must always run 'make clean', but I
haven't tried to figure out how to express the dependency.

Kind regards,
Petr

> > +
> > +distclean: clean
> > +	rm -rf .venv/
> Andrea


More information about the ltp mailing list