summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-06-11 21:57:48 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-06-12 17:38:26 -0400
commit52f70a0d9a39734f25706fda7b6f07c07d479c79 (patch)
tree5670574ce7bf8162f00d285c3739593fe40b848c
parente112a88f899adc92c05cbeee19519507508efff4 (diff)
downloadbuildstream-52f70a0d9a39734f25706fda7b6f07c07d479c79.tar.gz
doc/Makefile: Run bst2html.py to generate .html files from .run files
If you need an example output of bst to put in the documentation, just add a .run file to the doc/examples directory and it will result in a similarly named .html file in doc/source/examples.
-rw-r--r--doc/Makefile24
1 files changed, 22 insertions, 2 deletions
diff --git a/doc/Makefile b/doc/Makefile
index da88d5f54..2bd07faae 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -24,7 +24,9 @@ ALLSPHINXOPTS = -W -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-.PHONY: all templates html devhelp
+BST2HTML = $(CURDIR)/bst2html.py
+
+.PHONY: all clean templates templates-clean html devhelp
# Canned recipe for generating plugin api skeletons
# $1 = the plugin directory
@@ -56,9 +58,14 @@ define plugin-doc-skeleton
done
endef
+
+
# We set PYTHONPATH here because source/conf.py sys.modules hacks dont seem to help sphinx-build import the plugins
all: html devhelp
+clean: templates-clean
+ rm -rf build
+
# Generate rst templates for the docs using a mix of sphinx-apidoc and
# our 'plugin-doc-skeleton' routine for plugin pages.
templates:
@@ -68,10 +75,23 @@ templates:
$(call plugin-doc-skeleton,$(CURDIR)/../buildstream/plugins/elements,elements)
$(call plugin-doc-skeleton,$(CURDIR)/../buildstream/plugins/sources,sources)
+# Generate the html fragments of colorized BuildStream terminal output only
+# if they don't yet exist. This is expensive so you need to run `make clean` first
+# if you want to regenerate them.
+#
+SESSION_HTML = $(patsubst sessions/%.run,source/sessions/%.html,$(wildcard sessions/*.run))
+source/sessions/%.html:
+ $(BST2HTML) -o $@ --description $(patsubst source/sessions/%.html,sessions/%.run,$@)
+
+templates-clean:
+ rm -rf source/elements
+ rm -rf source/sources
+ rm -rf source/sessions
+
# Targets which generate docs with sphinx build
#
#
-html devhelp: templates
+html devhelp: templates $(SESSION_HTML)
@echo "Building $@..."
PYTHONPATH=$(CURDIR)/../buildstream/plugins \
$(SPHINXBUILD) -b $@ $(ALLSPHINXOPTS) "$(BUILDDIR)/$@" \