NAME

GraphViz::Makefile - Create Makefile graphs using GraphViz

SYNOPSIS

Output to a .png file:

use GraphViz::Makefile;
my $gm = GraphViz::Makefile->new(undef, "Makefile");
my $g = GraphViz2->new(global => {combine_node_and_port => 0, directed => 1});
$g->from_graph(GraphViz::Makefile::graphvizify($gm->generate_graph));
$g->run(format => "png", output_file => "makefile.png");

To output to a .ps file, just replace png with ps in the filename and method above.

Or, using the deprecated mutation style:

use GraphViz::Makefile;
my $gm = GraphViz::Makefile->new(undef, "Makefile");
$gm->generate;
$gm->GraphViz->run(format => "png", output_file => "makefile.png");

DESCRIPTION

GraphViz::Makefile uses the GraphViz2 and Make modules to visualize Makefile dependencies.

METHODS

new($graphviz, $makefile, $prefix, %args)

Create a GraphViz::Makefile object. The first argument should be a GraphViz2 object or undef. The second argument should be a Make object, the filename of a Makefile, or undef. In the latter case, the default Makefile is used. The third argument $prefix is optional and can be used to prepend a prefix to all rule names in the graph output.

The created nodes are named $prefix$name.

Further arguments (specified as key-value pairs): none at present.

generate

Generate the graph. Mutates the internal GraphViz2 object.

generate_graph
my $gm = GraphViz::Makefile->new(undef, "Makefile");
my $graph = $gm->generate_graph;
$gv->from_graph(GraphViz::Makefile::graphvizify($graph));
$gv->run(format => "png", output_file => "makefile.png");

Return a Graph object representing this Makefile.

GraphViz

Return a reference to the GraphViz2 object. This object will be used for the output methods. Will only be created if used. It is recommended to instead use the generate_graph method and make the calls on an externally-controlled GraphViz2 object.

Make

Return a reference to the Make object.

FUNCTIONS

graphviz_escape

Turn characters in the given string, that are considered special by GraphViz, into escaped versions so that they will appear literally as given in the visualisation.

graphvizify

my $gv_graph = GraphViz::Makefile::graphvizify($make_graph);

Given a Graph object representing a makefile, creates a new object to visualise it using "from_graph" in GraphViz2.

ALTERNATIVES

There's another module doing the same thing: Makefile::GraphViz.

AUTHOR

Slaven Rezic <srezic@cpan.org>

COPYRIGHT

Copyright (c) 2002,2003,2005,2008,2013 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

GraphViz2, Make, make(1), tkgvizmakefile.