NAME

Makefile::GraphViz - Draw building flowcharts from Makefiles using GraphViz

Table of Contents

VERSION

This document describes Makefile::GraphViz 0.21 released on 7 December 2014.

SYNOPSIS

use Makefile::GraphViz;

$parser = Makefile::GraphViz->new;
$parser->parse('Makefile');

# plot the tree rooted at the 'install' goal in Makefile:
$gv = $parser->plot('install');  # A GraphViz object returned.
$gv->as_png('install.png');

# plot the tree rooted at the 'default' goal in Makefile:
$gv = $parser->plot;
$gv->as_png('default.png');

# plot the forest consists of all the goals in Makefile:
$gv = $parser->plot_all;
$gv->as_png('default.png');

# you can also invoke all the methods
# inherited from the Makefile::Parser class:
@targets = $parser->targets;

DESCRIPTION

This module uses Makefile::Parser to render user's Makefiles via the amazing GraphViz module. Before I decided to write this thing, there had been already a CPAN module named GraphViz::Makefile which did the same thing. However, the pictures generated by GraphViz::Makefile is oversimplified in my opinion, so a much complex one is still needed.

For everyday use, the gvmake utility is much more convenient than using this module directly. :)

WARNING This module is highly experimental and is currently at alpha stage, so production use is strongly discouraged right now. Anyway, I have the plan to improve this stuff unfailingly.

For instance, the following makefile

all: foo
all: bar
        echo hallo

any: foo hiya
        echo larry
        echo howdy
any: blah blow

foo:: blah boo
        echo Hi
foo:: howdy buz
        echo Hey

produces the following image via the plot_all method:

PNG IMAGE

<p><img src="http://agentzh.org/misc/multi.png" border=0 alt="image hosted by agentzh.org"/></p>
<p>Image hosted by <a href="http://agentzh.org">agentzh.org</a></p>

Back to TOC

SAMPLE PICTURES

Browse http://search.cpan.org/src/AGENT/Makefile-GraphViz-0.16/samples.html for some sample output graphs.

Back to TOC

INSTALLATION

Prerequisites GraphViz and Makefile::Parser should be installed to your Perl distribution first. Among other things, the GraphViz module needs tools "dot", "neato", "twopi", "circo" and "fdp" from the Graphviz project (http://www.graphviz.org/ or http://www.research.att.com/sw/tools/graphviz/). Hence you have to download an executable package of AT&T's Graphviz for your platform or build it from source code yourself.

Back to TOC

The Makefile::GraphViz Class

This class is a subclass inherited from Makefile::Parser. So all the methods (and hence all the functionalities) provided by Makefile::Parser are accessible here. Additionally this class also provides some more methods on its own right.

Back to TOC

METHODS

Back to TOC

INTERNAL FUNCTIONS

Internal functions should not be used directly.

Back to TOC

TODO

Back to TOC

CODE COVERAGE

I use Devel::Cover to test the code coverage of my tests, below is the Devel::Cover report on this module test suite.

---------------------------- ------ ------ ------ ------ ------ ------ ------
File                           stmt   bran   cond    sub    pod   time  total
---------------------------- ------ ------ ------ ------ ------ ------ ------
.../lib/Makefile/GraphViz.pm  100.0   93.2   71.4  100.0  100.0   61.5   92.1
---------------------------- ------ ------ ------ ------ ------ ------ ------

Back to TOC

SOURCE CONTROL

For the very latest version of this module, check out the source from the Git repository below:

https://github.com/agentzh/makefile-graphviz-pm

There is anonymous access to all. If you'd like a commit bit, please let me know. :)

Back to TOC

BUGS

Please report bugs or send wish-list to https://github.com/agentzh/makefile-graphviz-pm/issues.

Back to TOC

SEE ALSO

gvmake, GraphViz, Makefile::Parser.

Back to TOC

AUTHOR

Yichun "agentzh" Zhang (章亦春) <agentzh@gmail.com>

Back to TOC

COPYRIGHT AND LICENSE

Copyright (c) 2005-2014 by Yichun "agentzh" Zhang (章亦春).

This module is licensed under the terms of the BSD license.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Back to TOC