doxygen
is the main program that parses the sources and generates the documentation. See section Doxygen usage for more detailed usage information.
The executable doxytag
is only needed if you want to generate references to external documentation (i.e. documentation that was generated by doxygen) for which you do not have the sources. See section Doxytag usage for more detailed usage information.
Optionally, the executable doxywizard
can be used, which is a graphical front-end for editing the configuration file that is used by doxygen and for running doxygen in a graphical environment. For Mac OS X doxywizard will be started by clicking on the Doxygen application icon.
The following figure shows the relation between the tools and the flow of information between them (it looks complex but that's only because it tries to be complete):
Doxygen information flow
To simplify the creation of a configuration file, doxygen can create a template configuration file for you. To do this call doxygen
from the command line with the -g
option:
doxygen -g <config-file>
where <config-file> is the name of the configuration file. If you omit the file name, a file named Doxyfile
will be created. If a file with the name <config-file> already exists, doxygen will rename it to <config-file>.bak before generating the configuration template. If you use -
(i.e. the minus sign) as the file name then doxygen will try to read the configuration file from standard input (stdin
), which can be useful for scripting.
The configuration file has a format that is similar to that of a (simple) Makefile. It consists of a number of assignments (tags) of the form:
TAGNAME = VALUE
or
TAGNAME = VALUE1 VALUE2 ...
You can probably leave the values of most tags in a generated template configuration file to their default value. See section Configuration for more details about the configuration file.
If you do not wish to edit the config file with a text editor, you should have a look at doxywizard, which is a GUI front-end that can create, read and write doxygen configuration files, and allows setting configuration options by entering them via dialogs.
For a small project consisting of a few C and/or C++ source and header files, you can leave INPUT tag empty and doxygen will search for sources in the current directory.
If you have a larger project consisting of a source directory or tree you should assign the root directory or directories to the INPUT tag, and add one or more file patterns to the FILE_PATTERNS tag (for instance *.cpp *.h
). Only files that match one of the patterns will be parsed (if the patterns are omitted a list of source extensions is used). For recursive parsing of a source tree you must set the RECURSIVE tag to YES
. To further fine-tune the list of files that is parsed the EXCLUDE and EXCLUDE_PATTERNS tags can be used. To omit all test
directories from a source tree for instance, one could use:
EXCLUDE_PATTERNS = */test/*
Doxygen looks at the file's extension to determine how to parse a file. If a file has an .idl
or .odl
extension it is treated as an IDL file. If it has a .java
extension it is treated as a file written in Java. Files ending with .cs
are treated as C# files and the .py
extension selects the Python parser. Finally, files with the extensions .php
, .php4
, .inc
or .phtml
are treated as PHP sources. Any other extension is parsed as if it is a C/C++ file, where files that end with .m
are treated as Objective-C source files.
If you start using doxygen for an existing project (thus without any documentation that doxygen is aware of), you can still get an idea of what the structure is and how the documented result would look like. To do so, you must set the EXTRACT_ALL tag in the configuration file to YES
. Then, doxygen will pretend everything in your sources is documented. Please note that as a consequence warnings about undocumented members will not be generated as long as EXTRACT_ALL is set to YES
.
To analyse an existing piece of software it is useful to cross-reference a (documented) entity with its definition in the source files. Doxygen will generate such cross-references if you set the SOURCE_BROWSER tag to YES
. It can also include the sources directly into the documentation by setting INLINE_SOURCES to YES
(this can be handy for code reviews for instance).
doxygen <config-file>
Depending on your settings doxygen will create html
, rtf
, latex
, xml
and/or man
directories inside the output directory. As the names suggest these directories contain the generated documentation in HTML, RTF, , XML and Unix-Man page format.
The default output directory is the directory in which doxygen
is started. The root directory to which the output is written can be changed using the OUTPUT_DIRECTORY. The format specific directory within the output directory can be selected using the HTML_OUTPUT, RTF_OUTPUT, LATEX_OUTPUT, XML_OUTPUT, and MAN_OUTPUT tags of the configuration file. If the output directory does not exist, doxygen
will try to create it for you (but it will not try to create a whole path recursively, like mkdir -p
does).
index.html
file in the html
directory. For the best results a browser that supports cascading style sheets (CSS) should be used (I'm using Mozilla, Safari, Konqueror, and sometimes IE6 to test the generated output).Some of the features the HTML section (such as GENERATE_TREEVIEW) require a browser that supports DHTML and Javascript.
If you plan to use the search engine (see SEARCHENGINE), you should view the HTML output via a PHP-enabled web server (e.g. apache with the PHP module installed).
doxygen
writes a Makefile
into the latex
directory.
The contents and targets in the Makefile
depend on the setting of USE_PDFLATEX. If it is disabled (set to NO
), then typing make
in the latex
directory a dvi file called refman.dvi
will be generated. This file can then be viewed using xdvi
or converted into a PostScript file refman.ps
by typing make ps
(this requires dvips
).
To put 2 pages on one physical page use make ps_2on1
instead. The resulting PostScript file can be send to a PostScript printer. If you do not have a PostScript printer, you can try to use ghostscript to convert PostScript into something your printer understands.
Conversion to PDF is also possible if you have installed the ghostscript interpreter; just type make pdf
(or make pdf_2on1
).
To get the best results for PDF output you should set the PDF_HYPERLINKS and USE_PDFLATEX tags to YES
. In this case the Makefile
will only contain a target to build refman.pdf
directly.
A file called combine.xslt XSLT script is also generated and can be used to combine all XML files into a single file.
Doxygen also generates two XML schema files index.xsd (for the index file) and compound.xsd (for the compound files). This schema file describes the possible elements, their attributes and how they are structured, i.e. it the describes the grammar of the XML files and can be used for validation or to steer XSLT scripts.
In the addon/doxmlparser directory you can find a parser library for reading the XML output produced by doxygen in an incremental way (see addon/doxmlparser/include/doxmlintf.h for the interface of the library)
man
program. You do need to make sure the man directory is in the man path (see the MANPATH
environment variable). Note that there are some limitations to the capabilities of the man page format, so some information (like class diagrams, cross references and formulas) will be lost.
If the EXTRACT_ALL option is set to NO
in the configuration file (the default), then doxygen will only generate documentation for documented members, files, classes and namespaces. So how do you document these? For members, classes and namespaces there are basically two options:
The text inside a special documentation block is parsed before it is written to the HTML and/or output files.
During parsing the following steps take place:
*
) and then optionally more whitespace, then all whitespace and asterisks are removed.