NAME

Makefile::Parser - A simple Parser for Makefiles

SYNOPSIS

use Makefile::Parser;

# Equivalent to "->new('Makefile');"
$mk = Makefile::Parser->new or
    die Makefile::Parser->error;

# Get last value assigned to the specified variable 'CC':
print $mk->var('CC');

$tar = $mk->target('install');
# Get the name of the target, say, 'install' here:
print $tar->name;

# Get the dependencies for the target 'install':
@depends = $tar->depends;

# The first element of @depends itself is also a target:
$tar = $depends[0]->name;

# Access the shell command used to build the current target.
$cmd = $tar->cmd;

# Parse another file using the same Parser object:
$mk->parse('Makefile.old');

# Get the target who is specified by variable EXE_FILE
my $tar = $mk->target($mk->var('EXE_FILE'));

DESCRIPTION

This is a parser for Makefiles. At this very early stage, the parser only support a very limited set of features, so it may not do what you expected it to do. Currently its main purpose is to provide basic support for another module named GraphViz::Make, which is aimed to render the buiding processes specified by a Makefile using the amazing GraphViz library. The Make module is not satisfactory for this purpose, so I decided to build one of my own.

I have a plan to improve this parser constantly.

EXPORT

None by default.

SEE ALSO

GraphViz::Make, Make.

AUTHOR

Agent Zhang, <agent2002@126.com>

COPYRIGHT AND LICENSE

Copyright (C) 2005 Agent Zhang.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.