=head1 NAME

makeppreplay -- Fast repeater of selected makepp actions

=for vc $Id: makeppreplay.pod,v 1.11 2012/12/27 23:10:05 pfeiffer Exp $

=head1 DESCRIPTION

=for genindex '[-$][-?\w]+' makeppreplay.pod

B<?:>E<nbsp>L<-?|/_>,E<nbsp>
B<A:>E<nbsp>L<-A|/a_filename>,
  L<--args-file|/a_filename>,
  L<--arguments-file|/a_filename>,E<nbsp>
B<C:>E<nbsp>L<-C|/c_directory>,
  L<-c|/c>,E<nbsp>
B<D:>E<nbsp>L<--directory|/c_directory>,
  L<--dry-run|/n>,E<nbsp>
B<H:>E<nbsp>L<-h|/_>,
  L<--help|/_>,E<nbsp>
B<I:>E<nbsp>L<-I|/i_directory>,
  L<--include|/i_directory>,
  L<--include-dir|/i_directory>,E<nbsp>
B<J:>E<nbsp>L<--just-print|/n>,E<nbsp>
B<K:>E<nbsp>L<-k|/k>,
  L<--keep-going|/k>,E<nbsp>
B<L:>E<nbsp>L<--log|/log_logfilename>,
  L<--log-file|/log_logfilename>,E<nbsp>
B<M:>E<nbsp>L<-M|/m_module_arg>,
  L<$MAKEPPREPLAYFLAGS|/_makeppreplayflags>,
  L<--module|/m_module_arg>,E<nbsp>
B<N:>E<nbsp>L<-n|/n>,
  L<--no-log|/no_log>,
  L<--no-print-directory|/no_print_directory>,
  L<--no-warn|/no_warn>,E<nbsp>
B<P:>E<nbsp>L<--profile|/profile>,E<nbsp>
B<R:>E<nbsp>L<--recon|/n>,
  L<--root-dir|/c>,
  L<--root-directory|/c>,E<nbsp>
B<S:>E<nbsp>L<-s|/s_perl_expression>,
  L<--sed|/s_perl_expression>,E<nbsp>
B<T:>E<nbsp>L<-t|/t>,
  L<--temporary|/t>,E<nbsp>
B<V:>E<nbsp>L<-V|/v>,
  L<--version|/v>

B<makeppreplay> S<[ I<option> ... ]> S<[ I<VAR=value> ]> S<[ I<target> ... ]>

B<mppr> S<[ I<option> ... ]> S<[ I<VAR=value> ]> S<[ I<target> ... ]>

Makeppreplay tries to do the same things makepp did.  It does this solely
based on the remembered build info, saving much time by not reading makefiles,
not parsing commands, not scanning files and not looking at every repository
file, to see whether it fits.  But unlike makepp it reuses all repository
links it finds.

It does not know about phony or default targets, so you have to give it real
files or directories, as a shortcut for all files makepp has built therein.
By default it builds all files makepp built in the current or chosen directory.

This approach is only correct when there are no structural changes, i.e. no
different modules to be linked, no moved files, no different C<#include>
statements, which should possibly have caused those files to be (re)built.
After updating from version control, or when building against a repository,
where others may have caused such changes, you should call makepp once after
potential changes (e.g. in the morning after an overnight repository update),
to be sure your build infos are up to date.

Not reading makefiles means, it will not know any subs (Perl functions)
defined in them.  For this you should put all your functions into an external
module.  It will also not know about any variable settings, which is only a
problem if your Perl code accesses them (because in rule actions they have
already been expanded).

=head1 TODO

This is still experimental and imperfect.

=over

=item *

Build up a complete dependency tree starting from the given targets and decide
which of them to build based on their build check methods.  That requires the
method to be remembered in the build info.

=item *

After implementing the previous bullet item, accept more makepp opts, like C<-j>
or C<--dont-build>.

=item *

