---
# System prepended metadata

title: Dependency Diagram Generator in Linux
tags: [coding, note]

---

# Dependency Diagram Generator in Linux
###### tags: `note` `coding`

## [Install Doxygen](http://www.doxygen.nl/download.html)
Before that, Install flex and bison:
```
sudo apt-get install flex bison
```

The last step `make install` should be done with `sudo`:
```
sudo make install
```
## Install Graphviz
```
sudo apt install graphviz
```

## [Get Started](http://www.doxygen.nl/manual/starting.html)
The following contents are extracted from the above link.

### Step 0: Documenting the Sources
>  依照 Doxygen 要求的方式在程式中 comment，若無仍然可以執行，參見下方 "without documentation"

Follow Step 3 in [this link](http://www.doxygen.nl/manual/starting.html).

### Step 1: Create a configuration file
```
doxygen -g <config-file>
```
If you omit the file name, a file named `Doxyfile` will be created. 

You can probably leave the values of most tags in a generated template configuration file to their default value. See section [Configuration](http://www.doxygen.nl/manual/config.html) for more details about the configuration file.

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 typical patterns is used for the types of files doxygen supports). 

==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/* 
```

#### Without Documentation
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. 

### Step 2: Run Doxygen
```
doxygen <config-file>
```
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`, `MAN_OUTPUT`, and `DOCBOOK_OUTPUT`. tags of the configuration file.

