Have the object files of a module depend on the build file that contain the module

svn path=/branches/xmlbuildsystem/; revision=14591
This commit is contained in:
Casper Hornstrup 2005-04-11 18:45:48 +00:00
parent fb03ace091
commit 1c89a135da
5 changed files with 51 additions and 26 deletions

View file

@ -339,9 +339,11 @@ XMLAttribute& XMLAttribute::operator = ( const XMLAttribute& src )
return *this;
}
XMLElement::XMLElement ( const string& location_ )
: location(location_),
parentElement(NULL)
XMLElement::XMLElement ( XMLFile* xmlFile,
const string& location )
: xmlFile ( xmlFile ),
location ( location ),
parentElement ( NULL )
{
}
@ -517,7 +519,8 @@ XMLParse ( XMLFile& f,
return NULL;
}
XMLElement* e = new XMLElement ( f.Location () );
XMLElement* e = new XMLElement ( &f,
f.Location () );
bool bNeedEnd = e->Parse ( token, end_tag );
if ( e->name == "xi:include" && includes )
@ -634,8 +637,8 @@ XMLLoadInclude ( XMLInclude& include,
string file ( include.path.Fixup(att->value, true) );
string top_file ( Path::RelativeFromWorkingDirectory ( file ) );
include.e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) );
XMLFile fInc;
if ( !fInc.open ( file ) )
XMLFile* fInc = new XMLFile();
if ( !fInc->open ( file ) )
{
include.fileExists = false;
// look for xi:fallback element
@ -669,10 +672,11 @@ XMLLoadInclude ( XMLInclude& include,
else
{
include.fileExists = true;
XMLElement* new_e = new XMLElement ( include.e->location );
XMLElement* new_e = new XMLElement ( fInc,
include.e->location );
new_e->name = "xi:included";
Path path2 ( include.path, att->value );
XMLReadFile ( fInc, *new_e, includes, path2 );
XMLReadFile ( *fInc, *new_e, includes, path2 );
return new_e;
}
}
@ -682,14 +686,15 @@ XMLLoadFile ( const string& filename,
const Path& path,
XMLIncludes& includes )
{
XMLFile f;
XMLFile* f = new XMLFile();
if ( !f.open ( filename ) )
if ( !f->open ( filename ) )
throw FileNotFoundException ( filename );
XMLElement* head = new XMLElement ( "(virtual)" );
XMLElement* head = new XMLElement ( f,
"(virtual)" );
XMLReadFile ( f, *head, includes, path );
XMLReadFile ( *f, *head, includes, path );
for ( size_t i = 0; i < includes.size (); i++ )
{
@ -700,7 +705,7 @@ XMLLoadFile ( const string& filename,
throw FileNotFoundException (
ssprintf ( "%s (referenced from %s)",
e->GetAttribute ( "top_href", true )->value.c_str (),
f.Location ().c_str () ) );
f->Location ().c_str () ) );
}
XMLElement* parent = e->parentElement;
XMLElement** parent_container = NULL;

View file

@ -88,6 +88,7 @@ public:
class XMLElement
{
public:
XMLFile* xmlFile;
std::string location;
std::string name;
std::vector<XMLAttribute*> attributes;
@ -95,7 +96,8 @@ public:
std::vector<XMLElement*> subElements;
std::string value;
XMLElement ( const std::string& location_ );
XMLElement ( XMLFile* xmlFile,
const std::string& location );
~XMLElement();
bool Parse(const std::string& token,
bool& end_tag);

View file

@ -786,19 +786,20 @@ MingwModuleHandler::GenerateGccCommand (
const string& cc,
const string& cflagsMacro )
{
string deps = sourceFilename;
string dependencies = sourceFilename;
if ( module.pch && use_pch )
deps += " " + module.pch->header + ".gch";
dependencies += " " + module.pch->header + ".gch";
/* WIDL generated headers may be used */
deps += " " + GetLinkingDependenciesMacro ();
dependencies += " " + GetLinkingDependenciesMacro ();
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string objectFilename = GetObjectFilename (
sourceFilename, &clean_files );
fprintf ( fMakefile,
"%s: %s | %s\n",
objectFilename.c_str (),
deps.c_str (),
dependencies.c_str (),
GetDirectory ( objectFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_CC)\n" );
fprintf ( fMakefile,
@ -813,12 +814,14 @@ MingwModuleHandler::GenerateGccAssemblerCommand (
const string& cc,
const string& cflagsMacro )
{
string dependencies = sourceFilename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string objectFilename = GetObjectFilename (
sourceFilename, &clean_files );
fprintf ( fMakefile,
"%s: %s | %s\n",
objectFilename.c_str (),
sourceFilename.c_str (),
dependencies.c_str (),
GetDirectory ( objectFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_GAS)\n" );
fprintf ( fMakefile,
@ -832,12 +835,14 @@ MingwModuleHandler::GenerateNasmCommand (
const string& sourceFilename,
const string& nasmflagsMacro )
{
string dependencies = sourceFilename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string objectFilename = GetObjectFilename (
sourceFilename, &clean_files );
fprintf ( fMakefile,
"%s: %s | %s\n",
objectFilename.c_str (),
sourceFilename.c_str (),
dependencies.c_str (),
GetDirectory ( objectFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_NASM)\n" );
fprintf ( fMakefile,
@ -851,6 +856,8 @@ MingwModuleHandler::GenerateWindresCommand (
const string& sourceFilename,
const string& windresflagsMacro )
{
string dependencies = sourceFilename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string objectFilename =
GetObjectFilename ( sourceFilename, &clean_files );
string rciFilename = ros_temp +
@ -862,7 +869,7 @@ MingwModuleHandler::GenerateWindresCommand (
fprintf ( fMakefile,
"%s: %s $(WRC_TARGET) | %s\n",
objectFilename.c_str (),
sourceFilename.c_str (),
dependencies.c_str (),
GetDirectory ( objectFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_WRC)\n" );
fprintf ( fMakefile,
@ -890,7 +897,7 @@ MingwModuleHandler::GenerateWindresCommand (
fprintf ( fMakefile,
"%s: %s $(WRC_TARGET) | %s\n",
objectFilename.c_str (),
sourceFilename.c_str (),
dependencies.c_str (),
GetDirectory ( objectFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_WRC)\n" );
fprintf ( fMakefile,
@ -904,8 +911,10 @@ void
MingwModuleHandler::GenerateWinebuildCommands (
const string& sourceFilename )
{
string basename = GetBasename ( sourceFilename );
string dependencies = sourceFilename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string basename = GetBasename ( sourceFilename );
string def_file = PassThruCacheDirectory (
basename + ".spec.def",
backend->intermediateDirectory );
@ -919,7 +928,7 @@ MingwModuleHandler::GenerateWinebuildCommands (
fprintf ( fMakefile,
"%s: %s $(WINEBUILD_TARGET)\n",
def_file.c_str (),
sourceFilename.c_str () );
dependencies.c_str () );
fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );
fprintf ( fMakefile,
"\t%s --def=%s -o %s\n",
@ -944,6 +953,9 @@ MingwModuleHandler::GenerateWidlCommandsServer (
const string& sourceFilename,
const string& widlflagsMacro )
{
string dependencies = sourceFilename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string basename = GetBasename ( sourceFilename );
/*string generatedHeaderFilename = PassThruCacheDirectory (
@ -963,7 +975,7 @@ MingwModuleHandler::GenerateWidlCommandsServer (
"%s %s: %s $(WIDL_TARGET) | %s\n",
generatedServerFilename.c_str (),
generatedHeaderFilename.c_str (),
sourceFilename.c_str (),
dependencies.c_str (),
GetDirectory ( generatedServerFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );
fprintf ( fMakefile,
@ -980,6 +992,9 @@ MingwModuleHandler::GenerateWidlCommandsClient (
const string& sourceFilename,
const string& widlflagsMacro )
{
string dependencies = sourceFilename;
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string basename = GetBasename ( sourceFilename );
/*string generatedHeaderFilename = PassThruCacheDirectory (
@ -999,7 +1014,7 @@ MingwModuleHandler::GenerateWidlCommandsClient (
"%s %s: %s $(WIDL_TARGET) | %s\n",
generatedClientFilename.c_str (),
generatedHeaderFilename.c_str (),
sourceFilename.c_str (),
dependencies.c_str (),
GetDirectory ( generatedClientFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );
fprintf ( fMakefile,

View file

@ -137,6 +137,8 @@ Module::Module ( const Project& project,
__LINE__,
"Module created with non-<module> node" );
xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename() );
path = FixSeparator ( modulePath );
const XMLAttribute* att = moduleNode.GetAttribute ( "name", true );

View file

@ -154,6 +154,7 @@ class Module
public:
const Project& project;
const XMLElement& node;
std::string xmlbuildFile;
std::string name;
std::string extension;
std::string entrypoint;