From 24de999ac24441b49df59e7ace51666fa4801220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Thu, 2 Aug 2007 14:14:19 +0000 Subject: [PATCH] Support "root" attribute in elements svn path=/trunk/; revision=28102 --- reactos/tools/rbuild/backend/mingw/mingw.cpp | 2 +- reactos/tools/rbuild/module.cpp | 26 ++++++++++++++++++-- reactos/tools/rbuild/project.cpp | 3 ++- reactos/tools/rbuild/rbuild.h | 2 ++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 916108bc10d..6ef26d43326 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -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" ); } diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 0b7b7830aad..f6e6341c268 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -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 ( " 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" ) { diff --git a/reactos/tools/rbuild/project.cpp b/reactos/tools/rbuild/project.cpp index 509d7315b0e..4a20129ecba 100644 --- a/reactos/tools/rbuild/project.cpp +++ b/reactos/tools/rbuild/project.cpp @@ -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" ) { diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 56c0b6de27c..5476dab2715 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -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