blob: f1c74261ce4d153f01aea9af633670826ec7b710 [file] [log] [blame]
Daniel Dunbar75083eb2012-04-19 16:31:19 +00001LLVM Documentation
2==================
3
Sean Silvaccb80192013-01-02 02:31:51 +00004LLVM's documentation is written in reStructuredText, a lightweight
5plaintext markup language (file extension `.rst`). While the
6reStructuredText documentation should be quite readable in source form, it
Sean Silvaba78f0b2013-02-27 18:48:42 +00007is mostly meant to be processed by the Sphinx documentation generation
8system to create HTML pages which are hosted on <http://llvm.org/docs/> and
9updated after every commit. Manpage output is also supported, see below.
Daniel Dunbar75083eb2012-04-19 16:31:19 +000010
Sean Silvaccb80192013-01-02 02:31:51 +000011If you instead would like to generate and view the HTML locally, install
12Sphinx <http://sphinx-doc.org/> and then do:
Daniel Dunbar75083eb2012-04-19 16:31:19 +000013
Philip Reames06f00862016-02-07 15:42:12 +000014 cd <build-dir>
15 cmake -DLLVM_ENABLE_SPHINX=true -DSPHINX_OUTPUT_HTML=true <src-dir>
16 make -j3 docs-llvm-html
17 $BROWSER <build-dir>/docs//html/index.html
Daniel Dunbar75083eb2012-04-19 16:31:19 +000018
Sean Silvaccb80192013-01-02 02:31:51 +000019The mapping between reStructuredText files and generated documentation is
Philip Reames06f00862016-02-07 15:42:12 +000020`docs/Foo.rst` <-> `<build-dir>/docs//html/Foo.html` <-> `http://llvm.org/docs/Foo.html`.
Sean Silvaccb80192013-01-02 02:31:51 +000021
22If you are interested in writing new documentation, you will want to read
23`SphinxQuickstartTemplate.rst` which will get you writing documentation
24very fast and includes examples of the most important reStructuredText
25markup syntax.
Sean Silvaba78f0b2013-02-27 18:48:42 +000026
27Manpage Output
28===============
29
30Building the manpages is similar to building the HTML documentation. The
31primary difference is to use the `man` makefile target, instead of the
32default (which is `html`). Sphinx then produces the man pages in the
Philip Reames06f00862016-02-07 15:42:12 +000033directory `<build-dir>/docs/man/`.
Sean Silvaba78f0b2013-02-27 18:48:42 +000034
Philip Reames06f00862016-02-07 15:42:12 +000035 cd <build-dir>
36 cmake -DLLVM_ENABLE_SPHINX=true -DSPHINX_OUTPUT_MAN=true <src-dir>
37 make -j3 docs-llvm-man
38 man -l >build-dir>/docs/man/FileCheck.1
Sean Silvaba78f0b2013-02-27 18:48:42 +000039
40The correspondence between .rst files and man pages is
Philip Reames06f00862016-02-07 15:42:12 +000041`docs/CommandGuide/Foo.rst` <-> `<build-dir>/docs//man/Foo.1`.
Sean Silvaba78f0b2013-02-27 18:48:42 +000042These .rst files are also included during HTML generation so they are also
43viewable online (as noted above) at e.g.
44`http://llvm.org/docs/CommandGuide/Foo.html`.
Sean Silva42357542014-04-22 21:47:53 +000045
Tanya Lattner62a29da2017-06-24 20:13:32 +000046Checking links
Sean Silva42357542014-04-22 21:47:53 +000047==============
48
Steve Kingdfc15d62015-08-12 23:56:50 +000049The reachability of external links in the documentation can be checked by
Sean Silva42357542014-04-22 21:47:53 +000050running:
51
52 cd docs/
53 make -f Makefile.sphinx linkcheck
Vassil Vassilev94e7e882017-04-27 17:23:53 +000054
55Doxygen page Output
56==============
57
58Install doxygen <http://www.stack.nl/~dimitri/doxygen/download.html> and dot2tex <https://dot2tex.readthedocs.io/en/latest>.
59
60 cd <build-dir>
61 cmake -DLLVM_ENABLE_DOXYGEN=On <llvm-top-src-dir>
62 make doxygen-llvm # for LLVM docs
63 make doxygen-clang # for clang docs
64
65It will generate html in
66
67 <build-dir>/docs/doxygen/html # for LLVM docs
68 <build-dir>/tools/clang/docs/doxygen/html # for clang docs