Remove mdrun-only build configuration
[alexxy/gromacs.git] / docs / dev-manual / documentation-generation.rst
1 Documentation generation
2 ========================
3
4 Building the |Gromacs| documentation
5 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
7 For now, there are multiple components, formats and tools for the
8 |Gromacs| documentation, which is aimed primarily at version-specific
9 deployment of the complete documentation on the website and in the
10 release tarball.
11
12 This is quite complex, because the dependencies for building the
13 documentation must not get in the way of building the code
14 (particularly when cross-compiling), and yet the code must build and
15 run in order for some documentation to be generated. Also, man page
16 documentation (and command-line completions) must be built from the
17 wrapper binary, in order to be bundled into the tarball. This helps
18 ensure that the functionality and the documentation remain in sync.
19
20 The outputs of interest to most developers are generally produced in the
21 ``docs/html/`` subdirectory of the build tree.
22
23 You need to enable at least some of the following CMake options:
24
25 ``GMX_BUILD_MANUAL``
26   Option needed for trying to build the PDF reference manual
27   (requires LaTeX and ImageMagick). See :cmake:`GMX_BUILD_MANUAL`.
28 ``GMX_BUILD_HELP``
29   Option that controls 1) whether shell completions are built automatically,
30   and 2) whether built man pages are installed if available (the user still needs
31   to build the ``man`` target manually before installing). See
32   :cmake:`GMX_BUILD_HELP`.
33
34 Some documentation cannot be built when cross-compiling, as it
35 requires executing the ``gmx`` binary.
36
37 The following make targets are the most useful:
38
39 ``manual``
40   Builds the PDF reference manual.
41 ``man``
42   Makes man pages from the wrapper binary with Sphinx.
43 ``doxygen-all``
44   Makes the code documentation with Doxygen.
45 ``install-guide``
46   Makes the INSTALL file for the tarball with Sphinx.
47 ``webpage-sphinx``
48   Makes all the components of the |Gromacs| webpage that require Sphinx,
49   including install guide and user guide.
50 ``webpage``
51   Makes the complete |Gromacs| webpage, requires everything. When complete,
52   you can browse ``docs/html/index.html`` to find everything.
53
54   If built from a release tarball, the ``SOURCE_MD5SUM``,
55   ``SOURCE_TARBALL``, ``REGRESSIONTESTS_MD5SUM``, and
56   ``REGRESSIONTESTS_TARBALL`` CMake variables can be set to pass in
57   the md5sum values and names of those tarballs, for embedding into the
58   final deployment to the |Gromacs| website.
59
60 Needed build tools
61 ^^^^^^^^^^^^^^^^^^
62
63 The following tools are used in building parts of the documentation.
64
65 Doxygen
66   `Doxygen <http://www.doxygen.org>`_ is used to extract documentation from
67   source code comments.  Also some other overview
68   content is laid out by Doxygen from Markdown source files.  Currently, version
69   |EXPECTED_DOXYGEN_VERSION| is required for a warning-free build.  Thorough
70   explanation of the Doxygen setup and instructions for documenting the source
71   code can be found on a separate page: :doc:`doxygen`.
72
73 graphviz (dot)
74   The Doxygen documentation uses ``dot`` from `graphviz
75   <http://www.graphviz.org>`_ for building some graphs.  The tool is not
76   mandatory, but the Doxygen build will produce warnings if it is not
77   available, and the graphs are omitted from the documentation.
78
79 mscgen
80   The Doxygen documentation uses `mscgen
81   <http://www.mcternan.me.uk/mscgen/>`_ for building some graphs.  As with ``dot``,
82   the tool is not mandatory, but not having it available will result in warnings
83   and missing graphs.
84
85 Doxygen issue checker
86   Doxygen produces warnings about some incorrect uses and wrong
87   documentation, but there are many common mistakes that it does not detect.
88   |Gromacs| uses an additional, custom Python script to check for such issues.
89   This is most easily invoked through a ``check-source`` target in the build system.
90   The script also checks that documentation for a header matches its use in the
91   source code (e.g., that a header documented as internal to a module is not
92   actually used from outside the module).  These checks are run in Jenkins as
93   part of the Documentation job.  Details for the custom checker are on a
94   separate page (common for several checkers): :doc:`gmxtree`.
95
96 module dependency graphs
97   |Gromacs| uses a custom Python script to generate an annotated dependency
98   graph for the code, showing #include dependencies between modules.
99   The generated graph is embedded into the Doxygen documentation:
100   `Module dependency graph`__
101   This script shares most of its implementation with the custom checkers, and is
102   documented on the same page: :doc:`gmxtree`.
103
104 __ doxygen-page-modulegraph_
105
106 Sphinx
107   `Sphinx <http://sphinx-doc.org/>`_; at least version |EXPECTED_SPHINX_VERSION| is used
108   for building some parts of the documentation from reStructuredText
109   source files.
110
111 LaTeX
112   Also requires ImageMagick for converting graphics file formats.
113
114 linkchecker
115   `linkchecker <http://wummel.github.io/linkchecker/>`__ is used together with the
116   :file:`docs/linkcheckerrc` file to ensure
117   that all the links in the documentation can be resolved correctly.
118
119 documentation exported from source files
120   For man pages, HTML documentation of command-line options for executables,
121   and for shell completions, the ``gmx`` binary has explicit C++ code to export
122   the information required.  The build system provides targets that then invoke
123   the built ``gmx`` binary to produce these documentation items.  The generated
124   items are packaged into source tarballs so that this is not necessary when
125   building from a source distribution (since in general, it will not work in
126   cross-compilation scenarios).  To build and install these from a git
127   distribution, explicit action is required.
128   See `Doxygen documentation on the wrapper binary`__
129   for some additional details.
130
131 __ doxygen-page-wrapperbinary_
132
133 .. include:: /fragments/doxygen-links.rst