Allow build cache with implicit C<--no-populate-bc> (because makeppreplay
doesn't guarantee a correct build).  Makepp might later publish to the build
cache anything it retains.

=item *

Have makepp remember build info for all failed commands and for those it
didn't attempt because their dependencies failed.  This is only partially
possible, because dependencies may only be found out after building the files
that require them.  What should happen with (a has no build info):

    a: b
    b: c
	cmd_producing_a_and_b

=back

=head1 OPTIONS

Options include some of the makepp options, plus two new ones, for loading
modules that would normally be loaded from a makefile.

=over 4

=item -A I<filename>

=item --args-file=I<filename>

=item --arguments-file=I<filename>

Read the file and parse it as possibly quoted whitespace- and/or newline-separated options.

=item -C I<directory>

=item --directory=I<directory>

Cd to the given directory before loading the makefile and trying to build the
targets.  This is more or less equivalent to specifying a directory with
C<-F>, except that subsequent C<-C>, C<-f>, C<-F>, C<-I> and C<-R> options are
interpreted relative to the new directory, rather than the old one.

=item -c

=item --root-dir

=item --root-directory

Cd up to the directory containing a RootMakeppfile.

=item -I I<directory>

=item --include=I<directory>

=item --include-dir=I<directory>

Add I<directory> to Perl load path C<@INC>.

=item -?

=item -h

=item --help

Print out a brief summary of the options.

=item -k

=item --keep-going

Build as many files as possible, even if some of them have errors.  By
default, makepp stops when it encounters the first error, even if there
are other files that need to be built that don't depend on the erroneous
file.

=item --log=I<logfilename>

=item --log-file=I<logfilename>

Changes the name of the log file to the indicated name.  By default, the log
file is called F<.makepp/log>.  This file is readable with L<makepplog,
mppl|makepplog>.

=item -M I<module[=arg,...]>

=item --module=I<module[=arg,...]>

Load module and import any functions it exports.

=item -n

=item --dry-run

=item --just-print

=item --recon

Print out commands without actually executing them.

=item --no-log

Don't bother writing a detailed description of what was done to the log file.

=item --no-print-directory

Turn off the entering or leaving directory messages.

=item --profile

Output raw timestamps before and after each action.

=item -s I<perl-expression>

=item --sed=I<perl-expression>

Run the perl expression against the command before running it, like for
preprocessor C<-s 's/ -c / -E /; s/\.o\b/.i/g'>.  This would transform a
compilation command (C<-c>) into a preprocessor (C<-E>) invocation, changing
the F<.o> suffix to F<.i>, which is a conventional suffix for preprocessed C.
Or you might want to add some debug output to your linker.  If you have only
one command in the rule, you can do this by substituting it into the first
space: C<-s 's/ / -Wl,-t /'>.

When the command is altered, nothing is remembered about this, i.e. makepp
will think you have manually modified the file, causing a rebuild.

Note that (unlike makepp) makeppreplay does not parse the command, so it won't
notice that the target filename was changed.  So you must still request the
F<.o> target, even though a F<.i> will be built.  And makeppclean won't know
to remove it.

=item -t

=item --temporary

Makeppreplay modifies the build info of all files it touched and of all
dependencies it found modified.  It marks them in such a way that makepp
nevertheless knows that it needs to rescan these files.  But with this option
you can prevent these modifications, so that makepp will simply consider all
files makeppreplay created as incorrect.

=item -V

=item --version

Print out the version number.

=item --no-warn

Don't print any warning messages.

=back

=head1 EXAMPLES

Probably the most common use is relinking either a program or a library after
editing a source file:

    makeppreplay subdir/foo.o bin/bar
    mppr subdir/foo.o lib/libbar.so

=head1 ENVIRONMENT

Makeppreplay looks at the following environment variable:

=over

=item $MAKEPPREPLAYFLAGS

Any options you may want to always pass.

=back

=head1 AUTHOR

Daniel Pfeiffer (occitan@esperanto.org)
