The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Rule -- Stores information about a build rule

USAGE

  my $rule = new 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 FileInfo hierarchy.

$rule->execute($command_string)

   $handle = $rule->execute($command_string);

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->signature_method

  my $sig_method = $rule->signature_method;

Returns the signature method to use to determine whether this rule needs to be applied.

The default method is exact_match (see Signature::exact_match for details). However, if the name of the target is Makefile or Makefile.in, then the default method is target_newer. This is to allow legacy makefiles to work.

$rule->scan_action

  $rule->scan_action($action_string);

Scans the given actions, looking for additional dependencies (such as include files) or targets (such as .libs/xyz.lo) that weren't explicitly listed. Make variables in the action string have already been expanded.

Calls $rule->add_dependency for new dependencies, and $rule->add_target for new targets.

$rule->source

  $source_string = $rule->source;

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