gov.llnl.babel.backend

Class DependenciesGenerator

Implemented Interfaces:
BuildGenerator, ContextAware, FileListener

public class DependenciesGenerator
extends java.lang.Object
implements FileListener, BuildGenerator, ContextAware

This class is used to generate makefiles but may be amenable to extension to other types of build files. gets the database of generated files from the FileManager. It then create makefiles
See Also:
FileManager

Constructor Summary

DependenciesGenerator()

Method Summary

void
createAll()
Create all Makefiles in all the directories registered with the FileManager.
void
createMakefileInDirectory(String dependfilename, String dirname)
Create a single makefile in a specific directory.
protected String
defaultDependencyFilename()
Return the default file name.
protected String
defaultFilename()
Return the default file name.
protected String
defaultPackageDependencyFilename()
Set
getLanguages()
void
newFile(SymbolID id, int type, String role, String dir, String name)
This method is called for each file created by the FileManager.
void
setContext(Context context)
protected void
writeMakefile(PrintWriter pw, Map role2files, HashMap fileData)
Generate the actual make file.

Constructor Details

DependenciesGenerator

public DependenciesGenerator()

Method Details

createAll

public void createAll()
            throws IOException
Create all Makefiles in all the directories registered with the FileManager.
Specified by:
createAll in interface BuildGenerator
See Also:
FileManager

createMakefileInDirectory

public void createMakefileInDirectory(String dependfilename,
                                      String dirname)
            throws IOException
Create a single makefile in a specific directory. This will do nothing if there are no files defined in that directory according to the FileManager class.
Parameters:
dependfilename - set makefile name, if null or "", defaults to <make-prefix> + "babel.make"
dirname - directory to look for

defaultDependencyFilename

protected String defaultDependencyFilename()
Return the default file name. This method can be overridden in derived classes if a different default name is preferred.
Returns:
value of the make file name

defaultFilename

protected String defaultFilename()
Return the default file name. This method can be overridden in derived classes if a different default name is preferred.
Returns:
value of the make file name

defaultPackageDependencyFilename

protected String defaultPackageDependencyFilename()

getLanguages

public Set getLanguages()
Specified by:
getLanguages in interface BuildGenerator

newFile

public void newFile(SymbolID id,
                    int type,
                    String role,
                    String dir,
                    String name)
This method is called for each file created by the FileManager.
Specified by:
newFile in interface FileListener

setContext

public void setContext(Context context)
Specified by:
setContext in interface ContextAware

writeMakefile

protected void writeMakefile(PrintWriter pw,
                             Map role2files,
                             HashMap fileData)
Generate the actual make file. This method can be overridden for tools other than make provided that whatever files are generated exist in the same directory as the sourcecode.
Parameters: