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

Petr Vorel pvorel@suse.cz
Thu Feb 6 15:34:17 CET 2025


* 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
 
 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
+
+distclean: clean
+	rm -rf .venv/
-- 
2.47.2



More information about the ltp mailing list