NAME

Makefile -- an object that parses makefiles and stores their relevant info

USAGE

$makefile = Makefile::load("filename_or_dir_nae");
$makefile = Makefile::load($fileinfo_or_dirinfo);

$makefile->expand_string("$(STRING) $(WITH) $(MAKE) $(VARIABLES) $(OR FUNCTIONS)");
$makefilename = $makefile->name("dir");

DESCRIPTION

The Makefile package is responsible for parsing a makefile, and subsequently for holding all relevant information from the makefile, such as variable definitions.

A new Makefile class may be created at any time, whenever you discover that it is available. The Makefile constructor parses the makefile, and integrates all of its rules into the makepp's memory database.

expand_text("string", $makefile_line)

  my $expanded_string = $makefile->expand_text("string with make variables",
			                       $makefile_line);

Expands all the make variables and expressions in the text and returns the result. If an error occurs, die's with the error message prefixed by $makefile_line.

load("makefile", $default_dir, $command_line_vars, $makecmdgoals, $include_path, $environment)

Makes a new makefile object. The argument is the makefile to load, or else a directory that may contain the makefile. Exits with die if no such makefile exists, or if there is a fatal parse error. Otherwise, returns the Makefile object.

If you do not specify the default directory, then directory containing the makefile is assumed.

If the makefile has already been loaded, then this does not reload the makefile; it returns the old makefile object.

$command_line_vars is a reference to a hash containing the names and values of all variables which were specified on the command line.

$makecmdgoals is the value of $(MAKECMDGOALS) for this makefile.

include_path is an array of FileInfo structures for directories that the include statement should search.

$environment is a hash containing the environment for this particular makefile.

If there is a target in the Makefile for the Makefile itself, the makefile is remade and then reread. Makefile::load does not return until the makefile has been rebuilt.