Gary Holt > makepp-1.19 > FileInfo_makepp.pm

Download:
makepp-1.19.tar.gz

Annotate this POD

CPAN RT

New  3
Open  1
View/Report Bugs
Source  

build_info_string

  my $string = $finfo->build_info_string("key");

Returns information about this file which was saved on the last build. This information is stored in a separate file, and is automatically invalidated if the file it refers to has changed. It is intended for remembering things like the command used to build the file when it was last built, or the signatures of the dependencies.

See also: set_build_info_string

get_rule

  my $rule = $finfo->get_rule;

Returns the rule to build the file, if there is one, or undef if there is none.

If an argument is present, get_rule tries harder to find a rule. If there is no rule currently available but no makefile has been read from that directory, then it attempts to load a makefile from that directory.

exists_or_can_be_built

  if ($finfo->exists_or_can_be_built) { ... }

Returns true (actually, returns the FileInfo structure) if the file exists and is readable, or does not yet exist but can be built. This function determines whether a file exists by checking the build signature, not by actually looking in the file system, so if you set up a signature function that can return a valid build signature for a pseudofile (like a dataset inside an HDF file or a member of an archive) then this function will return true.

If this is not what you want, then consider the function file_exists(), which looks in the file system to see whether the file exists or not.

flush_build_info

  clean_fileinfos($dirinfo)

Discards all the build information for all files in the given directory after making sure they've been written out to disk. Also discards all FileInfos for files which we haven't tried to build and don't have a build rule.

move_or_link_target

  $status = $finfo->move_or_link_target($repository_file);

Links a file in from a repository or variant build cache into the current directory.

Returns 0 if successful, nonzero if something went wrong.

name

  $string = $finfo->name;
  $string = $finfo->name($cwd);

Returns the name of the file. With no extra argument, returns the absolute filename; with the argument, returns the filename relative to that directory.

set_additional_dependencies

  $finfo->set_additional_dependencies($dependency_string, $makefile, $makefile_line);

Indicates that the list of objects in $dependency_string are extra dependencies of the file. These dependencies are appended to the list of dependencies from the rule to build the file. $makefile and $makefile_line are used only when we have to expand the list of dependencies. We can't do this until we actually need to make the file, because we might not be able to expand wildcards or other things properly.

set_build_info_string

  $finfo->set_build_info_string($key, $value, $key, $value, ...);

Sets the build info string for the given key(s). This can be read back in later or on a subsequent build by build_info_string().

You should call update_build_infos() to flush the build information to disk, or else it will never be stored. It's a good idea to call update_build_infos() fairly frequently, so that nothing is lost in the case of a machine crash or someone killing your program.

set_rule

  $finfo->set_rule($rule);

Sets a rule for building the specified file. If there is already a rule, which rule overrides is determined by the following procedure:

  1. A rule that recursively invokes make never overrides any other rule. This is a hack necessary to deal with some legacy makefiles which have rules for targets that actually invoke the proper rule in some other makefile, something which is no longer necessary with makepp.
  2. If either rule is an explicit rule, and not a pattern rule or a backward inference rule, then the explicit rule is used. If both rules are explicit rules, then this is an error.

    Note that a pattern rule which is specified like this:

      %.o: %.c : foreach abc.c def.c ghi.c

    where no wildcards are involved is treated as an explicit rule for abc.o, def.o, and ghi.o.

  3. A pattern rule overrides a backward inference rule. (This should never happen, since backward inference rules should only be generated if no pattern rule exists.)
  4. A pattern rule from a "nearer" makefile overrides one from a "farther" makefile. Nearness is determined by the length of the relative file name of the target compared to the makefile's cwd.
  5. A pattern rule seen later overrides one seen earlier. Thus more specific pattern rules should be placed after the more general pattern rules.
  6. A builtin rule is always overridden by any other kind of rule, and never overrides anything.

signature

   $str = $fileinfo->signature;

Returns the signature of this file. The signature is usually the file time, but users can change it to be anything they want.

Returns undef if the file doesn't exist.

update_build_infos

  FileInfo::update_build_infos();

Flushes our cache of build information to disk. You should call this fairly frequently, or else if the machine crashes or some other bad thing happens, some build information may be lost.

syntax highlighting: