Daniel Pfeiffer > makepp > Mpp::Rule

Download:
makepp-2.0.98.2.tgz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source   Latest Release: makepp-2.0.98.4

NAME ^

Rule -- Stores information about a build rule

USAGE ^

  my $rule = new Mpp::Rule "targets", "dependencies",
    "command"[, $makefile, $makefile_line];

DESCRIPTION ^

A rule object contains all the information necessary to make a specific file.

$makefile is a pointer to the structure returned by load_makefile. $makefile_line is an ASCII string that is used if an error message occurs while expanding variables in this rule.

This does not actually place the rule into the Mpp::File hierarchy.

get_tagname

   $real_tag = $rule->get_tagname($tag)

Returns a unique tag name for $tag. See "load_scaninfo".

Since a rule can have multiple commands with the same include tag, the requested tag might not match the actual tag that gets returned.

add_include_dir

   $rule->add_include_dir($real_tag, $dirname);

Add an include directory for scanner caching. See "load_scaninfo".

$dirname is a name relative to build_cwd.

add_include_suffix

   $rule->add_include_suffix($real_tag, $suffix);

Add an include suffix list for scanner caching. See "load_scaninfo".

add_meta_dependency

   $rule->add_meta_dependency($real_tag, $src, $name, $finfo);

Add an include file for scanner caching. Return value is TRUE iff the meta dependency failed to build. See "load_scaninfo".

$name is the requested name relative to the directory named by $src (relative to the build directory). If $real_tag is undef, then it is treated as a path including only ".". $src is ignored if $name is an absolute path or none of the directories in the include path are undefined. If $src is undef, then the build directory is used.

The return value is zero on success (including if the file could not be found), nonzero on build failure.

add_implicit_dependency

   $rule->add_implicit_dependency($real_tag, $src, $name, $finfo);

Add a dependency file for scanner caching. See "load_scaninfo".

This works just like add_meta_dependency, except that the rule doesn't have to be re-scanned by virtue of an implicit dependency being out of date.

add_implicit_target

   $rule->add_implicit_target($name);

Add a target file for scanner caching. See "load_scaninfo".

add_implicit_env_dependency

   $rule->add_implicit_env_dependency($name);

Add an environmental dependency for scanner caching. See "load_scaninfo".

set_signature_class

   $rule->set_signature_class($name, $implicit, $method)

Look up and cache the signature method. If $implicit don't replace a previously set one (when reading meta data). If $method is given, skip look up.

mark_scaninfo_uncacheable

   $rule->mark_scaninfo_uncacheable

Prohibit the rule from caching its scanner information. This is useful when the information gathered by one of the scanners that gets involved doesn't fit into the caching scheme, and that could cause build inaccuracies.

cache_scaninfo

   $rule->cache_scaninfo(\@targets);

Set build_info_string's for scanner caching for each of @targets. See "load_scaninfo".

Once transferred to the build_info cache, the information is deleted from $rule, in order to save memory.

load_scaninfo

   $rule->load_scaninfo($tinfo, $command_string, $explicit_dependencies);

Attempt to get all the scanned information about $rule from $tinfo's build info file. If this fails for whatever reason, including the scaninfo possibly being out of date, then the reason is returned, and $rule is left in its original state. This typically means that it must be re-scanned from scratch. Otherwise, 0 is returned.

$rule->execute($command_string, $all_targets, $all_dependencies)

   $handle = $rule->execute($command_string, $all_targets, $all_dependencies);

Executes the given command string, and returns a handle for the executing process (which may not have finished by the time we return). The command string may contain several shell commands separated by newlines.

This is part of the Rule class so the default execute routine can be overridden. You can replace the execute routine with any complicated operation you want, provided it returns the appropriate kind of handles.

$rule->print_command

Print out a command instead of executing it. This is used only when we are running with -n (dry run mode).

$rule->append($rule)

Add the targets and commands from another rule to this rule. This is used only when grokking double colon rules like this:

   clean::
       $(RM) *.o

   # Later in the makefile:
   clean::
       $(RM) y.tab.c y.tab.h

$rule->setup_environment()

Sets up the environment for the rule's makefile.

build_check_method

  $rule->build_check_method;

Gets the build check method for this particular rule.

set_build_check_method

  $rule->set_build_check_method(method);

Sets the build check method to be the given method.

$rule->signature_method

  my $sig_method = $rule->signature_method;

Returns the signature method to use to calculate signatures for files.

The default method is the file time + file size (see Mpp/Signature.pm for details).

$rule->lexer

  $rule->lexer()

Returns the rule lexer object, creating it if it doesn't already exist.

$rule->source

  $source_string = $rule->source;

Returns a description of where this rule was encountered, suitable for error messages.

syntax highlighting: