-Add a new module type 'cabinet' to handle .cab files generation
[reactos.git] / reactos / tools / rbuild / rbuild.h
index 04d4afb..1b6adba 100644 (file)
 #endif/*WIN32*/
 #endif/*_MSC_VER*/
 
+#include <infhost.h>
+
 #include "ssprintf.h"
 #include "exception.h"
-#include "XML.h"
+#include "xml.h"
+
+class Backend; // forward declaration
 
 typedef std::vector<std::string> string_list;
 
+extern std::string ExePrefix;
+extern std::string ExePostfix;
+extern std::string sSep;
+extern std::string sBadSep;
+extern char cSep;
+extern char cBadSep;
+
 #ifdef WIN32
-#define EXEPREFIX ""
-#define EXEPOSTFIX ".exe"
-#define CSEP '\\'
-#define CBAD_SEP '/'
-#define SSEP "\\"
-#define SBAD_SEP "/"
+#define DEF_EXEPREFIX ""
+#define DEF_EXEPOSTFIX ".exe"
+#define DEF_CSEP '\\'
+#define DEF_CBAD_SEP '/'
+#define DEF_SSEP "\\"
+#define DEF_SBAD_SEP "/"
 #else
-#define EXEPREFIX "./"
-#define EXEPOSTFIX ""
-#define CSEP '/'
-#define CBAD_SEP '\\'
-#define SSEP "/"
-#define SBAD_SEP "\\"
+#define DEF_EXEPREFIX "./"
+#define DEF_EXEPOSTFIX ""
+#define DEF_CSEP '/'
+#define DEF_CBAD_SEP '\\'
+#define DEF_SSEP "/"
+#define DEF_SBAD_SEP "\\"
 #endif
 
+#define MS_VS_DEF_VERSION "7.10"
+
+class XmlNode;
+class Directory;
 class Project;
 class IfableData;
 class Module;
@@ -71,9 +86,9 @@ class ImportLibrary;
 class If;
 class CompilerFlag;
 class LinkerFlag;
+class LinkerScript;
 class Property;
 class TestSupportCode;
-class WineResource;
 class AutomaticDependency;
 class Bootstrap;
 class CDFile;
@@ -81,8 +96,57 @@ class InstallFile;
 class PchFile;
 class StubbedComponent;
 class StubbedSymbol;
+class CompilationUnit;
+class FileLocation;
+class AutoRegister;
 
 class SourceFileTest;
+class Metadata;
+
+typedef std::map<std::string,Directory*> directory_map;
+
+class XmlNode
+{
+protected:
+       const Project& project;
+       const XMLElement& node;
+
+       XmlNode ( const Project& project_,
+                 const XMLElement& node_ );
+       virtual ~XmlNode();
+
+public:
+       virtual void ProcessXML();
+};
+
+enum DirectoryLocation
+{
+       SourceDirectory,
+       IntermediateDirectory,
+       OutputDirectory,
+       InstallDirectory,
+       TemporaryDirectory,
+};
+
+class Directory
+{
+public:
+       std::string name;
+       directory_map subdirs;
+       Directory ( const std::string& name );
+       ~Directory();
+       void Add ( const char* subdir );
+       void GenerateTree ( DirectoryLocation root,
+                           bool verbose );
+       void CreateRule ( FILE* f,
+                         const std::string& parent );
+private:
+       bool mkdir_p ( const char* path );
+       bool CreateDirectory ( const std::string& path );
+       std::string EscapeSpaces ( const std::string& path );
+       void GenerateTree ( const std::string& parent,
+                           bool verbose );
+};
 
 
 class Configuration
@@ -94,79 +158,112 @@ public:
        bool CleanAsYouGo;
        bool AutomaticDependencies;
        bool CheckDependenciesForModuleOnly;
+       bool CompilationUnitsEnabled;
        std::string CheckDependenciesForModuleOnlyModule;
+       std::string VSProjectVersion;
+       std::string VSConfigurationType;
+       bool UseVSVersionInPath;
+       bool UseConfigurationInPath;
        bool MakeHandlesInstallDirectories;
        bool GenerateProxyMakefilesInSourceTree;
+       bool InstallFiles;
 };
 
 class Environment
 {
 public:
        static std::string GetVariable ( const std::string& name );
+       static std::string GetArch ();
        static std::string GetIntermediatePath ();
        static std::string GetOutputPath ();
+       static std::string GetCdOutputPath ();
        static std::string GetInstallPath ();
+       static std::string GetAutomakeFile ( const std::string& defaultFile );
        static std::string GetEnvironmentVariablePathOrDefault ( const std::string& name,
                                                                 const std::string& defaultValue );
 };
 
+
 class FileSupportCode
 {
 public:
        static void WriteIfChanged ( char* outbuf,
-                                    std::string filename );
+                                    const std::string& filename,
+                                    bool ignoreError = false );
+};
+
+
+class ParseContext
+{
+public:
+       If* ifData;
+       CompilationUnit* compilationUnit;
+       ParseContext ();
 };
 
+
 class IfableData
 {
 public:
+       std::vector<CompilationUnit*> compilationUnits;
        std::vector<File*> files;
        std::vector<Include*> includes;
        std::vector<Define*> defines;
        std::vector<Library*> libraries;
        std::vector<Property*> properties;
+       std::vector<Module*> modules;
        std::vector<CompilerFlag*> compilerFlags;
        std::vector<If*> ifs;
+       int asmFiles; // number of .asm files in compilationUnits
 
+       IfableData();
        ~IfableData();
        void ProcessXML();
+       void ExtractModules( std::vector<Module*> &modules );
 };
 
 class Project
 {
        std::string xmlfile;
        XMLElement *node, *head;
+       Backend* _backend;
 public:
+       const Configuration& configuration;
        std::string name;
        std::string makefile;
        XMLIncludes xmlbuildfiles;
-       std::vector<Module*> modules;
        std::vector<LinkerFlag*> linkerFlags;
        std::vector<CDFile*> cdfiles;
        std::vector<InstallFile*> installfiles;
+       std::vector<Module*> modules;
        IfableData non_if_data;
 
-       Project ( const std::string& filename );
+       Project ( const Configuration& configuration,
+                 const std::string& filename,
+                 const std::map<std::string, std::string>* properties = NULL );
        ~Project ();
+       void SetBackend ( Backend* backend ) { _backend = backend; }
+       Backend& GetBackend() { return *_backend; }
        void WriteConfigurationFile ();
        void ExecuteInvocations ();
+
        void ProcessXML ( const std::string& path );
        Module* LocateModule ( const std::string& name );
        const Module* LocateModule ( const std::string& name ) const;
-       std::string GetProjectFilename () const;
+       const std::string& GetProjectFilename () const;
        std::string ResolveProperties ( const std::string& s ) const;
 private:
-       std::string ResolveNextProperty ( std::string& s ) const;
+       std::string ResolveNextProperty ( const std::string& s ) const;
        const Property* LookupProperty ( const std::string& name ) const;
        void SetConfigurationOption ( char* s,
                                      std::string name,
-                                     std::string* alternativeName );
+                                     std::string alternativeName );
        void SetConfigurationOption ( char* s,
                                      std::string name );
        void ReadXml ();
        void ProcessXMLSubElement ( const XMLElement& e,
                                    const std::string& path,
-                                   If* pIf = NULL );
+                                   ParseContext& parseContext );
 
        // disable copy semantics
        Project ( const Project& );
@@ -185,23 +282,58 @@ enum ModuleType
        NativeDLL = 6,
        NativeCUI = 7,
        Win32DLL = 8,
-       Win32CUI = 9,
-       Win32GUI = 10,
-       BootLoader = 11,
-       BootSector = 12,
-       Iso = 13,
-       LiveIso = 14,
-       Test = 15,
-       RpcServer = 16,
-       RpcClient = 17,
-       Alias = 18
+       Win32OCX = 9,
+       Win32CUI = 10,
+       Win32GUI = 11,
+       BootLoader = 12,
+       BootSector = 13,
+       Iso = 14,
+       LiveIso = 15,
+       Test = 16,
+       RpcServer = 17,
+       RpcClient = 18,
+       Alias = 19,
+       BootProgram = 20,
+       Win32SCR = 21,
+       IdlHeader = 23,
+       IsoRegTest = 24,
+       LiveIsoRegTest = 25,
+       EmbeddedTypeLib = 26,
+       ElfExecutable = 27,
+       RpcProxy,
+       HostStaticLibrary,
+       TypeDontCare,
+       Cabinet
 };
 
 enum HostType
 {
        HostFalse,
        HostDefault,
-       HostTrue
+       HostTrue,
+       HostDontCare,
+};
+
+enum CompilerType
+{
+       CompilerTypeDontCare,
+       CompilerTypeCC,
+       CompilerTypeCPP,
+};
+
+class FileLocation
+{
+public:
+       DirectoryLocation directory;
+       std::string relative_path;
+       std::string name;
+
+       FileLocation ( const DirectoryLocation directory,
+                      const std::string& relative_path,
+                      const std::string& name,
+                      const XMLElement *node = NULL );
+
+       FileLocation ( const FileLocation& other );
 };
 
 class Module
@@ -211,30 +343,38 @@ public:
        const XMLElement& node;
        std::string xmlbuildFile;
        std::string name;
+       std::string guid;
        std::string extension;
-       std::string entrypoint;
        std::string baseaddress;
-       std::string path;
+       std::string payload;
+       std::string buildtype;
        ModuleType type;
        ImportLibrary* importLibrary;
+       Metadata* metadata;
        bool mangledSymbols;
+       bool underscoreSymbols;
+       bool isUnicode;
+       bool isDefaultEntryPoint;
        Bootstrap* bootstrap;
+       AutoRegister* autoRegister; // <autoregister> node
        IfableData non_if_data;
        std::vector<Invoke*> invocations;
        std::vector<Dependency*> dependencies;
        std::vector<CompilerFlag*> compilerFlags;
        std::vector<LinkerFlag*> linkerFlags;
        std::vector<StubbedComponent*> stubbedComponents;
+       LinkerScript* linkerScript;
        PchFile* pch;
        bool cplusplus;
        std::string prefix;
        HostType host;
-       std::string installBase;
-       std::string installName;
        std::string aliasedModuleName;
-       bool useWRC;
        bool allowWarnings;
        bool enabled;
+       bool isStartupLib;
+       FileLocation *output; // "path/foo.exe"
+       FileLocation *dependency; // "path/foo.exe" or "path/libfoo.a"
+       FileLocation *install;
 
        Module ( const Project& project,
                 const XMLElement& moduleNode,
@@ -244,50 +384,48 @@ public:
                                   const XMLAttribute& attribute );
        bool HasImportLibrary () const;
        bool IsDLL () const;
-       bool GenerateInOutputTree () const;
-       std::string GetTargetName () const; // "foo.exe"
-       std::string GetDependencyPath () const; // "path/foo.exe" or "path/libfoo.a"
-       std::string GetBasePath () const; // "path"
-       std::string GetPath () const; // "path/foo.exe"
        std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
+       std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
+       std::string GetEntryPoint(bool leadingUnderscore) const;
        void GetTargets ( string_list& ) const;
        std::string GetInvocationTarget ( const int index ) const;
        bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
        void InvokeModule () const;
        void ProcessXML ();
-       void GetSourceFilenames ( string_list& list,
-                                  bool includeGeneratedFiles ) const;
 private:
+       void SetImportLibrary ( ImportLibrary* importLibrary );
+       DirectoryLocation GetTargetDirectoryTree () const;
        std::string GetDefaultModuleExtension () const;
        std::string GetDefaultModuleEntrypoint () const;
        std::string GetDefaultModuleBaseaddress () const;
+       std::string entrypoint;
        void ProcessXMLSubElement ( const XMLElement& e,
-                                   const std::string& path,
-                                   If* pIf = NULL );
+                                   DirectoryLocation directory,
+                                   const std::string& relative_path,
+                                   ParseContext& parseContext );
 };
 
 
 class Include
 {
 public:
-       const Project& project;
-       const Module* module;
-       const XMLElement* node;
-       const Module* baseModule;
-       std::string directory;
-       std::string basePath;
+       FileLocation *directory;
 
        Include ( const Project& project,
                  const XMLElement* includeNode );
        Include ( const Project& project,
-                 const Module* module,
-                 const XMLElement* includeNode );
+                 const XMLElement* includeNode,
+                 const Module* module );
        Include ( const Project& project,
-                 std::string directory,
-                 std::string basePath );
+                 DirectoryLocation directory,
+                 const std::string& relative_path );
        ~Include ();
-       void ProcessXML();
+       void ProcessXML ();
 private:
+       const Project& project;
+       const XMLElement* node;
+       const Module* module;
+       DirectoryLocation GetDefaultDirectoryTree ( const Module* module ) const;
 };
 
 
@@ -296,15 +434,21 @@ class Define
 public:
        const Project& project;
        const Module* module;
-       const XMLElement& node;
+       const XMLElement* node;
        std::string name;
        std::string value;
+       std::string backend;
+       bool overridable;
 
        Define ( const Project& project,
                 const XMLElement& defineNode );
        Define ( const Project& project,
                 const Module* module,
                 const XMLElement& defineNode );
+       Define ( const Project& project,
+                const Module* module,
+                const std::string& name_,
+                const std::string& backend_ = "" );
        ~Define();
        void ProcessXML();
 private:
@@ -315,25 +459,27 @@ private:
 class File
 {
 public:
-       std::string name;
+       FileLocation file;
        bool first;
        std::string switches;
        bool isPreCompiledHeader;
 
-       File ( const std::string& _name,
+       File ( DirectoryLocation directory,
+              const std::string& relative_path,
+              const std::string& name,
               bool _first,
-              std::string _switches,
+              const std::string& _switches,
               bool _isPreCompiledHeader );
 
        void ProcessXML();
-       bool IsGeneratedFile () const;
+       std::string GetFullPath () const;
 };
 
 
 class Library
 {
+       const XMLElement *node;
 public:
-       const XMLElement& node;
        const Module& module;
        std::string name;
        const Module* importedModule;
@@ -341,6 +487,8 @@ public:
        Library ( const XMLElement& _node,
                  const Module& _module,
                  const std::string& _name );
+       Library ( const Module& _module,
+                 const std::string& _name );
 
        void ProcessXML();
 };
@@ -395,19 +543,36 @@ public:
        void ProcessXML();
 };
 
-
-class ImportLibrary
+class Metadata
 {
 public:
        const XMLElement& node;
        const Module& module;
-       std::string basename;
-       std::string definition;
+       std::string name;
+       std::string description;
+       std::string version;
+       std::string copyright;
+       std::string url;
+       std::string date;
+       std::string owner;
 
-       ImportLibrary ( const XMLElement& _node,
-                       const Module& module );
+       Metadata ( const XMLElement& _node,
+                 const Module& _module );
 
-       void ProcessXML ();
+       void ProcessXML();
+};
+
+class ImportLibrary : public XmlNode
+{
+public:
+       const Module& module;
+       std::string dllname;
+       FileLocation *source;
+
+       ImportLibrary ( const Project& project,
+                       const XMLElement& node,
+                       const Module& module );
+       ~ImportLibrary ();
 };
 
 
@@ -438,6 +603,7 @@ public:
        const Module* module;
        const XMLElement& node;
        std::string flag;
+       CompilerType compiler;
 
        CompilerFlag ( const Project& project,
                       const XMLElement& compilerFlagNode );
@@ -471,10 +637,24 @@ private:
 };
 
 
-class Property
+class LinkerScript
 {
 public:
        const XMLElement& node;
+       const Module& module;
+       const FileLocation *file;
+
+       LinkerScript ( const XMLElement& node,
+                      const Module& module,
+                      const FileLocation *file );
+       ~LinkerScript ();
+       void ProcessXML();
+};
+
+
+class Property
+{
+public:
        const Project& project;
        const Module* module;
        std::string name, value;
@@ -483,6 +663,11 @@ public:
                   const Project& project_,
                   const Module* module_ );
 
+       Property ( const Project& project_,
+                  const Module* module_,
+                  const std::string& name_,
+                  const std::string& value_ );
+
        void ProcessXML();
 };
 
@@ -508,11 +693,11 @@ private:
        void WriteHooksFile ( Module& module );
        std::string GetStubsFilename ( Module& module );
        char* WriteStubbedSymbolToStubsFile ( char* buffer,
-                                              const StubbedComponent& component,
+                                             const StubbedComponent& component,
                                              const StubbedSymbol& symbol,
                                              int stubIndex );
        char* WriteStubbedComponentToStubsFile ( char* buffer,
-                                                 const StubbedComponent& component,
+                                                const StubbedComponent& component,
                                                 int* stubIndex );
        void WriteStubsFile ( Module& module );
        std::string GetStartupFilename ( Module& module );
@@ -520,69 +705,41 @@ private:
        std::string GetTestDispatcherName ( std::string filename );
        bool IsTestFile ( std::string& filename ) const;
        void GetSourceFilenames ( string_list& list,
-                                  Module& module ) const;
+                                 Module& module ) const;
        char* WriteTestDispatcherPrototypesToStartupFile ( char* buffer,
-                                                           Module& module );
+                                                          Module& module );
        char* WriteRegisterTestsFunctionToStartupFile ( char* buffer,
                                                        Module& module );
        void WriteStartupFile ( Module& module );
 };
 
 
-class WineResource
-{
-public:
-       const Project& project;
-       std::string bin2res;
-
-       WineResource ( const Project& project,
-                      std::string bin2res );
-       ~WineResource ();
-       void UnpackResources ( bool verbose );
-private:
-       bool IsSpecFile ( const File& file );
-       bool IsWineModule ( const Module& module );
-       bool IsResourceFile ( const File& file );
-       std::string GetResourceFilename ( const Module& module );
-       void UnpackResourcesInModule ( Module& module,
-                                      bool verbose );
-};
-
-
 class SourceFile
 {
 public:
        SourceFile ( AutomaticDependency* automaticDependency,
                     const Module& module,
-                    const std::string& filename,
-                    SourceFile* parent,
-                    bool isNonAutomaticDependency );
-       SourceFile* ParseFile ( const std::string& normalizedFilename );
+                    const File& file,
+                    SourceFile* parent );
        void Parse ();
-       std::string Location () const;
-       std::vector<SourceFile*> files;
+       std::vector<SourceFile*> files; /* List of files included in this file */
+       const File& file;
        AutomaticDependency* automaticDependency;
        const Module& module;
-       std::string filename;
-       std::string filenamePart;
-       std::string directoryPart;
        std::vector<SourceFile*> parents; /* List of files, this file is included from */
-       bool isNonAutomaticDependency;
-       std::string cachedDependencies;
        time_t lastWriteTime;
        time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */
        SourceFile* youngestFile;
 private:
