1. Installing Doxygen
Currently the latest version of the Doxygen is doxygen1.8.13, the installation package can be downloaded on the official website, the URL is:http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc .
When downloading from the official website, The first download is doxygen-1.8.13.src.tar.gz this installation package, found that only one installation, no executable configure files and makefile files, need to download another installation package DOXYGEN-1.8.13.LINUX.BIN.TAR.G Z. In the Chinese version of the Linux operating system after downloading the default exists in the "Downloads" folder, the English version of the Linux operating system after downloading the default "Downloads" folder.
When the download is complete, open the termianal input command:
(1) CD download
(2) Tar Xvfz doxygen-1.8.13.src.tar.gz
(3) Tar Xvfz doxygen-1.8.13.linux.bin.tar.gz
(4) CD doxygen-1.8.13
(5)./configure
(6) sudo make
(7) sudo make install
You will encounter some problems when installing, as shown in:
Unable to get the file status of ' Bin/doxytag ', we can first look at the makefile file and the Bin folder, and find that the file in the Makefile File Bin folder does not have.
If you want to install Doxygen correctly, you will need to modify the makefile file. Using the VIM Makefile command to open the makefile file, modify the makefile file according to the files in the bin folder such as:
Then use the command sudo make install installation.
2. Configuring the Doxygen Working environment
Go to project directory (test for example) CD test/
Build configuration file Doxygen–g
The default generated profile name is "Doxyfile", or you can specify the generated profile name in the "doxygen-g your-cfg-filename" command format. If there is no special need, the default configuration file name can be used.
Doxyfile file content is very much, about 1000 lines, but about 4/5 of them are comments, each configuration option has a detailed comment. In the future, if you have some understanding of the meaning of the Doxygen configuration options, you can add the "-S" option to the command that generates the configuration file, creating a profile without annotations, as follows:
$ doxygen–s-g
3. Appropriate settings for the configuration file
Next you need to open this Doxygen document, configure some of these fields, in general, only need to configure more than 10 of these fields can be:
# project name, which will be used as the first page title of the generated program document
project_name = "Test"
# Document version number, which corresponds to the project version number, such as SVN, CVS generated project version number
project_number = "1.0.0"
# Program Document Output Directory
output_directory = doc/
# Program Documentation Language environment
output_language = Chinese
# If you are making a C program document, this option must be set to YES, otherwise the C + + document format will be generated by default
optimize_output_for_c = YES
# for data types that use typedef-defined structures, enumerations, unions, and so on, only document the type names defined by typedef
typedef_hides_struct = YES
# in a C + + program document, this value can be set to no, whereas in the C program document, because C does not have the so-called domain/namespace concept, it is set to YES here
hide_scope_names = YES
# let Doxygen silently generate a document for you, only in the event of a warning or error, the terminal output prompt information
QUIET = YES
# Document information in the header File Generator documentation
File_patterns = *.h
# recursively traverse the subdirectory of the current directory to find the documented program source file
RECURSIVE = YES
# Sample Program Directory
Example_path = example/
# The header document (. h file) of the sample program and the implementation document (. c file) are documented objects as programs
Example_patterns = *.c *.h
# recursively traverse the subdirectory of the sample program directory to find the document source file
example_recursive = YES
# Allow program documents to display this documented function to call relationships
Referenced_by_relation = YES
References_relation = YES
References_link_source = YES
# do not generate a Latex-formatted program document
Generate_latex = NO
# allows the function call relationship to be displayed as a legend in the program documentation, provided you have installed the Graphviz package
Have_dot = YES
Call_graph = YES
Caller_graph = YES
# get Doxygen to search all subdirectories and source files recursively, starting from the same folder as the configuration file
RECURSIVE = YES
# in the last generated document, include all the source code in it
SOURCE BROWSER = YES
$ this adds a sidebar to the HTML document, and displays the relationships of packages, classes, interfaces, and so on in a tree-like structure
GENERATE TREEVIEW = All
4. Documentation of the program source code
After Doxygen's working environment is ready, if you want to use Doxygen, you must use the Doxygen required annotation rules in the source comments, otherwise doxygen is not recognized.
The annotation types of doxygen can be divided into:
(1) Row type: Note statement does not appear in the same line with the program source code, mainly for the comment header file appears in the structure (struct), enumeration (enum), Union (uion) and other data types, as well as the function of the program interface and the use of conventions, as follows:
/**
* This is an example of an doxygen approved inline annotation tag
*/
(2) in-line comment: The comment statement and the program source code appear in the same line, mainly for the local comments of the codes. As shown in the Doxygen approved inline comment tag.
struct job{
pthread_t Tid; Thread ID
Job Next; Next linked list node
Int Val; Node value
}
5. Program Documentation Generation
If you are using the "doxygen-g" generated profile doxyfile, you can generate the program documentation by entering Doxygen directly in the terminal, and the document is stored in the Doc folder you just set up.
Installation and use of Linux Doxygen