-#ifndef __RBUILD_H\r
-#define __RBUILD_H\r
-\r
-#include "pch.h"\r
-\r
-#ifdef WIN32\r
-#include <direct.h>\r
-#include <io.h>\r
-#endif/*WIN32*/\r
-#include <sys/stat.h>\r
-#include <time.h>\r
-#ifdef _MSC_VER\r
-#include <sys/utime.h>\r
-#else/*_MSC_VER*/\r
-#include <utime.h>\r
-#ifdef WIN32\r
-#include <process.h>\r
-#endif/*WIN32*/\r
-#endif/*_MSC_VER*/\r
-\r
-#include "ssprintf.h"\r
-#include "exception.h"\r
-#include "XML.h"\r
-\r
-typedef std::vector<std::string> string_list;\r
-\r
-#ifdef WIN32\r
-#define EXEPREFIX ""\r
-#define EXEPOSTFIX ".exe"\r
-#define CSEP '\\'\r
-#define CBAD_SEP '/'\r
-#define SSEP "\\"\r
-#define SBAD_SEP "/"\r
-#else\r
-#define EXEPREFIX "./"\r
-#define EXEPOSTFIX ""\r
-#define CSEP '/'\r
-#define CBAD_SEP '\\'\r
-#define SSEP "/"\r
-#define SBAD_SEP "\\"\r
-#endif\r
-\r
-class Project;\r
-class IfableData;\r
-class Module;\r
-class Include;\r
-class Define;\r
-class File;\r
-class Library;\r
-class Invoke;\r
-class InvokeFile;\r
-class Dependency;\r
-class ImportLibrary;\r
-class If;\r
-class CompilerFlag;\r
-class LinkerFlag;\r
-class Property;\r
-class AutomaticDependency;\r
-class Bootstrap;\r
-class CDFile;\r
-class InstallFile;\r
-class PchFile;\r
-class StubbedComponent;\r
-class StubbedSymbol;\r
-\r
-class SourceFileTest;\r
-\r
-class IfableData\r
-{\r
-public:\r
- std::vector<File*> files;\r
- std::vector<Include*> includes;\r
- std::vector<Define*> defines;\r
- std::vector<Library*> libraries;\r
- std::vector<Property*> properties;\r
- std::vector<If*> ifs;\r
-\r
- ~IfableData();\r
- void ProcessXML();\r
-};\r
-\r
-class Project\r
-{\r
- std::string xmlfile;\r
- XMLElement *node, *head;\r
-public:\r
- std::string name;\r
- std::string makefile;\r
- XMLIncludes xmlbuildfiles;\r
- std::vector<Module*> modules;\r
- std::vector<LinkerFlag*> linkerFlags;\r
- std::vector<CDFile*> cdfiles;\r
- std::vector<InstallFile*> installfiles;\r
- IfableData non_if_data;\r
-\r
- Project ( const std::string& filename );\r
- ~Project ();\r
- void WriteConfigurationFile ();\r
- void ExecuteInvocations ();\r
- void ProcessXML ( const std::string& path );\r
- Module* LocateModule ( const std::string& name );\r
- const Module* LocateModule ( const std::string& name ) const;\r
- std::string GetProjectFilename () const;\r
-private:\r
- const Property* LookupProperty ( const std::string& name ) const;\r
- void SetConfigurationOption ( char* s,\r
- std::string name,\r
- std::string* alternativeName );\r
- void SetConfigurationOption ( char* s,\r
- std::string name );\r
- void WriteIfChanged ( char* outbuf,\r
- std::string filename );\r
- void ReadXml ();\r
- void ProcessXMLSubElement ( const XMLElement& e,\r
- const std::string& path,\r
- If* pIf = NULL );\r
-\r
- // disable copy semantics\r
- Project ( const Project& );\r
- Project& operator = ( const Project& );\r
-};\r
-\r
-\r
-enum ModuleType\r
-{\r
- BuildTool,\r
- StaticLibrary,\r
- ObjectLibrary,\r
- Kernel,\r
- KernelModeDLL,\r
- KernelModeDriver,\r
- NativeDLL,\r
- NativeCUI,\r
- Win32DLL,\r
- Win32CUI,\r
- Win32GUI,\r
- BootLoader,\r
- BootSector,\r
- Iso,\r
- LiveIso,\r
- Test,\r
- RpcServer,\r
- RpcClient\r
-};\r
-\r
-enum HostType\r
-{\r
- HostFalse,\r
- HostDefault,\r
- HostTrue\r
-};\r
-\r
-class Module\r
-{\r
-public:\r
- const Project& project;\r
- const XMLElement& node;\r
- std::string xmlbuildFile;\r
- std::string name;\r
- std::string extension;\r
- std::string entrypoint;\r
- std::string baseaddress;\r
- std::string path;\r
- ModuleType type;\r
- ImportLibrary* importLibrary;\r
- bool mangledSymbols;\r
- Bootstrap* bootstrap;\r
- IfableData non_if_data;\r
- std::vector<Invoke*> invocations;\r
- std::vector<Dependency*> dependencies;\r
- std::vector<CompilerFlag*> compilerFlags;\r
- std::vector<LinkerFlag*> linkerFlags;\r
- std::vector<StubbedComponent*> stubbedComponents;\r
- PchFile* pch;\r
- bool cplusplus;\r
- std::string prefix;\r
- HostType host;\r
- std::string installBase;\r
- std::string installName;\r
- bool useWRC;\r
- bool enableWarnings;\r
-\r
- Module ( const Project& project,\r
- const XMLElement& moduleNode,\r
- const std::string& modulePath );\r
- ~Module ();\r
- ModuleType GetModuleType ( const std::string& location,\r
- const XMLAttribute& attribute );\r
- bool HasImportLibrary () const;\r
- std::string GetTargetName () const;\r
- std::string GetDependencyPath () const;\r
- std::string GetBasePath () const;\r
- std::string GetPath () const;\r
- std::string GetPathWithPrefix ( const std::string& prefix ) const;\r
- void GetTargets ( string_list& ) const;\r
- std::string GetInvocationTarget ( const int index ) const;\r
- bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;\r
- void InvokeModule () const;\r
- void ProcessXML ();\r
-private:\r
- std::string GetDefaultModuleExtension () const;\r
- std::string GetDefaultModuleEntrypoint () const;\r
- std::string GetDefaultModuleBaseaddress () const;\r
- void ProcessXMLSubElement ( const XMLElement& e,\r
- const std::string& path,\r
- If* pIf = NULL );\r
-};\r
-\r
-\r
-class Include\r
-{\r
-public:\r
- const Project& project;\r
- const Module* module;\r
- const XMLElement& node;\r
- std::string directory;\r
- std::string basePath;\r
-\r
- Include ( const Project& project,\r
- const XMLElement& includeNode );\r
- Include ( const Project& project,\r
- const Module* module,\r
- const XMLElement& includeNode );\r
- ~Include ();\r
- void ProcessXML();\r
-private:\r
- void Initialize();\r
-};\r
-\r
-\r
-class Define\r
-{\r
-public:\r
- const Project& project;\r
- const Module* module;\r
- const XMLElement& node;\r
- std::string name;\r
- std::string value;\r
-\r
- Define ( const Project& project,\r
- const XMLElement& defineNode );\r
- Define ( const Project& project,\r
- const Module* module,\r
- const XMLElement& defineNode );\r
- ~Define();\r
- void ProcessXML();\r
-private:\r
- void Initialize();\r
-};\r
-\r
-\r
-class File\r
-{\r
-public:\r
- std::string name;\r
- bool first;\r
- std::string switches;\r
-\r
- File ( const std::string& _name,\r
- bool _first,\r
- std::string _switches );\r
-\r
- void ProcessXML();\r
-};\r
-\r
-\r
-class Library\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Module& module;\r
- std::string name;\r
- const Module* imported_module;\r
-\r
- Library ( const XMLElement& _node,\r
- const Module& _module,\r
- const std::string& _name );\r
-\r
- void ProcessXML();\r
-};\r
-\r
-\r
-class Invoke\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Module& module;\r
- const Module* invokeModule;\r
- std::vector<InvokeFile*> input;\r
- std::vector<InvokeFile*> output;\r
-\r
- Invoke ( const XMLElement& _node,\r
- const Module& _module );\r
-\r
- void ProcessXML();\r
- void GetTargets ( string_list& targets ) const;\r
- std::string GetParameters () const;\r
-private:\r
- void ProcessXMLSubElement ( const XMLElement& e );\r
- void ProcessXMLSubElementInput ( const XMLElement& e );\r
- void ProcessXMLSubElementOutput ( const XMLElement& e );\r
-};\r
-\r
-\r
-class InvokeFile\r
-{\r
-public:\r
- const XMLElement& node;\r
- std::string name;\r
- std::string switches;\r
-\r
- InvokeFile ( const XMLElement& _node,\r
- const std::string& _name );\r
-\r
- void ProcessXML ();\r
-};\r
-\r
-\r
-class Dependency\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Module& module;\r
- const Module* dependencyModule;\r
-\r
- Dependency ( const XMLElement& _node,\r
- const Module& _module );\r
-\r
- void ProcessXML();\r
-};\r
-\r
-\r
-class ImportLibrary\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Module& module;\r
- std::string basename;\r
- std::string definition;\r
-\r
- ImportLibrary ( const XMLElement& _node,\r
- const Module& module );\r
-\r
- void ProcessXML ();\r
-};\r
-\r
-\r
-class If\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Project& project;\r
- const Module* module;\r
- std::string property, value;\r
- IfableData data;\r
-\r
- If ( const XMLElement& node_,\r
- const Project& project_,\r
- const Module* module_ );\r
- ~If();\r
-\r
- void ProcessXML();\r
-};\r
-\r
-\r
-class CompilerFlag\r
-{\r
-public:\r
- const Project& project;\r
- const Module* module;\r
- const XMLElement& node;\r
- std::string flag;\r
-\r
- CompilerFlag ( const Project& project,\r
- const XMLElement& compilerFlagNode );\r
- CompilerFlag ( const Project& project,\r
- const Module* module,\r
- const XMLElement& compilerFlagNode );\r
- ~CompilerFlag ();\r
- void ProcessXML();\r
-private:\r
- void Initialize();\r
-};\r
-\r
-\r
-class LinkerFlag\r
-{\r
-public:\r
- const Project& project;\r
- const Module* module;\r
- const XMLElement& node;\r
- std::string flag;\r
-\r
- LinkerFlag ( const Project& project,\r
- const XMLElement& linkerFlagNode );\r
- LinkerFlag ( const Project& project,\r
- const Module* module,\r
- const XMLElement& linkerFlagNode );\r
- ~LinkerFlag ();\r
- void ProcessXML();\r
-private:\r
- void Initialize();\r
-};\r
-\r
-\r
-class Property\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Project& project;\r
- const Module* module;\r
- std::string name, value;\r
-\r
- Property ( const XMLElement& node_,\r
- const Project& project_,\r
- const Module* module_ );\r
-\r
- void ProcessXML();\r
-};\r
-\r
-\r
-class SourceFile\r
-{\r
-public:\r
- SourceFile ( AutomaticDependency* automaticDependency,\r
- Module& module,\r
- const std::string& filename,\r
- SourceFile* parent,\r
- bool isNonAutomaticDependency );\r
- SourceFile* ParseFile ( const std::string& normalizedFilename );\r
- void Parse ();\r
- std::string Location () const;\r
- std::vector<SourceFile*> files;\r
- AutomaticDependency* automaticDependency;\r
- Module& module;\r
- std::string filename;\r
- std::string filenamePart;\r
- std::string directoryPart;\r
- std::vector<SourceFile*> parents; /* List of files, this file is included from */\r
- bool isNonAutomaticDependency;\r
- std::string cachedDependencies;\r
- time_t lastWriteTime;\r
- time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */\r
- SourceFile* youngestFile;\r
-private:\r
- void GetDirectoryAndFilenameParts ();\r
- void Close ();\r
- void Open ();\r
- void SkipWhitespace ();\r
- bool ReadInclude ( std::string& filename,\r
- bool& includeNext );\r
- bool IsIncludedFrom ( const std::string& normalizedFilename );\r
- SourceFile* GetParentSourceFile ();\r
- bool CanProcessFile ( const std::string& extension );\r
- bool IsParentOf ( const SourceFile* parent,\r
- const SourceFile* child );\r
- std::string buf;\r
- const char *p;\r
- const char *end;\r
-};\r
-\r
-\r
-class AutomaticDependency\r
-{\r
- friend class SourceFileTest;\r
-public:\r
- const Project& project;\r
-\r
- AutomaticDependency ( const Project& project );\r
- ~AutomaticDependency ();\r
- void Process ();\r
- std::string GetFilename ( const std::string& filename );\r
- bool LocateIncludedFile ( const std::string& directory,\r
- const std::string& includedFilename,\r
- std::string& resolvedFilename );\r
- bool LocateIncludedFile ( SourceFile* sourceFile,\r
- Module& module,\r
- const std::string& includedFilename,\r
- bool includeNext,\r
- std::string& resolvedFilename );\r
- SourceFile* RetrieveFromCacheOrParse ( Module& module,\r
- const std::string& filename,\r
- SourceFile* parentSourceFile );\r
- SourceFile* RetrieveFromCache ( const std::string& filename );\r
- void CheckAutomaticDependencies ( bool verbose );\r
- void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );\r
-private:\r
- void ProcessModule ( Module& module );\r
- void ProcessFile ( Module& module,\r
- const File& file );\r
- std::map<std::string, SourceFile*> sourcefile_map;\r
-};\r
-\r
-\r
-class Bootstrap\r
-{\r
-public:\r
- const Project& project;\r
- const Module* module;\r
- const XMLElement& node;\r
- std::string base;\r
- std::string nameoncd;\r
-\r
- Bootstrap ( const Project& project,\r
- const Module* module,\r
- const XMLElement& bootstrapNode );\r
- ~Bootstrap ();\r
- void ProcessXML();\r
-private:\r
- bool IsSupportedModuleType ( ModuleType type );\r
- void Initialize();\r
-};\r
-\r
-\r
-class CDFile\r
-{\r
-public:\r
- const Project& project;\r
- const XMLElement& node;\r
- std::string name;\r
- std::string base;\r
- std::string nameoncd;\r
- std::string path;\r
-\r
- CDFile ( const Project& project,\r
- const XMLElement& bootstrapNode,\r
- const std::string& path );\r
- ~CDFile ();\r
- void ProcessXML();\r
- std::string GetPath () const;\r
-};\r
-\r
-\r
-class InstallFile\r
-{\r
-public:\r
- const Project& project;\r
- const XMLElement& node;\r
- std::string name;\r
- std::string base;\r
- std::string newname;\r
- std::string path;\r
-\r
- InstallFile ( const Project& project,\r
- const XMLElement& bootstrapNode,\r
- const std::string& path );\r
- ~InstallFile ();\r
- void ProcessXML ();\r
- std::string GetPath () const;\r
-};\r
-\r
-\r
-class PchFile\r
-{\r
-public:\r
- const XMLElement& node;\r
- const Module& module;\r
- std::string header;\r
-\r
- PchFile (\r
- const XMLElement& node,\r
- const Module& module,\r
- const std::string& header );\r
- void ProcessXML();\r
-};\r
-\r
-\r
-class StubbedComponent\r
-{\r
-public:\r
- const Module* module;\r
- const XMLElement& node;\r
- std::string name;\r
- std::vector<StubbedSymbol*> symbols;\r
-\r
- StubbedComponent ( const Module* module_,\r
- const XMLElement& stubbedComponentNode );\r
- ~StubbedComponent ();\r
- void ProcessXML ();\r
- void ProcessXMLSubElement ( const XMLElement& e );\r
-};\r
-\r
-\r
-class StubbedSymbol\r
-{\r
-public:\r
- const XMLElement& node;\r
- std::string symbol;\r
- std::string newname;\r
-\r
- StubbedSymbol ( const XMLElement& stubbedSymbolNode );\r
- ~StubbedSymbol ();\r
- void ProcessXML();\r
-};\r
-\r
-extern std::string\r
-FixSeparator ( const std::string& s );\r
-\r
-extern std::string\r
-ReplaceExtension (\r
- const std::string& filename,\r
- const std::string& newExtension );\r
-\r
-extern std::string\r
-GetSubPath (\r
- const std::string& location,\r
- const std::string& path,\r
- const std::string& att_value );\r
-\r
-extern std::string\r
-GetExtension ( const std::string& filename );\r
-\r
-extern std::string\r
-GetDirectory ( const std::string& filename );\r
-\r
-extern std::string\r
-NormalizeFilename ( const std::string& filename );\r
-\r
-#endif /* __RBUILD_H */\r
+#ifndef __RBUILD_H
+#define __RBUILD_H
+
+#include "pch.h"
+
+#ifdef WIN32
+#include <direct.h>
+#include <io.h>
+#endif/*WIN32*/
+#include <sys/stat.h>
+#include <time.h>
+#ifdef _MSC_VER
+#include <sys/utime.h>
+#else/*_MSC_VER*/
+#include <utime.h>
+#ifdef WIN32
+#include <process.h>
+#endif/*WIN32*/
+#endif/*_MSC_VER*/
+
+#include "ssprintf.h"
+#include "exception.h"
+#include "XML.h"
+
+typedef std::vector<std::string> string_list;
+
+#ifdef WIN32
+#define EXEPREFIX ""
+#define EXEPOSTFIX ".exe"
+#define CSEP '\\'
+#define CBAD_SEP '/'
+#define SSEP "\\"
+#define SBAD_SEP "/"
+#else
+#define EXEPREFIX "./"
+#define EXEPOSTFIX ""
+#define CSEP '/'
+#define CBAD_SEP '\\'
+#define SSEP "/"
+#define SBAD_SEP "\\"
+#endif
+
+class Project;
+class IfableData;
+class Module;
+class Include;
+class Define;
+class File;
+class Library;
+class Invoke;
+class InvokeFile;
+class Dependency;
+class ImportLibrary;
+class If;
+class CompilerFlag;
+class LinkerFlag;
+class Property;
+class AutomaticDependency;
+class Bootstrap;
+class CDFile;
+class InstallFile;
+class PchFile;
+class StubbedComponent;
+class StubbedSymbol;
+
+class SourceFileTest;
+
+class IfableData
+{
+public:
+ std::vector<File*> files;
+ std::vector<Include*> includes;
+ std::vector<Define*> defines;
+ std::vector<Library*> libraries;
+ std::vector<Property*> properties;
+ std::vector<If*> ifs;
+
+ ~IfableData();
+ void ProcessXML();
+};
+
+class Project
+{
+ std::string xmlfile;
+ XMLElement *node, *head;
+public:
+ std::string name;
+ std::string makefile;
+ XMLIncludes xmlbuildfiles;
+ std::vector<Module*> modules;
+ std::vector<LinkerFlag*> linkerFlags;
+ std::vector<CDFile*> cdfiles;
+ std::vector<InstallFile*> installfiles;
+ IfableData non_if_data;
+
+ Project ( const std::string& filename );
+ ~Project ();
+ 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;
+private:
+ const Property* LookupProperty ( const std::string& name ) const;
+ void SetConfigurationOption ( char* s,
+ std::string name,
+ std::string* alternativeName );
+ void SetConfigurationOption ( char* s,
+ std::string name );
+ void WriteIfChanged ( char* outbuf,
+ std::string filename );
+ void ReadXml ();
+ void ProcessXMLSubElement ( const XMLElement& e,
+ const std::string& path,
+ If* pIf = NULL );
+
+ // disable copy semantics
+ Project ( const Project& );
+ Project& operator = ( const Project& );
+};
+
+
+enum ModuleType
+{
+ BuildTool,
+ StaticLibrary,
+ ObjectLibrary,
+ Kernel,
+ KernelModeDLL,
+ KernelModeDriver,
+ NativeDLL,
+ NativeCUI,
+ Win32DLL,
+ Win32CUI,
+ Win32GUI,
+ BootLoader,
+ BootSector,
+ Iso,
+ LiveIso,
+ Test,
+ RpcServer,
+ RpcClient
+};
+
+enum HostType
+{
+ HostFalse,
+ HostDefault,
+ HostTrue
+};
+
+class Module
+{
+public:
+ const Project& project;
+ const XMLElement& node;
+ std::string xmlbuildFile;
+ std::string name;
+ std::string extension;
+ std::string entrypoint;
+ std::string baseaddress;
+ std::string path;
+ ModuleType type;
+ ImportLibrary* importLibrary;
+ bool mangledSymbols;
+ Bootstrap* bootstrap;
+ IfableData non_if_data;
+ std::vector<Invoke*> invocations;
+ std::vector<Dependency*> dependencies;
+ std::vector<CompilerFlag*> compilerFlags;
+ std::vector<LinkerFlag*> linkerFlags;
+ std::vector<StubbedComponent*> stubbedComponents;
+ PchFile* pch;
+ bool cplusplus;
+ std::string prefix;
+ HostType host;
+ std::string installBase;
+ std::string installName;
+ bool useWRC;
+ bool enableWarnings;
+
+ Module ( const Project& project,
+ const XMLElement& moduleNode,
+ const std::string& modulePath );
+ ~Module ();
+ ModuleType GetModuleType ( const std::string& location,
+ const XMLAttribute& attribute );
+ bool HasImportLibrary () const;
+ std::string GetTargetName () const;
+ std::string GetDependencyPath () const;
+ std::string GetBasePath () const;
+ std::string GetPath () const;
+ std::string GetPathWithPrefix ( const std::string& prefix ) 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 ();
+private:
+ std::string GetDefaultModuleExtension () const;
+ std::string GetDefaultModuleEntrypoint () const;
+ std::string GetDefaultModuleBaseaddress () const;
+ void ProcessXMLSubElement ( const XMLElement& e,
+ const std::string& path,
+ If* pIf = NULL );
+};
+
+
+class Include
+{
+public:
+ const Project& project;
+ const Module* module;
+ const XMLElement& node;
+ std::string directory;
+ std::string basePath;
+
+ Include ( const Project& project,
+ const XMLElement& includeNode );
+ Include ( const Project& project,
+ const Module* module,
+ const XMLElement& includeNode );
+ ~Include ();
+ void ProcessXML();
+private:
+ void Initialize();
+};
+
+
+class Define
+{
+public:
+ const Project& project;
+ const Module* module;
+ const XMLElement& node;
+ std::string name;
+ std::string value;
+
+ Define ( const Project& project,
+ const XMLElement& defineNode );
+ Define ( const Project& project,
+ const Module* module,
+ const XMLElement& defineNode );
+ ~Define();
+ void ProcessXML();
+private:
+ void Initialize();
+};
+
+
+class File
+{
+public:
+ std::string name;
+ bool first;
+ std::string switches;
+
+ File ( const std::string& _name,
+ bool _first,
+ std::string _switches );
+
+ void ProcessXML();
+};
+
+
+class Library
+{
+public:
+ const XMLElement& node;
+ const Module& module;
+ std::string name;
+ const Module* imported_module;
+
+ Library ( const XMLElement& _node,
+ const Module& _module,
+ const std::string& _name );
+
+ void ProcessXML();
+};
+
+
+class Invoke
+{
+public:
+ const XMLElement& node;
+ const Module& module;
+ const Module* invokeModule;
+ std::vector<InvokeFile*> input;
+ std::vector<InvokeFile*> output;
+
+ Invoke ( const XMLElement& _node,
+ const Module& _module );
+
+ void ProcessXML();
+ void GetTargets ( string_list& targets ) const;
+ std::string GetParameters () const;
+private:
+ void ProcessXMLSubElement ( const XMLElement& e );
+ void ProcessXMLSubElementInput ( const XMLElement& e );
+ void ProcessXMLSubElementOutput ( const XMLElement& e );
+};
+
+
+class InvokeFile
+{
+public:
+ const XMLElement& node;
+ std::string name;
+ std::string switches;
+
+ InvokeFile ( const XMLElement& _node,
+ const std::string& _name );
+
+ void ProcessXML ();
+};
+
+
+class Dependency
+{
+public:
+ const XMLElement& node;
+ const Module& module;
+ const Module* dependencyModule;
+
+ Dependency ( const XMLElement& _node,
+ const Module& _module );
+
+ void ProcessXML();
+};
+
+
+class ImportLibrary
+{
+public:
+ const XMLElement& node;
+ const Module& module;
+ std::string basename;
+ std::string definition;
+
+ ImportLibrary ( const XMLElement& _node,
+ const Module& module );
+
+ void ProcessXML ();
+};
+
+
+class If
+{
+public:
+ const XMLElement& node;
+ const Project& project;
+ const Module* module;
+ std::string property, value;
+ IfableData data;
+
+ If ( const XMLElement& node_,
+ const Project& project_,
+ const Module* module_ );
+ ~If();
+
+ void ProcessXML();
+};
+
+
+class CompilerFlag
+{
+public:
+ const Project& project;
+ const Module* module;
+ const XMLElement& node;
+ std::string flag;
+
+ CompilerFlag ( const Project& project,
+ const XMLElement& compilerFlagNode );
+ CompilerFlag ( const Project& project,
+ const Module* module,
+ const XMLElement& compilerFlagNode );
+ ~CompilerFlag ();
+ void ProcessXML();
+private:
+ void Initialize();
+};
+
+
+class LinkerFlag
+{
+public:
+ const Project& project;
+ const Module* module;
+ const XMLElement& node;
+ std::string flag;
+
+ LinkerFlag ( const Project& project,
+ const XMLElement& linkerFlagNode );
+ LinkerFlag ( const Project& project,
+ const Module* module,
+ const XMLElement& linkerFlagNode );
+ ~LinkerFlag ();
+ void ProcessXML();
+private:
+ void Initialize();
+};
+
+
+class Property
+{
+public:
+ const XMLElement& node;
+ const Project& project;
+ const Module* module;
+ std::string name, value;
+
+ Property ( const XMLElement& node_,
+ const Project& project_,
+ const Module* module_ );
+
+ void ProcessXML();
+};
+
+
+class SourceFile
+{
+public:
+ SourceFile ( AutomaticDependency* automaticDependency,
+ Module& module,
+ const std::string& filename,
+ SourceFile* parent,
+ bool isNonAutomaticDependency );
+ SourceFile* ParseFile ( const std::string& normalizedFilename );
+ void Parse ();
+ std::string Location () const;
+ std::vector<SourceFile*> files;
+ AutomaticDependency* automaticDependency;
+ 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& includeNext );
+ bool IsIncludedFrom ( const std::string& normalizedFilename );
+ SourceFile* GetParentSourceFile ();
+ bool CanProcessFile ( const std::string& extension );
+ bool IsParentOf ( const SourceFile* parent,
+ const SourceFile* child );
+ std::string buf;
+ const char *p;
+ const char *end;
+};
+
+
+class AutomaticDependency
+{
+ friend class SourceFileTest;
+public:
+ const Project& project;
+
+ AutomaticDependency ( const Project& project );
+ ~AutomaticDependency ();
+ void Process ();
+ std::string GetFilename ( const std::string& filename );
+ bool LocateIncludedFile ( const std::string& directory,
+ const std::string& includedFilename,
+ std::string& resolvedFilename );
+ bool LocateIncludedFile ( SourceFile* sourceFile,
+ Module& module,
+ const std::string& includedFilename,
+ bool includeNext,
+ std::string& resolvedFilename );
+ SourceFile* RetrieveFromCacheOrParse ( Module& module,
+ const std::string& filename,
+ SourceFile* parentSourceFile );
+ SourceFile* RetrieveFromCache ( const std::string& filename );
+ void CheckAutomaticDependencies ( bool verbose );
+ void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
+private:
+ void ProcessModule ( Module& module );
+ void ProcessFile ( Module& module,
+ const File& file );
+ std::map<std::string, SourceFile*> sourcefile_map;
+};
+
+
+class Bootstrap
+{
+public:
+ const Project& project;
+ const Module* module;
+ const XMLElement& node;
+ std::string base;
+ std::string nameoncd;
+
+ Bootstrap ( const Project& project,
+ const Module* module,
+ const XMLElement& bootstrapNode );
+ ~Bootstrap ();
+ void ProcessXML();
+private:
+ bool IsSupportedModuleType ( ModuleType type );
+ void Initialize();
+};
+
+
+class CDFile
+{
+public:
+ const Project& project;
+ const XMLElement& node;
+ std::string name;
+ std::string base;
+ std::string nameoncd;
+ std::string path;
+
+ CDFile ( const Project& project,
+ const XMLElement& bootstrapNode,
+ const std::string& path );
+ ~CDFile ();
+ void ProcessXML();
+ std::string GetPath () const;
+};
+
+
+class InstallFile
+{
+public:
+ const Project& project;
+ const XMLElement& node;
+ std::string name;
+ std::string base;
+ std::string newname;
+ std::string path;
+
+ InstallFile ( const Project& project,
+ const XMLElement& bootstrapNode,
+ const std::string& path );
+ ~InstallFile ();
+ void ProcessXML ();
+ std::string GetPath () const;
+};
+
+
+class PchFile
+{
+public:
+ const XMLElement& node;
+ const Module& module;
+ std::string header;
+
+ PchFile (
+ const XMLElement& node,
+ const Module& module,
+ const std::string& header );
+ void ProcessXML();
+};
+
+
+class StubbedComponent
+{
+public:
+ const Module* module;
+ const XMLElement& node;
+ std::string name;
+ std::vector<StubbedSymbol*> symbols;
+
+ StubbedComponent ( const Module* module_,
+ const XMLElement& stubbedComponentNode );
+ ~StubbedComponent ();
+ void ProcessXML ();
+ void ProcessXMLSubElement ( const XMLElement& e );
+};
+
+
+class StubbedSymbol
+{
+public:
+ const XMLElement& node;
+ std::string symbol;
+ std::string newname;
+
+ StubbedSymbol ( const XMLElement& stubbedSymbolNode );
+ ~StubbedSymbol ();
+ void ProcessXML();
+};
+
+extern std::string
+FixSeparator ( const std::string& s );
+
+extern std::string
+ReplaceExtension (
+ const std::string& filename,
+ const std::string& newExtension );
+
+extern std::string
+GetSubPath (
+ const std::string& location,
+ const std::string& path,
+ const std::string& att_value );
+
+extern std::string
+GetExtension ( const std::string& filename );
+
+extern std::string
+GetDirectory ( const std::string& filename );
+
+extern std::string
+NormalizeFilename ( const std::string& filename );
+
+#endif /* __RBUILD_H */