-       void GetDirectoryAndFilenameParts ();
        void Close ();
        void Open ();
        void SkipWhitespace ();
        bool ReadInclude ( std::string& filename,
                           bool& searchCurrentDirectory,
                           bool& includeNext );
-       bool IsIncludedFrom ( const std::string& normalizedFilename );
-       SourceFile* GetParentSourceFile ();
-       bool CanProcessFile ( const std::string& extension );
+       bool IsIncludedFrom ( const File& file );
+       SourceFile* ParseFile(const File& file);
+       bool CanProcessFile ( const File& file );
        bool IsParentOf ( const SourceFile* parent,
                          const SourceFile* child );
        std::string buf;
@@ -599,34 +756,30 @@ public:
 
        AutomaticDependency ( const Project& project );
        ~AutomaticDependency ();
-       std::string GetFilename ( const std::string& filename );
-       bool LocateIncludedFile ( const std::string& directory,
-                                 const std::string& includedFilename,
-                                 std::string& resolvedFilename );
+       bool LocateIncludedFile ( const FileLocation& directory,
+                                 const std::string& includedFilename );
        bool LocateIncludedFile ( SourceFile* sourceFile,
                                  const Module& module,
                                  const std::string& includedFilename,
                                  bool searchCurrentDirectory,
                                  bool includeNext,
-                                 std::string& resolvedFilename );
+                                 File& resolvedFile );
        SourceFile* RetrieveFromCacheOrParse ( const Module& module,
-                                              const std::string& filename,
+                                              const File& file,
                                               SourceFile* parentSourceFile );
-       SourceFile* RetrieveFromCache ( const std::string& filename );
+       SourceFile* RetrieveFromCache ( const File& file );
        void CheckAutomaticDependencies ( bool verbose );
        void CheckAutomaticDependenciesForModule ( Module& module,
                                                   bool verbose );
 private:
        void GetModulesToCheck ( Module& module, std::vector<const Module*>& modules );
        void CheckAutomaticDependencies ( const Module& module,
-                                          bool verbose );
+                                         bool verbose );
        void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
        void GetIncludeDirectories ( std::vector<Include*>& includes,
-                                    const Module& module,
-                                     Include& currentDirectory,
-                                     bool searchCurrentDirectory );
+                                    const Module& module );
        void GetModuleFiles ( const Module& module,
-                              std::vector<File*>& files ) const;
+                                 std::vector<File*>& files ) const;
        void ParseFiles ();
        void ParseFiles ( const Module& module );
        void ParseFile ( const Module& module,
@@ -652,44 +805,39 @@ public:
 private:
        bool IsSupportedModuleType ( ModuleType type );
        void Initialize();
+       static std::string ReplaceVariable ( const std::string& name,
+                                            const std::string& value,
+                                            std::string path );
 };
 
 
-class CDFile
+class CDFile : public XmlNode
 {
 public:
-       const Project& project;
-       const XMLElement& node;
-       std::string name;
-       std::string base;
-       std::string nameoncd;
-       std::string path;
+       FileLocation *source;
+       FileLocation *target;
 
        CDFile ( const Project& project,
                 const XMLElement& bootstrapNode,
                 const std::string& path );
        ~CDFile ();
-       void ProcessXML();
-       std::string GetPath () const;
+private:
+       static std::string ReplaceVariable ( const std::string& name,
+                                            const std::string& value,
+                                            std::string path );
 };
 
 
-class InstallFile
+class InstallFile : public XmlNode
 {
 public:
-       const Project& project;
-       const XMLElement& node;
-       std::string name;
-       std::string base;
-       std::string newname;
-       std::string path;
+       FileLocation *source;
+       FileLocation *target;
 
        InstallFile ( const Project& project,
                      const XMLElement& bootstrapNode,
                      const std::string& path );
        ~InstallFile ();
-       void ProcessXML ();
-       std::string GetPath () const;
 };
 
 
@@ -698,12 +846,13 @@ class PchFile
 public:
        const XMLElement& node;
        const Module& module;
-       File file;
+       const FileLocation *file;
 
        PchFile (
                const XMLElement& node,
                const Module& module,
-               const File file );
+               const FileLocation *file );
+       ~PchFile();
        void ProcessXML();
 };
 
@@ -739,15 +888,110 @@ private:
        std::string StripSymbol ( std::string symbol );
 };
 
+
+class CompilationUnit
+{
+public:
+       std::string name;
+
+       CompilationUnit ( const File* file );
+       CompilationUnit ( const Project* project,
+                         const Module* module,
+                         const XMLElement* node );
+       ~CompilationUnit ();
+       void ProcessXML();
+       bool IsGeneratedFile () const;
+       bool HasFileWithExtension ( const std::string& extension ) const;
+       bool IsFirstFile () const;
+       const FileLocation& GetFilename () const;
+       const std::string& GetSwitches () const;
+       void AddFile ( const File * file );
+       const std::vector<const File*> GetFiles () const;
+private:
+       const Project* project;
+       const Module* module;
+       const XMLElement* node;
+       std::vector<const File*> files;
+       FileLocation *default_name;
+};
+
+
+class CompilationUnitSupportCode
+{
+public:
+       const Project& project;
+
+       CompilationUnitSupportCode ( const Project& project );
+       ~CompilationUnitSupportCode ();
+       void Generate ( bool verbose );
+private:
+       void GenerateForModule ( Module& module,
+                                bool verbose );
+       std::string GetCompilationUnitFilename ( Module& module,
+                                                CompilationUnit& compilationUnit );
+       void WriteCompilationUnitFile ( Module& module,
+                                       CompilationUnit& compilationUnit );
+};
+
+
+enum AutoRegisterType
+{
+       DllRegisterServer,
+       DllInstall,
+       Both
+};
+
+class AutoRegister : public XmlNode
+{
+public:
+       const Module* module;
+       std::string infSection;
+       AutoRegisterType type;
+       AutoRegister ( const Project& project_,
+                      const Module* module_,
+                      const XMLElement& node_ );
+private:
+       bool IsSupportedModuleType ( ModuleType type );
+       AutoRegisterType GetAutoRegisterType( const std::string& type );
+       void Initialize ();
+};
+
+
+class SysSetupGenerator
+{
+public:
+       const Project& project;
+       SysSetupGenerator ( const Project& project );
+       ~SysSetupGenerator ();
+       void Generate ();
+private:
+       std::string GetDirectoryId ( const Module& module );
+       std::string GetFlags ( const Module& module );
+       void Generate ( HINF inf,
+                       const Module& module );
+};
+
+
+extern void
+InitializeEnvironment ();
+
 extern std::string
 Right ( const std::string& s, size_t n );
 
 extern std::string
 Replace ( const std::string& s, const std::string& find, const std::string& with );
 
+extern std::string
+ChangeSeparator ( const std::string& s,
+                  const char fromSeparator,
+                  const char toSeparator );
+
 extern std::string
 FixSeparator ( const std::string& s );
 
+extern std::string
+FixSeparatorForSystemCommand ( const std::string& s );
+
 extern std::string
 DosSeparator ( const std::string& s );
 
@@ -758,20 +1002,18 @@ ReplaceExtension (
 
 extern std::string
 GetSubPath (
+       const Project& project,
        const std::string& location,
        const std::string& path,
        const std::string& att_value );
 
 extern std::string
-GetExtension ( const std::string& filename );
+GetExtension ( const FileLocation& file );
 
 extern std::string
-GetDirectory ( const std::string& filename );
-
-extern std::string
-GetFilename ( const std::string& filename );
+NormalizeFilename ( const std::string& filename );
 
 extern std::string
-NormalizeFilename ( const std::string& filename );
+ToLower ( std::string filename );
 
 #endif /* __RBUILD_H */