2018-03-06 14:54:44 +08:00
|
|
|
# Minimal makefile for Sphinx documentation
|
|
|
|
#
|
|
|
|
|
2018-03-09 07:59:55 +08:00
|
|
|
ifeq ($(VERBOSE),1)
|
|
|
|
Q =
|
|
|
|
else
|
|
|
|
Q = @
|
|
|
|
endif
|
|
|
|
|
2018-03-06 14:54:44 +08:00
|
|
|
# You can set these variables from the command line.
|
2018-04-14 05:36:25 +08:00
|
|
|
SPHINXOPTS ?= -q
|
2018-03-06 14:54:44 +08:00
|
|
|
SPHINXBUILD = sphinx-build
|
|
|
|
SPHINXPROJ = "Project ACRN"
|
2018-06-12 17:38:43 +08:00
|
|
|
BUILDDIR ?= _build
|
2019-09-10 18:18:44 +08:00
|
|
|
SOURCEDIR = $(BUILDDIR)/rst/
|
2018-03-06 14:54:44 +08:00
|
|
|
|
2018-06-15 04:54:59 +08:00
|
|
|
# document publication assumes the folder structure is setup
|
|
|
|
# with the acrn-hypervisor and projectacrn.github.io repos as
|
|
|
|
# sibling folders and make is run inside the acrn-hypervisor/docs
|
|
|
|
# folder.
|
|
|
|
|
|
|
|
ACRN_BASE = "$(CURDIR)/../.."
|
2018-04-14 05:36:25 +08:00
|
|
|
DOC_TAG ?= development
|
|
|
|
RELEASE ?= latest
|
2018-06-15 04:54:59 +08:00
|
|
|
PUBLISHDIR = $(ACRN_BASE)/projectacrn.github.io/$(RELEASE)
|
2018-03-07 07:12:49 +08:00
|
|
|
|
2018-03-06 14:54:44 +08:00
|
|
|
# Put it first so that "make" without argument is like "make help".
|
|
|
|
help:
|
2018-06-12 17:34:54 +08:00
|
|
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(OPTS)
|
2018-05-05 00:41:59 +08:00
|
|
|
@echo ""
|
|
|
|
@echo "make publish"
|
|
|
|
@echo " publish generated html to projectacrn.github.io site:"
|
|
|
|
@echo " specify RELEASE=name to publish as a tagged release version"
|
2018-05-15 18:02:07 +08:00
|
|
|
@echo " and placed in a version subfolder. Requires repo merge permission."
|
2018-03-06 14:54:44 +08:00
|
|
|
|
2019-09-10 18:18:44 +08:00
|
|
|
.PHONY: help Makefile copy-to-sourcedir doxy content kconfig html singlehtml clean publish
|
2018-03-06 14:54:44 +08:00
|
|
|
|
2018-03-07 04:26:59 +08:00
|
|
|
# Generate the doxygen xml (for Sphinx) and copy the doxygen html to the
|
|
|
|
# api folder for publishing along with the Sphinx-generated API docs.
|
|
|
|
|
2019-09-10 18:18:44 +08:00
|
|
|
copy-to-sourcedir:
|
|
|
|
$(Q)mkdir -p $(SOURCEDIR)
|
|
|
|
$(Q)rsync -rt --exclude=$(BUILDDIR) . $(SOURCEDIR)
|
2018-03-06 14:54:44 +08:00
|
|
|
|
2019-09-10 18:18:44 +08:00
|
|
|
doxy: copy-to-sourcedir
|
|
|
|
$(Q)(cat acrn.doxyfile ; echo "OUTPUT_DIRECTORY=$(SOURCEDIR)/doxygen" ) | doxygen - > $(BUILDDIR)/doc.log 2>&1
|
|
|
|
$(Q)find $(SOURCEDIR)/doxygen/xml/* | xargs sed -i 's/simplesect kind="pre"/simplesect kind="preconditions"/'
|
2018-05-30 05:07:34 +08:00
|
|
|
|
2019-09-10 18:18:44 +08:00
|
|
|
content: copy-to-sourcedir
|
|
|
|
$(Q)scripts/extract_content.py $(SOURCEDIR) misc
|
2021-01-28 10:14:00 +08:00
|
|
|
$(Q)mkdir -p $(SOURCEDIR)/misc/config_tools/schema
|
|
|
|
$(Q)rsync -rt ../misc/config_tools/schema/*.xsd $(SOURCEDIR)/misc/config_tools/schema
|
|
|
|
$(Q)xsltproc -xinclude ./scripts/configdoc.xsl $(SOURCEDIR)/misc/config_tools/schema/config.xsd > $(SOURCEDIR)/reference/configdoc.txt
|
2019-09-10 18:18:44 +08:00
|
|
|
|
2018-07-25 07:57:40 +08:00
|
|
|
pullsource:
|
|
|
|
$(Q)scripts/pullsource.sh
|
|
|
|
|
2021-02-03 02:44:03 +08:00
|
|
|
html: copy-to-sourcedir doxy content
|
2019-09-10 18:18:44 +08:00
|
|
|
-$(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html -d $(BUILDDIR)/doctrees $(SOURCEDIR) $(BUILDDIR)/html $(SPHINXOPTS) $(OPTS) >> $(BUILDDIR)/doc.log 2>&1
|
|
|
|
$(Q)./scripts/filter-doc-log.sh $(BUILDDIR)/doc.log
|
2018-03-14 07:24:35 +08:00
|
|
|
|
2021-02-03 02:44:03 +08:00
|
|
|
singlehtml: doxy content
|
2019-09-10 18:18:44 +08:00
|
|
|
-$(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b singlehtml -d $(BUILDDIR)/doctrees $(SOURCEDIR) $(BUILDDIR)/html $(SPHINXOPTS) $(OPTS) >> $(BUILDDIR)/doc.log 2>&1
|
|
|
|
$(Q)./scripts/filter-doc-log.sh $(BUILDDIR)/doc.log
|
2018-03-14 07:24:35 +08:00
|
|
|
|
2018-03-07 07:12:49 +08:00
|
|
|
# Remove generated content (Sphinx and doxygen)
|
2018-03-06 14:54:44 +08:00
|
|
|
|
|
|
|
clean:
|
2019-09-10 18:18:44 +08:00
|
|
|
rm -fr $(BUILDDIR)
|
2021-01-28 18:54:59 +08:00
|
|
|
@# Keeping these temporarily, but no longer strictly needed.
|
2021-02-03 02:44:03 +08:00
|
|
|
rm -fr doxygen misc reference/kconfig
|
2018-03-07 07:12:49 +08:00
|
|
|
|
2019-09-10 18:18:44 +08:00
|
|
|
|
2018-03-07 07:12:49 +08:00
|
|
|
# Copy material over to the GitHub pages staging repo
|
2018-03-09 07:59:55 +08:00
|
|
|
# along with a README
|
2018-03-07 07:12:49 +08:00
|
|
|
|
|
|
|
publish:
|
2018-07-12 21:47:55 +08:00
|
|
|
mkdir -p $(PUBLISHDIR)
|
2018-09-17 05:22:09 +08:00
|
|
|
cd $(PUBLISHDIR)/..; git pull origin master
|
2018-03-09 07:59:55 +08:00
|
|
|
rm -fr $(PUBLISHDIR)/*
|
|
|
|
cp -r $(BUILDDIR)/html/* $(PUBLISHDIR)
|
2020-04-09 05:08:30 +08:00
|
|
|
ifeq ($(RELEASE),latest)
|
2018-04-14 05:36:25 +08:00
|
|
|
cp scripts/publish-README.md $(PUBLISHDIR)/../README.md
|
|
|
|
cp scripts/publish-index.html $(PUBLISHDIR)/../index.html
|
2019-04-05 06:37:49 +08:00
|
|
|
cp scripts/publish-robots.txt $(PUBLISHDIR)/../robots.txt
|
2020-04-10 04:48:22 +08:00
|
|
|
sed 's/<head>/<head>\n <base href="https:\/\/projectacrn.github.io\/latest\/">/' $(BUILDDIR)/html/404.html > $(PUBLISHDIR)/../404.html
|
2020-04-09 05:08:30 +08:00
|
|
|
endif
|
2018-04-14 05:36:25 +08:00
|
|
|
cd $(PUBLISHDIR)/..; git add -A; git commit -s -m "publish $(RELEASE)"; git push origin master;
|
2018-03-06 14:54:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
2018-06-12 17:34:54 +08:00
|
|
|
# "make mode" option. $(OPTS) is meant as a shortcut for $(SPHINXOPTS).
|
2018-03-06 14:54:44 +08:00
|
|
|
%: Makefile doxy
|
2018-06-12 17:34:54 +08:00
|
|
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(OPTS)
|