forgot to recurse If elements when generating macros
[reactos.git] / reactos / tools / rbuild / backend / mingw / modulehandler.cpp
index 43df9ba..af98501 100644 (file)
@@ -267,6 +267,7 @@ MingwModuleHandler::GenerateMacros (
        const vector<File*>& files,\r
        const vector<Include*>* includes,\r
        const vector<Define*>& defines,\r
+       const vector<If*>* ifs,\r
        const string& cflags_macro,\r
        const string& nasmflags_macro,\r
        const string& objs_macro) const\r
@@ -319,6 +320,35 @@ MingwModuleHandler::GenerateMacros (
                }\r
                fprintf ( fMakefile, "\n" );\r
        }\r
+\r
+       if ( ifs && ifs->size() )\r
+       {\r
+               for ( size_t i = 0; i < module.ifs.size(); i++ )\r
+               {\r
+                       If& rIf = *(*ifs)[i];\r
+                       if ( rIf.defines.size() || rIf.files.size() || rIf.ifs.size() )\r
+                       {\r
+                               fprintf (\r
+                                       fMakefile,\r
+                                       "ifeq ($(%s),\"%s\")\n",\r
+                                       rIf.property.c_str(),\r
+                                       rIf.value.c_str() );\r
+                               GenerateMacros (\r
+                                       module,\r
+                                       "+=",\r
+                                       rIf.files,\r
+                                       NULL,\r
+                                       rIf.defines,\r
+                                       &rIf.ifs,\r
+                                       cflags_macro,\r
+                                       nasmflags_macro,\r
+                                       objs_macro );\r
+                               fprintf ( \r
+                                       fMakefile,\r
+                                       "endif\n\n" );\r
+                       }\r
+               }\r
+       }\r
 }\r
 \r
 void\r
@@ -334,6 +364,7 @@ MingwModuleHandler::GenerateMacros (
                module.files,\r
                &module.includes,\r
                module.defines,\r
+               NULL,\r
                cflags_macro,\r
                nasmflags_macro,\r
                objs_macro );\r
@@ -342,7 +373,7 @@ MingwModuleHandler::GenerateMacros (
        for ( size_t i = 0; i < module.ifs.size(); i++ )\r
        {\r
                If& rIf = *module.ifs[i];\r
-               if ( rIf.defines.size() || rIf.files.size() )\r
+               if ( rIf.defines.size() || rIf.files.size() || rIf.ifs.size() )\r
                {\r
                        fprintf (\r
                                fMakefile,\r
@@ -355,6 +386,7 @@ MingwModuleHandler::GenerateMacros (
                                rIf.files,\r
                                NULL,\r
                                rIf.defines,\r
+                               &rIf.ifs,\r
                                cflags_macro,\r
                                nasmflags_macro,\r
                                objs_macro );\r