Home | History | Annotate | Download | only in doc
      1 # Makefile for Sphinx documentation
      2 #
      3 
      4 # You can set these variables from the command line.
      5 SPHINXOPTS    = -W
      6 SPHINXBUILD   = sphinx-build
      7 BUILDDIR      = _build
      8 CHROMESITE_BUILDDIR = $(realpath ../../doc_generated)
      9 PORT = 8000
     10 
     11 # User-friendly check for sphinx-build
     12 ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
     13 $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
     14 endif
     15 
     16 # Internal variables.
     17 ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .
     18 
     19 .PHONY: all help clean linkcheck doctest chromesite chromesite_rst serve
     20 
     21 all: chromesite
     22 
     23 help:
     24 	@echo "Please use \`make <target>' where <target> is one of"
     25 	@echo "  html            to make standalone HTML files"
     26 	@echo "  chromesite      build docs for developer.chrome.com"
     27 	@echo "  chromesite_rst  only build .rst docs; no doxygen"
     28 	@echo "  serve           start python web server for chromesite docs"
     29 	@echo "  linkcheck       to check all external links for integrity"
     30 	@echo "  doctest         to run all doctests embedded in the documentation (if enabled)"
     31 	@echo "  presubmit       build docs in a temp directory (for presubmit check)"
     32 
     33 clean:
     34 	rm -rf $(BUILDDIR)/*
     35 
     36 html:
     37 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
     38 	@echo
     39 	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
     40 
     41 linkcheck:
     42 	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
     43 	@echo
     44 	@echo "Link check complete; look for any errors in the above output " \
     45 	      "or in $(BUILDDIR)/linkcheck/output.txt."
     46 
     47 doctest:
     48 	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
     49 	@echo "Testing of doctests in the sources finished, look at the " \
     50 	      "results in $(BUILDDIR)/doctest/output.txt."
     51 
     52 chromesite:
     53 	-rm $(CHROMESITE_BUILDDIR)/.buildinfo
     54 	doxygen/generate_docs.py $(CHROMESITE_BUILDDIR)
     55 	$(SPHINXBUILD) -b chromesite $(ALLSPHINXOPTS) $(CHROMESITE_BUILDDIR)
     56 	rm -rf $(CHROMESITE_BUILDDIR)/images
     57 	cp -r $(CHROMESITE_BUILDDIR)/_images $(CHROMESITE_BUILDDIR)/images
     58 	rm -rf $(CHROMESITE_BUILDDIR)/{_images,searchindex.js}
     59 	@echo
     60 	@echo "Build finished. The HTML pages are in $(CHROMESITE_BUILDDIR)"
     61 
     62 chromesite_rst:
     63 	-rm $(CHROMESITE_BUILDDIR)/.buildinfo
     64 	$(SPHINXBUILD) -b chromesite $(ALLSPHINXOPTS) $(CHROMESITE_BUILDDIR)
     65 	rm -rf $(CHROMESITE_BUILDDIR)/images
     66 	cp -r $(CHROMESITE_BUILDDIR)/_images $(CHROMESITE_BUILDDIR)/images
     67 	rm -rf $(CHROMESITE_BUILDDIR)/{_images,searchindex.js}
     68 
     69 presubmit:
     70 	-rm $(BUILDDIR)/.buildinfo
     71 	$(SPHINXBUILD) -b chromesite $(ALLSPHINXOPTS) $(BUILDDIR)
     72 
     73 serve: chromesite_rst
     74 	../../../chrome/common/extensions/docs/server2/preview.py -p $(PORT)
     75