Support "root" attribute in <directory> elements

svn path=/trunk/; revision=28102
This commit is contained in:
Hervé Poussineau 2007-08-02 14:14:19 +00:00
parent d645b9c6d7
commit 24de999ac2
4 changed files with 29 additions and 4 deletions

View file

@ -426,7 +426,7 @@ MingwBackend::GenerateGlobalVariables () const
fprintf ( fMakefile, "PROJECT_LFLAGS := %s\n",
GenerateProjectLFLAGS ().c_str () );
fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" );
fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
fprintf ( fMakefile, "PROJECT_CFLAGS += $(PROJECT_GCCOPTIONS)\n" );
fprintf ( fMakefile, "\n" );
}

View file

@ -118,8 +118,10 @@ ReplaceExtension (
string
GetSubPath (
const Project& project,
const string& location,
const string& path,
const XMLAttribute* root,
const string& att_value )
{
if ( !att_value.size() )
@ -132,7 +134,26 @@ GetSubPath (
"<directory> tag has invalid characters in 'name' attribute" );
if ( !path.size() )
return att_value;
return FixSeparator(path + cSep + att_value);
string path_prefix;
if ( root )
{
if ( root->value == "intermediate" )
path_prefix = Environment::GetIntermediatePath() + cSep;
else if ( root->value == "output" )
path_prefix = Environment::GetOutputPath() + cSep;
else
{
throw InvalidAttributeValueException (
location,
"root",
root->value );
}
}
else
path_prefix = "";
return FixSeparator(path_prefix + path + cSep + att_value);
}
string
@ -617,8 +638,9 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
else if ( e.name == "directory" )
{
const XMLAttribute* att = e.GetAttribute ( "name", true );
const XMLAttribute* base = e.GetAttribute ( "root", false );
assert(att);
subpath = GetSubPath ( e.location, path, att->value );
subpath = GetSubPath ( this->project, e.location, path, base, att->value );
}
else if ( e.name == "include" )
{

View file

@ -375,8 +375,9 @@ Project::ProcessXMLSubElement ( const XMLElement& e,
else if ( e.name == "directory" )
{
const XMLAttribute* att = e.GetAttribute ( "name", true );
const XMLAttribute* base = e.GetAttribute ( "root", false );
assert(att);
subpath = GetSubPath ( e.location, path, att->value );
subpath = GetSubPath ( *this, e.location, path, base, att->value );
}
else if ( e.name == "include" )
{

View file

@ -986,8 +986,10 @@ ReplaceExtension (
extern std::string
GetSubPath (
const Project& project,
const std::string& location,
const std::string& path,
const XMLAttribute* root,
const std::string& att_value );
extern std::string