mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Set svn:eol-style=native
svn path=/branches/xmlbuildsystem/; revision=15035
This commit is contained in:
parent
751a4e3a06
commit
ae18ba571a
64 changed files with 12373 additions and 12373 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,116 +1,116 @@
|
|||
#ifndef XML_H
|
||||
#define XML_H
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
class XMLElement;
|
||||
|
||||
void
|
||||
InitWorkingDirectory();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
unsigned __int64
|
||||
#else
|
||||
unsigned long long
|
||||
#endif
|
||||
filelen ( FILE* f );
|
||||
|
||||
class Path
|
||||
{
|
||||
std::vector<std::string> path;
|
||||
public:
|
||||
Path(); // initializes path to getcwd();
|
||||
Path ( const Path& cwd, const std::string& filename );
|
||||
std::string Fixup ( const std::string& filename, bool include_filename ) const;
|
||||
|
||||
std::string RelativeFromWorkingDirectory ();
|
||||
static std::string RelativeFromWorkingDirectory ( const std::string& path );
|
||||
|
||||
static void Split ( std::vector<std::string>& out,
|
||||
const std::string& path,
|
||||
bool include_last );
|
||||
};
|
||||
|
||||
class XMLInclude
|
||||
{
|
||||
public:
|
||||
XMLElement *e;
|
||||
Path path;
|
||||
std::string topIncludeFilename;
|
||||
bool fileExists;
|
||||
|
||||
XMLInclude ( XMLElement* e_, const Path& path_, const std::string topIncludeFilename_ )
|
||||
: e ( e_ ), path ( path_ ), topIncludeFilename ( topIncludeFilename_ )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class XMLIncludes : public std::vector<XMLInclude*>
|
||||
{
|
||||
public:
|
||||
~XMLIncludes();
|
||||
};
|
||||
|
||||
class XMLFile
|
||||
{
|
||||
friend class XMLElement;
|
||||
public:
|
||||
XMLFile();
|
||||
void close();
|
||||
bool open(const std::string& filename);
|
||||
void next_token();
|
||||
bool next_is_text();
|
||||
bool more_tokens();
|
||||
bool get_token(std::string& token);
|
||||
const std::string& filename() { return _filename; }
|
||||
std::string Location() const;
|
||||
|
||||
private:
|
||||
std::string _buf, _filename;
|
||||
|
||||
const char *_p, *_end;
|
||||
};
|
||||
|
||||
|
||||
class XMLAttribute
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
XMLAttribute();
|
||||
XMLAttribute ( const std::string& name_, const std::string& value_ );
|
||||
XMLAttribute ( const XMLAttribute& );
|
||||
XMLAttribute& operator = ( const XMLAttribute& );
|
||||
};
|
||||
|
||||
|
||||
class XMLElement
|
||||
{
|
||||
public:
|
||||
XMLFile* xmlFile;
|
||||
std::string location;
|
||||
std::string name;
|
||||
std::vector<XMLAttribute*> attributes;
|
||||
XMLElement* parentElement;
|
||||
std::vector<XMLElement*> subElements;
|
||||
std::string value;
|
||||
|
||||
XMLElement ( XMLFile* xmlFile,
|
||||
const std::string& location );
|
||||
~XMLElement();
|
||||
bool Parse(const std::string& token,
|
||||
bool& end_tag);
|
||||
void AddSubElement ( XMLElement* e );
|
||||
XMLAttribute* GetAttribute ( const std::string& attribute,
|
||||
bool required);
|
||||
const XMLAttribute* GetAttribute ( const std::string& attribute,
|
||||
bool required) const;
|
||||
};
|
||||
|
||||
XMLElement*
|
||||
XMLLoadFile ( const std::string& filename,
|
||||
const Path& path,
|
||||
XMLIncludes& includes );
|
||||
|
||||
#endif // XML_H
|
||||
#ifndef XML_H
|
||||
#define XML_H
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
class XMLElement;
|
||||
|
||||
void
|
||||
InitWorkingDirectory();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
unsigned __int64
|
||||
#else
|
||||
unsigned long long
|
||||
#endif
|
||||
filelen ( FILE* f );
|
||||
|
||||
class Path
|
||||
{
|
||||
std::vector<std::string> path;
|
||||
public:
|
||||
Path(); // initializes path to getcwd();
|
||||
Path ( const Path& cwd, const std::string& filename );
|
||||
std::string Fixup ( const std::string& filename, bool include_filename ) const;
|
||||
|
||||
std::string RelativeFromWorkingDirectory ();
|
||||
static std::string RelativeFromWorkingDirectory ( const std::string& path );
|
||||
|
||||
static void Split ( std::vector<std::string>& out,
|
||||
const std::string& path,
|
||||
bool include_last );
|
||||
};
|
||||
|
||||
class XMLInclude
|
||||
{
|
||||
public:
|
||||
XMLElement *e;
|
||||
Path path;
|
||||
std::string topIncludeFilename;
|
||||
bool fileExists;
|
||||
|
||||
XMLInclude ( XMLElement* e_, const Path& path_, const std::string topIncludeFilename_ )
|
||||
: e ( e_ ), path ( path_ ), topIncludeFilename ( topIncludeFilename_ )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class XMLIncludes : public std::vector<XMLInclude*>
|
||||
{
|
||||
public:
|
||||
~XMLIncludes();
|
||||
};
|
||||
|
||||
class XMLFile
|
||||
{
|
||||
friend class XMLElement;
|
||||
public:
|
||||
XMLFile();
|
||||
void close();
|
||||
bool open(const std::string& filename);
|
||||
void next_token();
|
||||
bool next_is_text();
|
||||
bool more_tokens();
|
||||
bool get_token(std::string& token);
|
||||
const std::string& filename() { return _filename; }
|
||||
std::string Location() const;
|
||||
|
||||
private:
|
||||
std::string _buf, _filename;
|
||||
|
||||
const char *_p, *_end;
|
||||
};
|
||||
|
||||
|
||||
class XMLAttribute
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
XMLAttribute();
|
||||
XMLAttribute ( const std::string& name_, const std::string& value_ );
|
||||
XMLAttribute ( const XMLAttribute& );
|
||||
XMLAttribute& operator = ( const XMLAttribute& );
|
||||
};
|
||||
|
||||
|
||||
class XMLElement
|
||||
{
|
||||
public:
|
||||
XMLFile* xmlFile;
|
||||
std::string location;
|
||||
std::string name;
|
||||
std::vector<XMLAttribute*> attributes;
|
||||
XMLElement* parentElement;
|
||||
std::vector<XMLElement*> subElements;
|
||||
std::string value;
|
||||
|
||||
XMLElement ( XMLFile* xmlFile,
|
||||
const std::string& location );
|
||||
~XMLElement();
|
||||
bool Parse(const std::string& token,
|
||||
bool& end_tag);
|
||||
void AddSubElement ( XMLElement* e );
|
||||
XMLAttribute* GetAttribute ( const std::string& attribute,
|
||||
bool required);
|
||||
const XMLAttribute* GetAttribute ( const std::string& attribute,
|
||||
bool required) const;
|
||||
};
|
||||
|
||||
XMLElement*
|
||||
XMLLoadFile ( const std::string& filename,
|
||||
const Path& path,
|
||||
XMLIncludes& includes );
|
||||
|
||||
#endif // XML_H
|
||||
|
|
|
@ -1,453 +1,453 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
/* Read at most this amount of bytes from each file and assume that all #includes are located within this block */
|
||||
#define MAX_BYTES_TO_READ 4096
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
SourceFile::SourceFile ( AutomaticDependency* automaticDependency,
|
||||
Module& module,
|
||||
const string& filename,
|
||||
SourceFile* parent,
|
||||
bool isNonAutomaticDependency )
|
||||
: automaticDependency ( automaticDependency ),
|
||||
module ( module ),
|
||||
filename ( filename ),
|
||||
isNonAutomaticDependency ( isNonAutomaticDependency ),
|
||||
youngestLastWriteTime ( 0 )
|
||||
{
|
||||
if ( parent != NULL )
|
||||
parents.push_back ( parent );
|
||||
GetDirectoryAndFilenameParts ();
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::GetDirectoryAndFilenameParts ()
|
||||
{
|
||||
size_t index = filename.find_last_of ( CSEP );
|
||||
if ( index != string::npos )
|
||||
{
|
||||
directoryPart = filename.substr ( 0, index );
|
||||
filenamePart = filename.substr ( index + 1, filename.length () - index );
|
||||
}
|
||||
else
|
||||
{
|
||||
directoryPart = "";
|
||||
filenamePart = filename;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::Close ()
|
||||
{
|
||||
buf.resize ( 0 );
|
||||
p = end = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::Open ()
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
Close ();
|
||||
FILE* f = fopen ( filename.c_str (), "rb" );
|
||||
if ( !f )
|
||||
throw FileNotFoundException ( filename );
|
||||
|
||||
if ( fstat ( fileno ( f ), &statbuf ) != 0 )
|
||||
{
|
||||
fclose ( f );
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
lastWriteTime = statbuf.st_mtime;
|
||||
|
||||
unsigned long len = (unsigned long) filelen ( f );
|
||||
if ( len > MAX_BYTES_TO_READ )
|
||||
len = MAX_BYTES_TO_READ;
|
||||
buf.resize ( len );
|
||||
fread ( &buf[0], 1, len, f );
|
||||
fclose ( f );
|
||||
p = buf.c_str ();
|
||||
end = p + len;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::SkipWhitespace ()
|
||||
{
|
||||
while ( p < end && isspace ( *p ))
|
||||
p++;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::ReadInclude ( string& filename,
|
||||
bool& includeNext)
|
||||
{
|
||||
while ( p < end )
|
||||
{
|
||||
if ( ( *p == '#') && ( end - p > 13 ) )
|
||||
{
|
||||
bool include = false;
|
||||
p++;
|
||||
SkipWhitespace ();
|
||||
if ( strncmp ( p, "include ", 8 ) == 0 )
|
||||
{
|
||||
p += 8;
|
||||
includeNext = false;
|
||||
include = true;
|
||||
}
|
||||
if ( strncmp ( p, "include_next ", 13 ) == 0 )
|
||||
{
|
||||
p += 13;
|
||||
includeNext = true;
|
||||
include = true;
|
||||
}
|
||||
|
||||
if ( include )
|
||||
{
|
||||
SkipWhitespace ();
|
||||
if ( p < end && *p == '<' || *p == '"' )
|
||||
{
|
||||
p++;
|
||||
filename.resize ( MAX_PATH );
|
||||
int i = 0;
|
||||
while ( p < end && *p != '>' && *p != '"' && *p != '\n' )
|
||||
filename[i++] = *p++;
|
||||
filename.resize ( i );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
filename = "";
|
||||
includeNext = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::IsParentOf ( const SourceFile* parent,
|
||||
const SourceFile* child )
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( child->parents[i] == parent )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( IsParentOf ( parent,
|
||||
child->parents[i] ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::IsIncludedFrom ( const string& normalizedFilename )
|
||||
{
|
||||
if ( normalizedFilename == filename )
|
||||
return true;
|
||||
|
||||
SourceFile* sourceFile = automaticDependency->RetrieveFromCache ( normalizedFilename );
|
||||
if ( sourceFile == NULL )
|
||||
return false;
|
||||
|
||||
return IsParentOf ( sourceFile,
|
||||
this );
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
SourceFile::GetParentSourceFile ()
|
||||
{
|
||||
if ( isNonAutomaticDependency )
|
||||
return NULL;
|
||||
return this;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::CanProcessFile ( const string& extension )
|
||||
{
|
||||
if ( extension == ".h" || extension == ".H" )
|
||||
return true;
|
||||
if ( extension == ".c" || extension == ".C" )
|
||||
return true;
|
||||
if ( extension == ".cpp" || extension == ".CPP" )
|
||||
return true;
|
||||
if ( extension == ".rc" || extension == ".RC" )
|
||||
return true;
|
||||
if ( extension == ".s" || extension == ".S" )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
SourceFile::ParseFile ( const string& normalizedFilename )
|
||||
{
|
||||
string extension = GetExtension ( normalizedFilename );
|
||||
if ( CanProcessFile ( extension ) )
|
||||
{
|
||||
if ( IsIncludedFrom ( normalizedFilename ) )
|
||||
return NULL;
|
||||
|
||||
SourceFile* sourceFile = automaticDependency->RetrieveFromCacheOrParse ( module,
|
||||
normalizedFilename,
|
||||
GetParentSourceFile () );
|
||||
return sourceFile;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::Parse ()
|
||||
{
|
||||
Open ();
|
||||
while ( p < end )
|
||||
{
|
||||
string includedFilename ( "" );
|
||||
|
||||
bool includeNext;
|
||||
while ( ReadInclude ( includedFilename,
|
||||
includeNext ) )
|
||||
{
|
||||
string resolvedFilename ( "" );
|
||||
bool locatedFile = automaticDependency->LocateIncludedFile ( this,
|
||||
module,
|
||||
includedFilename,
|
||||
includeNext,
|
||||
resolvedFilename );
|
||||
if ( locatedFile )
|
||||
{
|
||||
SourceFile* sourceFile = ParseFile ( resolvedFilename );
|
||||
if ( sourceFile != NULL )
|
||||
files.push_back ( sourceFile );
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
Close ();
|
||||
}
|
||||
|
||||
string
|
||||
SourceFile::Location () const
|
||||
{
|
||||
int line = 1;
|
||||
const char* end_of_line = strchr ( buf.c_str (), '\n' );
|
||||
while ( end_of_line && end_of_line < p )
|
||||
{
|
||||
++line;
|
||||
end_of_line = strchr ( end_of_line + 1, '\n' );
|
||||
}
|
||||
return ssprintf ( "%s(%i)",
|
||||
filename.c_str (),
|
||||
line );
|
||||
}
|
||||
|
||||
|
||||
AutomaticDependency::AutomaticDependency ( const Project& project )
|
||||
: project ( project )
|
||||
{
|
||||
}
|
||||
|
||||
AutomaticDependency::~AutomaticDependency ()
|
||||
{
|
||||
std::map<std::string, SourceFile*>::iterator theIterator;
|
||||
for ( theIterator = sourcefile_map.begin (); theIterator != sourcefile_map.end (); theIterator++ )
|
||||
delete theIterator->second;
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::Process ()
|
||||
{
|
||||
for ( size_t i = 0; i < project.modules.size (); i++ )
|
||||
ProcessModule ( *project.modules[i] );
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::ProcessModule ( Module& module )
|
||||
{
|
||||
const vector<File*>& files = module.non_if_data.files;
|
||||
for ( size_t i = 0; i < files.size (); i++ )
|
||||
ProcessFile ( module, *files[i] );
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::ProcessFile ( Module& module,
|
||||
const File& file )
|
||||
{
|
||||
string normalizedFilename = NormalizeFilename ( file.name );
|
||||
RetrieveFromCacheOrParse ( module,
|
||||
normalizedFilename,
|
||||
NULL );
|
||||
}
|
||||
|
||||
bool
|
||||
AutomaticDependency::LocateIncludedFile ( const string& directory,
|
||||
const string& includedFilename,
|
||||
string& resolvedFilename )
|
||||
{
|
||||
string normalizedFilename = NormalizeFilename ( directory + SSEP + includedFilename );
|
||||
FILE* f = fopen ( normalizedFilename.c_str (), "rb" );
|
||||
if ( f != NULL )
|
||||
{
|
||||
fclose ( f );
|
||||
resolvedFilename = normalizedFilename;
|
||||
return true;
|
||||
}
|
||||
resolvedFilename = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
string
|
||||
AutomaticDependency::GetFilename ( const string& filename )
|
||||
{
|
||||
size_t index = filename.find_last_of ( CSEP );
|
||||
if (index == string::npos)
|
||||
return filename;
|
||||
else
|
||||
return filename.substr ( index + 1,
|
||||
filename.length () - index - 1);
|
||||
}
|
||||
|
||||
bool
|
||||
AutomaticDependency::LocateIncludedFile ( SourceFile* sourceFile,
|
||||
Module& module,
|
||||
const string& includedFilename,
|
||||
bool includeNext,
|
||||
string& resolvedFilename )
|
||||
{
|
||||
size_t i, j;
|
||||
const vector<Include*>* pincludes;
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( !i )
|
||||
pincludes = &module.non_if_data.includes;
|
||||
else
|
||||
pincludes = &module.project.non_if_data.includes;
|
||||
const vector<Include*>& includes = *pincludes;
|
||||
for ( j = 0; j < includes.size (); j++ )
|
||||
{
|
||||
Include& include = *includes[j];
|
||||
if ( LocateIncludedFile ( include.directory,
|
||||
includedFilename,
|
||||
resolvedFilename ) )
|
||||
{
|
||||
if ( includeNext && stricmp ( resolvedFilename.c_str (),
|
||||
sourceFile->filename.c_str () ) == 0 )
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolvedFilename = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
AutomaticDependency::RetrieveFromCacheOrParse ( Module& module,
|
||||
const string& filename,
|
||||
SourceFile* parentSourceFile )
|
||||
{
|
||||
SourceFile* sourceFile = sourcefile_map[filename];
|
||||
if ( sourceFile == NULL )
|
||||
{
|
||||
sourceFile = new SourceFile ( this,
|
||||
module,
|
||||
filename,
|
||||
parentSourceFile,
|
||||
false );
|
||||
sourcefile_map[filename] = sourceFile;
|
||||
sourceFile->Parse ();
|
||||
}
|
||||
else if ( parentSourceFile != NULL )
|
||||
sourceFile->parents.push_back ( parentSourceFile );
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
AutomaticDependency::RetrieveFromCache ( const string& filename )
|
||||
{
|
||||
return sourcefile_map[filename];
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::CheckAutomaticDependencies ( bool verbose )
|
||||
{
|
||||
struct utimbuf timebuf;
|
||||
for ( size_t mi = 0; mi < project.modules.size (); mi++ )
|
||||
{
|
||||
const vector<File*>& files = project.modules[mi]->non_if_data.files;
|
||||
for ( size_t fi = 0; fi < files.size (); fi++ )
|
||||
{
|
||||
File& file = *files[fi];
|
||||
string normalizedFilename = NormalizeFilename ( file.name );
|
||||
|
||||
SourceFile* sourceFile = RetrieveFromCache ( normalizedFilename );
|
||||
if ( sourceFile != NULL )
|
||||
{
|
||||
CheckAutomaticDependenciesForFile ( sourceFile );
|
||||
assert ( sourceFile->youngestLastWriteTime != 0 );
|
||||
if ( sourceFile->youngestLastWriteTime > sourceFile->lastWriteTime )
|
||||
{
|
||||
if ( verbose )
|
||||
{
|
||||
printf ( "Marking %s for rebuild due to younger file %s\n",
|
||||
sourceFile->filename.c_str (),
|
||||
sourceFile->youngestFile->filename.c_str () );
|
||||
}
|
||||
timebuf.actime = sourceFile->youngestLastWriteTime;
|
||||
timebuf.modtime = sourceFile->youngestLastWriteTime;
|
||||
utime ( sourceFile->filename.c_str (),
|
||||
&timebuf );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::CheckAutomaticDependenciesForFile ( SourceFile* sourceFile )
|
||||
{
|
||||
if ( sourceFile->youngestLastWriteTime > 0 )
|
||||
return;
|
||||
|
||||
if ( sourceFile->files.size () == 0 )
|
||||
{
|
||||
sourceFile->youngestLastWriteTime = sourceFile->lastWriteTime;
|
||||
sourceFile->youngestFile = sourceFile;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < sourceFile->files.size (); i++ )
|
||||
{
|
||||
SourceFile* childSourceFile = sourceFile->files[i];
|
||||
|
||||
CheckAutomaticDependenciesForFile ( childSourceFile );
|
||||
if ( ( childSourceFile->youngestLastWriteTime > sourceFile->youngestLastWriteTime ) ||
|
||||
( childSourceFile->lastWriteTime > sourceFile->youngestLastWriteTime ) )
|
||||
{
|
||||
if ( childSourceFile->youngestLastWriteTime > childSourceFile->lastWriteTime )
|
||||
{
|
||||
sourceFile->youngestLastWriteTime = childSourceFile->youngestLastWriteTime;
|
||||
sourceFile->youngestFile = childSourceFile->youngestFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceFile->youngestLastWriteTime = childSourceFile->lastWriteTime;
|
||||
sourceFile->youngestFile = childSourceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
/* Read at most this amount of bytes from each file and assume that all #includes are located within this block */
|
||||
#define MAX_BYTES_TO_READ 4096
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
SourceFile::SourceFile ( AutomaticDependency* automaticDependency,
|
||||
Module& module,
|
||||
const string& filename,
|
||||
SourceFile* parent,
|
||||
bool isNonAutomaticDependency )
|
||||
: automaticDependency ( automaticDependency ),
|
||||
module ( module ),
|
||||
filename ( filename ),
|
||||
isNonAutomaticDependency ( isNonAutomaticDependency ),
|
||||
youngestLastWriteTime ( 0 )
|
||||
{
|
||||
if ( parent != NULL )
|
||||
parents.push_back ( parent );
|
||||
GetDirectoryAndFilenameParts ();
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::GetDirectoryAndFilenameParts ()
|
||||
{
|
||||
size_t index = filename.find_last_of ( CSEP );
|
||||
if ( index != string::npos )
|
||||
{
|
||||
directoryPart = filename.substr ( 0, index );
|
||||
filenamePart = filename.substr ( index + 1, filename.length () - index );
|
||||
}
|
||||
else
|
||||
{
|
||||
directoryPart = "";
|
||||
filenamePart = filename;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::Close ()
|
||||
{
|
||||
buf.resize ( 0 );
|
||||
p = end = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::Open ()
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
Close ();
|
||||
FILE* f = fopen ( filename.c_str (), "rb" );
|
||||
if ( !f )
|
||||
throw FileNotFoundException ( filename );
|
||||
|
||||
if ( fstat ( fileno ( f ), &statbuf ) != 0 )
|
||||
{
|
||||
fclose ( f );
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
lastWriteTime = statbuf.st_mtime;
|
||||
|
||||
unsigned long len = (unsigned long) filelen ( f );
|
||||
if ( len > MAX_BYTES_TO_READ )
|
||||
len = MAX_BYTES_TO_READ;
|
||||
buf.resize ( len );
|
||||
fread ( &buf[0], 1, len, f );
|
||||
fclose ( f );
|
||||
p = buf.c_str ();
|
||||
end = p + len;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::SkipWhitespace ()
|
||||
{
|
||||
while ( p < end && isspace ( *p ))
|
||||
p++;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::ReadInclude ( string& filename,
|
||||
bool& includeNext)
|
||||
{
|
||||
while ( p < end )
|
||||
{
|
||||
if ( ( *p == '#') && ( end - p > 13 ) )
|
||||
{
|
||||
bool include = false;
|
||||
p++;
|
||||
SkipWhitespace ();
|
||||
if ( strncmp ( p, "include ", 8 ) == 0 )
|
||||
{
|
||||
p += 8;
|
||||
includeNext = false;
|
||||
include = true;
|
||||
}
|
||||
if ( strncmp ( p, "include_next ", 13 ) == 0 )
|
||||
{
|
||||
p += 13;
|
||||
includeNext = true;
|
||||
include = true;
|
||||
}
|
||||
|
||||
if ( include )
|
||||
{
|
||||
SkipWhitespace ();
|
||||
if ( p < end && *p == '<' || *p == '"' )
|
||||
{
|
||||
p++;
|
||||
filename.resize ( MAX_PATH );
|
||||
int i = 0;
|
||||
while ( p < end && *p != '>' && *p != '"' && *p != '\n' )
|
||||
filename[i++] = *p++;
|
||||
filename.resize ( i );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
filename = "";
|
||||
includeNext = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::IsParentOf ( const SourceFile* parent,
|
||||
const SourceFile* child )
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( child->parents[i] == parent )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( IsParentOf ( parent,
|
||||
child->parents[i] ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::IsIncludedFrom ( const string& normalizedFilename )
|
||||
{
|
||||
if ( normalizedFilename == filename )
|
||||
return true;
|
||||
|
||||
SourceFile* sourceFile = automaticDependency->RetrieveFromCache ( normalizedFilename );
|
||||
if ( sourceFile == NULL )
|
||||
return false;
|
||||
|
||||
return IsParentOf ( sourceFile,
|
||||
this );
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
SourceFile::GetParentSourceFile ()
|
||||
{
|
||||
if ( isNonAutomaticDependency )
|
||||
return NULL;
|
||||
return this;
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::CanProcessFile ( const string& extension )
|
||||
{
|
||||
if ( extension == ".h" || extension == ".H" )
|
||||
return true;
|
||||
if ( extension == ".c" || extension == ".C" )
|
||||
return true;
|
||||
if ( extension == ".cpp" || extension == ".CPP" )
|
||||
return true;
|
||||
if ( extension == ".rc" || extension == ".RC" )
|
||||
return true;
|
||||
if ( extension == ".s" || extension == ".S" )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
SourceFile::ParseFile ( const string& normalizedFilename )
|
||||
{
|
||||
string extension = GetExtension ( normalizedFilename );
|
||||
if ( CanProcessFile ( extension ) )
|
||||
{
|
||||
if ( IsIncludedFrom ( normalizedFilename ) )
|
||||
return NULL;
|
||||
|
||||
SourceFile* sourceFile = automaticDependency->RetrieveFromCacheOrParse ( module,
|
||||
normalizedFilename,
|
||||
GetParentSourceFile () );
|
||||
return sourceFile;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::Parse ()
|
||||
{
|
||||
Open ();
|
||||
while ( p < end )
|
||||
{
|
||||
string includedFilename ( "" );
|
||||
|
||||
bool includeNext;
|
||||
while ( ReadInclude ( includedFilename,
|
||||
includeNext ) )
|
||||
{
|
||||
string resolvedFilename ( "" );
|
||||
bool locatedFile = automaticDependency->LocateIncludedFile ( this,
|
||||
module,
|
||||
includedFilename,
|
||||
includeNext,
|
||||
resolvedFilename );
|
||||
if ( locatedFile )
|
||||
{
|
||||
SourceFile* sourceFile = ParseFile ( resolvedFilename );
|
||||
if ( sourceFile != NULL )
|
||||
files.push_back ( sourceFile );
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
Close ();
|
||||
}
|
||||
|
||||
string
|
||||
SourceFile::Location () const
|
||||
{
|
||||
int line = 1;
|
||||
const char* end_of_line = strchr ( buf.c_str (), '\n' );
|
||||
while ( end_of_line && end_of_line < p )
|
||||
{
|
||||
++line;
|
||||
end_of_line = strchr ( end_of_line + 1, '\n' );
|
||||
}
|
||||
return ssprintf ( "%s(%i)",
|
||||
filename.c_str (),
|
||||
line );
|
||||
}
|
||||
|
||||
|
||||
AutomaticDependency::AutomaticDependency ( const Project& project )
|
||||
: project ( project )
|
||||
{
|
||||
}
|
||||
|
||||
AutomaticDependency::~AutomaticDependency ()
|
||||
{
|
||||
std::map<std::string, SourceFile*>::iterator theIterator;
|
||||
for ( theIterator = sourcefile_map.begin (); theIterator != sourcefile_map.end (); theIterator++ )
|
||||
delete theIterator->second;
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::Process ()
|
||||
{
|
||||
for ( size_t i = 0; i < project.modules.size (); i++ )
|
||||
ProcessModule ( *project.modules[i] );
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::ProcessModule ( Module& module )
|
||||
{
|
||||
const vector<File*>& files = module.non_if_data.files;
|
||||
for ( size_t i = 0; i < files.size (); i++ )
|
||||
ProcessFile ( module, *files[i] );
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::ProcessFile ( Module& module,
|
||||
const File& file )
|
||||
{
|
||||
string normalizedFilename = NormalizeFilename ( file.name );
|
||||
RetrieveFromCacheOrParse ( module,
|
||||
normalizedFilename,
|
||||
NULL );
|
||||
}
|
||||
|
||||
bool
|
||||
AutomaticDependency::LocateIncludedFile ( const string& directory,
|
||||
const string& includedFilename,
|
||||
string& resolvedFilename )
|
||||
{
|
||||
string normalizedFilename = NormalizeFilename ( directory + SSEP + includedFilename );
|
||||
FILE* f = fopen ( normalizedFilename.c_str (), "rb" );
|
||||
if ( f != NULL )
|
||||
{
|
||||
fclose ( f );
|
||||
resolvedFilename = normalizedFilename;
|
||||
return true;
|
||||
}
|
||||
resolvedFilename = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
string
|
||||
AutomaticDependency::GetFilename ( const string& filename )
|
||||
{
|
||||
size_t index = filename.find_last_of ( CSEP );
|
||||
if (index == string::npos)
|
||||
return filename;
|
||||
else
|
||||
return filename.substr ( index + 1,
|
||||
filename.length () - index - 1);
|
||||
}
|
||||
|
||||
bool
|
||||
AutomaticDependency::LocateIncludedFile ( SourceFile* sourceFile,
|
||||
Module& module,
|
||||
const string& includedFilename,
|
||||
bool includeNext,
|
||||
string& resolvedFilename )
|
||||
{
|
||||
size_t i, j;
|
||||
const vector<Include*>* pincludes;
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( !i )
|
||||
pincludes = &module.non_if_data.includes;
|
||||
else
|
||||
pincludes = &module.project.non_if_data.includes;
|
||||
const vector<Include*>& includes = *pincludes;
|
||||
for ( j = 0; j < includes.size (); j++ )
|
||||
{
|
||||
Include& include = *includes[j];
|
||||
if ( LocateIncludedFile ( include.directory,
|
||||
includedFilename,
|
||||
resolvedFilename ) )
|
||||
{
|
||||
if ( includeNext && stricmp ( resolvedFilename.c_str (),
|
||||
sourceFile->filename.c_str () ) == 0 )
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolvedFilename = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
AutomaticDependency::RetrieveFromCacheOrParse ( Module& module,
|
||||
const string& filename,
|
||||
SourceFile* parentSourceFile )
|
||||
{
|
||||
SourceFile* sourceFile = sourcefile_map[filename];
|
||||
if ( sourceFile == NULL )
|
||||
{
|
||||
sourceFile = new SourceFile ( this,
|
||||
module,
|
||||
filename,
|
||||
parentSourceFile,
|
||||
false );
|
||||
sourcefile_map[filename] = sourceFile;
|
||||
sourceFile->Parse ();
|
||||
}
|
||||
else if ( parentSourceFile != NULL )
|
||||
sourceFile->parents.push_back ( parentSourceFile );
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
SourceFile*
|
||||
AutomaticDependency::RetrieveFromCache ( const string& filename )
|
||||
{
|
||||
return sourcefile_map[filename];
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::CheckAutomaticDependencies ( bool verbose )
|
||||
{
|
||||
struct utimbuf timebuf;
|
||||
for ( size_t mi = 0; mi < project.modules.size (); mi++ )
|
||||
{
|
||||
const vector<File*>& files = project.modules[mi]->non_if_data.files;
|
||||
for ( size_t fi = 0; fi < files.size (); fi++ )
|
||||
{
|
||||
File& file = *files[fi];
|
||||
string normalizedFilename = NormalizeFilename ( file.name );
|
||||
|
||||
SourceFile* sourceFile = RetrieveFromCache ( normalizedFilename );
|
||||
if ( sourceFile != NULL )
|
||||
{
|
||||
CheckAutomaticDependenciesForFile ( sourceFile );
|
||||
assert ( sourceFile->youngestLastWriteTime != 0 );
|
||||
if ( sourceFile->youngestLastWriteTime > sourceFile->lastWriteTime )
|
||||
{
|
||||
if ( verbose )
|
||||
{
|
||||
printf ( "Marking %s for rebuild due to younger file %s\n",
|
||||
sourceFile->filename.c_str (),
|
||||
sourceFile->youngestFile->filename.c_str () );
|
||||
}
|
||||
timebuf.actime = sourceFile->youngestLastWriteTime;
|
||||
timebuf.modtime = sourceFile->youngestLastWriteTime;
|
||||
utime ( sourceFile->filename.c_str (),
|
||||
&timebuf );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::CheckAutomaticDependenciesForFile ( SourceFile* sourceFile )
|
||||
{
|
||||
if ( sourceFile->youngestLastWriteTime > 0 )
|
||||
return;
|
||||
|
||||
if ( sourceFile->files.size () == 0 )
|
||||
{
|
||||
sourceFile->youngestLastWriteTime = sourceFile->lastWriteTime;
|
||||
sourceFile->youngestFile = sourceFile;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < sourceFile->files.size (); i++ )
|
||||
{
|
||||
SourceFile* childSourceFile = sourceFile->files[i];
|
||||
|
||||
CheckAutomaticDependenciesForFile ( childSourceFile );
|
||||
if ( ( childSourceFile->youngestLastWriteTime > sourceFile->youngestLastWriteTime ) ||
|
||||
( childSourceFile->lastWriteTime > sourceFile->youngestLastWriteTime ) )
|
||||
{
|
||||
if ( childSourceFile->youngestLastWriteTime > childSourceFile->lastWriteTime )
|
||||
{
|
||||
sourceFile->youngestLastWriteTime = childSourceFile->youngestLastWriteTime;
|
||||
sourceFile->youngestFile = childSourceFile->youngestFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceFile->youngestLastWriteTime = childSourceFile->lastWriteTime;
|
||||
sourceFile->youngestFile = childSourceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
|
||||
#include "../pch.h"
|
||||
|
||||
#include "../rbuild.h"
|
||||
#include "backend.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
map<string,Backend::Factory*>*
|
||||
Backend::Factory::factories = NULL;
|
||||
int
|
||||
Backend::Factory::ref = 0;
|
||||
|
||||
Backend::Factory::Factory ( const std::string& name_ )
|
||||
{
|
||||
string name(name_);
|
||||
strlwr ( &name[0] );
|
||||
if ( !ref++ )
|
||||
factories = new map<string,Factory*>;
|
||||
(*factories)[name] = this;
|
||||
}
|
||||
|
||||
Backend::Factory::~Factory ()
|
||||
{
|
||||
if ( !--ref )
|
||||
{
|
||||
delete factories;
|
||||
factories = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ Backend*
|
||||
Backend::Factory::Create ( const string& name,
|
||||
Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo )
|
||||
{
|
||||
string sname ( name );
|
||||
strlwr ( &sname[0] );
|
||||
if ( !factories || !factories->size () )
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__,
|
||||
"No registered factories" );
|
||||
Backend::Factory* f = (*factories)[sname];
|
||||
if ( !f )
|
||||
{
|
||||
throw UnknownBackendException ( sname );
|
||||
return NULL;
|
||||
}
|
||||
return (*f) ( project, verbose, cleanAsYouGo );
|
||||
}
|
||||
|
||||
Backend::Backend ( Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo )
|
||||
: ProjectNode ( project ),
|
||||
verbose ( verbose ),
|
||||
cleanAsYouGo ( cleanAsYouGo )
|
||||
{
|
||||
}
|
||||
|
||||
#include "../pch.h"
|
||||
|
||||
#include "../rbuild.h"
|
||||
#include "backend.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
map<string,Backend::Factory*>*
|
||||
Backend::Factory::factories = NULL;
|
||||
int
|
||||
Backend::Factory::ref = 0;
|
||||
|
||||
Backend::Factory::Factory ( const std::string& name_ )
|
||||
{
|
||||
string name(name_);
|
||||
strlwr ( &name[0] );
|
||||
if ( !ref++ )
|
||||
factories = new map<string,Factory*>;
|
||||
(*factories)[name] = this;
|
||||
}
|
||||
|
||||
Backend::Factory::~Factory ()
|
||||
{
|
||||
if ( !--ref )
|
||||
{
|
||||
delete factories;
|
||||
factories = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ Backend*
|
||||
Backend::Factory::Create ( const string& name,
|
||||
Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo )
|
||||
{
|
||||
string sname ( name );
|
||||
strlwr ( &sname[0] );
|
||||
if ( !factories || !factories->size () )
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__,
|
||||
"No registered factories" );
|
||||
Backend::Factory* f = (*factories)[sname];
|
||||
if ( !f )
|
||||
{
|
||||
throw UnknownBackendException ( sname );
|
||||
return NULL;
|
||||
}
|
||||
return (*f) ( project, verbose, cleanAsYouGo );
|
||||
}
|
||||
|
||||
Backend::Backend ( Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo )
|
||||
: ProjectNode ( project ),
|
||||
verbose ( verbose ),
|
||||
cleanAsYouGo ( cleanAsYouGo )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
#ifndef __BACKEND_H
|
||||
#define __BACKEND_H
|
||||
|
||||
#include "../rbuild.h"
|
||||
|
||||
class Backend;
|
||||
|
||||
typedef Backend* BackendFactory ( Project& project,
|
||||
bool verbose );
|
||||
|
||||
class Backend
|
||||
{
|
||||
public:
|
||||
class Factory
|
||||
{
|
||||
static std::map<std::string,Factory*>* factories;
|
||||
static int ref;
|
||||
|
||||
protected:
|
||||
|
||||
Factory ( const std::string& name_ );
|
||||
virtual ~Factory();
|
||||
|
||||
virtual Backend* operator() ( Project&,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo ) = 0;
|
||||
|
||||
public:
|
||||
static Backend* Create ( const std::string& name,
|
||||
Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo );
|
||||
};
|
||||
|
||||
protected:
|
||||
Backend ( Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo );
|
||||
|
||||
public:
|
||||
virtual void Process () = 0;
|
||||
Project& ProjectNode;
|
||||
bool verbose;
|
||||
bool cleanAsYouGo;
|
||||
};
|
||||
|
||||
#endif /* __BACKEND_H */
|
||||
#ifndef __BACKEND_H
|
||||
#define __BACKEND_H
|
||||
|
||||
#include "../rbuild.h"
|
||||
|
||||
class Backend;
|
||||
|
||||
typedef Backend* BackendFactory ( Project& project,
|
||||
bool verbose );
|
||||
|
||||
class Backend
|
||||
{
|
||||
public:
|
||||
class Factory
|
||||
{
|
||||
static std::map<std::string,Factory*>* factories;
|
||||
static int ref;
|
||||
|
||||
protected:
|
||||
|
||||
Factory ( const std::string& name_ );
|
||||
virtual ~Factory();
|
||||
|
||||
virtual Backend* operator() ( Project&,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo ) = 0;
|
||||
|
||||
public:
|
||||
static Backend* Create ( const std::string& name,
|
||||
Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo );
|
||||
};
|
||||
|
||||
protected:
|
||||
Backend ( Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo );
|
||||
|
||||
public:
|
||||
virtual void Process () = 0;
|
||||
Project& ProjectNode;
|
||||
bool verbose;
|
||||
bool cleanAsYouGo;
|
||||
};
|
||||
|
||||
#endif /* __BACKEND_H */
|
||||
|
|
|
@ -1,251 +1,251 @@
|
|||
/*
|
||||
* Dev-C++ Backend
|
||||
* Copyright (C) 2005 Trevor McCort
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "devcpp.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static class DevCppFactory : public Backend::Factory
|
||||
{
|
||||
public:
|
||||
|
||||
DevCppFactory() : Factory("devcpp") {}
|
||||
Backend *operator() (Project &project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo)
|
||||
{
|
||||
return new DevCppBackend(project, verbose, cleanAsYouGo);
|
||||
}
|
||||
|
||||
} factory;
|
||||
|
||||
|
||||
DevCppBackend::DevCppBackend(Project &project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo) : Backend(project, verbose, cleanAsYouGo)
|
||||
{
|
||||
m_unitCount = 0;
|
||||
}
|
||||
|
||||
void DevCppBackend::Process()
|
||||
{
|
||||
string filename = ProjectNode.name + ".dev";
|
||||
|
||||
cout << "Creating Dev-C++ project: " << filename << endl;
|
||||
|
||||
ProcessModules();
|
||||
|
||||
m_devFile.open(filename.c_str());
|
||||
|
||||
if(!m_devFile.is_open())
|
||||
{
|
||||
cout << "Could not open file." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
m_devFile << "[Project]" << endl;
|
||||
|
||||
m_devFile << "FileName=" << filename << endl
|
||||
<< "Name=" << ProjectNode.name << endl
|
||||
<< "UnitCount=" << m_unitCount << endl
|
||||
<< "Type=1" << endl
|
||||
<< "Ver=1" << endl
|
||||
<< "ObjFiles=" << endl
|
||||
<< "Includes=" << endl
|
||||
<< "Libs=" << endl
|
||||
<< "PrivateResource=" << endl
|
||||
<< "ResourceIncludes=" << endl
|
||||
<< "MakeIncludes=" << endl
|
||||
<< "Compiler=" << endl
|
||||
<< "CppCompiler=" << endl
|
||||
<< "Linker=" << endl
|
||||
<< "IsCpp=1" << endl
|
||||
<< "Icon=" << endl
|
||||
<< "ExeOutput=" << endl
|
||||
<< "ObjectOutput=" << endl
|
||||
<< "OverrideOutput=0" << endl
|
||||
<< "OverrideOutputName=" << endl
|
||||
<< "HostApplication=" << endl
|
||||
<< "CommandLine=" << endl
|
||||
<< "UseCustomMakefile=1" << endl
|
||||
<< "CustomMakefile=" << ProjectNode.makefile << endl
|
||||
<< "IncludeVersionInto=0" << endl
|
||||
<< "SupportXPThemes=0" << endl
|
||||
<< "CompilerSet=0" << endl
|
||||
|
||||
<< "CompilerSettings=0000000000000000000000" << endl;
|
||||
|
||||
OutputFolders();
|
||||
|
||||
m_devFile << endl << endl;
|
||||
|
||||
OutputFileUnits();
|
||||
|
||||
m_devFile.close();
|
||||
|
||||
// Dev-C++ needs a makefile, so use the MinGW backend to create one.
|
||||
|
||||
cout << "Creating Makefile: " << ProjectNode.makefile << endl;
|
||||
|
||||
Backend *backend = Backend::Factory::Create("mingw",
|
||||
ProjectNode,
|
||||
verbose,
|
||||
cleanAsYouGo );
|
||||
backend->Process();
|
||||
delete backend;
|
||||
|
||||
cout << "Done." << endl << endl;
|
||||
|
||||
cout << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the "
|
||||
<< "parsing required for large projects can take quite awhile."
|
||||
<< endl << endl
|
||||
<< "(Tools->Editor Options->Class browsing->Enable class browsing check box)"
|
||||
<< endl << endl;
|
||||
}
|
||||
|
||||
void DevCppBackend::ProcessModules()
|
||||
{
|
||||
for(size_t i = 0; i < ProjectNode.modules.size(); i++)
|
||||
{
|
||||
Module &module = *ProjectNode.modules[i];
|
||||
|
||||
for(size_t k = 0; k < module.non_if_data.files.size(); k++)
|
||||
{
|
||||
File &file = *module.non_if_data.files[k];
|
||||
|
||||
ProcessFile(file.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileExists(string &filename)
|
||||
{
|
||||
ifstream file(filename.c_str());
|
||||
|
||||
if(!file.is_open())
|
||||
return false;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DevCppBackend::ProcessFile(string &filepath)
|
||||
{
|
||||
// Remove the .\ at the start of the filenames
|
||||
filepath.erase(0, 2);
|
||||
|
||||
if(!FileExists(filepath))
|
||||
return;
|
||||
|
||||
// Change the \ to /
|
||||
for(size_t i = 0; i < filepath.length(); i++)
|
||||
{
|
||||
if(filepath[i] == '\\')
|
||||
filepath[i] = '/';
|
||||
}
|
||||
|
||||
// Remove the filename from the path
|
||||
string folder = "";
|
||||
|
||||
size_t pos = filepath.rfind(string("/"), filepath.length() - 1);
|
||||
|
||||
if(pos != string::npos)
|
||||
{
|
||||
folder = filepath;
|
||||
folder.erase(pos, folder.length() - pos);
|
||||
}
|
||||
|
||||
FileUnit fileUnit;
|
||||
fileUnit.filename = filepath;
|
||||
fileUnit.folder = folder;
|
||||
|
||||
m_fileUnits.push_back(fileUnit);
|
||||
|
||||
if(folder != "")
|
||||
AddFolders(folder);
|
||||
|
||||
m_unitCount++;
|
||||
}
|
||||
|
||||
bool DevCppBackend::CheckFolderAdded(string &folder)
|
||||
{
|
||||
for(size_t i = 0; i < m_folders.size(); i++)
|
||||
{
|
||||
if(m_folders[i] == folder)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DevCppBackend::AddFolders(string &folder)
|
||||
{
|
||||
// Check if this folder was already added. true if it was, false otherwise.
|
||||
if(CheckFolderAdded(folder))
|
||||
return;
|
||||
|
||||
m_folders.push_back(folder);
|
||||
|
||||
size_t pos = folder.rfind(string("/"), folder.length() - 1);
|
||||
|
||||
if(pos == string::npos)
|
||||
return;
|
||||
|
||||
folder.erase(pos, folder.length() - pos);
|
||||
AddFolders(folder);
|
||||
}
|
||||
|
||||
void DevCppBackend::OutputFolders()
|
||||
{
|
||||
m_devFile << "Folders=";
|
||||
|
||||
for(size_t i = 0; i < m_folders.size(); i++)
|
||||
{
|
||||
if(i > 0)
|
||||
m_devFile << ",";
|
||||
|
||||
m_devFile << m_folders[i];
|
||||
}
|
||||
}
|
||||
|
||||
void DevCppBackend::OutputFileUnits()
|
||||
{
|
||||
for(size_t i = 0; i < m_fileUnits.size(); i++)
|
||||
{
|
||||
m_devFile << "[Unit" << i + 1 << "]" << endl;
|
||||
|
||||
|
||||
m_devFile << "FileName=" << m_fileUnits[i].filename << endl;
|
||||
m_devFile << "CompileCpp=1" << endl;
|
||||
m_devFile << "Folder=" << m_fileUnits[i].folder << endl;
|
||||
m_devFile << "Compile=1" << endl;
|
||||
m_devFile << "Link=1" << endl;
|
||||
m_devFile << "Priority=1000" << endl;
|
||||
m_devFile << "OverrideBuildCmd=0" << endl;
|
||||
m_devFile << "BuildCmd=" << endl << endl;;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Dev-C++ Backend
|
||||
* Copyright (C) 2005 Trevor McCort
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "devcpp.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static class DevCppFactory : public Backend::Factory
|
||||
{
|
||||
public:
|
||||
|
||||
DevCppFactory() : Factory("devcpp") {}
|
||||
Backend *operator() (Project &project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo)
|
||||
{
|
||||
return new DevCppBackend(project, verbose, cleanAsYouGo);
|
||||
}
|
||||
|
||||
} factory;
|
||||
|
||||
|
||||
DevCppBackend::DevCppBackend(Project &project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo) : Backend(project, verbose, cleanAsYouGo)
|
||||
{
|
||||
m_unitCount = 0;
|
||||
}
|
||||
|
||||
void DevCppBackend::Process()
|
||||
{
|
||||
string filename = ProjectNode.name + ".dev";
|
||||
|
||||
cout << "Creating Dev-C++ project: " << filename << endl;
|
||||
|
||||
ProcessModules();
|
||||
|
||||
m_devFile.open(filename.c_str());
|
||||
|
||||
if(!m_devFile.is_open())
|
||||
{
|
||||
cout << "Could not open file." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
m_devFile << "[Project]" << endl;
|
||||
|
||||
m_devFile << "FileName=" << filename << endl
|
||||
<< "Name=" << ProjectNode.name << endl
|
||||
<< "UnitCount=" << m_unitCount << endl
|
||||
<< "Type=1" << endl
|
||||
<< "Ver=1" << endl
|
||||
<< "ObjFiles=" << endl
|
||||
<< "Includes=" << endl
|
||||
<< "Libs=" << endl
|
||||
<< "PrivateResource=" << endl
|
||||
<< "ResourceIncludes=" << endl
|
||||
<< "MakeIncludes=" << endl
|
||||
<< "Compiler=" << endl
|
||||
<< "CppCompiler=" << endl
|
||||
<< "Linker=" << endl
|
||||
<< "IsCpp=1" << endl
|
||||
<< "Icon=" << endl
|
||||
<< "ExeOutput=" << endl
|
||||
<< "ObjectOutput=" << endl
|
||||
<< "OverrideOutput=0" << endl
|
||||
<< "OverrideOutputName=" << endl
|
||||
<< "HostApplication=" << endl
|
||||
<< "CommandLine=" << endl
|
||||
<< "UseCustomMakefile=1" << endl
|
||||
<< "CustomMakefile=" << ProjectNode.makefile << endl
|
||||
<< "IncludeVersionInto=0" << endl
|
||||
<< "SupportXPThemes=0" << endl
|
||||
<< "CompilerSet=0" << endl
|
||||
|
||||
<< "CompilerSettings=0000000000000000000000" << endl;
|
||||
|
||||
OutputFolders();
|
||||
|
||||
m_devFile << endl << endl;
|
||||
|
||||
OutputFileUnits();
|
||||
|
||||
m_devFile.close();
|
||||
|
||||
// Dev-C++ needs a makefile, so use the MinGW backend to create one.
|
||||
|
||||
cout << "Creating Makefile: " << ProjectNode.makefile << endl;
|
||||
|
||||
Backend *backend = Backend::Factory::Create("mingw",
|
||||
ProjectNode,
|
||||
verbose,
|
||||
cleanAsYouGo );
|
||||
backend->Process();
|
||||
delete backend;
|
||||
|
||||
cout << "Done." << endl << endl;
|
||||
|
||||
cout << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the "
|
||||
<< "parsing required for large projects can take quite awhile."
|
||||
<< endl << endl
|
||||
<< "(Tools->Editor Options->Class browsing->Enable class browsing check box)"
|
||||
<< endl << endl;
|
||||
}
|
||||
|
||||
void DevCppBackend::ProcessModules()
|
||||
{
|
||||
for(size_t i = 0; i < ProjectNode.modules.size(); i++)
|
||||
{
|
||||
Module &module = *ProjectNode.modules[i];
|
||||
|
||||
for(size_t k = 0; k < module.non_if_data.files.size(); k++)
|
||||
{
|
||||
File &file = *module.non_if_data.files[k];
|
||||
|
||||
ProcessFile(file.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileExists(string &filename)
|
||||
{
|
||||
ifstream file(filename.c_str());
|
||||
|
||||
if(!file.is_open())
|
||||
return false;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DevCppBackend::ProcessFile(string &filepath)
|
||||
{
|
||||
// Remove the .\ at the start of the filenames
|
||||
filepath.erase(0, 2);
|
||||
|
||||
if(!FileExists(filepath))
|
||||
return;
|
||||
|
||||
// Change the \ to /
|
||||
for(size_t i = 0; i < filepath.length(); i++)
|
||||
{
|
||||
if(filepath[i] == '\\')
|
||||
filepath[i] = '/';
|
||||
}
|
||||
|
||||
// Remove the filename from the path
|
||||
string folder = "";
|
||||
|
||||
size_t pos = filepath.rfind(string("/"), filepath.length() - 1);
|
||||
|
||||
if(pos != string::npos)
|
||||
{
|
||||
folder = filepath;
|
||||
folder.erase(pos, folder.length() - pos);
|
||||
}
|
||||
|
||||
FileUnit fileUnit;
|
||||
fileUnit.filename = filepath;
|
||||
fileUnit.folder = folder;
|
||||
|
||||
m_fileUnits.push_back(fileUnit);
|
||||
|
||||
if(folder != "")
|
||||
AddFolders(folder);
|
||||
|
||||
m_unitCount++;
|
||||
}
|
||||
|
||||
bool DevCppBackend::CheckFolderAdded(string &folder)
|
||||
{
|
||||
for(size_t i = 0; i < m_folders.size(); i++)
|
||||
{
|
||||
if(m_folders[i] == folder)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DevCppBackend::AddFolders(string &folder)
|
||||
{
|
||||
// Check if this folder was already added. true if it was, false otherwise.
|
||||
if(CheckFolderAdded(folder))
|
||||
return;
|
||||
|
||||
m_folders.push_back(folder);
|
||||
|
||||
size_t pos = folder.rfind(string("/"), folder.length() - 1);
|
||||
|
||||
if(pos == string::npos)
|
||||
return;
|
||||
|
||||
folder.erase(pos, folder.length() - pos);
|
||||
AddFolders(folder);
|
||||
}
|
||||
|
||||
void DevCppBackend::OutputFolders()
|
||||
{
|
||||
m_devFile << "Folders=";
|
||||
|
||||
for(size_t i = 0; i < m_folders.size(); i++)
|
||||
{
|
||||
if(i > 0)
|
||||
m_devFile << ",";
|
||||
|
||||
m_devFile << m_folders[i];
|
||||
}
|
||||
}
|
||||
|
||||
void DevCppBackend::OutputFileUnits()
|
||||
{
|
||||
for(size_t i = 0; i < m_fileUnits.size(); i++)
|
||||
{
|
||||
m_devFile << "[Unit" << i + 1 << "]" << endl;
|
||||
|
||||
|
||||
m_devFile << "FileName=" << m_fileUnits[i].filename << endl;
|
||||
m_devFile << "CompileCpp=1" << endl;
|
||||
m_devFile << "Folder=" << m_fileUnits[i].folder << endl;
|
||||
m_devFile << "Compile=1" << endl;
|
||||
m_devFile << "Link=1" << endl;
|
||||
m_devFile << "Priority=1000" << endl;
|
||||
m_devFile << "OverrideBuildCmd=0" << endl;
|
||||
m_devFile << "BuildCmd=" << endl << endl;;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
|
||||
#ifndef __DEVCPP_H__
|
||||
#define __DEVCPP_H__
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../backend.h"
|
||||
|
||||
class FileUnit
|
||||
{
|
||||
public:
|
||||
std::string filename;
|
||||
std::string folder;
|
||||
};
|
||||
|
||||
class DevCppBackend : public Backend
|
||||
{
|
||||
public:
|
||||
|
||||
DevCppBackend(Project &project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo);
|
||||
virtual ~DevCppBackend() {}
|
||||
|
||||
virtual void Process();
|
||||
|
||||
private:
|
||||
|
||||
void ProcessModules();
|
||||
void ProcessFile(std::string &filename);
|
||||
|
||||
bool CheckFolderAdded(std::string &folder);
|
||||
void AddFolders(std::string &folder);
|
||||
|
||||
void OutputFolders();
|
||||
void OutputFileUnits();
|
||||
|
||||
std::vector<FileUnit> m_fileUnits;
|
||||
std::vector<std::string> m_folders;
|
||||
|
||||
int m_unitCount;
|
||||
|
||||
std::ofstream m_devFile;
|
||||
};
|
||||
|
||||
#endif // __DEVCPP_H__
|
||||
|
||||
|
||||
#ifndef __DEVCPP_H__
|
||||
#define __DEVCPP_H__
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../backend.h"
|
||||
|
||||
class FileUnit
|
||||
{
|
||||
public:
|
||||
std::string filename;
|
||||
std::string folder;
|
||||
};
|
||||
|
||||
class DevCppBackend : public Backend
|
||||
{
|
||||
public:
|
||||
|
||||
DevCppBackend(Project &project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo);
|
||||
virtual ~DevCppBackend() {}
|
||||
|
||||
virtual void Process();
|
||||
|
||||
private:
|
||||
|
||||
void ProcessModules();
|
||||
void ProcessFile(std::string &filename);
|
||||
|
||||
bool CheckFolderAdded(std::string &folder);
|
||||
void AddFolders(std::string &folder);
|
||||
|
||||
void OutputFolders();
|
||||
void OutputFileUnits();
|
||||
|
||||
std::vector<FileUnit> m_fileUnits;
|
||||
std::vector<std::string> m_folders;
|
||||
|
||||
int m_unitCount;
|
||||
|
||||
std::ofstream m_devFile;
|
||||
};
|
||||
|
||||
#endif // __DEVCPP_H__
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,112 +1,112 @@
|
|||
#ifndef MINGW_H
|
||||
#define MINGW_H
|
||||
|
||||
#include "../backend.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define NUL "NUL"
|
||||
#else
|
||||
#define NUL "/dev/null"
|
||||
#endif
|
||||
|
||||
class Directory;
|
||||
class MingwModuleHandler;
|
||||
|
||||
extern std::string
|
||||
v2s ( const string_list& v, int wrap_at );
|
||||
|
||||
typedef std::map<std::string,Directory*> directory_map;
|
||||
|
||||
|
||||
class Environment
|
||||
{
|
||||
public:
|
||||
static std::string GetVariable ( const std::string& name );
|
||||
};
|
||||
|
||||
|
||||
class Directory
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
directory_map subdirs;
|
||||
Directory ( const std::string& name );
|
||||
void Add ( const char* subdir );
|
||||
void GenerateTree ( const std::string& parent,
|
||||
bool verbose );
|
||||
private:
|
||||
bool mkdir_p ( const char* path );
|
||||
std::string ReplaceVariable ( std::string name,
|
||||
std::string value,
|
||||
std::string path );
|
||||
std::string GetEnvironmentVariable ( const std::string& name );
|
||||
std::string GetEnvironmentVariablePathOrDefault ( const std::string& name,
|
||||
const std::string& defaultValue );
|
||||
std::string GetIntermediatePath ();
|
||||
std::string GetOutputPath ();
|
||||
std::string GetInstallPath ();
|
||||
void ResolveVariablesInPath ( char* buf,
|
||||
std::string path );
|
||||
bool CreateDirectory ( std::string path );
|
||||
};
|
||||
|
||||
|
||||
class MingwBackend : public Backend
|
||||
{
|
||||
public:
|
||||
MingwBackend ( Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo );
|
||||
virtual ~MingwBackend ();
|
||||
virtual void Process ();
|
||||
std::string AddDirectoryTarget ( const std::string& directory,
|
||||
Directory* directoryTree );
|
||||
std::string compilerCommand;
|
||||
bool usePipe;
|
||||
Directory* intermediateDirectory;
|
||||
Directory* outputDirectory;
|
||||
Directory* installDirectory;
|
||||
private:
|
||||
void CreateMakefile ();
|
||||
void CloseMakefile () const;
|
||||
void GenerateHeader () const;
|
||||
void GenerateProjectCFlagsMacro ( const char* assignmentOperation,
|
||||
IfableData& data ) const;
|
||||
void GenerateGlobalCFlagsAndProperties ( const char* op,
|
||||
IfableData& data ) const;
|
||||
std::string GenerateProjectLFLAGS () const;
|
||||
void GenerateDirectories ();
|
||||
void GenerateGlobalVariables () const;
|
||||
bool IncludeInAllTarget ( const Module& module ) const;
|
||||
void GenerateAllTarget ( const std::vector<MingwModuleHandler*>& handlers ) const;
|
||||
std::string GetBuildToolDependencies () const;
|
||||
void GenerateInitTarget () const;
|
||||
void GenerateXmlBuildFilesMacro() const;
|
||||
void CheckAutomaticDependencies ();
|
||||
bool IncludeDirectoryTarget ( const std::string& directory ) const;
|
||||
bool TryToDetectThisCompiler ( const std::string& compiler );
|
||||
void DetectCompiler ();
|
||||
void DetectPipeSupport ();
|
||||
void DetectPCHSupport ();
|
||||
void ProcessModules ();
|
||||
std::string GetNonModuleInstallDirectories ( const std::string& installDirectory );
|
||||
std::string GetInstallDirectories ( const std::string& installDirectory );
|
||||
void GetNonModuleInstallFiles ( std::vector<std::string>& out ) const;
|
||||
void GetInstallFiles ( std::vector<std::string>& out ) const;
|
||||
void GetNonModuleInstallTargetFiles ( std::vector<std::string>& out ) const;
|
||||
void GetModuleInstallTargetFiles ( std::vector<std::string>& out ) const;
|
||||
void GetInstallTargetFiles ( std::vector<std::string>& out ) const;
|
||||
void OutputInstallTarget ( const std::string& sourceFilename,
|
||||
const std::string& targetFilename,
|
||||
const std::string& targetDirectory );
|
||||
void OutputNonModuleInstallTargets ();
|
||||
void OutputModuleInstallTargets ();
|
||||
std::string GetRegistrySourceFiles ();
|
||||
std::string GetRegistryTargetFiles ();
|
||||
void OutputRegistryInstallTarget ();
|
||||
void GenerateInstallTarget ();
|
||||
FILE* fMakefile;
|
||||
bool use_pch;
|
||||
};
|
||||
|
||||
#endif /* MINGW_H */
|
||||
#ifndef MINGW_H
|
||||
#define MINGW_H
|
||||
|
||||
#include "../backend.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define NUL "NUL"
|
||||
#else
|
||||
#define NUL "/dev/null"
|
||||
#endif
|
||||
|
||||
class Directory;
|
||||
class MingwModuleHandler;
|
||||
|
||||
extern std::string
|
||||
v2s ( const string_list& v, int wrap_at );
|
||||
|
||||
typedef std::map<std::string,Directory*> directory_map;
|
||||
|
||||
|
||||
class Environment
|
||||
{
|
||||
public:
|
||||
static std::string GetVariable ( const std::string& name );
|
||||
};
|
||||
|
||||
|
||||
class Directory
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
directory_map subdirs;
|
||||
Directory ( const std::string& name );
|
||||
void Add ( const char* subdir );
|
||||
void GenerateTree ( const std::string& parent,
|
||||
bool verbose );
|
||||
private:
|
||||
bool mkdir_p ( const char* path );
|
||||
std::string ReplaceVariable ( std::string name,
|
||||
std::string value,
|
||||
std::string path );
|
||||
std::string GetEnvironmentVariable ( const std::string& name );
|
||||
std::string GetEnvironmentVariablePathOrDefault ( const std::string& name,
|
||||
const std::string& defaultValue );
|
||||
std::string GetIntermediatePath ();
|
||||
std::string GetOutputPath ();
|
||||
std::string GetInstallPath ();
|
||||
void ResolveVariablesInPath ( char* buf,
|
||||
std::string path );
|
||||
bool CreateDirectory ( std::string path );
|
||||
};
|
||||
|
||||
|
||||
class MingwBackend : public Backend
|
||||
{
|
||||
public:
|
||||
MingwBackend ( Project& project,
|
||||
bool verbose,
|
||||
bool cleanAsYouGo );
|
||||
virtual ~MingwBackend ();
|
||||
virtual void Process ();
|
||||
std::string AddDirectoryTarget ( const std::string& directory,
|
||||
Directory* directoryTree );
|
||||
std::string compilerCommand;
|
||||
bool usePipe;
|
||||
Directory* intermediateDirectory;
|
||||
Directory* outputDirectory;
|
||||
Directory* installDirectory;
|
||||
private:
|
||||
void CreateMakefile ();
|
||||
void CloseMakefile () const;
|
||||
void GenerateHeader () const;
|
||||
void GenerateProjectCFlagsMacro ( const char* assignmentOperation,
|
||||
IfableData& data ) const;
|
||||
void GenerateGlobalCFlagsAndProperties ( const char* op,
|
||||
IfableData& data ) const;
|
||||
std::string GenerateProjectLFLAGS () const;
|
||||
void GenerateDirectories ();
|
||||
void GenerateGlobalVariables () const;
|
||||
bool IncludeInAllTarget ( const Module& module ) const;
|
||||
void GenerateAllTarget ( const std::vector<MingwModuleHandler*>& handlers ) const;
|
||||
std::string GetBuildToolDependencies () const;
|
||||
void GenerateInitTarget () const;
|
||||
void GenerateXmlBuildFilesMacro() const;
|
||||
void CheckAutomaticDependencies ();
|
||||
bool IncludeDirectoryTarget ( const std::string& directory ) const;
|
||||
bool TryToDetectThisCompiler ( const std::string& compiler );
|
||||
void DetectCompiler ();
|
||||
void DetectPipeSupport ();
|
||||
void DetectPCHSupport ();
|
||||
void ProcessModules ();
|
||||
std::string GetNonModuleInstallDirectories ( const std::string& installDirectory );
|
||||
std::string GetInstallDirectories ( const std::string& installDirectory );
|
||||
void GetNonModuleInstallFiles ( std::vector<std::string>& out ) const;
|
||||
void GetInstallFiles ( std::vector<std::string>& out ) const;
|
||||
void GetNonModuleInstallTargetFiles ( std::vector<std::string>& out ) const;
|
||||
void GetModuleInstallTargetFiles ( std::vector<std::string>& out ) const;
|
||||
void GetInstallTargetFiles ( std::vector<std::string>& out ) const;
|
||||
void OutputInstallTarget ( const std::string& sourceFilename,
|
||||
const std::string& targetFilename,
|
||||
const std::string& targetDirectory );
|
||||
void OutputNonModuleInstallTargets ();
|
||||
void OutputModuleInstallTargets ();
|
||||
std::string GetRegistrySourceFiles ();
|
||||
std::string GetRegistryTargetFiles ();
|
||||
void OutputRegistryInstallTarget ();
|
||||
void GenerateInstallTarget ();
|
||||
FILE* fMakefile;
|
||||
bool use_pch;
|
||||
};
|
||||
|
||||
#endif /* MINGW_H */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,412 +1,412 @@
|
|||
#ifndef MINGW_MODULEHANDLER_H
|
||||
#define MINGW_MODULEHANDLER_H
|
||||
|
||||
#include "../backend.h"
|
||||
#include "mingw.h"
|
||||
|
||||
class MingwBackend;
|
||||
|
||||
extern std::string
|
||||
GetTargetMacro ( const Module&, bool with_dollar = true );
|
||||
|
||||
extern std::string
|
||||
PrefixFilename (
|
||||
const std::string& filename,
|
||||
const std::string& prefix );
|
||||
|
||||
class MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwModuleHandler ( const Module& module_ );
|
||||
virtual ~MingwModuleHandler();
|
||||
|
||||
static void SetBackend ( MingwBackend* backend_ );
|
||||
static void SetMakefile ( FILE* f );
|
||||
static void SetUsePch ( bool use_pch );
|
||||
|
||||
static std::string PassThruCacheDirectory (
|
||||
const std::string &f,
|
||||
Directory* directoryTree );
|
||||
|
||||
static std::string GetTargetFilename (
|
||||
const Module& module,
|
||||
string_list* pclean_files );
|
||||
|
||||
static std::string
|
||||
GetImportLibraryFilename (
|
||||
const Module& module,
|
||||
string_list* pclean_files );
|
||||
|
||||
std::string GetModuleTargets ( const Module& module );
|
||||
void GetObjectsVector ( const IfableData& data,
|
||||
std::vector<std::string>& objectFiles ) const;
|
||||
void GenerateObjectMacro();
|
||||
void GenerateTargetMacro();
|
||||
void GenerateOtherMacros();
|
||||
|
||||
static MingwModuleHandler* InstanciateHandler ( const Module& module_,
|
||||
MingwBackend* backend_ );
|
||||
virtual HostType DefaultHost() = 0;
|
||||
void GeneratePreconditionDependencies ();
|
||||
virtual void Process () = 0;
|
||||
virtual std::string TypeSpecificCFlags() { return ""; }
|
||||
virtual std::string TypeSpecificNasmFlags() { return ""; }
|
||||
virtual std::string TypeSpecificLinkerFlags() { return ""; }
|
||||
void GenerateInvocations () const;
|
||||
void GenerateCleanTarget () const;
|
||||
static bool ReferenceObjects ( const Module& module );
|
||||
protected:
|
||||
std::string GetWorkingDirectory () const;
|
||||
std::string GetBasename ( const std::string& filename ) const;
|
||||
std::string GetActualSourceFilename ( const std::string& filename ) const;
|
||||
std::string GetModuleArchiveFilename () const;
|
||||
bool IsGeneratedFile ( const File& file ) const;
|
||||
std::string GetImportLibraryDependency ( const Module& importedModule );
|
||||
void GetTargets ( const Module& dependencyModule,
|
||||
string_list& targets );
|
||||
void GetModuleDependencies ( string_list& dependencies );
|
||||
std::string GetAllDependencies () const;
|
||||
void GetSourceFilenames ( string_list& list, bool includeGeneratedFiles = true ) const;
|
||||
void GetSourceFilenamesWithoutGeneratedFiles ( string_list& list ) const;
|
||||
std::string GetObjectFilename ( const std::string& sourceFilename,
|
||||
string_list* pclean_files ) const;
|
||||
|
||||
std::string GetObjectFilenames ();
|
||||
|
||||
std::string GetPreconditionDependenciesName () const;
|
||||
std::string GetCFlagsMacro () const;
|
||||
static std::string GetObjectsMacro ( const Module& );
|
||||
std::string GetLinkingDependenciesMacro () const;
|
||||
std::string GetLibsMacro () const;
|
||||
std::string GetLinkerMacro () const;
|
||||
void GenerateCleanObjectsAsYouGoCode () const;
|
||||
void GenerateLinkerCommand ( const std::string& dependencies,
|
||||
const std::string& linker,
|
||||
const std::string& linkerParameters,
|
||||
const std::string& objectsMacro,
|
||||
const std::string& libsMacro );
|
||||
void GeneratePhonyTarget() const;
|
||||
void GenerateRules ();
|
||||
void GenerateImportLibraryTargetIfNeeded ();
|
||||
void GetDefinitionDependencies ( string_list& dependencies ) const;
|
||||
std::string GetLinkingDependencies () const;
|
||||
static MingwBackend* backend;
|
||||
static FILE* fMakefile;
|
||||
static bool use_pch;
|
||||
private:
|
||||
std::string ConcatenatePaths ( const std::string& path1,
|
||||
const std::string& path2 ) const;
|
||||
std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
|
||||
std::string GenerateGccDefineParameters () const;
|
||||
std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
|
||||
std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;
|
||||
std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
|
||||
std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );
|
||||
std::string GenerateLinkerParameters () const;
|
||||
void GenerateMacro ( const char* assignmentOperation,
|
||||
const std::string& macro,
|
||||
const IfableData& data,
|
||||
const std::vector<CompilerFlag*>* compilerFlags );
|
||||
void GenerateMacros ( const char* op,
|
||||
const IfableData& data,
|
||||
const std::vector<CompilerFlag*>* compilerFlags,
|
||||
const std::vector<LinkerFlag*>* linkerFlags );
|
||||
void GenerateObjectMacros ( const char* assignmentOperation,
|
||||
const IfableData& data,
|
||||
const std::vector<CompilerFlag*>* compilerFlags,
|
||||
const std::vector<LinkerFlag*>* linkerFlags );
|
||||
std::string GenerateGccIncludeParameters () const;
|
||||
std::string GenerateGccParameters () const;
|
||||
std::string GenerateNasmParameters () const;
|
||||
void GenerateGccCommand ( const std::string& sourceFilename,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro );
|
||||
void GenerateGccAssemblerCommand ( const std::string& sourceFilename,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro );
|
||||
void GenerateNasmCommand ( const std::string& sourceFilename,
|
||||
const std::string& nasmflagsMacro );
|
||||
void GenerateWindresCommand ( const std::string& sourceFilename,
|
||||
const std::string& windresflagsMacro );
|
||||
void GenerateWinebuildCommands ( const std::string& sourceFilename );
|
||||
std::string GetWidlFlags ( const File& file );
|
||||
void GenerateWidlCommandsServer (
|
||||
const File& file,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateWidlCommandsClient (
|
||||
const File& file,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateWidlCommands ( const File& file,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateCommands ( const File& file,
|
||||
const std::string& cc,
|
||||
const std::string& cppc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateObjectFileTargets ( const IfableData& data,
|
||||
const std::string& cc,
|
||||
const std::string& cppc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateObjectFileTargets ( const std::string& cc,
|
||||
const std::string& cppc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro,
|
||||
const std::string& widlflagsMacro );
|
||||
std::string GenerateArchiveTarget ( const std::string& ar,
|
||||
const std::string& objs_macro ) const;
|
||||
void GetSpecObjectDependencies ( string_list& dependencies,
|
||||
const std::string& filename ) const;
|
||||
void GetWidlObjectDependencies ( string_list& dependencies,
|
||||
const std::string& filename ) const;
|
||||
void GetDefaultDependencies ( string_list& dependencies ) const;
|
||||
void GetInvocationDependencies ( const Module& module, string_list& dependencies );
|
||||
bool IsWineModule () const;
|
||||
std::string GetDefinitionFilename () const;
|
||||
static std::string RemoveVariables ( std::string path);
|
||||
void GenerateBuildMapCode ();
|
||||
void GenerateBuildNonSymbolStrippedCode ();
|
||||
public:
|
||||
const Module& module;
|
||||
string_list clean_files;
|
||||
std::string cflagsMacro;
|
||||
std::string nasmflagsMacro;
|
||||
std::string windresflagsMacro;
|
||||
std::string widlflagsMacro;
|
||||
std::string linkerflagsMacro;
|
||||
std::string objectsMacro;
|
||||
std::string libsMacro;
|
||||
std::string linkDepsMacro;
|
||||
};
|
||||
|
||||
|
||||
class MingwBuildToolModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBuildToolModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostTrue; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateBuildToolModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
|
||||
private:
|
||||
void GenerateKernelModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwStaticLibraryModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwStaticLibraryModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateStaticLibraryModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwObjectLibraryModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwObjectLibraryModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateObjectLibraryModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModeDLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModeDLLModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateKernelModeDLLModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModeDriverModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModeDriverModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D__NTDRIVER__ -D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateKernelModeDriverModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwNativeDLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwNativeDLLModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateNativeDLLModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwNativeCUIModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwNativeCUIModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D__NTAPP__ -D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateNativeCUIModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32DLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32DLLModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateExtractWineDLLResourcesTarget ();
|
||||
void GenerateWin32DLLModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32CUIModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32CUIModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateWin32CUIModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32GUIModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32GUIModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateWin32GUIModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwBootLoaderModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBootLoaderModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateBootLoaderModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwBootSectorModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBootSectorModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificNasmFlags() { return "-f bin"; }
|
||||
private:
|
||||
void GenerateBootSectorModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwIsoModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwIsoModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateIsoModuleTarget ();
|
||||
std::string GetBootstrapCdDirectories ( const std::string& bootcdDirectory );
|
||||
std::string GetNonModuleCdDirectories ( const std::string& bootcdDirectory );
|
||||
std::string GetCdDirectories ( const std::string& bootcdDirectory );
|
||||
void GetBootstrapCdFiles ( std::vector<std::string>& out ) const;
|
||||
void GetNonModuleCdFiles ( std::vector<std::string>& out ) const;
|
||||
void GetCdFiles ( std::vector<std::string>& out ) const;
|
||||
void OutputBootstrapfileCopyCommands ( const std::string& bootcdDirectory );
|
||||
void OutputCdfileCopyCommands ( const std::string& bootcdDirectory );
|
||||
};
|
||||
|
||||
|
||||
class MingwLiveIsoModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwLiveIsoModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateLiveIsoModuleTarget ();
|
||||
void CreateDirectory ( const std::string& directory );
|
||||
void OutputCopyCommand ( const std::string& sourceFilename,
|
||||
const std::string& targetFilename,
|
||||
const std::string& targetDirectory );
|
||||
void OutputModuleCopyCommands ( std::string& livecdDirectory,
|
||||
std::string& livecdReactos );
|
||||
void OutputNonModuleCopyCommands ( std::string& livecdDirectory,
|
||||
std::string& livecdReactos );
|
||||
void OutputProfilesDirectoryCommands ( std::string& livecdDirectory );
|
||||
void OutputLoaderCommands ( std::string& livecdDirectory );
|
||||
void OutputRegistryCommands ( std::string& livecdDirectory );
|
||||
};
|
||||
|
||||
|
||||
class MingwTestModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwTestModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateTestModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwRpcServerModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwRpcServerModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
};
|
||||
|
||||
|
||||
class MingwRpcClientModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwRpcClientModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
};
|
||||
|
||||
#endif /* MINGW_MODULEHANDLER_H */
|
||||
#ifndef MINGW_MODULEHANDLER_H
|
||||
#define MINGW_MODULEHANDLER_H
|
||||
|
||||
#include "../backend.h"
|
||||
#include "mingw.h"
|
||||
|
||||
class MingwBackend;
|
||||
|
||||
extern std::string
|
||||
GetTargetMacro ( const Module&, bool with_dollar = true );
|
||||
|
||||
extern std::string
|
||||
PrefixFilename (
|
||||
const std::string& filename,
|
||||
const std::string& prefix );
|
||||
|
||||
class MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwModuleHandler ( const Module& module_ );
|
||||
virtual ~MingwModuleHandler();
|
||||
|
||||
static void SetBackend ( MingwBackend* backend_ );
|
||||
static void SetMakefile ( FILE* f );
|
||||
static void SetUsePch ( bool use_pch );
|
||||
|
||||
static std::string PassThruCacheDirectory (
|
||||
const std::string &f,
|
||||
Directory* directoryTree );
|
||||
|
||||
static std::string GetTargetFilename (
|
||||
const Module& module,
|
||||
string_list* pclean_files );
|
||||
|
||||
static std::string
|
||||
GetImportLibraryFilename (
|
||||
const Module& module,
|
||||
string_list* pclean_files );
|
||||
|
||||
std::string GetModuleTargets ( const Module& module );
|
||||
void GetObjectsVector ( const IfableData& data,
|
||||
std::vector<std::string>& objectFiles ) const;
|
||||
void GenerateObjectMacro();
|
||||
void GenerateTargetMacro();
|
||||
void GenerateOtherMacros();
|
||||
|
||||
static MingwModuleHandler* InstanciateHandler ( const Module& module_,
|
||||
MingwBackend* backend_ );
|
||||
virtual HostType DefaultHost() = 0;
|
||||
void GeneratePreconditionDependencies ();
|
||||
virtual void Process () = 0;
|
||||
virtual std::string TypeSpecificCFlags() { return ""; }
|
||||
virtual std::string TypeSpecificNasmFlags() { return ""; }
|
||||
virtual std::string TypeSpecificLinkerFlags() { return ""; }
|
||||
void GenerateInvocations () const;
|
||||
void GenerateCleanTarget () const;
|
||||
static bool ReferenceObjects ( const Module& module );
|
||||
protected:
|
||||
std::string GetWorkingDirectory () const;
|
||||
std::string GetBasename ( const std::string& filename ) const;
|
||||
std::string GetActualSourceFilename ( const std::string& filename ) const;
|
||||
std::string GetModuleArchiveFilename () const;
|
||||
bool IsGeneratedFile ( const File& file ) const;
|
||||
std::string GetImportLibraryDependency ( const Module& importedModule );
|
||||
void GetTargets ( const Module& dependencyModule,
|
||||
string_list& targets );
|
||||
void GetModuleDependencies ( string_list& dependencies );
|
||||
std::string GetAllDependencies () const;
|
||||
void GetSourceFilenames ( string_list& list, bool includeGeneratedFiles = true ) const;
|
||||
void GetSourceFilenamesWithoutGeneratedFiles ( string_list& list ) const;
|
||||
std::string GetObjectFilename ( const std::string& sourceFilename,
|
||||
string_list* pclean_files ) const;
|
||||
|
||||
std::string GetObjectFilenames ();
|
||||
|
||||
std::string GetPreconditionDependenciesName () const;
|
||||
std::string GetCFlagsMacro () const;
|
||||
static std::string GetObjectsMacro ( const Module& );
|
||||
std::string GetLinkingDependenciesMacro () const;
|
||||
std::string GetLibsMacro () const;
|
||||
std::string GetLinkerMacro () const;
|
||||
void GenerateCleanObjectsAsYouGoCode () const;
|
||||
void GenerateLinkerCommand ( const std::string& dependencies,
|
||||
const std::string& linker,
|
||||
const std::string& linkerParameters,
|
||||
const std::string& objectsMacro,
|
||||
const std::string& libsMacro );
|
||||
void GeneratePhonyTarget() const;
|
||||
void GenerateRules ();
|
||||
void GenerateImportLibraryTargetIfNeeded ();
|
||||
void GetDefinitionDependencies ( string_list& dependencies ) const;
|
||||
std::string GetLinkingDependencies () const;
|
||||
static MingwBackend* backend;
|
||||
static FILE* fMakefile;
|
||||
static bool use_pch;
|
||||
private:
|
||||
std::string ConcatenatePaths ( const std::string& path1,
|
||||
const std::string& path2 ) const;
|
||||
std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
|
||||
std::string GenerateGccDefineParameters () const;
|
||||
std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
|
||||
std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;
|
||||
std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;
|
||||
std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );
|
||||
std::string GenerateLinkerParameters () const;
|
||||
void GenerateMacro ( const char* assignmentOperation,
|
||||
const std::string& macro,
|
||||
const IfableData& data,
|
||||
const std::vector<CompilerFlag*>* compilerFlags );
|
||||
void GenerateMacros ( const char* op,
|
||||
const IfableData& data,
|
||||
const std::vector<CompilerFlag*>* compilerFlags,
|
||||
const std::vector<LinkerFlag*>* linkerFlags );
|
||||
void GenerateObjectMacros ( const char* assignmentOperation,
|
||||
const IfableData& data,
|
||||
const std::vector<CompilerFlag*>* compilerFlags,
|
||||
const std::vector<LinkerFlag*>* linkerFlags );
|
||||
std::string GenerateGccIncludeParameters () const;
|
||||
std::string GenerateGccParameters () const;
|
||||
std::string GenerateNasmParameters () const;
|
||||
void GenerateGccCommand ( const std::string& sourceFilename,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro );
|
||||
void GenerateGccAssemblerCommand ( const std::string& sourceFilename,
|
||||
const std::string& cc,
|
||||
const std::string& cflagsMacro );
|
||||
void GenerateNasmCommand ( const std::string& sourceFilename,
|
||||
const std::string& nasmflagsMacro );
|
||||
void GenerateWindresCommand ( const std::string& sourceFilename,
|
||||
const std::string& windresflagsMacro );
|
||||
void GenerateWinebuildCommands ( const std::string& sourceFilename );
|
||||
std::string GetWidlFlags ( const File& file );
|
||||
void GenerateWidlCommandsServer (
|
||||
const File& file,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateWidlCommandsClient (
|
||||
const File& file,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateWidlCommands ( const File& file,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateCommands ( const File& file,
|
||||
const std::string& cc,
|
||||
const std::string& cppc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateObjectFileTargets ( const IfableData& data,
|
||||
const std::string& cc,
|
||||
const std::string& cppc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro,
|
||||
const std::string& widlflagsMacro );
|
||||
void GenerateObjectFileTargets ( const std::string& cc,
|
||||
const std::string& cppc,
|
||||
const std::string& cflagsMacro,
|
||||
const std::string& nasmflagsMacro,
|
||||
const std::string& windresflagsMacro,
|
||||
const std::string& widlflagsMacro );
|
||||
std::string GenerateArchiveTarget ( const std::string& ar,
|
||||
const std::string& objs_macro ) const;
|
||||
void GetSpecObjectDependencies ( string_list& dependencies,
|
||||
const std::string& filename ) const;
|
||||
void GetWidlObjectDependencies ( string_list& dependencies,
|
||||
const std::string& filename ) const;
|
||||
void GetDefaultDependencies ( string_list& dependencies ) const;
|
||||
void GetInvocationDependencies ( const Module& module, string_list& dependencies );
|
||||
bool IsWineModule () const;
|
||||
std::string GetDefinitionFilename () const;
|
||||
static std::string RemoveVariables ( std::string path);
|
||||
void GenerateBuildMapCode ();
|
||||
void GenerateBuildNonSymbolStrippedCode ();
|
||||
public:
|
||||
const Module& module;
|
||||
string_list clean_files;
|
||||
std::string cflagsMacro;
|
||||
std::string nasmflagsMacro;
|
||||
std::string windresflagsMacro;
|
||||
std::string widlflagsMacro;
|
||||
std::string linkerflagsMacro;
|
||||
std::string objectsMacro;
|
||||
std::string libsMacro;
|
||||
std::string linkDepsMacro;
|
||||
};
|
||||
|
||||
|
||||
class MingwBuildToolModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBuildToolModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostTrue; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateBuildToolModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
|
||||
private:
|
||||
void GenerateKernelModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwStaticLibraryModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwStaticLibraryModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateStaticLibraryModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwObjectLibraryModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwObjectLibraryModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateObjectLibraryModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModeDLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModeDLLModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateKernelModeDLLModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModeDriverModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModeDriverModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D__NTDRIVER__ -D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateKernelModeDriverModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwNativeDLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwNativeDLLModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateNativeDLLModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwNativeCUIModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwNativeCUIModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificCFlags() { return "-D__NTAPP__ -D_SEH_NO_NATIVE_NLG"; }
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateNativeCUIModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32DLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32DLLModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateExtractWineDLLResourcesTarget ();
|
||||
void GenerateWin32DLLModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32CUIModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32CUIModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateWin32CUIModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32GUIModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32GUIModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateWin32GUIModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwBootLoaderModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBootLoaderModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
|
||||
private:
|
||||
void GenerateBootLoaderModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwBootSectorModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBootSectorModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
std::string TypeSpecificNasmFlags() { return "-f bin"; }
|
||||
private:
|
||||
void GenerateBootSectorModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwIsoModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwIsoModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateIsoModuleTarget ();
|
||||
std::string GetBootstrapCdDirectories ( const std::string& bootcdDirectory );
|
||||
std::string GetNonModuleCdDirectories ( const std::string& bootcdDirectory );
|
||||
std::string GetCdDirectories ( const std::string& bootcdDirectory );
|
||||
void GetBootstrapCdFiles ( std::vector<std::string>& out ) const;
|
||||
void GetNonModuleCdFiles ( std::vector<std::string>& out ) const;
|
||||
void GetCdFiles ( std::vector<std::string>& out ) const;
|
||||
void OutputBootstrapfileCopyCommands ( const std::string& bootcdDirectory );
|
||||
void OutputCdfileCopyCommands ( const std::string& bootcdDirectory );
|
||||
};
|
||||
|
||||
|
||||
class MingwLiveIsoModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwLiveIsoModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateLiveIsoModuleTarget ();
|
||||
void CreateDirectory ( const std::string& directory );
|
||||
void OutputCopyCommand ( const std::string& sourceFilename,
|
||||
const std::string& targetFilename,
|
||||
const std::string& targetDirectory );
|
||||
void OutputModuleCopyCommands ( std::string& livecdDirectory,
|
||||
std::string& livecdReactos );
|
||||
void OutputNonModuleCopyCommands ( std::string& livecdDirectory,
|
||||
std::string& livecdReactos );
|
||||
void OutputProfilesDirectoryCommands ( std::string& livecdDirectory );
|
||||
void OutputLoaderCommands ( std::string& livecdDirectory );
|
||||
void OutputRegistryCommands ( std::string& livecdDirectory );
|
||||
};
|
||||
|
||||
|
||||
class MingwTestModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwTestModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
private:
|
||||
void GenerateTestModuleTarget ();
|
||||
};
|
||||
|
||||
|
||||
class MingwRpcServerModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwRpcServerModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
};
|
||||
|
||||
|
||||
class MingwRpcClientModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwRpcClientModuleHandler ( const Module& module );
|
||||
virtual HostType DefaultHost() { return HostFalse; }
|
||||
virtual void Process ();
|
||||
};
|
||||
|
||||
#endif /* MINGW_MODULEHANDLER_H */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
int
|
||||
main ( int argc, char** argv )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
main ( int argc, char** argv )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
Bootstrap::Bootstrap ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& bootstrapNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(bootstrapNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Bootstrap::~Bootstrap ()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
Bootstrap::IsSupportedModuleType ( ModuleType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case Kernel:
|
||||
case KernelModeDLL:
|
||||
case NativeDLL:
|
||||
case NativeCUI:
|
||||
case Win32DLL:
|
||||
case Win32CUI:
|
||||
case Win32GUI:
|
||||
case KernelModeDriver:
|
||||
case BootSector:
|
||||
case BootLoader:
|
||||
return true;
|
||||
case BuildTool:
|
||||
case StaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case Iso:
|
||||
case LiveIso:
|
||||
case Test:
|
||||
case RpcServer:
|
||||
case RpcClient:
|
||||
return false;
|
||||
}
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__ );
|
||||
}
|
||||
|
||||
void
|
||||
Bootstrap::Initialize ()
|
||||
{
|
||||
if ( !IsSupportedModuleType ( module->type ) )
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<bootstrap> is not applicable for this module type." );
|
||||
}
|
||||
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
base = "";
|
||||
|
||||
att = node.GetAttribute ( "nameoncd", false );
|
||||
if ( att != NULL )
|
||||
nameoncd = att->value;
|
||||
else
|
||||
nameoncd = module->GetTargetName ();
|
||||
}
|
||||
|
||||
void
|
||||
Bootstrap::ProcessXML()
|
||||
{
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
Bootstrap::Bootstrap ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& bootstrapNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(bootstrapNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Bootstrap::~Bootstrap ()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
Bootstrap::IsSupportedModuleType ( ModuleType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case Kernel:
|
||||
case KernelModeDLL:
|
||||
case NativeDLL:
|
||||
case NativeCUI:
|
||||
case Win32DLL:
|
||||
case Win32CUI:
|
||||
case Win32GUI:
|
||||
case KernelModeDriver:
|
||||
case BootSector:
|
||||
case BootLoader:
|
||||
return true;
|
||||
case BuildTool:
|
||||
case StaticLibrary:
|
||||
case ObjectLibrary:
|
||||
case Iso:
|
||||
case LiveIso:
|
||||
case Test:
|
||||
case RpcServer:
|
||||
case RpcClient:
|
||||
return false;
|
||||
}
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__ );
|
||||
}
|
||||
|
||||
void
|
||||
Bootstrap::Initialize ()
|
||||
{
|
||||
if ( !IsSupportedModuleType ( module->type ) )
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<bootstrap> is not applicable for this module type." );
|
||||
}
|
||||
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
base = "";
|
||||
|
||||
att = node.GetAttribute ( "nameoncd", false );
|
||||
if ( att != NULL )
|
||||
nameoncd = att->value;
|
||||
else
|
||||
nameoncd = module->GetTargetName ();
|
||||
}
|
||||
|
||||
void
|
||||
Bootstrap::ProcessXML()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
CDFile::CDFile ( const Project& project_,
|
||||
const XMLElement& cdfileNode,
|
||||
const string& path )
|
||||
: project ( project_ ),
|
||||
node ( cdfileNode )
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
base = "";
|
||||
|
||||
att = node.GetAttribute ( "nameoncd", false );
|
||||
if ( att != NULL )
|
||||
nameoncd = att->value;
|
||||
else
|
||||
nameoncd = node.value;
|
||||
name = node.value;
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
CDFile::~CDFile ()
|
||||
{
|
||||
}
|
||||
|
||||
string
|
||||
CDFile::GetPath () const
|
||||
{
|
||||
return path + SSEP + name;
|
||||
}
|
||||
|
||||
void
|
||||
CDFile::ProcessXML()
|
||||
{
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
CDFile::CDFile ( const Project& project_,
|
||||
const XMLElement& cdfileNode,
|
||||
const string& path )
|
||||
: project ( project_ ),
|
||||
node ( cdfileNode )
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
base = "";
|
||||
|
||||
att = node.GetAttribute ( "nameoncd", false );
|
||||
if ( att != NULL )
|
||||
nameoncd = att->value;
|
||||
else
|
||||
nameoncd = node.value;
|
||||
name = node.value;
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
CDFile::~CDFile ()
|
||||
{
|
||||
}
|
||||
|
||||
string
|
||||
CDFile::GetPath () const
|
||||
{
|
||||
return path + SSEP + name;
|
||||
}
|
||||
|
||||
void
|
||||
CDFile::ProcessXML()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
CompilerFlag::CompilerFlag ( const Project& project_,
|
||||
const XMLElement& compilerFlagNode )
|
||||
: project(project_),
|
||||
module(NULL),
|
||||
node(compilerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CompilerFlag::CompilerFlag ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& compilerFlagNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(compilerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CompilerFlag::~CompilerFlag ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CompilerFlag::Initialize ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CompilerFlag::ProcessXML ()
|
||||
{
|
||||
if (node.value.size () == 0)
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<compilerflag> is empty." );
|
||||
}
|
||||
flag = node.value;
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
CompilerFlag::CompilerFlag ( const Project& project_,
|
||||
const XMLElement& compilerFlagNode )
|
||||
: project(project_),
|
||||
module(NULL),
|
||||
node(compilerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CompilerFlag::CompilerFlag ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& compilerFlagNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(compilerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CompilerFlag::~CompilerFlag ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CompilerFlag::Initialize ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CompilerFlag::ProcessXML ()
|
||||
{
|
||||
if (node.value.size () == 0)
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<compilerflag> is empty." );
|
||||
}
|
||||
flag = node.value;
|
||||
}
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
Define::Define ( const Project& project,
|
||||
const XMLElement& defineNode )
|
||||
: project(project),
|
||||
module(NULL),
|
||||
node(defineNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Define::Define ( const Project& project,
|
||||
const Module* module,
|
||||
const XMLElement& defineNode )
|
||||
: project(project),
|
||||
module(module),
|
||||
node(defineNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Define::~Define ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Define::Initialize()
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
name = att->value;
|
||||
value = node.value;
|
||||
}
|
||||
|
||||
void
|
||||
Define::ProcessXML()
|
||||
{
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
Define::Define ( const Project& project,
|
||||
const XMLElement& defineNode )
|
||||
: project(project),
|
||||
module(NULL),
|
||||
node(defineNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Define::Define ( const Project& project,
|
||||
const Module* module,
|
||||
const XMLElement& defineNode )
|
||||
: project(project),
|
||||
module(module),
|
||||
node(defineNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Define::~Define ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Define::Initialize()
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
name = att->value;
|
||||
value = node.value;
|
||||
}
|
||||
|
||||
void
|
||||
Define::ProcessXML()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,174 +1,174 @@
|
|||
|
||||
#include "pch.h"
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
Exception::Exception ()
|
||||
{
|
||||
}
|
||||
|
||||
Exception::Exception ( const string& message )
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
|
||||
Exception::Exception ( const char* format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
format);
|
||||
Message = ssvprintf ( format,
|
||||
args);
|
||||
va_end ( args );
|
||||
}
|
||||
|
||||
void Exception::SetMessage ( const char* message,
|
||||
va_list args)
|
||||
{
|
||||
Message = ssvprintf ( message,
|
||||
args);
|
||||
}
|
||||
|
||||
|
||||
OutOfMemoryException::OutOfMemoryException ()
|
||||
: Exception ( "Out of memory" )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
InvalidOperationException::InvalidOperationException ( const char* filename,
|
||||
const int linenumber )
|
||||
{
|
||||
Message = ssprintf ( "%s:%d",
|
||||
filename,
|
||||
linenumber );
|
||||
}
|
||||
|
||||
InvalidOperationException::InvalidOperationException ( const char* filename,
|
||||
const int linenumber,
|
||||
const char* message,
|
||||
... )
|
||||
{
|
||||
string errorMessage;
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
message );
|
||||
errorMessage = ssvprintf ( message,
|
||||
args );
|
||||
va_end ( args );
|
||||
Message = ssprintf ( "%s:%d %s",
|
||||
filename,
|
||||
linenumber,
|
||||
errorMessage.c_str () );
|
||||
}
|
||||
|
||||
|
||||
FileNotFoundException::FileNotFoundException ( const string& filename )
|
||||
: Exception ( "File '%s' not found.",
|
||||
filename.c_str() )
|
||||
{
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
|
||||
AccessDeniedException::AccessDeniedException ( const string& filename)
|
||||
: Exception ( "Access denied to file or directory '%s'.",
|
||||
filename.c_str() )
|
||||
{
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
|
||||
InvalidBuildFileException::InvalidBuildFileException ( const string& location,
|
||||
const char* message,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
message );
|
||||
SetLocationMessage ( location, message, args );
|
||||
va_end ( args );
|
||||
}
|
||||
|
||||
InvalidBuildFileException::InvalidBuildFileException ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
InvalidBuildFileException::SetLocationMessage ( const std::string& location,
|
||||
const char* message,
|
||||
va_list args )
|
||||
{
|
||||
Message = location + ": " + ssvprintf ( message, args );
|
||||
}
|
||||
|
||||
XMLSyntaxErrorException::XMLSyntaxErrorException ( const string& location,
|
||||
const char* message,
|
||||
... )
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
message );
|
||||
SetLocationMessage ( location, message, args );
|
||||
va_end ( args );
|
||||
}
|
||||
|
||||
|
||||
RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
|
||||
const string& location,
|
||||
const string& attributeName,
|
||||
const string& elementName )
|
||||
: InvalidBuildFileException ( location,
|
||||
"Required attribute '%s' not found on '%s'.",
|
||||
attributeName.c_str (),
|
||||
elementName.c_str ())
|
||||
{
|
||||
}
|
||||
|
||||
InvalidAttributeValueException::InvalidAttributeValueException (
|
||||
const string& location,
|
||||
const string& name,
|
||||
const string& value )
|
||||
: InvalidBuildFileException ( location,
|
||||
"Attribute '%s' has an invalid value '%s'.",
|
||||
name.c_str (),
|
||||
value.c_str () )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BackendNameConflictException::BackendNameConflictException ( const string& name )
|
||||
: Exception ( "Backend name conflict: '%s'",
|
||||
name.c_str() )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
UnknownBackendException::UnknownBackendException ( const string& name )
|
||||
: Exception ( "Unknown Backend requested: '%s'",
|
||||
name.c_str() )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
UnknownModuleTypeException::UnknownModuleTypeException ( const string& location,
|
||||
int moduletype )
|
||||
: InvalidBuildFileException ( location,
|
||||
"module type requested: %i",
|
||||
moduletype )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
InvocationFailedException::InvocationFailedException ( const std::string& command,
|
||||
int exitcode )
|
||||
: Exception ( "Failed to execute '%s' (exit code %d)",
|
||||
command.c_str (),
|
||||
exitcode )
|
||||
{
|
||||
Command = command;
|
||||
ExitCode = exitcode;
|
||||
}
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
Exception::Exception ()
|
||||
{
|
||||
}
|
||||
|
||||
Exception::Exception ( const string& message )
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
|
||||
Exception::Exception ( const char* format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
format);
|
||||
Message = ssvprintf ( format,
|
||||
args);
|
||||
va_end ( args );
|
||||
}
|
||||
|
||||
void Exception::SetMessage ( const char* message,
|
||||
va_list args)
|
||||
{
|
||||
Message = ssvprintf ( message,
|
||||
args);
|
||||
}
|
||||
|
||||
|
||||
OutOfMemoryException::OutOfMemoryException ()
|
||||
: Exception ( "Out of memory" )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
InvalidOperationException::InvalidOperationException ( const char* filename,
|
||||
const int linenumber )
|
||||
{
|
||||
Message = ssprintf ( "%s:%d",
|
||||
filename,
|
||||
linenumber );
|
||||
}
|
||||
|
||||
InvalidOperationException::InvalidOperationException ( const char* filename,
|
||||
const int linenumber,
|
||||
const char* message,
|
||||
... )
|
||||
{
|
||||
string errorMessage;
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
message );
|
||||
errorMessage = ssvprintf ( message,
|
||||
args );
|
||||
va_end ( args );
|
||||
Message = ssprintf ( "%s:%d %s",
|
||||
filename,
|
||||
linenumber,
|
||||
errorMessage.c_str () );
|
||||
}
|
||||
|
||||
|
||||
FileNotFoundException::FileNotFoundException ( const string& filename )
|
||||
: Exception ( "File '%s' not found.",
|
||||
filename.c_str() )
|
||||
{
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
|
||||
AccessDeniedException::AccessDeniedException ( const string& filename)
|
||||
: Exception ( "Access denied to file or directory '%s'.",
|
||||
filename.c_str() )
|
||||
{
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
|
||||
InvalidBuildFileException::InvalidBuildFileException ( const string& location,
|
||||
const char* message,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
message );
|
||||
SetLocationMessage ( location, message, args );
|
||||
va_end ( args );
|
||||
}
|
||||
|
||||
InvalidBuildFileException::InvalidBuildFileException ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
InvalidBuildFileException::SetLocationMessage ( const std::string& location,
|
||||
const char* message,
|
||||
va_list args )
|
||||
{
|
||||
Message = location + ": " + ssvprintf ( message, args );
|
||||
}
|
||||
|
||||
XMLSyntaxErrorException::XMLSyntaxErrorException ( const string& location,
|
||||
const char* message,
|
||||
... )
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args,
|
||||
message );
|
||||
SetLocationMessage ( location, message, args );
|
||||
va_end ( args );
|
||||
}
|
||||
|
||||
|
||||
RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
|
||||
const string& location,
|
||||
const string& attributeName,
|
||||
const string& elementName )
|
||||
: InvalidBuildFileException ( location,
|
||||
"Required attribute '%s' not found on '%s'.",
|
||||
attributeName.c_str (),
|
||||
elementName.c_str ())
|
||||
{
|
||||
}
|
||||
|
||||
InvalidAttributeValueException::InvalidAttributeValueException (
|
||||
const string& location,
|
||||
const string& name,
|
||||
const string& value )
|
||||
: InvalidBuildFileException ( location,
|
||||
"Attribute '%s' has an invalid value '%s'.",
|
||||
name.c_str (),
|
||||
value.c_str () )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BackendNameConflictException::BackendNameConflictException ( const string& name )
|
||||
: Exception ( "Backend name conflict: '%s'",
|
||||
name.c_str() )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
UnknownBackendException::UnknownBackendException ( const string& name )
|
||||
: Exception ( "Unknown Backend requested: '%s'",
|
||||
name.c_str() )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
UnknownModuleTypeException::UnknownModuleTypeException ( const string& location,
|
||||
int moduletype )
|
||||
: InvalidBuildFileException ( location,
|
||||
"module type requested: %i",
|
||||
moduletype )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
InvocationFailedException::InvocationFailedException ( const std::string& command,
|
||||
int exitcode )
|
||||
: Exception ( "Failed to execute '%s' (exit code %d)",
|
||||
command.c_str (),
|
||||
exitcode )
|
||||
{
|
||||
Command = command;
|
||||
ExitCode = exitcode;
|
||||
}
|
||||
|
|
|
@ -1,125 +1,125 @@
|
|||
#ifndef __EXCEPTION_H
|
||||
#define __EXCEPTION_H
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
class Exception
|
||||
{
|
||||
public:
|
||||
Exception ( const std::string& message );
|
||||
Exception ( const char* format,
|
||||
...);
|
||||
std::string Message;
|
||||
protected:
|
||||
Exception ();
|
||||
void SetMessage ( const char* message,
|
||||
va_list args );
|
||||
};
|
||||
|
||||
|
||||
class InvalidOperationException : public Exception
|
||||
{
|
||||
public:
|
||||
InvalidOperationException ( const char* filename,
|
||||
const int linenumber);
|
||||
InvalidOperationException ( const char* filename,
|
||||
const int linenumber,
|
||||
const char* message,
|
||||
... );
|
||||
};
|
||||
|
||||
|
||||
class OutOfMemoryException : public Exception
|
||||
{
|
||||
public:
|
||||
OutOfMemoryException ();
|
||||
};
|
||||
|
||||
|
||||
class FileNotFoundException : public Exception
|
||||
{
|
||||
public:
|
||||
FileNotFoundException ( const std::string& filename );
|
||||
std::string Filename;
|
||||
};
|
||||
|
||||
|
||||
class AccessDeniedException : public Exception
|
||||
{
|
||||
public:
|
||||
AccessDeniedException ( const std::string& filename );
|
||||
std::string Filename;
|
||||
};
|
||||
|
||||
class InvalidBuildFileException : public Exception
|
||||
{
|
||||
public:
|
||||
InvalidBuildFileException ( const std::string& location,
|
||||
const char* message,
|
||||
...);
|
||||
void SetLocationMessage ( const std::string& location,
|
||||
const char* message,
|
||||
va_list args );
|
||||
protected:
|
||||
InvalidBuildFileException ();
|
||||
};
|
||||
|
||||
|
||||
class XMLSyntaxErrorException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
XMLSyntaxErrorException ( const std::string& location,
|
||||
const char* message,
|
||||
... );
|
||||
};
|
||||
|
||||
|
||||
class RequiredAttributeNotFoundException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
RequiredAttributeNotFoundException ( const std::string& location,
|
||||
const std::string& attributeName,
|
||||
const std::string& elementName );
|
||||
};
|
||||
|
||||
|
||||
class InvalidAttributeValueException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
InvalidAttributeValueException ( const std::string& location,
|
||||
const std::string& name,
|
||||
const std::string& value );
|
||||
};
|
||||
|
||||
|
||||
class BackendNameConflictException : public Exception
|
||||
{
|
||||
public:
|
||||
BackendNameConflictException ( const std::string& name );
|
||||
};
|
||||
|
||||
|
||||
class UnknownBackendException : public Exception
|
||||
{
|
||||
public:
|
||||
UnknownBackendException ( const std::string& name );
|
||||
};
|
||||
|
||||
class UnknownModuleTypeException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
UnknownModuleTypeException ( const std::string& location,
|
||||
int moduletype );
|
||||
};
|
||||
|
||||
|
||||
class InvocationFailedException : public Exception
|
||||
{
|
||||
public:
|
||||
InvocationFailedException ( const std::string& command,
|
||||
int exitcode );
|
||||
std::string Command;
|
||||
int ExitCode;
|
||||
};
|
||||
|
||||
#endif /* __EXCEPTION_H */
|
||||
#ifndef __EXCEPTION_H
|
||||
#define __EXCEPTION_H
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
class Exception
|
||||
{
|
||||
public:
|
||||
Exception ( const std::string& message );
|
||||
Exception ( const char* format,
|
||||
...);
|
||||
std::string Message;
|
||||
protected:
|
||||
Exception ();
|
||||
void SetMessage ( const char* message,
|
||||
va_list args );
|
||||
};
|
||||
|
||||
|
||||
class InvalidOperationException : public Exception
|
||||
{
|
||||
public:
|
||||
InvalidOperationException ( const char* filename,
|
||||
const int linenumber);
|
||||
InvalidOperationException ( const char* filename,
|
||||
const int linenumber,
|
||||
const char* message,
|
||||
... );
|
||||
};
|
||||
|
||||
|
||||
class OutOfMemoryException : public Exception
|
||||
{
|
||||
public:
|
||||
OutOfMemoryException ();
|
||||
};
|
||||
|
||||
|
||||
class FileNotFoundException : public Exception
|
||||
{
|
||||
public:
|
||||
FileNotFoundException ( const std::string& filename );
|
||||
std::string Filename;
|
||||
};
|
||||
|
||||
|
||||
class AccessDeniedException : public Exception
|
||||
{
|
||||
public:
|
||||
AccessDeniedException ( const std::string& filename );
|
||||
std::string Filename;
|
||||
};
|
||||
|
||||
class InvalidBuildFileException : public Exception
|
||||
{
|
||||
public:
|
||||
InvalidBuildFileException ( const std::string& location,
|
||||
const char* message,
|
||||
...);
|
||||
void SetLocationMessage ( const std::string& location,
|
||||
const char* message,
|
||||
va_list args );
|
||||
protected:
|
||||
InvalidBuildFileException ();
|
||||
};
|
||||
|
||||
|
||||
class XMLSyntaxErrorException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
XMLSyntaxErrorException ( const std::string& location,
|
||||
const char* message,
|
||||
... );
|
||||
};
|
||||
|
||||
|
||||
class RequiredAttributeNotFoundException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
RequiredAttributeNotFoundException ( const std::string& location,
|
||||
const std::string& attributeName,
|
||||
const std::string& elementName );
|
||||
};
|
||||
|
||||
|
||||
class InvalidAttributeValueException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
InvalidAttributeValueException ( const std::string& location,
|
||||
const std::string& name,
|
||||
const std::string& value );
|
||||
};
|
||||
|
||||
|
||||
class BackendNameConflictException : public Exception
|
||||
{
|
||||
public:
|
||||
BackendNameConflictException ( const std::string& name );
|
||||
};
|
||||
|
||||
|
||||
class UnknownBackendException : public Exception
|
||||
{
|
||||
public:
|
||||
UnknownBackendException ( const std::string& name );
|
||||
};
|
||||
|
||||
class UnknownModuleTypeException : public InvalidBuildFileException
|
||||
{
|
||||
public:
|
||||
UnknownModuleTypeException ( const std::string& location,
|
||||
int moduletype );
|
||||
};
|
||||
|
||||
|
||||
class InvocationFailedException : public Exception
|
||||
{
|
||||
public:
|
||||
InvocationFailedException ( const std::string& command,
|
||||
int exitcode );
|
||||
std::string Command;
|
||||
int ExitCode;
|
||||
};
|
||||
|
||||
#endif /* __EXCEPTION_H */
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
Include::Include ( const Project& project_,
|
||||
const XMLElement& includeNode )
|
||||
: project (project_),
|
||||
module (NULL),
|
||||
node (includeNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Include::Include ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& includeNode )
|
||||
: project (project_),
|
||||
module (module_),
|
||||
node (includeNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Include::~Include ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Include::Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Include::ProcessXML()
|
||||
{
|
||||
const XMLAttribute* att;
|
||||
att = node.GetAttribute ( "base",
|
||||
false );
|
||||
if ( att )
|
||||
{
|
||||
if ( !module )
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"'base' attribute illegal from global <include>" );
|
||||
bool referenceResolved = false;
|
||||
if ( att->value == project.name )
|
||||
{
|
||||
basePath = ".";
|
||||
referenceResolved = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const Module* base = project.LocateModule ( att->value );
|
||||
if ( base != NULL )
|
||||
{
|
||||
basePath = base->GetBasePath ();
|
||||
referenceResolved = true;
|
||||
}
|
||||
}
|
||||
if ( !referenceResolved )
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<include> attribute 'base' references non-existant project or module '%s'",
|
||||
att->value.c_str() );
|
||||
directory = FixSeparator ( basePath + "/" + node.value );
|
||||
}
|
||||
else
|
||||
directory = FixSeparator ( node.value );
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
Include::Include ( const Project& project_,
|
||||
const XMLElement& includeNode )
|
||||
: project (project_),
|
||||
module (NULL),
|
||||
node (includeNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Include::Include ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& includeNode )
|
||||
: project (project_),
|
||||
module (module_),
|
||||
node (includeNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Include::~Include ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Include::Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Include::ProcessXML()
|
||||
{
|
||||
const XMLAttribute* att;
|
||||
att = node.GetAttribute ( "base",
|
||||
false );
|
||||
if ( att )
|
||||
{
|
||||
if ( !module )
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"'base' attribute illegal from global <include>" );
|
||||
bool referenceResolved = false;
|
||||
if ( att->value == project.name )
|
||||
{
|
||||
basePath = ".";
|
||||
referenceResolved = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const Module* base = project.LocateModule ( att->value );
|
||||
if ( base != NULL )
|
||||
{
|
||||
basePath = base->GetBasePath ();
|
||||
referenceResolved = true;
|
||||
}
|
||||
}
|
||||
if ( !referenceResolved )
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<include> attribute 'base' references non-existant project or module '%s'",
|
||||
att->value.c_str() );
|
||||
directory = FixSeparator ( basePath + "/" + node.value );
|
||||
}
|
||||
else
|
||||
directory = FixSeparator ( node.value );
|
||||
}
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
InstallFile::InstallFile ( const Project& project_,
|
||||
const XMLElement& installfileNode,
|
||||
const string& path )
|
||||
: project ( project_ ),
|
||||
node ( installfileNode )
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
base = "";
|
||||
|
||||
att = node.GetAttribute ( "newname", false );
|
||||
if ( att != NULL )
|
||||
newname = att->value;
|
||||
else
|
||||
newname = node.value;
|
||||
name = node.value;
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
InstallFile::~InstallFile ()
|
||||
{
|
||||
}
|
||||
|
||||
string
|
||||
InstallFile::GetPath () const
|
||||
{
|
||||
return path + SSEP + name;
|
||||
}
|
||||
|
||||
void
|
||||
InstallFile::ProcessXML()
|
||||
{
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
InstallFile::InstallFile ( const Project& project_,
|
||||
const XMLElement& installfileNode,
|
||||
const string& path )
|
||||
: project ( project_ ),
|
||||
node ( installfileNode )
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
base = "";
|
||||
|
||||
att = node.GetAttribute ( "newname", false );
|
||||
if ( att != NULL )
|
||||
newname = att->value;
|
||||
else
|
||||
newname = node.value;
|
||||
name = node.value;
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
InstallFile::~InstallFile ()
|
||||
{
|
||||
}
|
||||
|
||||
string
|
||||
InstallFile::GetPath () const
|
||||
{
|
||||
return path + SSEP + name;
|
||||
}
|
||||
|
||||
void
|
||||
InstallFile::ProcessXML()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
LinkerFlag::LinkerFlag ( const Project& project_,
|
||||
const XMLElement& linkerFlagNode )
|
||||
: project(project_),
|
||||
module(NULL),
|
||||
node(linkerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
LinkerFlag::LinkerFlag ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& linkerFlagNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(linkerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
LinkerFlag::~LinkerFlag ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LinkerFlag::Initialize ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LinkerFlag::ProcessXML ()
|
||||
{
|
||||
if ( node.value.size () == 0 )
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<linkerflag> is empty." );
|
||||
}
|
||||
flag = node.value;
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
LinkerFlag::LinkerFlag ( const Project& project_,
|
||||
const XMLElement& linkerFlagNode )
|
||||
: project(project_),
|
||||
module(NULL),
|
||||
node(linkerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
LinkerFlag::LinkerFlag ( const Project& project_,
|
||||
const Module* module_,
|
||||
const XMLElement& linkerFlagNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(linkerFlagNode)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
LinkerFlag::~LinkerFlag ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LinkerFlag::Initialize ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LinkerFlag::ProcessXML ()
|
||||
{
|
||||
if ( node.value.size () == 0 )
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<linkerflag> is empty." );
|
||||
}
|
||||
flag = node.value;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,36 +1,36 @@
|
|||
// pre-compiled header stuff
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define MAX_PATH _MAX_PATH
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
#include <math.h>
|
||||
|
||||
inline char* strlwr ( char* str )
|
||||
{
|
||||
char* p = str;
|
||||
while ( *p )
|
||||
*p++ = tolower(*p);
|
||||
return str;
|
||||
}
|
||||
// pre-compiled header stuff
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define MAX_PATH _MAX_PATH
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
#include <math.h>
|
||||
|
||||
inline char* strlwr ( char* str )
|
||||
{
|
||||
char* p = str;
|
||||
while ( *p )
|
||||
*p++ = tolower(*p);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline char* strupr ( char* str )
|
||||
{
|
||||
|
@ -40,11 +40,11 @@ inline char* strupr ( char* str )
|
|||
return c;
|
||||
}
|
||||
|
||||
#define _finite __finite
|
||||
#define _isnan __isnan
|
||||
#define stricmp strcasecmp
|
||||
#define MAX_PATH PATH_MAX
|
||||
#define _MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
#endif//PCH_H
|
||||
#define _finite __finite
|
||||
#define _isnan __isnan
|
||||
#define stricmp strcasecmp
|
||||
#define MAX_PATH PATH_MAX
|
||||
#define _MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
#endif//PCH_H
|
||||
|
|
|
@ -1,350 +1,350 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
Project::Project ( const string& filename )
|
||||
: xmlfile (filename),
|
||||
node (NULL),
|
||||
head (NULL)
|
||||
{
|
||||
ReadXml();
|
||||
}
|
||||
|
||||
Project::~Project ()
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < modules.size (); i++ )
|
||||
delete modules[i];
|
||||
for ( i = 0; i < linkerFlags.size (); i++ )
|
||||
delete linkerFlags[i];
|
||||
for ( i = 0; i < cdfiles.size (); i++ )
|
||||
delete cdfiles[i];
|
||||
for ( i = 0; i < installfiles.size (); i++ )
|
||||
delete installfiles[i];
|
||||
delete head;
|
||||
}
|
||||
|
||||
const Property*
|
||||
Project::LookupProperty ( const string& name ) const
|
||||
{
|
||||
for ( size_t i = 0; i < non_if_data.properties.size (); i++ )
|
||||
{
|
||||
const Property* property = non_if_data.properties[i];
|
||||
if ( property->name == name )
|
||||
return property;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
Project::WriteIfChanged ( char* outbuf,
|
||||
string filename )
|
||||
{
|
||||
FILE* out;
|
||||
unsigned int end;
|
||||
char* cmpbuf;
|
||||
unsigned int stat;
|
||||
|
||||
out = fopen ( filename.c_str (), "rb" );
|
||||
if ( out == NULL )
|
||||
{
|
||||
out = fopen ( filename.c_str (), "wb" );
|
||||
if ( out == NULL )
|
||||
throw AccessDeniedException ( filename );
|
||||
fputs ( outbuf, out );
|
||||
fclose ( out );
|
||||
return;
|
||||
}
|
||||
|
||||
fseek ( out, 0, SEEK_END );
|
||||
end = ftell ( out );
|
||||
cmpbuf = (char*) malloc ( end );
|
||||
if ( cmpbuf == NULL )
|
||||
{
|
||||
fclose ( out );
|
||||
throw OutOfMemoryException ();
|
||||
}
|
||||
|
||||
fseek ( out, 0, SEEK_SET );
|
||||
stat = fread ( cmpbuf, 1, end, out );
|
||||
if ( stat != end )
|
||||
{
|
||||
free ( cmpbuf );
|
||||
fclose ( out );
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
if ( end == strlen ( outbuf ) && memcmp ( cmpbuf, outbuf, end ) == 0 )
|
||||
{
|
||||
free ( cmpbuf );
|
||||
fclose ( out );
|
||||
return;
|
||||
}
|
||||
|
||||
free ( cmpbuf );
|
||||
fclose ( out );
|
||||
out = fopen ( filename.c_str (), "wb" );
|
||||
if ( out == NULL )
|
||||
{
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
|
||||
stat = fwrite ( outbuf, 1, strlen ( outbuf ), out);
|
||||
if ( strlen ( outbuf ) != stat )
|
||||
{
|
||||
fclose ( out );
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
|
||||
fclose ( out );
|
||||
}
|
||||
|
||||
void
|
||||
Project::SetConfigurationOption ( char* s,
|
||||
string name,
|
||||
string* alternativeName )
|
||||
{
|
||||
const Property* property = LookupProperty ( name );
|
||||
if ( property != NULL && property->value.length () > 0 )
|
||||
{
|
||||
s = s + sprintf ( s,
|
||||
"#define %s=%s\n",
|
||||
property->name.c_str (),
|
||||
property->value.c_str () );
|
||||
}
|
||||
else if ( property != NULL )
|
||||
{
|
||||
s = s + sprintf ( s,
|
||||
"#define %s\n",
|
||||
property->name.c_str () );
|
||||
}
|
||||
else if ( alternativeName != NULL )
|
||||
{
|
||||
s = s + sprintf ( s,
|
||||
"#define %s\n",
|
||||
alternativeName->c_str () );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Project::SetConfigurationOption ( char* s,
|
||||
string name )
|
||||
{
|
||||
SetConfigurationOption ( s, name, NULL );
|
||||
}
|
||||
|
||||
void
|
||||
Project::WriteConfigurationFile ()
|
||||
{
|
||||
char* buf;
|
||||
char* s;
|
||||
|
||||
buf = (char*) malloc ( 10*1024 );
|
||||
if ( buf == NULL )
|
||||
throw OutOfMemoryException ();
|
||||
|
||||
s = buf;
|
||||
s = s + sprintf ( s, "/* Automatically generated. " );
|
||||
s = s + sprintf ( s, "Edit config.xml to change configuration */\n" );
|
||||
s = s + sprintf ( s, "#ifndef __INCLUDE_CONFIG_H\n" );
|
||||
s = s + sprintf ( s, "#define __INCLUDE_CONFIG_H\n" );
|
||||
|
||||
SetConfigurationOption ( s, "ARCH" );
|
||||
SetConfigurationOption ( s, "OPTIMIZED" );
|
||||
SetConfigurationOption ( s, "MP", new string ( "UP" ) );
|
||||
SetConfigurationOption ( s, "ACPI" );
|
||||
SetConfigurationOption ( s, "_3GB" );
|
||||
|
||||
s = s + sprintf ( s, "#endif /* __INCLUDE_CONFIG_H */\n" );
|
||||
|
||||
WriteIfChanged ( buf, "include" SSEP "roscfg.h" );
|
||||
|
||||
free ( buf );
|
||||
}
|
||||
|
||||
void
|
||||
Project::ExecuteInvocations ()
|
||||
{
|
||||
for ( size_t i = 0; i < modules.size (); i++ )
|
||||
modules[i]->InvokeModule ();
|
||||
}
|
||||
|
||||
void
|
||||
Project::ReadXml ()
|
||||
{
|
||||
Path path;
|
||||
head = XMLLoadFile ( xmlfile, path, xmlbuildfiles );
|
||||
node = NULL;
|
||||
for ( size_t i = 0; i < head->subElements.size (); i++ )
|
||||
{
|
||||
if ( head->subElements[i]->name == "project" )
|
||||
{
|
||||
node = head->subElements[i];
|
||||
string path;
|
||||
this->ProcessXML ( path );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw InvalidBuildFileException (
|
||||
node->location,
|
||||
"Document contains no 'project' tag." );
|
||||
}
|
||||
|
||||
void
|
||||
Project::ProcessXML ( const string& path )
|
||||
{
|
||||
const XMLAttribute *att;
|
||||
if ( node->name != "project" )
|
||||
throw Exception ( "internal tool error: Project::ProcessXML() called with non-<project> node" );
|
||||
|
||||
att = node->GetAttribute ( "name", false );
|
||||
if ( !att )
|
||||
name = "Unnamed";
|
||||
else
|
||||
name = att->value;
|
||||
|
||||
att = node->GetAttribute ( "makefile", true );
|
||||
assert(att);
|
||||
makefile = att->value;
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < node->subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *node->subElements[i], path );
|
||||
for ( i = 0; i < modules.size (); i++ )
|
||||
modules[i]->ProcessXML ();
|
||||
for ( i = 0; i < linkerFlags.size (); i++ )
|
||||
linkerFlags[i]->ProcessXML ();
|
||||
non_if_data.ProcessXML ();
|
||||
for ( i = 0; i < cdfiles.size (); i++ )
|
||||
cdfiles[i]->ProcessXML ();
|
||||
for ( i = 0; i < installfiles.size (); i++ )
|
||||
installfiles[i]->ProcessXML ();
|
||||
}
|
||||
|
||||
void
|
||||
Project::ProcessXMLSubElement ( const XMLElement& e,
|
||||
const string& path,
|
||||
If* pIf )
|
||||
{
|
||||
bool subs_invalid = false;
|
||||
string subpath(path);
|
||||
if ( e.name == "module" )
|
||||
{
|
||||
if ( pIf )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<module> is not a valid sub-element of <if>" );
|
||||
Module* module = new Module ( *this, e, path );
|
||||
if ( LocateModule ( module->name ) )
|
||||
throw InvalidBuildFileException (
|
||||
node->location,
|
||||
"module name conflict: '%s' (originally defined at %s)",
|
||||
module->name.c_str(),
|
||||
module->node.location.c_str() );
|
||||
modules.push_back ( module );
|
||||
return; // defer processing until later
|
||||
}
|
||||
else if ( e.name == "cdfile" )
|
||||
{
|
||||
CDFile* cdfile = new CDFile ( *this, e, path );
|
||||
cdfiles.push_back ( cdfile );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "installfile" )
|
||||
{
|
||||
InstallFile* installfile = new InstallFile ( *this, e, path );
|
||||
installfiles.push_back ( installfile );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "directory" )
|
||||
{
|
||||
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
subpath = GetSubPath ( e.location, path, att->value );
|
||||
}
|
||||
else if ( e.name == "include" )
|
||||
{
|
||||
Include* include = new Include ( *this, e );
|
||||
if ( pIf )
|
||||
pIf->data.includes.push_back ( include );
|
||||
else
|
||||
non_if_data.includes.push_back ( include );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "define" )
|
||||
{
|
||||
Define* define = new Define ( *this, e );
|
||||
if ( pIf )
|
||||
pIf->data.defines.push_back ( define );
|
||||
else
|
||||
non_if_data.defines.push_back ( define );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "linkerflag" )
|
||||
{
|
||||
linkerFlags.push_back ( new LinkerFlag ( *this, e ) );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "if" )
|
||||
{
|
||||
If* pOldIf = pIf;
|
||||
pIf = new If ( e, *this, NULL );
|
||||
if ( pOldIf )
|
||||
pOldIf->data.ifs.push_back ( pIf );
|
||||
else
|
||||
non_if_data.ifs.push_back ( pIf );
|
||||
subs_invalid = false;
|
||||
}
|
||||
else if ( e.name == "property" )
|
||||
{
|
||||
Property* property = new Property ( e, *this, NULL );
|
||||
if ( pIf )
|
||||
pIf->data.properties.push_back ( property );
|
||||
else
|
||||
non_if_data.properties.push_back ( property );
|
||||
}
|
||||
if ( subs_invalid && e.subElements.size() )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<%s> cannot have sub-elements",
|
||||
e.name.c_str() );
|
||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *e.subElements[i], subpath, pIf );
|
||||
}
|
||||
|
||||
Module*
|
||||
Project::LocateModule ( const string& name )
|
||||
{
|
||||
for ( size_t i = 0; i < modules.size (); i++ )
|
||||
{
|
||||
if (modules[i]->name == name)
|
||||
return modules[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const Module*
|
||||
Project::LocateModule ( const string& name ) const
|
||||
{
|
||||
for ( size_t i = 0; i < modules.size (); i++ )
|
||||
{
|
||||
if ( modules[i]->name == name )
|
||||
return modules[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string
|
||||
Project::GetProjectFilename () const
|
||||
{
|
||||
return xmlfile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
Project::Project ( const string& filename )
|
||||
: xmlfile (filename),
|
||||
node (NULL),
|
||||
head (NULL)
|
||||
{
|
||||
ReadXml();
|
||||
}
|
||||
|
||||
Project::~Project ()
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < modules.size (); i++ )
|
||||
delete modules[i];
|
||||
for ( i = 0; i < linkerFlags.size (); i++ )
|
||||
delete linkerFlags[i];
|
||||
for ( i = 0; i < cdfiles.size (); i++ )
|
||||
delete cdfiles[i];
|
||||
for ( i = 0; i < installfiles.size (); i++ )
|
||||
delete installfiles[i];
|
||||
delete head;
|
||||
}
|
||||
|
||||
const Property*
|
||||
Project::LookupProperty ( const string& name ) const
|
||||
{
|
||||
for ( size_t i = 0; i < non_if_data.properties.size (); i++ )
|
||||
{
|
||||
const Property* property = non_if_data.properties[i];
|
||||
if ( property->name == name )
|
||||
return property;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
Project::WriteIfChanged ( char* outbuf,
|
||||
string filename )
|
||||
{
|
||||
FILE* out;
|
||||
unsigned int end;
|
||||
char* cmpbuf;
|
||||
unsigned int stat;
|
||||
|
||||
out = fopen ( filename.c_str (), "rb" );
|
||||
if ( out == NULL )
|
||||
{
|
||||
out = fopen ( filename.c_str (), "wb" );
|
||||
if ( out == NULL )
|
||||
throw AccessDeniedException ( filename );
|
||||
fputs ( outbuf, out );
|
||||
fclose ( out );
|
||||
return;
|
||||
}
|
||||
|
||||
fseek ( out, 0, SEEK_END );
|
||||
end = ftell ( out );
|
||||
cmpbuf = (char*) malloc ( end );
|
||||
if ( cmpbuf == NULL )
|
||||
{
|
||||
fclose ( out );
|
||||
throw OutOfMemoryException ();
|
||||
}
|
||||
|
||||
fseek ( out, 0, SEEK_SET );
|
||||
stat = fread ( cmpbuf, 1, end, out );
|
||||
if ( stat != end )
|
||||
{
|
||||
free ( cmpbuf );
|
||||
fclose ( out );
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
if ( end == strlen ( outbuf ) && memcmp ( cmpbuf, outbuf, end ) == 0 )
|
||||
{
|
||||
free ( cmpbuf );
|
||||
fclose ( out );
|
||||
return;
|
||||
}
|
||||
|
||||
free ( cmpbuf );
|
||||
fclose ( out );
|
||||
out = fopen ( filename.c_str (), "wb" );
|
||||
if ( out == NULL )
|
||||
{
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
|
||||
stat = fwrite ( outbuf, 1, strlen ( outbuf ), out);
|
||||
if ( strlen ( outbuf ) != stat )
|
||||
{
|
||||
fclose ( out );
|
||||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
|
||||
fclose ( out );
|
||||
}
|
||||
|
||||
void
|
||||
Project::SetConfigurationOption ( char* s,
|
||||
string name,
|
||||
string* alternativeName )
|
||||
{
|
||||
const Property* property = LookupProperty ( name );
|
||||
if ( property != NULL && property->value.length () > 0 )
|
||||
{
|
||||
s = s + sprintf ( s,
|
||||
"#define %s=%s\n",
|
||||
property->name.c_str (),
|
||||
property->value.c_str () );
|
||||
}
|
||||
else if ( property != NULL )
|
||||
{
|
||||
s = s + sprintf ( s,
|
||||
"#define %s\n",
|
||||
property->name.c_str () );
|
||||
}
|
||||
else if ( alternativeName != NULL )
|
||||
{
|
||||
s = s + sprintf ( s,
|
||||
"#define %s\n",
|
||||
alternativeName->c_str () );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Project::SetConfigurationOption ( char* s,
|
||||
string name )
|
||||
{
|
||||
SetConfigurationOption ( s, name, NULL );
|
||||
}
|
||||
|
||||
void
|
||||
Project::WriteConfigurationFile ()
|
||||
{
|
||||
char* buf;
|
||||
char* s;
|
||||
|
||||
buf = (char*) malloc ( 10*1024 );
|
||||
if ( buf == NULL )
|
||||
throw OutOfMemoryException ();
|
||||
|
||||
s = buf;
|
||||
s = s + sprintf ( s, "/* Automatically generated. " );
|
||||
s = s + sprintf ( s, "Edit config.xml to change configuration */\n" );
|
||||
s = s + sprintf ( s, "#ifndef __INCLUDE_CONFIG_H\n" );
|
||||
s = s + sprintf ( s, "#define __INCLUDE_CONFIG_H\n" );
|
||||
|
||||
SetConfigurationOption ( s, "ARCH" );
|
||||
SetConfigurationOption ( s, "OPTIMIZED" );
|
||||
SetConfigurationOption ( s, "MP", new string ( "UP" ) );
|
||||
SetConfigurationOption ( s, "ACPI" );
|
||||
SetConfigurationOption ( s, "_3GB" );
|
||||
|
||||
s = s + sprintf ( s, "#endif /* __INCLUDE_CONFIG_H */\n" );
|
||||
|
||||
WriteIfChanged ( buf, "include" SSEP "roscfg.h" );
|
||||
|
||||
free ( buf );
|
||||
}
|
||||
|
||||
void
|
||||
Project::ExecuteInvocations ()
|
||||
{
|
||||
for ( size_t i = 0; i < modules.size (); i++ )
|
||||
modules[i]->InvokeModule ();
|
||||
}
|
||||
|
||||
void
|
||||
Project::ReadXml ()
|
||||
{
|
||||
Path path;
|
||||
head = XMLLoadFile ( xmlfile, path, xmlbuildfiles );
|
||||
node = NULL;
|
||||
for ( size_t i = 0; i < head->subElements.size (); i++ )
|
||||
{
|
||||
if ( head->subElements[i]->name == "project" )
|
||||
{
|
||||
node = head->subElements[i];
|
||||
string path;
|
||||
this->ProcessXML ( path );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw InvalidBuildFileException (
|
||||
node->location,
|
||||
"Document contains no 'project' tag." );
|
||||
}
|
||||
|
||||
void
|
||||
Project::ProcessXML ( const string& path )
|
||||
{
|
||||
const XMLAttribute *att;
|
||||
if ( node->name != "project" )
|
||||
throw Exception ( "internal tool error: Project::ProcessXML() called with non-<project> node" );
|
||||
|
||||
att = node->GetAttribute ( "name", false );
|
||||
if ( !att )
|
||||
name = "Unnamed";
|
||||
else
|
||||
name = att->value;
|
||||
|
||||
att = node->GetAttribute ( "makefile", true );
|
||||
assert(att);
|
||||
makefile = att->value;
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < node->subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *node->subElements[i], path );
|
||||
for ( i = 0; i < modules.size (); i++ )
|
||||
modules[i]->ProcessXML ();
|
||||
for ( i = 0; i < linkerFlags.size (); i++ )
|
||||
linkerFlags[i]->ProcessXML ();
|
||||
non_if_data.ProcessXML ();
|
||||
for ( i = 0; i < cdfiles.size (); i++ )
|
||||
cdfiles[i]->ProcessXML ();
|
||||
for ( i = 0; i < installfiles.size (); i++ )
|
||||
installfiles[i]->ProcessXML ();
|
||||
}
|
||||
|
||||
void
|
||||
Project::ProcessXMLSubElement ( const XMLElement& e,
|
||||
const string& path,
|
||||
If* pIf )
|
||||
{
|
||||
bool subs_invalid = false;
|
||||
string subpath(path);
|
||||
if ( e.name == "module" )
|
||||
{
|
||||
if ( pIf )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<module> is not a valid sub-element of <if>" );
|
||||
Module* module = new Module ( *this, e, path );
|
||||
if ( LocateModule ( module->name ) )
|
||||
throw InvalidBuildFileException (
|
||||
node->location,
|
||||
"module name conflict: '%s' (originally defined at %s)",
|
||||
module->name.c_str(),
|
||||
module->node.location.c_str() );
|
||||
modules.push_back ( module );
|
||||
return; // defer processing until later
|
||||
}
|
||||
else if ( e.name == "cdfile" )
|
||||
{
|
||||
CDFile* cdfile = new CDFile ( *this, e, path );
|
||||
cdfiles.push_back ( cdfile );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "installfile" )
|
||||
{
|
||||
InstallFile* installfile = new InstallFile ( *this, e, path );
|
||||
installfiles.push_back ( installfile );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "directory" )
|
||||
{
|
||||
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
||||
assert(att);
|
||||
subpath = GetSubPath ( e.location, path, att->value );
|
||||
}
|
||||
else if ( e.name == "include" )
|
||||
{
|
||||
Include* include = new Include ( *this, e );
|
||||
if ( pIf )
|
||||
pIf->data.includes.push_back ( include );
|
||||
else
|
||||
non_if_data.includes.push_back ( include );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "define" )
|
||||
{
|
||||
Define* define = new Define ( *this, e );
|
||||
if ( pIf )
|
||||
pIf->data.defines.push_back ( define );
|
||||
else
|
||||
non_if_data.defines.push_back ( define );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "linkerflag" )
|
||||
{
|
||||
linkerFlags.push_back ( new LinkerFlag ( *this, e ) );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "if" )
|
||||
{
|
||||
If* pOldIf = pIf;
|
||||
pIf = new If ( e, *this, NULL );
|
||||
if ( pOldIf )
|
||||
pOldIf->data.ifs.push_back ( pIf );
|
||||
else
|
||||
non_if_data.ifs.push_back ( pIf );
|
||||
subs_invalid = false;
|
||||
}
|
||||
else if ( e.name == "property" )
|
||||
{
|
||||
Property* property = new Property ( e, *this, NULL );
|
||||
if ( pIf )
|
||||
pIf->data.properties.push_back ( property );
|
||||
else
|
||||
non_if_data.properties.push_back ( property );
|
||||
}
|
||||
if ( subs_invalid && e.subElements.size() )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<%s> cannot have sub-elements",
|
||||
e.name.c_str() );
|
||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *e.subElements[i], subpath, pIf );
|
||||
}
|
||||
|
||||
Module*
|
||||
Project::LocateModule ( const string& name )
|
||||
{
|
||||
for ( size_t i = 0; i < modules.size (); i++ )
|
||||
{
|
||||
if (modules[i]->name == name)
|
||||
return modules[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const Module*
|
||||
Project::LocateModule ( const string& name ) const
|
||||
{
|
||||
for ( size_t i = 0; i < modules.size (); i++ )
|
||||
{
|
||||
if ( modules[i]->name == name )
|
||||
return modules[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string
|
||||
Project::GetProjectFilename () const
|
||||
{
|
||||
return xmlfile;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,107 +1,107 @@
|
|||
// rbuild.cpp
|
||||
|
||||
#include "pch.h"
|
||||
#include <typeinfo>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "backend/backend.h"
|
||||
#include "backend/mingw/mingw.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
static string BuildSystem;
|
||||
static string RootXmlFile = "ReactOS.xml";
|
||||
static bool Verbose = false;
|
||||
static bool CleanAsYouGo = false;
|
||||
|
||||
bool
|
||||
ParseSwitch ( int argc, char** argv, int index )
|
||||
{
|
||||
char switchChar = argv[index][1];
|
||||
switch ( switchChar )
|
||||
{
|
||||
case 'v':
|
||||
Verbose = true;
|
||||
break;
|
||||
case 'c':
|
||||
CleanAsYouGo = true;
|
||||
break;
|
||||
case 'r':
|
||||
RootXmlFile = string(&argv[index][2]);
|
||||
break;
|
||||
default:
|
||||
printf ( "Unknown switch -%c",
|
||||
switchChar );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ParseArguments ( int argc, char** argv )
|
||||
{
|
||||
if ( argc < 2 )
|
||||
return false;
|
||||
|
||||
for ( int i = 1; i < argc; i++ )
|
||||
{
|
||||
if ( argv[i][0] == '-' )
|
||||
{
|
||||
if ( !ParseSwitch ( argc, argv, i ) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
BuildSystem = argv[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main ( int argc, char** argv )
|
||||
{
|
||||
if ( !ParseArguments ( argc, argv ) )
|
||||
{
|
||||
printf ( "Generates project files for buildsystems\n\n" );
|
||||
printf ( " rbuild [-v] [-rfile.xml] buildsystem\n\n" );
|
||||
printf ( "Switches:\n" );
|
||||
printf ( " -v Be verbose\n" );
|
||||
printf ( " -c Clean as you go. Delete generated files as soon as they are not needed anymore\n" );
|
||||
printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml\n" );
|
||||
printf ( "\n" );
|
||||
printf ( " buildsystem Target build system. Can be one of:\n" );
|
||||
printf ( " mingw MinGW\n" );
|
||||
printf ( " devcpp DevC++\n" );
|
||||
return 1;
|
||||
}
|
||||
try
|
||||
{
|
||||
string projectFilename ( RootXmlFile );
|
||||
printf ( "Reading build files..." );
|
||||
Project project ( projectFilename );
|
||||
printf ( "done\n" );
|
||||
project.WriteConfigurationFile ();
|
||||
project.ExecuteInvocations ();
|
||||
Backend* backend = Backend::Factory::Create ( BuildSystem,
|
||||
project,
|
||||
Verbose,
|
||||
CleanAsYouGo );
|
||||
backend->Process ();
|
||||
delete backend;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception& ex)
|
||||
{
|
||||
printf ( "%s\n",
|
||||
ex.Message.c_str () );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// rbuild.cpp
|
||||
|
||||
#include "pch.h"
|
||||
#include <typeinfo>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "backend/backend.h"
|
||||
#include "backend/mingw/mingw.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
static string BuildSystem;
|
||||
static string RootXmlFile = "ReactOS.xml";
|
||||
static bool Verbose = false;
|
||||
static bool CleanAsYouGo = false;
|
||||
|
||||
bool
|
||||
ParseSwitch ( int argc, char** argv, int index )
|
||||
{
|
||||
char switchChar = argv[index][1];
|
||||
switch ( switchChar )
|
||||
{
|
||||
case 'v':
|
||||
Verbose = true;
|
||||
break;
|
||||
case 'c':
|
||||
CleanAsYouGo = true;
|
||||
break;
|
||||
case 'r':
|
||||
RootXmlFile = string(&argv[index][2]);
|
||||
break;
|
||||
default:
|
||||
printf ( "Unknown switch -%c",
|
||||
switchChar );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ParseArguments ( int argc, char** argv )
|
||||
{
|
||||
if ( argc < 2 )
|
||||
return false;
|
||||
|
||||
for ( int i = 1; i < argc; i++ )
|
||||
{
|
||||
if ( argv[i][0] == '-' )
|
||||
{
|
||||
if ( !ParseSwitch ( argc, argv, i ) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
BuildSystem = argv[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main ( int argc, char** argv )
|
||||
{
|
||||
if ( !ParseArguments ( argc, argv ) )
|
||||
{
|
||||
printf ( "Generates project files for buildsystems\n\n" );
|
||||
printf ( " rbuild [-v] [-rfile.xml] buildsystem\n\n" );
|
||||
printf ( "Switches:\n" );
|
||||
printf ( " -v Be verbose\n" );
|
||||
printf ( " -c Clean as you go. Delete generated files as soon as they are not needed anymore\n" );
|
||||
printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml\n" );
|
||||
printf ( "\n" );
|
||||
printf ( " buildsystem Target build system. Can be one of:\n" );
|
||||
printf ( " mingw MinGW\n" );
|
||||
printf ( " devcpp DevC++\n" );
|
||||
return 1;
|
||||
}
|
||||
try
|
||||
{
|
||||
string projectFilename ( RootXmlFile );
|
||||
printf ( "Reading build files..." );
|
||||
Project project ( projectFilename );
|
||||
printf ( "done\n" );
|
||||
project.WriteConfigurationFile ();
|
||||
project.ExecuteInvocations ();
|
||||
Backend* backend = Backend::Factory::Create ( BuildSystem,
|
||||
project,
|
||||
Verbose,
|
||||
CleanAsYouGo );
|
||||
backend->Process ();
|
||||
delete backend;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception& ex)
|
||||
{
|
||||
printf ( "%s\n",
|
||||
ex.Message.c_str () );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,350 +1,350 @@
|
|||
RBUILD_BASE = $(TOOLS_BASE_)rbuild
|
||||
RBUILD_BASE_ = $(RBUILD_BASE)$(SEP)
|
||||
RBUILD_INT = $(INTERMEDIATE_)$(RBUILD_BASE)
|
||||
RBUILD_INT_ = $(RBUILD_INT)$(SEP)
|
||||
RBUILD_OUT = $(OUTPUT_)$(RBUILD_BASE)
|
||||
RBUILD_OUT_ = $(RBUILD_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_INT): | $(TOOLS_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_OUT): | $(TOOLS_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_BACKEND_BASE = $(RBUILD_BASE_)backend
|
||||
RBUILD_BACKEND_BASE_ = $(RBUILD_BACKEND_BASE)$(SEP)
|
||||
RBUILD_BACKEND_INT = $(INTERMEDIATE_)$(RBUILD_BACKEND_BASE)
|
||||
RBUILD_BACKEND_INT_ = $(RBUILD_BACKEND_INT)$(SEP)
|
||||
RBUILD_BACKEND_OUT = $(OUTPUT)$(RBUILD_BACKEND_BASE)
|
||||
RBUILD_BACKEND_OUT_ = $(RBUILD_BACKEND_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_BACKEND_INT): | $(RBUILD_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_BACKEND_OUT): | $(RBUILD_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_MINGW_BASE = $(RBUILD_BACKEND_BASE_)mingw
|
||||
RBUILD_MINGW_BASE_ = $(RBUILD_MINGW_BASE)$(SEP)
|
||||
RBUILD_MINGW_INT = $(INTERMEDIATE_)$(RBUILD_MINGW_BASE)
|
||||
RBUILD_MINGW_INT_ = $(RBUILD_MINGW_INT)$(SEP)
|
||||
RBUILD_MINGW_OUT = $(OUTPUT)$(RBUILD_MINGW_BASE)
|
||||
RBUILD_MINGW_OUT_ = $(RBUILD_MINGW_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_MINGW_INT): | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_MINGW_OUT): | $(RBUILD_BACKEND_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_TESTS_BASE = $(RBUILD_BASE_)tests
|
||||
RBUILD_TESTS_BASE_ = $(RBUILD_TESTS_BASE)$(SEP)
|
||||
RBUILD_TESTS_INT = $(INTERMEDIATE_)$(RBUILD_TESTS_BASE)
|
||||
RBUILD_TESTS_INT_ = $(RBUILD_TESTS_INT)$(SEP)
|
||||
RBUILD_TESTS_OUT = $(OUTPUT)$(RBUILD_TESTS_BASE)
|
||||
|
||||
$(RBUILD_TESTS_INT): | $(RBUILD_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_TESTS_OUT): | $(RBUILD_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_DEVCPP_BASE = $(RBUILD_BACKEND_BASE_)devcpp
|
||||
RBUILD_DEVCPP_BASE_ = $(RBUILD_DEVCPP_BASE)$(SEP)
|
||||
RBUILD_DEVCPP_INT = $(INTERMEDIATE_)$(RBUILD_DEVCPP_BASE)
|
||||
RBUILD_DEVCPP_INT_ = $(RBUILD_DEVCPP_INT)$(SEP)
|
||||
RBUILD_DEVCPP_OUT = $(OUTPUT)$(RBUILD_DEVCPP_BASE)
|
||||
RBUILD_DEVCPP_OUT_ = $(RBUILD_DEVCPP_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_DEVCPP_INT): | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_DEVCPP_OUT): | $(RBUILD_BACKEND_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_TARGET = \
|
||||
$(EXEPREFIX)$(RBUILD_OUT_)rbuild$(EXEPOSTFIX)
|
||||
|
||||
RBUILD_TEST_TARGET = \
|
||||
$(EXEPREFIX)$(RBUILD_OUT_)rbuild_test$(EXEPOSTFIX)
|
||||
|
||||
RBUILD_BACKEND_MINGW_BASE_SOURCES = $(addprefix $(RBUILD_MINGW_BASE_), \
|
||||
mingw.cpp \
|
||||
modulehandler.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_DEVCPP_BASE_SOURCES = $(addprefix $(RBUILD_DEVCPP_BASE_), \
|
||||
devcpp.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_SOURCES = \
|
||||
$(RBUILD_BACKEND_MINGW_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_DEVCPP_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_BASE_)backend.cpp
|
||||
|
||||
RBUILD_COMMON_SOURCES = \
|
||||
$(RBUILD_BACKEND_SOURCES) \
|
||||
$(addprefix $(RBUILD_BASE_), \
|
||||
automaticdependency.cpp \
|
||||
bootstrap.cpp \
|
||||
cdfile.cpp \
|
||||
compilerflag.cpp \
|
||||
define.cpp \
|
||||
exception.cpp \
|
||||
include.cpp \
|
||||
installfile.cpp \
|
||||
linkerflag.cpp \
|
||||
module.cpp \
|
||||
project.cpp \
|
||||
ssprintf.cpp \
|
||||
stubbedcomponent.cpp \
|
||||
XML.cpp \
|
||||
)
|
||||
|
||||
RBUILD_SPECIAL_SOURCES = \
|
||||
$(RBUILD_BASE_)rbuild.cpp
|
||||
|
||||
RBUILD_SOURCES = \
|
||||
$(RBUILD_COMMON_SOURCES) \
|
||||
$(RBUILD_SPECIAL_SOURCES)
|
||||
|
||||
RBUILD_COMMON_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_COMMON_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_SPECIAL_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_SPECIAL_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_OBJECTS = \
|
||||
$(RBUILD_COMMON_OBJECTS) \
|
||||
$(RBUILD_SPECIAL_OBJECTS)
|
||||
|
||||
RBUILD_BACKEND_DEVCPP_HEADERS = \
|
||||
devcpp.h
|
||||
|
||||
RBUILD_BACKEND_MINGW_HEADERS = \
|
||||
mingw.h \
|
||||
modulehandler.h
|
||||
|
||||
RBUILD_BACKEND_HEADERS = \
|
||||
backend.h \
|
||||
$(addprefix devcpp$(SEP), $(RBUILD_BACKEND_DEVCPP_HEADERS)) \
|
||||
$(addprefix mingw$(SEP), $(RBUILD_BACKEND_MINGW_HEADERS))
|
||||
|
||||
RBUILD_HEADERS = \
|
||||
$(addprefix $(RBUILD_BASE_), \
|
||||
exception.h \
|
||||
pch.h \
|
||||
rbuild.h \
|
||||
ssprintf.h \
|
||||
test.h \
|
||||
XML.h \
|
||||
$(addprefix backend$(SEP), $(RBUILD_BACKEND_HEADERS)) \
|
||||
)
|
||||
|
||||
RBUILD_TESTS = \
|
||||
tests$(SEP)cdfiletest.cpp \
|
||||
tests$(SEP)definetest.cpp \
|
||||
tests$(SEP)functiontest.cpp \
|
||||
tests$(SEP)iftest.cpp \
|
||||
tests$(SEP)includetest.cpp \
|
||||
tests$(SEP)invoketest.cpp \
|
||||
tests$(SEP)linkerflagtest.cpp \
|
||||
tests$(SEP)moduletest.cpp \
|
||||
tests$(SEP)projecttest.cpp \
|
||||
tests$(SEP)sourcefiletest.cpp \
|
||||
tests$(SEP)symboltest.cpp
|
||||
|
||||
RBUILD_TEST_SPECIAL_SOURCES = \
|
||||
$(addprefix $(RBUILD_BASE_), $(RBUILD_TESTS)) \
|
||||
$(RBUILD_BASE_)tests$(SEP)alltests.cpp
|
||||
|
||||
RBUILD_TEST_SOURCES = \
|
||||
$(RBUILD_COMMON_SOURCES) \
|
||||
$(RBUILD_TEST_SPECIAL_SOURCES)
|
||||
|
||||
RBUILD_TEST_SPECIAL_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_TEST_SPECIAL_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_TEST_OBJECTS = \
|
||||
$(RBUILD_COMMON_OBJECTS) \
|
||||
$(RBUILD_TEST_SPECIAL_OBJECTS)
|
||||
|
||||
RBUILD_HOST_CXXFLAGS = -g -I$(RBUILD_BASE) -Werror -Wall
|
||||
|
||||
RBUILD_HOST_LFLAGS = -g
|
||||
|
||||
.PHONY: rbuild
|
||||
rbuild: $(RBUILD_TARGET)
|
||||
|
||||
$(RBUILD_TARGET): $(RBUILD_OBJECTS) | $(RBUILD_OUT)
|
||||
$(ECHO_LD)
|
||||
${host_gpp} $(RBUILD_OBJECTS) $(RBUILD_HOST_LFLAGS) -o $@
|
||||
|
||||
$(RBUILD_INT_)automaticdependency.o: $(RBUILD_BASE_)automaticdependency.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)bootstrap.o: $(RBUILD_BASE_)bootstrap.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)cdfile.o: $(RBUILD_BASE_)cdfile.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)compilerflag.o: $(RBUILD_BASE_)compilerflag.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)define.o: $(RBUILD_BASE_)define.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)exception.o: $(RBUILD_BASE_)exception.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)include.o: $(RBUILD_BASE_)include.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)installfile.o: $(RBUILD_BASE_)installfile.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)linkerflag.o: $(RBUILD_BASE_)linkerflag.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)module.o: $(RBUILD_BASE_)module.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)project.o: $(RBUILD_BASE_)project.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)rbuild.o: $(RBUILD_BASE_)rbuild.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)ssprintf.o: $(RBUILD_BASE_)ssprintf.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)stubbedcomponent.o: $(RBUILD_BASE_)stubbedcomponent.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)XML.o: $(RBUILD_BASE_)XML.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_BACKEND_INT_)backend.o: $(RBUILD_BACKEND_BASE_)backend.cpp $(RBUILD_HEADERS) | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MINGW_INT_)mingw.o: $(RBUILD_MINGW_BASE_)mingw.cpp $(RBUILD_HEADERS) | $(RBUILD_MINGW_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MINGW_INT_)modulehandler.o: $(RBUILD_MINGW_BASE_)modulehandler.cpp $(RBUILD_HEADERS) | $(RBUILD_MINGW_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_DEVCPP_INT_)devcpp.o: $(RBUILD_DEVCPP_BASE_)devcpp.cpp $(RBUILD_HEADERS) | $(RBUILD_DEVCPP_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TEST_TARGET): $(RBUILD_TEST_OBJECTS) $(RBUILD_HEADERS) | $(RBUILD_OUT)
|
||||
$(ECHO_LD)
|
||||
${host_gpp} $(RBUILD_TEST_OBJECTS) $(RBUILD_HOST_LFLAGS) -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)cdfiletest.o: $(RBUILD_TESTS_BASE_)cdfiletest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)definetest.o: $(RBUILD_TESTS_BASE_)definetest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)functiontest.o: $(RBUILD_TESTS_BASE_)functiontest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)iftest.o: $(RBUILD_TESTS_BASE_)iftest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)includetest.o: $(RBUILD_TESTS_BASE_)includetest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)invoketest.o: $(RBUILD_TESTS_BASE_)invoketest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)linkerflagtest.o: $(RBUILD_TESTS_BASE_)linkerflagtest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)moduletest.o: $(RBUILD_TESTS_BASE_)moduletest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)projecttest.o: $(RBUILD_TESTS_BASE_)projecttest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)sourcefiletest.o: $(RBUILD_TESTS_BASE_)sourcefiletest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)symboltest.o: $(RBUILD_TESTS_BASE_)symboltest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)alltests.o: $(RBUILD_TESTS_BASE_)alltests.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
|
||||
.PHONY: rbuild_test
|
||||
|
||||
rbuild_test: $(RBUILD_TEST_TARGET)
|
||||
$(ECHO_TEST)
|
||||
$(Q)$(RBUILD_TEST_TARGET)
|
||||
|
||||
.PHONY: rbuild_test_clean
|
||||
rbuild_test_clean: $(RBUILD_TEST_TARGET) $(RBUILD_TESTS_INT)
|
||||
-@$(rm) $(RBUILD_TEST_TARGET) $(RBUILD_TEST_SPECIAL_OBJECTS) 2>$(NUL)
|
||||
|
||||
.PHONY: rbuild_clean
|
||||
rbuild_clean: $(RBUILD_TARGET) $(RBUILD_OBJECTS) $(RBUILD_TESTS_INT)
|
||||
-@$(rm) $(RBUILD_TARGET) $(RBUILD_OBJECTS) 2>$(NUL)
|
||||
clean: rbuild_clean
|
||||
RBUILD_BASE = $(TOOLS_BASE_)rbuild
|
||||
RBUILD_BASE_ = $(RBUILD_BASE)$(SEP)
|
||||
RBUILD_INT = $(INTERMEDIATE_)$(RBUILD_BASE)
|
||||
RBUILD_INT_ = $(RBUILD_INT)$(SEP)
|
||||
RBUILD_OUT = $(OUTPUT_)$(RBUILD_BASE)
|
||||
RBUILD_OUT_ = $(RBUILD_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_INT): | $(TOOLS_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_OUT): | $(TOOLS_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_BACKEND_BASE = $(RBUILD_BASE_)backend
|
||||
RBUILD_BACKEND_BASE_ = $(RBUILD_BACKEND_BASE)$(SEP)
|
||||
RBUILD_BACKEND_INT = $(INTERMEDIATE_)$(RBUILD_BACKEND_BASE)
|
||||
RBUILD_BACKEND_INT_ = $(RBUILD_BACKEND_INT)$(SEP)
|
||||
RBUILD_BACKEND_OUT = $(OUTPUT)$(RBUILD_BACKEND_BASE)
|
||||
RBUILD_BACKEND_OUT_ = $(RBUILD_BACKEND_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_BACKEND_INT): | $(RBUILD_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_BACKEND_OUT): | $(RBUILD_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_MINGW_BASE = $(RBUILD_BACKEND_BASE_)mingw
|
||||
RBUILD_MINGW_BASE_ = $(RBUILD_MINGW_BASE)$(SEP)
|
||||
RBUILD_MINGW_INT = $(INTERMEDIATE_)$(RBUILD_MINGW_BASE)
|
||||
RBUILD_MINGW_INT_ = $(RBUILD_MINGW_INT)$(SEP)
|
||||
RBUILD_MINGW_OUT = $(OUTPUT)$(RBUILD_MINGW_BASE)
|
||||
RBUILD_MINGW_OUT_ = $(RBUILD_MINGW_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_MINGW_INT): | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_MINGW_OUT): | $(RBUILD_BACKEND_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_TESTS_BASE = $(RBUILD_BASE_)tests
|
||||
RBUILD_TESTS_BASE_ = $(RBUILD_TESTS_BASE)$(SEP)
|
||||
RBUILD_TESTS_INT = $(INTERMEDIATE_)$(RBUILD_TESTS_BASE)
|
||||
RBUILD_TESTS_INT_ = $(RBUILD_TESTS_INT)$(SEP)
|
||||
RBUILD_TESTS_OUT = $(OUTPUT)$(RBUILD_TESTS_BASE)
|
||||
|
||||
$(RBUILD_TESTS_INT): | $(RBUILD_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_TESTS_OUT): | $(RBUILD_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_DEVCPP_BASE = $(RBUILD_BACKEND_BASE_)devcpp
|
||||
RBUILD_DEVCPP_BASE_ = $(RBUILD_DEVCPP_BASE)$(SEP)
|
||||
RBUILD_DEVCPP_INT = $(INTERMEDIATE_)$(RBUILD_DEVCPP_BASE)
|
||||
RBUILD_DEVCPP_INT_ = $(RBUILD_DEVCPP_INT)$(SEP)
|
||||
RBUILD_DEVCPP_OUT = $(OUTPUT)$(RBUILD_DEVCPP_BASE)
|
||||
RBUILD_DEVCPP_OUT_ = $(RBUILD_DEVCPP_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_DEVCPP_INT): | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_DEVCPP_OUT): | $(RBUILD_BACKEND_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_TARGET = \
|
||||
$(EXEPREFIX)$(RBUILD_OUT_)rbuild$(EXEPOSTFIX)
|
||||
|
||||
RBUILD_TEST_TARGET = \
|
||||
$(EXEPREFIX)$(RBUILD_OUT_)rbuild_test$(EXEPOSTFIX)
|
||||
|
||||
RBUILD_BACKEND_MINGW_BASE_SOURCES = $(addprefix $(RBUILD_MINGW_BASE_), \
|
||||
mingw.cpp \
|
||||
modulehandler.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_DEVCPP_BASE_SOURCES = $(addprefix $(RBUILD_DEVCPP_BASE_), \
|
||||
devcpp.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_SOURCES = \
|
||||
$(RBUILD_BACKEND_MINGW_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_DEVCPP_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_BASE_)backend.cpp
|
||||
|
||||
RBUILD_COMMON_SOURCES = \
|
||||
$(RBUILD_BACKEND_SOURCES) \
|
||||
$(addprefix $(RBUILD_BASE_), \
|
||||
automaticdependency.cpp \
|
||||
bootstrap.cpp \
|
||||
cdfile.cpp \
|
||||
compilerflag.cpp \
|
||||
define.cpp \
|
||||
exception.cpp \
|
||||
include.cpp \
|
||||
installfile.cpp \
|
||||
linkerflag.cpp \
|
||||
module.cpp \
|
||||
project.cpp \
|
||||
ssprintf.cpp \
|
||||
stubbedcomponent.cpp \
|
||||
XML.cpp \
|
||||
)
|
||||
|
||||
RBUILD_SPECIAL_SOURCES = \
|
||||
$(RBUILD_BASE_)rbuild.cpp
|
||||
|
||||
RBUILD_SOURCES = \
|
||||
$(RBUILD_COMMON_SOURCES) \
|
||||
$(RBUILD_SPECIAL_SOURCES)
|
||||
|
||||
RBUILD_COMMON_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_COMMON_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_SPECIAL_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_SPECIAL_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_OBJECTS = \
|
||||
$(RBUILD_COMMON_OBJECTS) \
|
||||
$(RBUILD_SPECIAL_OBJECTS)
|
||||
|
||||
RBUILD_BACKEND_DEVCPP_HEADERS = \
|
||||
devcpp.h
|
||||
|
||||
RBUILD_BACKEND_MINGW_HEADERS = \
|
||||
mingw.h \
|
||||
modulehandler.h
|
||||
|
||||
RBUILD_BACKEND_HEADERS = \
|
||||
backend.h \
|
||||
$(addprefix devcpp$(SEP), $(RBUILD_BACKEND_DEVCPP_HEADERS)) \
|
||||
$(addprefix mingw$(SEP), $(RBUILD_BACKEND_MINGW_HEADERS))
|
||||
|
||||
RBUILD_HEADERS = \
|
||||
$(addprefix $(RBUILD_BASE_), \
|
||||
exception.h \
|
||||
pch.h \
|
||||
rbuild.h \
|
||||
ssprintf.h \
|
||||
test.h \
|
||||
XML.h \
|
||||
$(addprefix backend$(SEP), $(RBUILD_BACKEND_HEADERS)) \
|
||||
)
|
||||
|
||||
RBUILD_TESTS = \
|
||||
tests$(SEP)cdfiletest.cpp \
|
||||
tests$(SEP)definetest.cpp \
|
||||
tests$(SEP)functiontest.cpp \
|
||||
tests$(SEP)iftest.cpp \
|
||||
tests$(SEP)includetest.cpp \
|
||||
tests$(SEP)invoketest.cpp \
|
||||
tests$(SEP)linkerflagtest.cpp \
|
||||
tests$(SEP)moduletest.cpp \
|
||||
tests$(SEP)projecttest.cpp \
|
||||
tests$(SEP)sourcefiletest.cpp \
|
||||
tests$(SEP)symboltest.cpp
|
||||
|
||||
RBUILD_TEST_SPECIAL_SOURCES = \
|
||||
$(addprefix $(RBUILD_BASE_), $(RBUILD_TESTS)) \
|
||||
$(RBUILD_BASE_)tests$(SEP)alltests.cpp
|
||||
|
||||
RBUILD_TEST_SOURCES = \
|
||||
$(RBUILD_COMMON_SOURCES) \
|
||||
$(RBUILD_TEST_SPECIAL_SOURCES)
|
||||
|
||||
RBUILD_TEST_SPECIAL_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_TEST_SPECIAL_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_TEST_OBJECTS = \
|
||||
$(RBUILD_COMMON_OBJECTS) \
|
||||
$(RBUILD_TEST_SPECIAL_OBJECTS)
|
||||
|
||||
RBUILD_HOST_CXXFLAGS = -g -I$(RBUILD_BASE) -Werror -Wall
|
||||
|
||||
RBUILD_HOST_LFLAGS = -g
|
||||
|
||||
.PHONY: rbuild
|
||||
rbuild: $(RBUILD_TARGET)
|
||||
|
||||
$(RBUILD_TARGET): $(RBUILD_OBJECTS) | $(RBUILD_OUT)
|
||||
$(ECHO_LD)
|
||||
${host_gpp} $(RBUILD_OBJECTS) $(RBUILD_HOST_LFLAGS) -o $@
|
||||
|
||||
$(RBUILD_INT_)automaticdependency.o: $(RBUILD_BASE_)automaticdependency.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)bootstrap.o: $(RBUILD_BASE_)bootstrap.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)cdfile.o: $(RBUILD_BASE_)cdfile.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)compilerflag.o: $(RBUILD_BASE_)compilerflag.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)define.o: $(RBUILD_BASE_)define.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)exception.o: $(RBUILD_BASE_)exception.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)include.o: $(RBUILD_BASE_)include.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)installfile.o: $(RBUILD_BASE_)installfile.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)linkerflag.o: $(RBUILD_BASE_)linkerflag.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)module.o: $(RBUILD_BASE_)module.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)project.o: $(RBUILD_BASE_)project.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)rbuild.o: $(RBUILD_BASE_)rbuild.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)ssprintf.o: $(RBUILD_BASE_)ssprintf.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)stubbedcomponent.o: $(RBUILD_BASE_)stubbedcomponent.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_INT_)XML.o: $(RBUILD_BASE_)XML.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_BACKEND_INT_)backend.o: $(RBUILD_BACKEND_BASE_)backend.cpp $(RBUILD_HEADERS) | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MINGW_INT_)mingw.o: $(RBUILD_MINGW_BASE_)mingw.cpp $(RBUILD_HEADERS) | $(RBUILD_MINGW_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MINGW_INT_)modulehandler.o: $(RBUILD_MINGW_BASE_)modulehandler.cpp $(RBUILD_HEADERS) | $(RBUILD_MINGW_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_DEVCPP_INT_)devcpp.o: $(RBUILD_DEVCPP_BASE_)devcpp.cpp $(RBUILD_HEADERS) | $(RBUILD_DEVCPP_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TEST_TARGET): $(RBUILD_TEST_OBJECTS) $(RBUILD_HEADERS) | $(RBUILD_OUT)
|
||||
$(ECHO_LD)
|
||||
${host_gpp} $(RBUILD_TEST_OBJECTS) $(RBUILD_HOST_LFLAGS) -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)cdfiletest.o: $(RBUILD_TESTS_BASE_)cdfiletest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)definetest.o: $(RBUILD_TESTS_BASE_)definetest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)functiontest.o: $(RBUILD_TESTS_BASE_)functiontest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)iftest.o: $(RBUILD_TESTS_BASE_)iftest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)includetest.o: $(RBUILD_TESTS_BASE_)includetest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)invoketest.o: $(RBUILD_TESTS_BASE_)invoketest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)linkerflagtest.o: $(RBUILD_TESTS_BASE_)linkerflagtest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)moduletest.o: $(RBUILD_TESTS_BASE_)moduletest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)projecttest.o: $(RBUILD_TESTS_BASE_)projecttest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)sourcefiletest.o: $(RBUILD_TESTS_BASE_)sourcefiletest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)symboltest.o: $(RBUILD_TESTS_BASE_)symboltest.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TESTS_INT_)alltests.o: $(RBUILD_TESTS_BASE_)alltests.cpp $(RBUILD_HEADERS) | $(RBUILD_TESTS_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
|
||||
.PHONY: rbuild_test
|
||||
|
||||
rbuild_test: $(RBUILD_TEST_TARGET)
|
||||
$(ECHO_TEST)
|
||||
$(Q)$(RBUILD_TEST_TARGET)
|
||||
|
||||
.PHONY: rbuild_test_clean
|
||||
rbuild_test_clean: $(RBUILD_TEST_TARGET) $(RBUILD_TESTS_INT)
|
||||
-@$(rm) $(RBUILD_TEST_TARGET) $(RBUILD_TEST_SPECIAL_OBJECTS) 2>$(NUL)
|
||||
|
||||
.PHONY: rbuild_clean
|
||||
rbuild_clean: $(RBUILD_TARGET) $(RBUILD_OBJECTS) $(RBUILD_TESTS_INT)
|
||||
-@$(rm) $(RBUILD_TARGET) $(RBUILD_OBJECTS) 2>$(NUL)
|
||||
clean: rbuild_clean
|
||||
|
|
|
@ -1,481 +1,481 @@
|
|||
ReactOS Build System Documentation
|
||||
==================================
|
||||
|
||||
Building ReactOS
|
||||
----------------
|
||||
To generate GNU make makefiles and building ReactOS do the following:
|
||||
|
||||
1) Go to the top-level reactos directory
|
||||
2) Run the command: mingw32-make
|
||||
|
||||
This will start building ReactOS.
|
||||
|
||||
To build a bootable CD run the following command:
|
||||
|
||||
mingw32-make bootcd
|
||||
|
||||
This will create ReactOS.iso in the top-level reactos directory.
|
||||
|
||||
|
||||
Top-level XML Build File
|
||||
------------------------
|
||||
The top-level xml build file (ReactOS.xml) is processed by rbuild. The following is an example of how it could look like:
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||
<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="config.xml">
|
||||
<xi:fallback>
|
||||
<xi:include href="config.template.xml" />
|
||||
</xi:fallback>
|
||||
</xi:include>
|
||||
|
||||
<define name="_M_IX86" />
|
||||
<if property="DBG" value="1">
|
||||
<define name="DBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
|
||||
<include base="ReactOS">include</include>
|
||||
|
||||
<directory name="boot">
|
||||
<xi:include href="boot/boot.xml" />
|
||||
</directory>
|
||||
|
||||
<module name="bootcd" type="iso">
|
||||
</module>
|
||||
</project>
|
||||
|
||||
|
||||
xi:include
|
||||
----------
|
||||
It is possible to split an xml build file over several files. The include element in the xi namespace is used to accomplish this.
|
||||
|
||||
Syntax:
|
||||
<xi:include href="config.xml">
|
||||
<xi:fallback>
|
||||
<xi:include href="config.template.xml" />
|
||||
</xi:fallback>
|
||||
</xi:include>
|
||||
|
||||
Attributes:
|
||||
href - Name of xml build file to include. The filename is relative to the location of the current xml build file.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
xi:fallback
|
||||
|
||||
|
||||
xi:fallback
|
||||
-----------
|
||||
This element is used to provide the name of an alternate file that is to be included if the first include file did not exists.
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
xi:include.
|
||||
|
||||
|
||||
Project element
|
||||
---------------
|
||||
There can be one project per top-level XML build file. A project can only be defined in a top-level xml build file.
|
||||
|
||||
Syntax:
|
||||
<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
...
|
||||
</project>
|
||||
|
||||
Attributes:
|
||||
name - Name of the project.
|
||||
makefile - Filename of the GNU makefile that is to be created.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
define, directory, if, include, module, property
|
||||
|
||||
|
||||
Module element
|
||||
--------------
|
||||
There can be zero or more modules per xml build file.
|
||||
|
||||
Syntax:
|
||||
<module name="msvcrt" type="win32dll" extension=".dll" entrypoint="_DllMain@12" baseaddress="0x70000000" mangledsymbols="true" installbase="system32" installname="msvcrt.dll" usewrc="false" warnings="true">
|
||||
...
|
||||
</module>
|
||||
|
||||
Attributes:
|
||||
name - Name of the module. Also the base name of the generated file if such file is generated for the particular module type.
|
||||
type - Type of module. See below for an explanation of module types.
|
||||
extension - Extension of the generated file if such file is generated for the particular module type.
|
||||
entrypoint - Entrypoint symbol of the generated file if such file is generated for the particular module type.
|
||||
baseaddress - Base address of the generated file if such file is generated for the particular module type.
|
||||
mangledsymbols - Controls wether or not to pass --kill-at to dlltool. If this attribute has the value false then --kill-at is passed to dlltool. If the value is true, then --kill-at is not passed to dlltool. If the generated file exports C++ classes then this need to be true.
|
||||
installbase - Base directory of the generated file in the installation directory. This attribute is optional.
|
||||
installname - Name of generated file in the installation directory. This attribute is optional, but if not specified, the generated file is not copied to the installation directory.
|
||||
usewrc - Use WRC to compile resources if true. If false, windres is used. This attribute is optional. If not specified, WRC will be used.
|
||||
warnings - Error out if false and at least one warning is emitted during building of this module. This attribute is optional. If not specified, it is assumed to be false.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
bootstrap, component, define, dependency, directory, file, if, importlibrary, include, invoke, library, property.
|
||||
|
||||
|
||||
Module types
|
||||
------------
|
||||
The module type determines the actions that is to be carried out to process the module. The defined module types are seen below:
|
||||
buildtool - Builds a tool that can be run (invoked) when building ReactOS. Default extension is .exe when building on Windows and nothing when building on Linux. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
staticlibrary - Builds a static library containing object files that can be linked together with other modules. Default extension is .a. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
objectlibrary - Builds object files that can be linked together with other modules. Default extension is .o. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
kernel - Builds ntoskrnl.exe. Default extension is .exe. Default entrypoint is _NtProcessStartup.
|
||||
kernelmodedll - Builds a kernel-mode DLL. Default extension is .dll. Default entrypoint is _DriverEntry@8.
|
||||
kernelmodedriver - Builds a kernel-mode driver. Default extension is .sys. Default entrypoint is _DriverEntry@8.
|
||||
nativedll - Builds a native DLL. Default extension is .dll. Default entrypoint is _DllMainCRTStartup@12.
|
||||
win32dll - Builds a Win32 DLL. Default extension is .dll. Default entrypoint is _DllMain@12.
|
||||
win32cui - Builds a Win32 console executable. Default extension is .exe. Default entrypoint is _mainCRTStartup. The baseaddress module attribute is not applicable for this module type.
|
||||
win32gui - Builds a Win32 GUI executable. Default extension is .exe. Default entrypoint is _WinMainCRTStartup. The baseaddress module attribute is not applicable for this module type.
|
||||
bootloader - Builds a bootloader. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
bootsector - Builds one or more bootsector binaries. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
iso - Builds a bootable CD. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
test - Builds a testsuite. Default extension is .exe. Default entrypoint is _mainCRTStartup. The baseaddress module attribute is not applicable for this module type.
|
||||
rpcserver - Generates and builds server code for an RPC interface. Default extension is .o. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
rpcclient - Generates and builds client code for an RPC interface. Default extension is .o. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
|
||||
|
||||
Bootstrap element
|
||||
-----------------
|
||||
A bootstrap element specifies that the generated file should be put on the bootable CD as a bootstrap file.
|
||||
|
||||
Syntax:
|
||||
<bootstrap base="reactos" nameoncd="halmp.dll" />
|
||||
|
||||
Attributes:
|
||||
base - Put file in this directory on the bootable CD. This attribute is optional.
|
||||
nameoncd - Name of file on the bootable CD. This attribute is optional.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
CDFile element
|
||||
--------------
|
||||
A cdfile element specifies the name of a file that is to be put on the bootable CD.
|
||||
|
||||
Syntax:
|
||||
<cdfile base="reactos" nameoncd="ReadMe.txt">ReadMe.txt</cdfile>
|
||||
|
||||
Attributes:
|
||||
base - Put file in this directory on the bootable CD. This attribute is optional.
|
||||
nameoncd - Name of file on the bootable CD. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Component element
|
||||
-----------------
|
||||
A component element specifies that imports from a library are to be stubbed so tests can be run without actually calling the functions in the library. This element can only be used for modules of type test.
|
||||
|
||||
Syntax:
|
||||
<component name="ntdll.dll">
|
||||
...
|
||||
</component>
|
||||
|
||||
Attributes:
|
||||
name - Name of library.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
Symbol.
|
||||
|
||||
|
||||
Symbol element
|
||||
--------------
|
||||
A symbol element specifies an imported function from a library that is to be stubbed so tests can be run without actually calling the function in the library.
|
||||
|
||||
Syntax:
|
||||
<symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
|
||||
|
||||
Attributes:
|
||||
newname - New name of symbol. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of symbol.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Define element
|
||||
--------------
|
||||
A define element specifies the name and (optionally) value of a define for the C/C++ compiler and resource compiler.
|
||||
|
||||
Syntax:
|
||||
<define name="WINVER">0x501</define>
|
||||
|
||||
Attributes:
|
||||
name - Name of define.
|
||||
|
||||
Value:
|
||||
Value of define. The value is optional.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Dependency element
|
||||
------------------
|
||||
A dependency element specifies the name of a module (usually of type buildtool) that is to be processed before the current module.
|
||||
|
||||
Syntax:
|
||||
<dependency>OtherModule</dependency>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of module.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Directory element
|
||||
-----------------
|
||||
A directory element specifies the name of a subdirectory.
|
||||
|
||||
Syntax:
|
||||
<directory name="MyDirectory">
|
||||
...
|
||||
</directory>
|
||||
|
||||
Attributes:
|
||||
name - Name of directory.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
cdfile, directory, file, if, property.
|
||||
|
||||
|
||||
File element
|
||||
------------
|
||||
A file element specifies the name of a file that is to be processed.
|
||||
|
||||
Syntax:
|
||||
<file>MyFile.c</file>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of file.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
If element
|
||||
----------
|
||||
An if element allows for conditional processing of other elements.
|
||||
|
||||
Syntax:
|
||||
<if property="DBG" value="1">
|
||||
...
|
||||
</if>
|
||||
|
||||
Attributes:
|
||||
property - Name of the property that is to be evaluated.
|
||||
value - Value to compare to the value of the property. If the property has the specified value, then the subelements are processed.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
define, directory, file, if, include, property.
|
||||
|
||||
|
||||
Importlibrary element
|
||||
---------------------
|
||||
An importlibrary element specifies that an import library should be generated which other modules can use to link with the current module.
|
||||
|
||||
Syntax:
|
||||
<importlibrary definition="MyModule.def" />
|
||||
|
||||
Attributes:
|
||||
definition - Filename of definition file (.def) used to generate the import library. The filename is relative to the current module.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Include element
|
||||
---------------
|
||||
An include element specifies an include directory for the C/C++ compiler and resource compiler.
|
||||
|
||||
Syntax:
|
||||
<include base="MyLibraryModule">include</include>
|
||||
|
||||
Attributes:
|
||||
base - Module or project which the value of this element is relative to. This attribute is optional. If left out, the include directory is relative to the position of the top-level xml build file.
|
||||
|
||||
Value:
|
||||
Relative include directory.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Installfile element
|
||||
-------------------
|
||||
An installfile element specifies the name of a file that is to be installed when using 'make install'.
|
||||
|
||||
Syntax:
|
||||
<installfile base="reactos" newname="ReadMe.txt">ReadMe.txt</installfile>
|
||||
|
||||
Attributes:
|
||||
base - Put file in this directory within the install directory. This attribute is optional.
|
||||
newname - Name of file within the install directory. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Invoke element
|
||||
--------------
|
||||
An invoke element specifies the name of a module which is to be executed before the current module is processed.
|
||||
|
||||
Syntax:
|
||||
<invoke module="wmc">
|
||||
<input>
|
||||
<inputfile>ntoskrnl.mc</inputfile>
|
||||
</input>
|
||||
<output>
|
||||
<outputfile switches="-H">../include/reactos/bugcodes.h</outputfile>
|
||||
<outputfile switches="-o">bugcodes.rc</outputfile>
|
||||
</output>
|
||||
</invoke>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of the module to execute.
|
||||
|
||||
Elements:
|
||||
input, output.
|
||||
|
||||
|
||||
Input element
|
||||
-------------
|
||||
An input element specifies a group of filenames that is to be passed as parameters to a build tool. Input filename parameters are located after output filename parameters on the command line.
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
inputfile.
|
||||
|
||||
|
||||
Inputfile element
|
||||
-----------------
|
||||
An inputfile element specifies a filename that is to be passed as a parameter to a build tool.
|
||||
|
||||
Attributes:
|
||||
switches - Switches that is passed as parameters just before the filename. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file that is to be passed as a parameter to the build tool.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Output element
|
||||
--------------
|
||||
An output element specifies a group of filenames that is to be passed as parameters to a build tool. Output filename parameters are located before input filename parameters on the command line.
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
outputfile.
|
||||
|
||||
|
||||
Outputfile element
|
||||
------------------
|
||||
An outputfile element specifies a filename that is to be passed as a parameter to a build tool.
|
||||
|
||||
Attributes:
|
||||
switches - Switches that is passed as parameters just before the filename. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file that is to be passed as a parameter to the build tool.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Library
|
||||
-------
|
||||
An importlibrary element specifies the name of another module which is to be linked with the current module.
|
||||
|
||||
Syntax:
|
||||
<library>MyLibraryModule</library>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of the module to link with.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Property
|
||||
--------
|
||||
A property element specifies the name and value of a property that can be used for conditional processing of the xml build file.
|
||||
|
||||
Syntax:
|
||||
<property name="mypropertyname" value="mypropertyvalue" />
|
||||
|
||||
Attributes:
|
||||
name - Name of property.
|
||||
value - Value of property.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
ReactOS Build System Documentation
|
||||
==================================
|
||||
|
||||
Building ReactOS
|
||||
----------------
|
||||
To generate GNU make makefiles and building ReactOS do the following:
|
||||
|
||||
1) Go to the top-level reactos directory
|
||||
2) Run the command: mingw32-make
|
||||
|
||||
This will start building ReactOS.
|
||||
|
||||
To build a bootable CD run the following command:
|
||||
|
||||
mingw32-make bootcd
|
||||
|
||||
This will create ReactOS.iso in the top-level reactos directory.
|
||||
|
||||
|
||||
Top-level XML Build File
|
||||
------------------------
|
||||
The top-level xml build file (ReactOS.xml) is processed by rbuild. The following is an example of how it could look like:
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||
<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="config.xml">
|
||||
<xi:fallback>
|
||||
<xi:include href="config.template.xml" />
|
||||
</xi:fallback>
|
||||
</xi:include>
|
||||
|
||||
<define name="_M_IX86" />
|
||||
<if property="DBG" value="1">
|
||||
<define name="DBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
|
||||
<include base="ReactOS">include</include>
|
||||
|
||||
<directory name="boot">
|
||||
<xi:include href="boot/boot.xml" />
|
||||
</directory>
|
||||
|
||||
<module name="bootcd" type="iso">
|
||||
</module>
|
||||
</project>
|
||||
|
||||
|
||||
xi:include
|
||||
----------
|
||||
It is possible to split an xml build file over several files. The include element in the xi namespace is used to accomplish this.
|
||||
|
||||
Syntax:
|
||||
<xi:include href="config.xml">
|
||||
<xi:fallback>
|
||||
<xi:include href="config.template.xml" />
|
||||
</xi:fallback>
|
||||
</xi:include>
|
||||
|
||||
Attributes:
|
||||
href - Name of xml build file to include. The filename is relative to the location of the current xml build file.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
xi:fallback
|
||||
|
||||
|
||||
xi:fallback
|
||||
-----------
|
||||
This element is used to provide the name of an alternate file that is to be included if the first include file did not exists.
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
xi:include.
|
||||
|
||||
|
||||
Project element
|
||||
---------------
|
||||
There can be one project per top-level XML build file. A project can only be defined in a top-level xml build file.
|
||||
|
||||
Syntax:
|
||||
<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
...
|
||||
</project>
|
||||
|
||||
Attributes:
|
||||
name - Name of the project.
|
||||
makefile - Filename of the GNU makefile that is to be created.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
define, directory, if, include, module, property
|
||||
|
||||
|
||||
Module element
|
||||
--------------
|
||||
There can be zero or more modules per xml build file.
|
||||
|
||||
Syntax:
|
||||
<module name="msvcrt" type="win32dll" extension=".dll" entrypoint="_DllMain@12" baseaddress="0x70000000" mangledsymbols="true" installbase="system32" installname="msvcrt.dll" usewrc="false" warnings="true">
|
||||
...
|
||||
</module>
|
||||
|
||||
Attributes:
|
||||
name - Name of the module. Also the base name of the generated file if such file is generated for the particular module type.
|
||||
type - Type of module. See below for an explanation of module types.
|
||||
extension - Extension of the generated file if such file is generated for the particular module type.
|
||||
entrypoint - Entrypoint symbol of the generated file if such file is generated for the particular module type.
|
||||
baseaddress - Base address of the generated file if such file is generated for the particular module type.
|
||||
mangledsymbols - Controls wether or not to pass --kill-at to dlltool. If this attribute has the value false then --kill-at is passed to dlltool. If the value is true, then --kill-at is not passed to dlltool. If the generated file exports C++ classes then this need to be true.
|
||||
installbase - Base directory of the generated file in the installation directory. This attribute is optional.
|
||||
installname - Name of generated file in the installation directory. This attribute is optional, but if not specified, the generated file is not copied to the installation directory.
|
||||
usewrc - Use WRC to compile resources if true. If false, windres is used. This attribute is optional. If not specified, WRC will be used.
|
||||
warnings - Error out if false and at least one warning is emitted during building of this module. This attribute is optional. If not specified, it is assumed to be false.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
bootstrap, component, define, dependency, directory, file, if, importlibrary, include, invoke, library, property.
|
||||
|
||||
|
||||
Module types
|
||||
------------
|
||||
The module type determines the actions that is to be carried out to process the module. The defined module types are seen below:
|
||||
buildtool - Builds a tool that can be run (invoked) when building ReactOS. Default extension is .exe when building on Windows and nothing when building on Linux. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
staticlibrary - Builds a static library containing object files that can be linked together with other modules. Default extension is .a. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
objectlibrary - Builds object files that can be linked together with other modules. Default extension is .o. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
kernel - Builds ntoskrnl.exe. Default extension is .exe. Default entrypoint is _NtProcessStartup.
|
||||
kernelmodedll - Builds a kernel-mode DLL. Default extension is .dll. Default entrypoint is _DriverEntry@8.
|
||||
kernelmodedriver - Builds a kernel-mode driver. Default extension is .sys. Default entrypoint is _DriverEntry@8.
|
||||
nativedll - Builds a native DLL. Default extension is .dll. Default entrypoint is _DllMainCRTStartup@12.
|
||||
win32dll - Builds a Win32 DLL. Default extension is .dll. Default entrypoint is _DllMain@12.
|
||||
win32cui - Builds a Win32 console executable. Default extension is .exe. Default entrypoint is _mainCRTStartup. The baseaddress module attribute is not applicable for this module type.
|
||||
win32gui - Builds a Win32 GUI executable. Default extension is .exe. Default entrypoint is _WinMainCRTStartup. The baseaddress module attribute is not applicable for this module type.
|
||||
bootloader - Builds a bootloader. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
bootsector - Builds one or more bootsector binaries. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
iso - Builds a bootable CD. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
test - Builds a testsuite. Default extension is .exe. Default entrypoint is _mainCRTStartup. The baseaddress module attribute is not applicable for this module type.
|
||||
rpcserver - Generates and builds server code for an RPC interface. Default extension is .o. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
rpcclient - Generates and builds client code for an RPC interface. Default extension is .o. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
|
||||
|
||||
|
||||
Bootstrap element
|
||||
-----------------
|
||||
A bootstrap element specifies that the generated file should be put on the bootable CD as a bootstrap file.
|
||||
|
||||
Syntax:
|
||||
<bootstrap base="reactos" nameoncd="halmp.dll" />
|
||||
|
||||
Attributes:
|
||||
base - Put file in this directory on the bootable CD. This attribute is optional.
|
||||
nameoncd - Name of file on the bootable CD. This attribute is optional.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
CDFile element
|
||||
--------------
|
||||
A cdfile element specifies the name of a file that is to be put on the bootable CD.
|
||||
|
||||
Syntax:
|
||||
<cdfile base="reactos" nameoncd="ReadMe.txt">ReadMe.txt</cdfile>
|
||||
|
||||
Attributes:
|
||||
base - Put file in this directory on the bootable CD. This attribute is optional.
|
||||
nameoncd - Name of file on the bootable CD. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Component element
|
||||
-----------------
|
||||
A component element specifies that imports from a library are to be stubbed so tests can be run without actually calling the functions in the library. This element can only be used for modules of type test.
|
||||
|
||||
Syntax:
|
||||
<component name="ntdll.dll">
|
||||
...
|
||||
</component>
|
||||
|
||||
Attributes:
|
||||
name - Name of library.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
Symbol.
|
||||
|
||||
|
||||
Symbol element
|
||||
--------------
|
||||
A symbol element specifies an imported function from a library that is to be stubbed so tests can be run without actually calling the function in the library.
|
||||
|
||||
Syntax:
|
||||
<symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
|
||||
|
||||
Attributes:
|
||||
newname - New name of symbol. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of symbol.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Define element
|
||||
--------------
|
||||
A define element specifies the name and (optionally) value of a define for the C/C++ compiler and resource compiler.
|
||||
|
||||
Syntax:
|
||||
<define name="WINVER">0x501</define>
|
||||
|
||||
Attributes:
|
||||
name - Name of define.
|
||||
|
||||
Value:
|
||||
Value of define. The value is optional.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Dependency element
|
||||
------------------
|
||||
A dependency element specifies the name of a module (usually of type buildtool) that is to be processed before the current module.
|
||||
|
||||
Syntax:
|
||||
<dependency>OtherModule</dependency>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of module.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Directory element
|
||||
-----------------
|
||||
A directory element specifies the name of a subdirectory.
|
||||
|
||||
Syntax:
|
||||
<directory name="MyDirectory">
|
||||
...
|
||||
</directory>
|
||||
|
||||
Attributes:
|
||||
name - Name of directory.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
cdfile, directory, file, if, property.
|
||||
|
||||
|
||||
File element
|
||||
------------
|
||||
A file element specifies the name of a file that is to be processed.
|
||||
|
||||
Syntax:
|
||||
<file>MyFile.c</file>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of file.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
If element
|
||||
----------
|
||||
An if element allows for conditional processing of other elements.
|
||||
|
||||
Syntax:
|
||||
<if property="DBG" value="1">
|
||||
...
|
||||
</if>
|
||||
|
||||
Attributes:
|
||||
property - Name of the property that is to be evaluated.
|
||||
value - Value to compare to the value of the property. If the property has the specified value, then the subelements are processed.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
define, directory, file, if, include, property.
|
||||
|
||||
|
||||
Importlibrary element
|
||||
---------------------
|
||||
An importlibrary element specifies that an import library should be generated which other modules can use to link with the current module.
|
||||
|
||||
Syntax:
|
||||
<importlibrary definition="MyModule.def" />
|
||||
|
||||
Attributes:
|
||||
definition - Filename of definition file (.def) used to generate the import library. The filename is relative to the current module.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Include element
|
||||
---------------
|
||||
An include element specifies an include directory for the C/C++ compiler and resource compiler.
|
||||
|
||||
Syntax:
|
||||
<include base="MyLibraryModule">include</include>
|
||||
|
||||
Attributes:
|
||||
base - Module or project which the value of this element is relative to. This attribute is optional. If left out, the include directory is relative to the position of the top-level xml build file.
|
||||
|
||||
Value:
|
||||
Relative include directory.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Installfile element
|
||||
-------------------
|
||||
An installfile element specifies the name of a file that is to be installed when using 'make install'.
|
||||
|
||||
Syntax:
|
||||
<installfile base="reactos" newname="ReadMe.txt">ReadMe.txt</installfile>
|
||||
|
||||
Attributes:
|
||||
base - Put file in this directory within the install directory. This attribute is optional.
|
||||
newname - Name of file within the install directory. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Invoke element
|
||||
--------------
|
||||
An invoke element specifies the name of a module which is to be executed before the current module is processed.
|
||||
|
||||
Syntax:
|
||||
<invoke module="wmc">
|
||||
<input>
|
||||
<inputfile>ntoskrnl.mc</inputfile>
|
||||
</input>
|
||||
<output>
|
||||
<outputfile switches="-H">../include/reactos/bugcodes.h</outputfile>
|
||||
<outputfile switches="-o">bugcodes.rc</outputfile>
|
||||
</output>
|
||||
</invoke>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of the module to execute.
|
||||
|
||||
Elements:
|
||||
input, output.
|
||||
|
||||
|
||||
Input element
|
||||
-------------
|
||||
An input element specifies a group of filenames that is to be passed as parameters to a build tool. Input filename parameters are located after output filename parameters on the command line.
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
inputfile.
|
||||
|
||||
|
||||
Inputfile element
|
||||
-----------------
|
||||
An inputfile element specifies a filename that is to be passed as a parameter to a build tool.
|
||||
|
||||
Attributes:
|
||||
switches - Switches that is passed as parameters just before the filename. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file that is to be passed as a parameter to the build tool.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Output element
|
||||
--------------
|
||||
An output element specifies a group of filenames that is to be passed as parameters to a build tool. Output filename parameters are located before input filename parameters on the command line.
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
outputfile.
|
||||
|
||||
|
||||
Outputfile element
|
||||
------------------
|
||||
An outputfile element specifies a filename that is to be passed as a parameter to a build tool.
|
||||
|
||||
Attributes:
|
||||
switches - Switches that is passed as parameters just before the filename. This attribute is optional.
|
||||
|
||||
Value:
|
||||
Name of file that is to be passed as a parameter to the build tool.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Library
|
||||
-------
|
||||
An importlibrary element specifies the name of another module which is to be linked with the current module.
|
||||
|
||||
Syntax:
|
||||
<library>MyLibraryModule</library>
|
||||
|
||||
Attributes:
|
||||
None.
|
||||
|
||||
Value:
|
||||
Name of the module to link with.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
||||
|
||||
Property
|
||||
--------
|
||||
A property element specifies the name and value of a property that can be used for conditional processing of the xml build file.
|
||||
|
||||
Syntax:
|
||||
<property name="mypropertyname" value="mypropertyvalue" />
|
||||
|
||||
Attributes:
|
||||
name - Name of property.
|
||||
value - Value of property.
|
||||
|
||||
Value:
|
||||
None.
|
||||
|
||||
Elements:
|
||||
None.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,23 +1,23 @@
|
|||
// ssprintf.h
|
||||
|
||||
#ifndef SSPRINTF_H
|
||||
#define SSPRINTF_H
|
||||
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
|
||||
std::string ssprintf ( const char* fmt, ... );
|
||||
std::string ssvprintf ( const char* fmt, va_list args );
|
||||
|
||||
std::wstring sswprintf ( const wchar_t* fmt, ... );
|
||||
std::wstring sswvprintf ( const wchar_t* fmt, va_list args );
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define sstprintf sswprintf
|
||||
#define sstvprintf sswvprintf
|
||||
#else
|
||||
#define sstprintf ssprintf
|
||||
#define sstvprintf ssvprintf
|
||||
#endif
|
||||
|
||||
#endif//SSPRINTF_H
|
||||
// ssprintf.h
|
||||
|
||||
#ifndef SSPRINTF_H
|
||||
#define SSPRINTF_H
|
||||
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
|
||||
std::string ssprintf ( const char* fmt, ... );
|
||||
std::string ssvprintf ( const char* fmt, va_list args );
|
||||
|
||||
std::wstring sswprintf ( const wchar_t* fmt, ... );
|
||||
std::wstring sswvprintf ( const wchar_t* fmt, va_list args );
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define sstprintf sswprintf
|
||||
#define sstvprintf sswvprintf
|
||||
#else
|
||||
#define sstprintf ssprintf
|
||||
#define sstvprintf ssvprintf
|
||||
#endif
|
||||
|
||||
#endif//SSPRINTF_H
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
StubbedComponent::StubbedComponent ( const Module* module_,
|
||||
const XMLElement& stubbedComponentNode )
|
||||
: module(module_),
|
||||
node(stubbedComponentNode)
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "name", true );
|
||||
assert ( att );
|
||||
name = att->value;
|
||||
}
|
||||
|
||||
StubbedComponent::~StubbedComponent ()
|
||||
{
|
||||
for ( size_t i = 0; i < symbols.size(); i++ )
|
||||
delete symbols[i];
|
||||
}
|
||||
|
||||
void
|
||||
StubbedComponent::ProcessXML ()
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < node.subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *node.subElements[i] );
|
||||
for ( i = 0; i < symbols.size (); i++ )
|
||||
symbols[i]->ProcessXML ();
|
||||
}
|
||||
|
||||
void
|
||||
StubbedComponent::ProcessXMLSubElement ( const XMLElement& e )
|
||||
{
|
||||
bool subs_invalid = false;
|
||||
if ( e.name == "symbol" )
|
||||
{
|
||||
symbols.push_back ( new StubbedSymbol ( e ) );
|
||||
subs_invalid = false;
|
||||
}
|
||||
if ( subs_invalid && e.subElements.size () > 0 )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<%s> cannot have sub-elements",
|
||||
e.name.c_str() );
|
||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *e.subElements[i] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
StubbedSymbol::StubbedSymbol ( const XMLElement& stubbedSymbolNode )
|
||||
: node(stubbedSymbolNode)
|
||||
{
|
||||
}
|
||||
|
||||
StubbedSymbol::~StubbedSymbol ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
StubbedSymbol::ProcessXML ()
|
||||
{
|
||||
if ( node.value.size () == 0 )
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<symbol> is empty." );
|
||||
}
|
||||
symbol = node.value;
|
||||
|
||||
const XMLAttribute* att = node.GetAttribute ( "newname", false );
|
||||
if ( att != NULL )
|
||||
newname = att->value;
|
||||
else
|
||||
newname = symbol;
|
||||
}
|
||||
#include "pch.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
StubbedComponent::StubbedComponent ( const Module* module_,
|
||||
const XMLElement& stubbedComponentNode )
|
||||
: module(module_),
|
||||
node(stubbedComponentNode)
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "name", true );
|
||||
assert ( att );
|
||||
name = att->value;
|
||||
}
|
||||
|
||||
StubbedComponent::~StubbedComponent ()
|
||||
{
|
||||
for ( size_t i = 0; i < symbols.size(); i++ )
|
||||
delete symbols[i];
|
||||
}
|
||||
|
||||
void
|
||||
StubbedComponent::ProcessXML ()
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < node.subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *node.subElements[i] );
|
||||
for ( i = 0; i < symbols.size (); i++ )
|
||||
symbols[i]->ProcessXML ();
|
||||
}
|
||||
|
||||
void
|
||||
StubbedComponent::ProcessXMLSubElement ( const XMLElement& e )
|
||||
{
|
||||
bool subs_invalid = false;
|
||||
if ( e.name == "symbol" )
|
||||
{
|
||||
symbols.push_back ( new StubbedSymbol ( e ) );
|
||||
subs_invalid = false;
|
||||
}
|
||||
if ( subs_invalid && e.subElements.size () > 0 )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<%s> cannot have sub-elements",
|
||||
e.name.c_str() );
|
||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||
ProcessXMLSubElement ( *e.subElements[i] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
StubbedSymbol::StubbedSymbol ( const XMLElement& stubbedSymbolNode )
|
||||
: node(stubbedSymbolNode)
|
||||
{
|
||||
}
|
||||
|
||||
StubbedSymbol::~StubbedSymbol ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
StubbedSymbol::ProcessXML ()
|
||||
{
|
||||
if ( node.value.size () == 0 )
|
||||
{
|
||||
throw InvalidBuildFileException (
|
||||
node.location,
|
||||
"<symbol> is empty." );
|
||||
}
|
||||
symbol = node.value;
|
||||
|
||||
const XMLAttribute* att = node.GetAttribute ( "newname", false );
|
||||
if ( att != NULL )
|
||||
newname = att->value;
|
||||
else
|
||||
newname = symbol;
|
||||
}
|
||||
|
|
|
@ -1,136 +1,136 @@
|
|||
#ifndef __TEST_H
|
||||
#define __TEST_H
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "backend/mingw/mingw.h"
|
||||
|
||||
#define RBUILD_BASE "tools" SSEP "rbuild" SSEP
|
||||
|
||||
class BaseTest
|
||||
{
|
||||
public:
|
||||
bool Failed;
|
||||
BaseTest ();
|
||||
virtual ~BaseTest ();
|
||||
virtual void Run () = 0;
|
||||
protected:
|
||||
void Assert ( const char *message,
|
||||
... );
|
||||
void IsNull ( void* reference,
|
||||
const char* file,
|
||||
int line );
|
||||
void IsNotNull ( void* reference,
|
||||
const char* file,
|
||||
int line );
|
||||
void IsTrue ( bool condition,
|
||||
const char* file,
|
||||
int line );
|
||||
void IsFalse ( bool condition,
|
||||
const char* file,
|
||||
int line );
|
||||
void AreEqual ( int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line );
|
||||
void AreEqual ( const std::string& expected,
|
||||
const std::string& actual,
|
||||
const char* file,
|
||||
int line );
|
||||
void AreNotEqual ( int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line );
|
||||
private:
|
||||
void Fail ();
|
||||
};
|
||||
|
||||
#define IS_NULL(reference) IsNull((void*)reference,__FILE__,__LINE__)
|
||||
#define IS_NOT_NULL(reference) IsNotNull((void*)reference,__FILE__,__LINE__)
|
||||
#define IS_TRUE(condition) IsTrue(condition,__FILE__,__LINE__)
|
||||
#define IS_FALSE(condition) IsFalse(condition,__FILE__,__LINE__)
|
||||
#define ARE_EQUAL(expected,actual) AreEqual(expected,actual,__FILE__,__LINE__)
|
||||
#define ARE_NOT_EQUAL(expected,actual) AreNotEqual(expected,actual,__FILE__,__LINE__)
|
||||
|
||||
class ProjectTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class ModuleTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class DefineTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class IncludeTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class InvokeTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class LinkerFlagTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class IfTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class FunctionTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class SourceFileTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
void IncludeTest ();
|
||||
void FullParseTest ();
|
||||
private:
|
||||
bool IsParentOf ( const SourceFile* parent,
|
||||
const SourceFile* child );
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CDFileTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class SymbolTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
#endif /* __TEST_H */
|
||||
#ifndef __TEST_H
|
||||
#define __TEST_H
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "backend/mingw/mingw.h"
|
||||
|
||||
#define RBUILD_BASE "tools" SSEP "rbuild" SSEP
|
||||
|
||||
class BaseTest
|
||||
{
|
||||
public:
|
||||
bool Failed;
|
||||
BaseTest ();
|
||||
virtual ~BaseTest ();
|
||||
virtual void Run () = 0;
|
||||
protected:
|
||||
void Assert ( const char *message,
|
||||
... );
|
||||
void IsNull ( void* reference,
|
||||
const char* file,
|
||||
int line );
|
||||
void IsNotNull ( void* reference,
|
||||
const char* file,
|
||||
int line );
|
||||
void IsTrue ( bool condition,
|
||||
const char* file,
|
||||
int line );
|
||||
void IsFalse ( bool condition,
|
||||
const char* file,
|
||||
int line );
|
||||
void AreEqual ( int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line );
|
||||
void AreEqual ( const std::string& expected,
|
||||
const std::string& actual,
|
||||
const char* file,
|
||||
int line );
|
||||
void AreNotEqual ( int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line );
|
||||
private:
|
||||
void Fail ();
|
||||
};
|
||||
|
||||
#define IS_NULL(reference) IsNull((void*)reference,__FILE__,__LINE__)
|
||||
#define IS_NOT_NULL(reference) IsNotNull((void*)reference,__FILE__,__LINE__)
|
||||
#define IS_TRUE(condition) IsTrue(condition,__FILE__,__LINE__)
|
||||
#define IS_FALSE(condition) IsFalse(condition,__FILE__,__LINE__)
|
||||
#define ARE_EQUAL(expected,actual) AreEqual(expected,actual,__FILE__,__LINE__)
|
||||
#define ARE_NOT_EQUAL(expected,actual) AreNotEqual(expected,actual,__FILE__,__LINE__)
|
||||
|
||||
class ProjectTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class ModuleTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class DefineTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class IncludeTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class InvokeTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class LinkerFlagTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class IfTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class FunctionTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class SourceFileTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
void IncludeTest ();
|
||||
void FullParseTest ();
|
||||
private:
|
||||
bool IsParentOf ( const SourceFile* parent,
|
||||
const SourceFile* child );
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CDFileTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
|
||||
class SymbolTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
void Run ();
|
||||
};
|
||||
|
||||
#endif /* __TEST_H */
|
||||
|
|
|
@ -1,193 +1,193 @@
|
|||
|
||||
#include "pch.h"
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "test.h"
|
||||
|
||||
BaseTest::BaseTest()
|
||||
{
|
||||
Failed = false;
|
||||
}
|
||||
|
||||
BaseTest::~BaseTest()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseTest::Assert(const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args, message );
|
||||
vprintf(message, args);
|
||||
va_end ( args );
|
||||
Fail();
|
||||
}
|
||||
|
||||
void BaseTest::IsNull(void* reference,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (reference != NULL)
|
||||
{
|
||||
Assert("Condition was not NULL at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::IsNotNull(void* reference,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (reference == NULL)
|
||||
{
|
||||
Assert("Condition was NULL at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::IsTrue(bool condition,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (!condition)
|
||||
{
|
||||
Assert("Condition was not true at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::IsFalse(bool condition,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
Assert("Condition was not false at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::AreEqual(int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (actual != expected)
|
||||
{
|
||||
Assert("Expected %d/0x%.08x was %d/0x%.08x at %s:%d\n",
|
||||
expected,
|
||||
expected,
|
||||
actual,
|
||||
actual,
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::AreEqual(const std::string& expected,
|
||||
const std::string& actual,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (actual != expected)
|
||||
{
|
||||
Assert("Expected '%s' was '%s' at %s:%d\n",
|
||||
expected.c_str(),
|
||||
actual.c_str(),
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::AreNotEqual(int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (actual == expected)
|
||||
{
|
||||
Assert("Actual value expected to be different from %d/0x%.08x at %s:%d\n",
|
||||
expected,
|
||||
expected,
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::Fail()
|
||||
{
|
||||
Failed = true;
|
||||
}
|
||||
|
||||
class BaseTestList : public std::vector<BaseTest*>
|
||||
{
|
||||
public:
|
||||
~BaseTestList()
|
||||
{
|
||||
for ( size_t i = 0; i < size(); i++ )
|
||||
{
|
||||
delete (*this)[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class TestDispatcher
|
||||
{
|
||||
public:
|
||||
void Run()
|
||||
{
|
||||
int numberOfFailedTests = 0;
|
||||
BaseTestList tests;
|
||||
GetTests(tests);
|
||||
for (size_t i = 0; i < tests.size(); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseTest& test = *tests[i];
|
||||
test.Run();
|
||||
if (test.Failed)
|
||||
numberOfFailedTests++;
|
||||
}
|
||||
catch (Exception& ex)
|
||||
{
|
||||
printf("%s\n",
|
||||
ex.Message.c_str());
|
||||
numberOfFailedTests++;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberOfFailedTests > 0)
|
||||
printf("%d tests failed\n",
|
||||
numberOfFailedTests);
|
||||
else
|
||||
printf("All tests succeeded\n");
|
||||
}
|
||||
|
||||
private:
|
||||
void GetTests ( BaseTestList& tests )
|
||||
{
|
||||
tests.push_back(new ProjectTest());
|
||||
tests.push_back(new ModuleTest());
|
||||
tests.push_back(new DefineTest());
|
||||
tests.push_back(new IncludeTest());
|
||||
tests.push_back(new InvokeTest());
|
||||
tests.push_back(new LinkerFlagTest());
|
||||
tests.push_back(new IfTest());
|
||||
tests.push_back(new FunctionTest());
|
||||
tests.push_back(new SourceFileTest());
|
||||
tests.push_back(new CDFileTest());
|
||||
tests.push_back(new SymbolTest());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc,
|
||||
char** argv)
|
||||
{
|
||||
TestDispatcher testDispatcher;
|
||||
testDispatcher.Run();
|
||||
return 0;
|
||||
};
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "test.h"
|
||||
|
||||
BaseTest::BaseTest()
|
||||
{
|
||||
Failed = false;
|
||||
}
|
||||
|
||||
BaseTest::~BaseTest()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseTest::Assert(const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start ( args, message );
|
||||
vprintf(message, args);
|
||||
va_end ( args );
|
||||
Fail();
|
||||
}
|
||||
|
||||
void BaseTest::IsNull(void* reference,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (reference != NULL)
|
||||
{
|
||||
Assert("Condition was not NULL at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::IsNotNull(void* reference,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (reference == NULL)
|
||||
{
|
||||
Assert("Condition was NULL at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::IsTrue(bool condition,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (!condition)
|
||||
{
|
||||
Assert("Condition was not true at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::IsFalse(bool condition,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
Assert("Condition was not false at %s:%d\n",
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::AreEqual(int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (actual != expected)
|
||||
{
|
||||
Assert("Expected %d/0x%.08x was %d/0x%.08x at %s:%d\n",
|
||||
expected,
|
||||
expected,
|
||||
actual,
|
||||
actual,
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::AreEqual(const std::string& expected,
|
||||
const std::string& actual,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (actual != expected)
|
||||
{
|
||||
Assert("Expected '%s' was '%s' at %s:%d\n",
|
||||
expected.c_str(),
|
||||
actual.c_str(),
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::AreNotEqual(int expected,
|
||||
int actual,
|
||||
const char* file,
|
||||
int line)
|
||||
{
|
||||
if (actual == expected)
|
||||
{
|
||||
Assert("Actual value expected to be different from %d/0x%.08x at %s:%d\n",
|
||||
expected,
|
||||
expected,
|
||||
file,
|
||||
line);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseTest::Fail()
|
||||
{
|
||||
Failed = true;
|
||||
}
|
||||
|
||||
class BaseTestList : public std::vector<BaseTest*>
|
||||
{
|
||||
public:
|
||||
~BaseTestList()
|
||||
{
|
||||
for ( size_t i = 0; i < size(); i++ )
|
||||
{
|
||||
delete (*this)[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class TestDispatcher
|
||||
{
|
||||
public:
|
||||
void Run()
|
||||
{
|
||||
int numberOfFailedTests = 0;
|
||||
BaseTestList tests;
|
||||
GetTests(tests);
|
||||
for (size_t i = 0; i < tests.size(); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseTest& test = *tests[i];
|
||||
test.Run();
|
||||
if (test.Failed)
|
||||
numberOfFailedTests++;
|
||||
}
|
||||
catch (Exception& ex)
|
||||
{
|
||||
printf("%s\n",
|
||||
ex.Message.c_str());
|
||||
numberOfFailedTests++;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberOfFailedTests > 0)
|
||||
printf("%d tests failed\n",
|
||||
numberOfFailedTests);
|
||||
else
|
||||
printf("All tests succeeded\n");
|
||||
}
|
||||
|
||||
private:
|
||||
void GetTests ( BaseTestList& tests )
|
||||
{
|
||||
tests.push_back(new ProjectTest());
|
||||
tests.push_back(new ModuleTest());
|
||||
tests.push_back(new DefineTest());
|
||||
tests.push_back(new IncludeTest());
|
||||
tests.push_back(new InvokeTest());
|
||||
tests.push_back(new LinkerFlagTest());
|
||||
tests.push_back(new IfTest());
|
||||
tests.push_back(new FunctionTest());
|
||||
tests.push_back(new SourceFileTest());
|
||||
tests.push_back(new CDFileTest());
|
||||
tests.push_back(new SymbolTest());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc,
|
||||
char** argv)
|
||||
{
|
||||
TestDispatcher testDispatcher;
|
||||
testDispatcher.Run();
|
||||
return 0;
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void CDFileTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/cdfile.xml" );
|
||||
Project project( projectFilename );
|
||||
ARE_EQUAL ( 3, project.cdfiles.size () );
|
||||
|
||||
CDFile& cdfile1 = *project.cdfiles[0];
|
||||
ARE_EQUAL("dir1", cdfile1.base);
|
||||
ARE_EQUAL("ReadMe1.txt", cdfile1.nameoncd);
|
||||
|
||||
CDFile& cdfile2 = *project.cdfiles[1];
|
||||
ARE_EQUAL("dir2", cdfile2.base);
|
||||
ARE_EQUAL("readme2.txt", cdfile2.nameoncd);
|
||||
|
||||
CDFile& cdfile3 = *project.cdfiles[2];
|
||||
//ARE_EQUAL("", cdfile3.base);
|
||||
ARE_EQUAL("readme3.txt", cdfile3.nameoncd);
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void CDFileTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/cdfile.xml" );
|
||||
Project project( projectFilename );
|
||||
ARE_EQUAL ( 3, project.cdfiles.size () );
|
||||
|
||||
CDFile& cdfile1 = *project.cdfiles[0];
|
||||
ARE_EQUAL("dir1", cdfile1.base);
|
||||
ARE_EQUAL("ReadMe1.txt", cdfile1.nameoncd);
|
||||
|
||||
CDFile& cdfile2 = *project.cdfiles[1];
|
||||
ARE_EQUAL("dir2", cdfile2.base);
|
||||
ARE_EQUAL("readme2.txt", cdfile2.nameoncd);
|
||||
|
||||
CDFile& cdfile3 = *project.cdfiles[2];
|
||||
//ARE_EQUAL("", cdfile3.base);
|
||||
ARE_EQUAL("readme3.txt", cdfile3.nameoncd);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="tools">
|
||||
<directory name="rbuild">
|
||||
<directory name="tests">
|
||||
<directory name="data">
|
||||
<module name="module1" type="buildtool">
|
||||
<include base="module1">.</include>
|
||||
<file>sourcefile1.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="tools">
|
||||
<directory name="rbuild">
|
||||
<directory name="tests">
|
||||
<directory name="data">
|
||||
<module name="module1" type="buildtool">
|
||||
<include base="module1">.</include>
|
||||
<file>sourcefile1.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="tools">
|
||||
<directory name="rbuild">
|
||||
<directory name="tests">
|
||||
<directory name="data">
|
||||
<module name="module1" type="buildtool">
|
||||
<include base="module1">.</include>
|
||||
<include base="module1">sourcefile1</include>
|
||||
<file>sourcefile_include.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="tools">
|
||||
<directory name="rbuild">
|
||||
<directory name="tests">
|
||||
<directory name="data">
|
||||
<module name="module1" type="buildtool">
|
||||
<include base="module1">.</include>
|
||||
<include base="module1">sourcefile1</include>
|
||||
<file>sourcefile_include.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<cdfile base="dir1" nameoncd="ReadMe1.txt">readme1.txt</cdfile>
|
||||
<cdfile base="dir2">readme2.txt</cdfile>
|
||||
<cdfile>readme3.txt</cdfile>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<cdfile base="dir1" nameoncd="ReadMe1.txt">readme1.txt</cdfile>
|
||||
<cdfile base="dir2">readme2.txt</cdfile>
|
||||
<cdfile>readme3.txt</cdfile>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<define name="define1">value1</define>
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<define name="define2">value2</define>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<define name="define1">value1</define>
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<define name="define2">value2</define>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<module name="module1" type="buildtool">
|
||||
<if property="VAR1" value="value1">
|
||||
<file>file1.c</file>
|
||||
</if>
|
||||
<file>file2.c</file>
|
||||
</module>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<module name="module1" type="buildtool">
|
||||
<if property="VAR1" value="value1">
|
||||
<file>file1.c</file>
|
||||
</if>
|
||||
<file>file2.c</file>
|
||||
</module>
|
||||
</project>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<include>include1</include>
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<include>include2</include>
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="dir2">
|
||||
<module name="module2" type="buildtool">
|
||||
<include base="module1">include3</include>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<include>include1</include>
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<include>include2</include>
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="dir2">
|
||||
<module name="module2" type="buildtool">
|
||||
<include base="module1">include3</include>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<file>file1.c</file>
|
||||
<invoke>
|
||||
<output>
|
||||
<outputfile>file1.c</outputfile>
|
||||
</output>
|
||||
</invoke>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<file>file1.c</file>
|
||||
<invoke>
|
||||
<output>
|
||||
<outputfile>file1.c</outputfile>
|
||||
</output>
|
||||
</invoke>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<linkerflag>-lgcc1</linkerflag>
|
||||
<module name="module1" type="buildtool">
|
||||
<linkerflag>-lgcc2</linkerflag>
|
||||
</module>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<linkerflag>-lgcc1</linkerflag>
|
||||
<module name="module1" type="buildtool">
|
||||
<linkerflag>-lgcc2</linkerflag>
|
||||
</module>
|
||||
</project>
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<file>file1.c</file>
|
||||
<file>file2.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="dir2">
|
||||
<module name="module2" type="kernelmodedll" installbase="reactos" installname="module2.ext">
|
||||
<dependency>module1</dependency>
|
||||
<library>module1</library>
|
||||
<file>file3.c</file>
|
||||
<file>file4.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
<file>file1.c</file>
|
||||
<file>file2.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="dir2">
|
||||
<module name="module2" type="kernelmodedll" installbase="reactos" installname="module2.ext">
|
||||
<dependency>module1</dependency>
|
||||
<library>module1</library>
|
||||
<file>file3.c</file>
|
||||
<file>file4.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="dir2">
|
||||
<module name="module2" type="buildtool">
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<directory name="dir1">
|
||||
<module name="module1" type="buildtool">
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="dir2">
|
||||
<module name="module2" type="buildtool">
|
||||
</module>
|
||||
</directory>
|
||||
</project>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
*/
|
||||
/* $Id: main.c 12694 2005-01-01 11:47:33Z hbirr $
|
||||
* FILE: ntoskrnl/ke/main.c
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <sourcefile1_header1.h>
|
||||
#include <sourcefile1_header2.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
/*
|
||||
* ReactOS kernel
|
||||
*/
|
||||
/* $Id: main.c 12694 2005-01-01 11:47:33Z hbirr $
|
||||
* FILE: ntoskrnl/ke/main.c
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <sourcefile1_header1.h>
|
||||
#include <sourcefile1_header2.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* empty */
|
||||
/* empty */
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* empty */
|
||||
/* empty */
|
||||
|
|
|
@ -1 +1 @@
|
|||
#include <sourcefile1_header2.h>
|
||||
#include <sourcefile1_header2.h>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#include "sourcefile1/sourcefile1_header3.h"
|
||||
#include <sourcefile2/sourcefile1_dontexist.h>
|
||||
#include <sourcefile1_recurse.h>
|
||||
#include "sourcefile1/sourcefile1_header3.h"
|
||||
#include <sourcefile2/sourcefile1_dontexist.h>
|
||||
#include <sourcefile1_recurse.h>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include <sourcefile1_recurse.h>
|
||||
#include <sourcefile1_header1.h>
|
||||
#include <sourcefile1_recurse.h>
|
||||
#include <sourcefile1_header1.h>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# include <sourcefile_include.h>
|
||||
#include <sourcefile_includenext.h>
|
||||
# include <sourcefile_include.h>
|
||||
#include <sourcefile_includenext.h>
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* empty */
|
||||
/* empty */
|
||||
|
|
|
@ -1 +1 @@
|
|||
#include_next <sourcefile_includenext.h>
|
||||
#include_next <sourcefile_includenext.h>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<module name="module1" type="test">
|
||||
<component name="ntdll.dll">
|
||||
<symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
|
||||
<symbol>LdrAccessResource@16</symbol>
|
||||
</component>
|
||||
</module>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Project" makefile="Makefile">
|
||||
<module name="module1" type="test">
|
||||
<component name="ntdll.dll">
|
||||
<symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>
|
||||
<symbol>LdrAccessResource@16</symbol>
|
||||
</component>
|
||||
</module>
|
||||
</project>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void DefineTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/define.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.non_if_data.defines.size());
|
||||
Define& define1 = *project.non_if_data.defines[0];
|
||||
ARE_EQUAL("define1", define1.name);
|
||||
ARE_EQUAL("value1", define1.value);
|
||||
|
||||
ARE_EQUAL(1, project.modules.size());
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL(1, module1.non_if_data.defines.size());
|
||||
Define& define2 = *module1.non_if_data.defines[0];
|
||||
ARE_EQUAL("define2", define2.name);
|
||||
ARE_EQUAL("value2", define2.value);
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void DefineTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/define.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.non_if_data.defines.size());
|
||||
Define& define1 = *project.non_if_data.defines[0];
|
||||
ARE_EQUAL("define1", define1.name);
|
||||
ARE_EQUAL("value1", define1.value);
|
||||
|
||||
ARE_EQUAL(1, project.modules.size());
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL(1, module1.non_if_data.defines.size());
|
||||
Define& define2 = *module1.non_if_data.defines[0];
|
||||
ARE_EQUAL("define2", define2.name);
|
||||
ARE_EQUAL("value2", define2.value);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void FunctionTest::Run ()
|
||||
{
|
||||
string fixedupFilename = NormalizeFilename ( "." SSEP "dir1" SSEP "dir2" SSEP ".." SSEP "filename.txt" );
|
||||
ARE_EQUAL ( "dir1" SSEP "filename.txt", fixedupFilename );
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void FunctionTest::Run ()
|
||||
{
|
||||
string fixedupFilename = NormalizeFilename ( "." SSEP "dir1" SSEP "dir2" SSEP ".." SSEP "filename.txt" );
|
||||
ARE_EQUAL ( "dir1" SSEP "filename.txt", fixedupFilename );
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void IfTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/if.xml" );
|
||||
Project project ( projectFilename );
|
||||
|
||||
ARE_EQUAL ( 1, project.modules.size () );
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL ( 1, module1.non_if_data.ifs.size () );
|
||||
If& if1 = *module1.non_if_data.ifs[0];
|
||||
ARE_EQUAL ( "VAR1", if1.property );
|
||||
ARE_EQUAL ( "value1", if1.value );
|
||||
|
||||
ARE_EQUAL ( 1, if1.data.files.size () );
|
||||
File& file1 = *if1.data.files[0];
|
||||
ARE_EQUAL( SSEP "file1.c", file1.name );
|
||||
|
||||
ARE_EQUAL ( 1, module1.non_if_data.files.size () );
|
||||
File& file2 = *module1.non_if_data.files[0];
|
||||
ARE_EQUAL( SSEP "file2.c", file2.name );
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void IfTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/if.xml" );
|
||||
Project project ( projectFilename );
|
||||
|
||||
ARE_EQUAL ( 1, project.modules.size () );
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL ( 1, module1.non_if_data.ifs.size () );
|
||||
If& if1 = *module1.non_if_data.ifs[0];
|
||||
ARE_EQUAL ( "VAR1", if1.property );
|
||||
ARE_EQUAL ( "value1", if1.value );
|
||||
|
||||
ARE_EQUAL ( 1, if1.data.files.size () );
|
||||
File& file1 = *if1.data.files[0];
|
||||
ARE_EQUAL( SSEP "file1.c", file1.name );
|
||||
|
||||
ARE_EQUAL ( 1, module1.non_if_data.files.size () );
|
||||
File& file2 = *module1.non_if_data.files[0];
|
||||
ARE_EQUAL( SSEP "file2.c", file2.name );
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void IncludeTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/include.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.non_if_data.includes.size());
|
||||
Include& include1 = *project.non_if_data.includes[0];
|
||||
ARE_EQUAL("include1", include1.directory);
|
||||
|
||||
ARE_EQUAL(2, project.modules.size());
|
||||
Module& module1 = *project.modules[0];
|
||||
Module& module2 = *project.modules[1];
|
||||
|
||||
ARE_EQUAL(1, module1.non_if_data.includes.size());
|
||||
Include& include2 = *module1.non_if_data.includes[0];
|
||||
ARE_EQUAL("include2", include2.directory);
|
||||
|
||||
ARE_EQUAL(1, module2.non_if_data.includes.size());
|
||||
Include& include3 = *module2.non_if_data.includes[0];
|
||||
ARE_EQUAL(FixSeparator("dir1/include3"), include3.directory);
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void IncludeTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/include.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.non_if_data.includes.size());
|
||||
Include& include1 = *project.non_if_data.includes[0];
|
||||
ARE_EQUAL("include1", include1.directory);
|
||||
|
||||
ARE_EQUAL(2, project.modules.size());
|
||||
Module& module1 = *project.modules[0];
|
||||
Module& module2 = *project.modules[1];
|
||||
|
||||
ARE_EQUAL(1, module1.non_if_data.includes.size());
|
||||
Include& include2 = *module1.non_if_data.includes[0];
|
||||
ARE_EQUAL("include2", include2.directory);
|
||||
|
||||
ARE_EQUAL(1, module2.non_if_data.includes.size());
|
||||
Include& include3 = *module2.non_if_data.includes[0];
|
||||
ARE_EQUAL(FixSeparator("dir1/include3"), include3.directory);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void InvokeTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/invoke.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.modules.size());
|
||||
|
||||
Module& module1 = *project.modules[0];
|
||||
ARE_EQUAL(1, module1.invocations.size());
|
||||
|
||||
Invoke& invoke1 = *module1.invocations[0];
|
||||
ARE_EQUAL(1, invoke1.output.size());
|
||||
|
||||
InvokeFile& file1 = *invoke1.output[0];
|
||||
ARE_EQUAL(FixSeparator("dir1/file1.c"), file1.name);
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void InvokeTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/invoke.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.modules.size());
|
||||
|
||||
Module& module1 = *project.modules[0];
|
||||
ARE_EQUAL(1, module1.invocations.size());
|
||||
|
||||
Invoke& invoke1 = *module1.invocations[0];
|
||||
ARE_EQUAL(1, invoke1.output.size());
|
||||
|
||||
InvokeFile& file1 = *invoke1.output[0];
|
||||
ARE_EQUAL(FixSeparator("dir1/file1.c"), file1.name);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void LinkerFlagTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/linkerflag.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.linkerFlags.size());
|
||||
LinkerFlag& linkerFlag1 = *project.linkerFlags[0];
|
||||
ARE_EQUAL("-lgcc1", linkerFlag1.flag);
|
||||
|
||||
ARE_EQUAL(1, project.modules.size());
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL(1, module1.linkerFlags.size());
|
||||
LinkerFlag& linkerFlag2 = *module1.linkerFlags[0];
|
||||
ARE_EQUAL("-lgcc2", linkerFlag2.flag);
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void LinkerFlagTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/linkerflag.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(1, project.linkerFlags.size());
|
||||
LinkerFlag& linkerFlag1 = *project.linkerFlags[0];
|
||||
ARE_EQUAL("-lgcc1", linkerFlag1.flag);
|
||||
|
||||
ARE_EQUAL(1, project.modules.size());
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL(1, module1.linkerFlags.size());
|
||||
LinkerFlag& linkerFlag2 = *module1.linkerFlags[0];
|
||||
ARE_EQUAL("-lgcc2", linkerFlag2.flag);
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void ModuleTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/module.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(2, project.modules.size());
|
||||
|
||||
Module& module1 = *project.modules[0];
|
||||
IS_TRUE(module1.type == BuildTool);
|
||||
|
||||
ARE_EQUAL(2, module1.non_if_data.files.size());
|
||||
ARE_EQUAL("dir1" SSEP "file1.c", module1.non_if_data.files[0]->name);
|
||||
ARE_EQUAL("dir1" SSEP "file2.c", module1.non_if_data.files[1]->name);
|
||||
|
||||
ARE_EQUAL(0, module1.non_if_data.libraries.size());
|
||||
|
||||
Module& module2 = *project.modules[1];
|
||||
IS_TRUE(module2.type == KernelModeDLL);
|
||||
ARE_EQUAL("reactos", module2.installBase);
|
||||
ARE_EQUAL("module2.ext", module2.installName);
|
||||
|
||||
ARE_EQUAL(2, module2.non_if_data.files.size());
|
||||
ARE_EQUAL("dir2" SSEP "file3.c", module2.non_if_data.files[0]->name);
|
||||
ARE_EQUAL("dir2" SSEP "file4.c", module2.non_if_data.files[1]->name);
|
||||
|
||||
ARE_EQUAL(1, module2.non_if_data.libraries.size());
|
||||
Library& library1 = *module2.non_if_data.libraries[0];
|
||||
ARE_EQUAL("module1", library1.name);
|
||||
|
||||
ARE_EQUAL(1, module2.dependencies.size());
|
||||
Dependency& module1dependency = *module2.dependencies[0];
|
||||
IS_NOT_NULL(module1dependency.dependencyModule);
|
||||
ARE_EQUAL("module1", module1dependency.dependencyModule->name);
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void ModuleTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/module.xml" );
|
||||
Project project ( projectFilename );
|
||||
ARE_EQUAL(2, project.modules.size());
|
||||
|
||||
Module& module1 = *project.modules[0];
|
||||
IS_TRUE(module1.type == BuildTool);
|
||||
|
||||
ARE_EQUAL(2, module1.non_if_data.files.size());
|
||||
ARE_EQUAL("dir1" SSEP "file1.c", module1.non_if_data.files[0]->name);
|
||||
ARE_EQUAL("dir1" SSEP "file2.c", module1.non_if_data.files[1]->name);
|
||||
|
||||
ARE_EQUAL(0, module1.non_if_data.libraries.size());
|
||||
|
||||
Module& module2 = *project.modules[1];
|
||||
IS_TRUE(module2.type == KernelModeDLL);
|
||||
ARE_EQUAL("reactos", module2.installBase);
|
||||
ARE_EQUAL("module2.ext", module2.installName);
|
||||
|
||||
ARE_EQUAL(2, module2.non_if_data.files.size());
|
||||
ARE_EQUAL("dir2" SSEP "file3.c", module2.non_if_data.files[0]->name);
|
||||
ARE_EQUAL("dir2" SSEP "file4.c", module2.non_if_data.files[1]->name);
|
||||
|
||||
ARE_EQUAL(1, module2.non_if_data.libraries.size());
|
||||
Library& library1 = *module2.non_if_data.libraries[0];
|
||||
ARE_EQUAL("module1", library1.name);
|
||||
|
||||
ARE_EQUAL(1, module2.dependencies.size());
|
||||
Dependency& module1dependency = *module2.dependencies[0];
|
||||
IS_NOT_NULL(module1dependency.dependencyModule);
|
||||
ARE_EQUAL("module1", module1dependency.dependencyModule->name);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void ProjectTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/project.xml" );
|
||||
Project project( projectFilename );
|
||||
ARE_EQUAL(2, project.modules.size());
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void ProjectTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/project.xml" );
|
||||
Project project( projectFilename );
|
||||
ARE_EQUAL(2, project.modules.size());
|
||||
}
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
bool
|
||||
SourceFileTest::IsParentOf ( const SourceFile* parent,
|
||||
const SourceFile* child )
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( child->parents[i] == parent )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( IsParentOf ( parent,
|
||||
child->parents[i] ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFileTest::IncludeTest ()
|
||||
{
|
||||
const Project project ( RBUILD_BASE "tests" SSEP "data" SSEP "automaticdependency_include.xml" );
|
||||
AutomaticDependency automaticDependency ( project );
|
||||
automaticDependency.Process ();
|
||||
ARE_EQUAL( 4, automaticDependency.sourcefile_map.size () );
|
||||
const SourceFile* include = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile_include.h" );
|
||||
IS_NOT_NULL( include );
|
||||
const SourceFile* includenext = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );
|
||||
IS_NOT_NULL( includenext );
|
||||
}
|
||||
|
||||
void
|
||||
SourceFileTest::FullParseTest ()
|
||||
{
|
||||
const Project project ( RBUILD_BASE "tests" SSEP "data" SSEP "automaticdependency.xml" );
|
||||
AutomaticDependency automaticDependency ( project );
|
||||
automaticDependency.Process ();
|
||||
ARE_EQUAL( 5, automaticDependency.sourcefile_map.size () );
|
||||
const SourceFile* header1 = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_header1.h" );
|
||||
IS_NOT_NULL( header1 );
|
||||
const SourceFile* recurse = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_recurse.h" );
|
||||
IS_NOT_NULL( recurse );
|
||||
IS_TRUE( IsParentOf ( header1,
|
||||
recurse ) );
|
||||
IS_FALSE( IsParentOf ( recurse,
|
||||
header1 ) );
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
SourceFileTest::Run ()
|
||||
{
|
||||
IncludeTest ();
|
||||
FullParseTest ();
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
bool
|
||||
SourceFileTest::IsParentOf ( const SourceFile* parent,
|
||||
const SourceFile* child )
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( child->parents[i] == parent )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( i = 0; i < child->parents.size (); i++ )
|
||||
{
|
||||
if ( child->parents[i] != NULL )
|
||||
{
|
||||
if ( IsParentOf ( parent,
|
||||
child->parents[i] ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
SourceFileTest::IncludeTest ()
|
||||
{
|
||||
const Project project ( RBUILD_BASE "tests" SSEP "data" SSEP "automaticdependency_include.xml" );
|
||||
AutomaticDependency automaticDependency ( project );
|
||||
automaticDependency.Process ();
|
||||
ARE_EQUAL( 4, automaticDependency.sourcefile_map.size () );
|
||||
const SourceFile* include = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile_include.h" );
|
||||
IS_NOT_NULL( include );
|
||||
const SourceFile* includenext = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );
|
||||
IS_NOT_NULL( includenext );
|
||||
}
|
||||
|
||||
void
|
||||
SourceFileTest::FullParseTest ()
|
||||
{
|
||||
const Project project ( RBUILD_BASE "tests" SSEP "data" SSEP "automaticdependency.xml" );
|
||||
AutomaticDependency automaticDependency ( project );
|
||||
automaticDependency.Process ();
|
||||
ARE_EQUAL( 5, automaticDependency.sourcefile_map.size () );
|
||||
const SourceFile* header1 = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_header1.h" );
|
||||
IS_NOT_NULL( header1 );
|
||||
const SourceFile* recurse = automaticDependency.RetrieveFromCache ( RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_recurse.h" );
|
||||
IS_NOT_NULL( recurse );
|
||||
IS_TRUE( IsParentOf ( header1,
|
||||
recurse ) );
|
||||
IS_FALSE( IsParentOf ( recurse,
|
||||
header1 ) );
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
SourceFileTest::Run ()
|
||||
{
|
||||
IncludeTest ();
|
||||
FullParseTest ();
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void SymbolTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/symbol.xml" );
|
||||
Project project ( projectFilename );
|
||||
|
||||
ARE_EQUAL ( 1, project.modules.size () );
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL ( 1, module1.stubbedComponents.size () );
|
||||
StubbedComponent& component1 = *module1.stubbedComponents[0];
|
||||
ARE_EQUAL ( "ntdll.dll", component1.name );
|
||||
|
||||
ARE_EQUAL ( 2, component1.symbols.size () );
|
||||
StubbedSymbol& symbol1 = *component1.symbols[0];
|
||||
ARE_EQUAL ( "HeapAlloc@12", symbol1.symbol );
|
||||
ARE_EQUAL ( "RtlAllocateHeap", symbol1.newname );
|
||||
|
||||
StubbedSymbol& symbol2 = *component1.symbols[1];
|
||||
ARE_EQUAL ( "LdrAccessResource@16", symbol2.symbol );
|
||||
ARE_EQUAL ( "LdrAccessResource@16", symbol2.newname );
|
||||
}
|
||||
#include "test.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
void SymbolTest::Run()
|
||||
{
|
||||
string projectFilename ( RBUILD_BASE "tests/data/symbol.xml" );
|
||||
Project project ( projectFilename );
|
||||
|
||||
ARE_EQUAL ( 1, project.modules.size () );
|
||||
Module& module1 = *project.modules[0];
|
||||
|
||||
ARE_EQUAL ( 1, module1.stubbedComponents.size () );
|
||||
StubbedComponent& component1 = *module1.stubbedComponents[0];
|
||||
ARE_EQUAL ( "ntdll.dll", component1.name );
|
||||
|
||||
ARE_EQUAL ( 2, component1.symbols.size () );
|
||||
StubbedSymbol& symbol1 = *component1.symbols[0];
|
||||
ARE_EQUAL ( "HeapAlloc@12", symbol1.symbol );
|
||||
ARE_EQUAL ( "RtlAllocateHeap", symbol1.newname );
|
||||
|
||||
StubbedSymbol& symbol2 = *component1.symbols[1];
|
||||
ARE_EQUAL ( "LdrAccessResource@16", symbol2.symbol );
|
||||
ARE_EQUAL ( "LdrAccessResource@16", symbol2.newname );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue