bugfixes to new <if> and related code Modified: branches/xmlbuildsystem/reactos/ReactOS.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h _____
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml --- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-13 03:43:10 UTC (rev 13016) @@ -8,11 +8,13 @@
</xi:include>
<define name="_M_IX86" /> - <if property="dbg" value="true"> - <define name="dbg_or_kdbg" value="true" /> + <if property="DBG" value="1"> + <define name="DBG" value="1" /> + <property name="DBG_OR_KDBG" value="true" /> </if> - <if property="kdbg" value="true"> - <define name="dbg_or_kdbg" value="true" /> + <if property="KDBG" value="1"> + <define name="KDBG" value="1" /> + <property name="DBG_OR_KDBG" value="true" /> </if>
<include>include</include> _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-13 03:43:10 UTC (rev 13016) @@ -59,39 +59,79 @@
fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); }
-string -MingwBackend::GenerateProjectCFLAGS () +void +MingwBackend::GenerateGlobalCFlagsAndProperties ( + const char* op, + const vector<Property*>& properties, + const vector<Include*>& includes, + const vector<Define*>& defines, + const vector<If*>& ifs ) { size_t i; - string clags; - for ( i = 0; i < ProjectNode.includes.size (); i++ ) + + for ( i = 0; i < properties.size(); i++ ) { - Include& include = *ProjectNode.includes[i]; - if (clags.length () > 0) - clags += " "; - clags += "-I" + include.directory; + Property& prop = *properties[i]; + fprintf ( fMakefile, "%s := %s\n", + prop.name.c_str(), + prop.value.c_str() ); } - - for ( i = 0; i < ProjectNode.defines.size (); i++ ) + + if ( includes.size() || defines.size() ) { - Define& define = *ProjectNode.defines[i]; - if ( clags.length () > 0 ) - clags += " "; - clags += "-D" + define.name; - if ( define.value.size() > 0 ) + fprintf ( + fMakefile, + "PROJECT_CFLAGS %s", + op ); + for ( i = 0; i < includes.size(); i++ ) { - clags += "="; - clags += define.value; + fprintf ( + fMakefile, + " -I%s", + includes[i]->directory.c_str() ); } + for ( i = 0; i < defines.size(); i++ ) + { + Define& d = *defines[i]; + fprintf ( + fMakefile, + " -D%s", + d.name.c_str() ); + if ( d.value.size() ) + fprintf ( + fMakefile, + "=%s", + d.value.c_str() ); + } + fprintf ( fMakefile, "\n" ); } - return clags; + + for ( i = 0; i < ifs.size(); i++ ) + { + If& rIf = *ifs[i]; + if ( rIf.defines.size() || rIf.includes.size() || rIf.ifs.size() ) + { + fprintf ( + fMakefile, + "ifeq ("$(%s)","%s")\n", + rIf.property.c_str(), + rIf.value.c_str() ); + GenerateGlobalCFlagsAndProperties ( + "+=", + rIf.properties, + rIf.includes, + rIf.defines, + rIf.ifs ); + fprintf ( + fMakefile, + "endif\n\n" ); + } + } }
void MingwBackend::GenerateGlobalVariables () { - size_t i; - fprintf ( fMakefile, "host_gcc = gcc\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); fprintf ( fMakefile, "host_ld = ld\n" ); @@ -99,15 +139,13 @@ fprintf ( fMakefile, "gcc = gcc\n" ); fprintf ( fMakefile, "ld = ld\n" ); fprintf ( fMakefile, "ar = ar\n" ); - fprintf ( fMakefile, "dlltool = dlltool\n" ); - fprintf ( fMakefile, "PROJECT_CFLAGS = %s\n", GenerateProjectCFLAGS ().c_str () ); - for ( i = 0; i < ProjectNode.properties.size(); i++ ) - { - Property& prop = *ProjectNode.properties[i]; - fprintf ( fMakefile, "%s := %s\n", - prop.name.c_str(), - prop.value.c_str() ); - } + fprintf ( fMakefile, "dlltool = dlltool\n\n" ); + GenerateGlobalCFlagsAndProperties ( + "=", + ProjectNode.properties, + ProjectNode.includes, + ProjectNode.defines, + ProjectNode.ifs ); fprintf ( fMakefile, "\n" ); }
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-13 03:43:10 UTC (rev 13016) @@ -14,7 +14,13 @@
void CreateMakefile (); void CloseMakefile (); void GenerateHeader (); - std::string GenerateProjectCFLAGS (); + void + MingwBackend::GenerateGlobalCFlagsAndProperties ( + const char* op, + const std::vector<Property*>& properties, + const std::vector<Include*>& includes, + const std::vector<Define*>& defines, + const std::vector<If*>& ifs ); void GenerateGlobalVariables (); void GenerateAllTarget (); FILE* fMakefile; _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-13 03:43:10 UTC (rev 13016) @@ -262,36 +262,36 @@
void MingwModuleHandler::GenerateMacros ( - const Module& module, const char* op, const vector<File*>& files, - const vector<Include*>* includes, + const vector<Include*>& includes, const vector<Define*>& defines, - const vector<If*>* ifs, + const vector<If*>& ifs, const string& cflags_macro, const string& nasmflags_macro, const string& objs_macro) const { size_t i;
- if ( (includes && includes->size()) || defines.size() ) + if ( includes.size() || defines.size() ) { fprintf ( fMakefile, "%s %s", cflags_macro.c_str(), op ); - if ( includes ) - for ( i = 0; i < includes->size(); i++ ) - fprintf ( - fMakefile, - " -I%s", - (*includes)[i]->directory.c_str() ); - for ( i = 0; i < module.defines.size(); i++ ) + for ( i = 0; i < includes.size(); i++ ) { - Define& d = *module.defines[i]; fprintf ( fMakefile, + " -I%s", + includes[i]->directory.c_str() ); + } + for ( i = 0; i < defines.size(); i++ ) + { + Define& d = *defines[i]; + fprintf ( + fMakefile, " -D%s", d.name.c_str() ); if ( d.value.size() ) @@ -321,32 +321,28 @@ fprintf ( fMakefile, "\n" ); }
- if ( ifs && ifs->size() ) + for ( i = 0; i < ifs.size(); i++ ) { - for ( size_t i = 0; i < ifs->size(); i++ ) + If& rIf = *ifs[i]; + if ( rIf.defines.size() || rIf.includes.size() || rIf.files.size() || rIf.ifs.size() ) { - If& rIf = *(*ifs)[i]; - if ( rIf.defines.size() || rIf.files.size() || rIf.ifs.size() ) - { - fprintf ( - fMakefile, - "ifeq ($(%s),"%s")\n", - rIf.property.c_str(), - rIf.value.c_str() ); - GenerateMacros ( - module, - "+=", - rIf.files, - NULL, - rIf.defines, - &rIf.ifs, - cflags_macro, - nasmflags_macro, - objs_macro ); - fprintf ( - fMakefile, - "endif\n\n" ); - } + fprintf ( + fMakefile, + "ifeq ($(%s),"%s")\n", + rIf.property.c_str(), + rIf.value.c_str() ); + GenerateMacros ( + "+=", + rIf.files, + rIf.includes, + rIf.defines, + rIf.ifs, + cflags_macro, + nasmflags_macro, + objs_macro ); + fprintf ( + fMakefile, + "endif\n\n" ); } } } @@ -359,42 +355,16 @@ const string& objs_macro) const { GenerateMacros ( - module, "=", module.files, - &module.includes, + module.includes, module.defines, - NULL, + module.ifs, cflags_macro, nasmflags_macro, objs_macro ); fprintf ( fMakefile, "\n" );
- for ( size_t i = 0; i < module.ifs.size(); i++ ) - { - If& rIf = *module.ifs[i]; - if ( rIf.defines.size() || rIf.files.size() || rIf.ifs.size() ) - { - fprintf ( - fMakefile, - "ifeq ("$(%s)","%s")\n", - rIf.property.c_str(), - rIf.value.c_str() ); - GenerateMacros ( - module, - "+=", - rIf.files, - NULL, - rIf.defines, - &rIf.ifs, - cflags_macro, - nasmflags_macro, - objs_macro ); - fprintf ( - fMakefile, - "endif\n\n" ); - } - } fprintf ( fMakefile, "%s += $(PROJECT_CFLAGS)\n\n", _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-13 03:43:10 UTC (rev 13016) @@ -46,12 +46,11 @@
std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const; std::string GenerateGccDefineParameters ( const Module& module ) const; std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const; - void GenerateMacros ( const Module& module, - const char* op, + void GenerateMacros ( const char* op, const std::vector<File*>& files, - const std::vector<Include*>* includes, + const std::vector<Include*>& includes, const std::vector<Define*>& defines, - const std::vector<If*>* ifs, + const std::vector<If*>& ifs, const std::string& cflags_macro, const std::string& nasmflags_macro, const std::string& objs_macro) const; _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-13 03:43:10 UTC (rev 13016) @@ -122,11 +122,11 @@
} else if ( e.name == "include" ) { + Include* include = new Include ( project, this, e ); if ( pIf ) - throw InvalidBuildFileException ( - e.location, - "<include> is not a valid sub-element of <if>" ); - includes.push_back ( new Include ( project, this, e ) ); + pIf->includes.push_back ( include ); + else + includes.push_back ( include ); subs_invalid = true; } else if ( e.name == "define" ) @@ -513,6 +513,8 @@ size_t i; for ( i = 0; i < files.size(); i++ ) delete files[i]; + for ( i = 0; i < includes.size(); i++ ) + delete includes[i]; for ( i = 0; i < defines.size(); i++ ) delete defines[i]; for ( i = 0; i < ifs.size(); i++ ) _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-13 03:43:10 UTC (rev 13016) @@ -96,6 +96,10 @@
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 ( @@ -114,7 +118,11 @@ } else if ( e.name == "include" ) { - includes.push_back ( new Include ( *this, e ) ); + Include* include = new Include ( *this, e ); + if ( pIf ) + pIf->includes.push_back ( include ); + else + includes.push_back ( include ); subs_invalid = true; } else if ( e.name == "define" ) _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-13 02:46:46 UTC (rev 13015) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-13 03:43:10 UTC (rev 13016) @@ -256,6 +256,7 @@
const Module* module; std::string property, value; std::vector<File*> files; + std::vector<Include*> includes; std::vector<Define*> defines; std::vector<Property*> properties; std::vector<If*> ifs;