The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Document::Maker - Makefile-like functionality in Perl

VERSION

Version 0.022

SYNOPSIS

    my $maker = Document::Maker->new;

    $maker->parser->parse_target( "tgt/a.out" => "src/defs.txt", 
        do => sub {
            my $target = shift;
            my $file = shift; # tgt/a.out
            ....
        },
    );

    $maker->make("tgt/a.out"); # Will only make if "tgt/a.out" is older than "src/defs.txt" or doesn't exist

DESCRIPTION

Document::Maker is intended to have similar functionality as GNU make with additional enhancements.

WARNING: Although this is a 3rd-iteration attempt at Makefile-ness, the API is very fluid and could change in future versions.

WARNING: There may be bugs lurking about, I'll be happy to entertain bug reports.

Already working

Target-from-one-source

    $maker->parser->parse_target( "tgt/a.out" => "src/defs.txt", 
        do => sub {
            my $target = shift;
            my $file = shift; # tgt/a.out
            ....
        },
    );

Target-from-many-sources

    $maker->parser->parse_target( "tgt/a.out" => [ "src/defs.txt", "src/xyzzy.txt" ], 
        do => sub {
            my $target = shift;
            my $file = shift; # tgt/a.out
            ....
        },
    );

Many-targets-dependent-on-many-sources

    $maker->parser->parse_target( [ "tgt/a.out", "tgt/b.out" ] => [ "src/defs.txt", "src/xyzzy.txt" ], 
        do => sub {
            my $target = shift;
            my $file = shift;
            ....
        },
    );

Non-file, Target-only

    $maker->parser->parse_simple_target( "configure",
        do => sub {
            my $target = shift; # No second argument
            ....
        },
    );

Target/source-patterns

    $maker->parser->parse_pattern_target(qw( tgt/%.html src/%.in a b c d e ), [ "header.html" ], { 
        do => sub {
            my $target = shift;
            my $file = shift; # tgt/a.html, tgt/b.html, etc.
            my $source_file = shift; # src/a.in, src/b.in, etc.
            ....
        },
    });

Target/source-patterns based on crawling through a directory

    # This will crawl src/ looking for every file matching the src pattern and making a target out of it
    $maker->parser->parse_pattern_target(qw( tgt/%.html src/%.in src/* ), [ "header.html" ], { 
        do => sub {
            my $target = shift;
            my $file = shift;
            my $source_file = shift;
            ....
        },
    });

Waiting to be implemented

.PHONY targets (always_make flag, sort-of implemented via simple targets)

Control of intermediate targets/sources

Better control of make conditions (should_make parameter)

Shell-like "do" arguments, similar to a real Makefile

For example, something like:

        $maker->parser->parse...(..., do => \<<_END_);
    @echo "Using m4 first before getting a line count"
    m4 < main.m4 $< | wc -l > $@
    _END_

Consistent handling of make failures/stale files

Last-chance wildcard targets

Document and test advanced patterns (embedded regexp, etc.)

AUTHOR

Robert Krimen, <rkrimen at cpan.org>

BUGS

Please report any bugs or feature requests to bug-document-maker at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Document-Maker. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Document::Maker

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2007 Robert Krimen, all rights reserved.

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