host vs target refactoring, <module> has two new attributes 'host' and 'prefix' ...
authorRoyce Mitchell III <royce3@ev1.net>
Fri, 11 Mar 2005 07:46:22 +0000 (07:46 +0000)
committerRoyce Mitchell III <royce3@ev1.net>
Fri, 11 Mar 2005 07:46:22 +0000 (07:46 +0000)
svn path=/branches/xmlbuildsystem/; revision=13924

reactos/lib/zlib/zlib.xml
reactos/lib/zlib/zlib_common.xml [new file with mode: 0644]
reactos/tools/buildno/makefile
reactos/tools/cabman/cabman.xml
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.h
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/rbuild.h

index ac00376..bc2d962 100644 (file)
@@ -1,17 +1,7 @@
 <module name="zlib" type="staticlibrary">\r
-       <include base="zlib">.</include>\r
-       <file>adler32.c</file>\r
-       <file>compress.c</file>\r
-       <file>crc32.c</file>\r
-       <file>gzio.c</file>\r
-       <file>uncompr.c</file>\r
-       <file>deflate.c</file>\r
-       <file>trees.c</file>\r
-       <file>zutil.c</file>\r
-       <file>inflate.c</file>\r
-       <file>infblock.c</file>\r
-       <file>inftrees.c</file>\r
-       <file>infcodes.c</file>\r
-       <file>infutil.c</file>\r
-       <file>inffast.c</file>\r
+       <xi:include href="zlib_common.xml" />\r
+</module>\r
+\r
+<module name="hostzlib" type="staticlibrary" host="true" prefix="host_">\r
+       <xi:include href="zlib_common.xml" />\r
 </module>\r
diff --git a/reactos/lib/zlib/zlib_common.xml b/reactos/lib/zlib/zlib_common.xml
new file mode 100644 (file)
index 0000000..1a12879
--- /dev/null
@@ -0,0 +1,16 @@
+<include base="zlib">.</include>\r
+\r
+<file>adler32.c</file>\r
+<file>compress.c</file>\r
+<file>crc32.c</file>\r
+<file>gzio.c</file>\r
+<file>uncompr.c</file>\r
+<file>deflate.c</file>\r
+<file>trees.c</file>\r
+<file>zutil.c</file>\r
+<file>inflate.c</file>\r
+<file>infblock.c</file>\r
+<file>inftrees.c</file>\r
+<file>infcodes.c</file>\r
+<file>infutil.c</file>\r
+<file>inffast.c</file>\r
index 520b649..7f46cb0 100644 (file)
@@ -28,7 +28,8 @@ $(BUILDNO_OBJECTS): %.o : %.cpp include$(SEP)reactos$(SEP)version.h
 buildno_clean:
        -@$(rm) $(BUILDNO_TARGET) $(BUILDNO_OBJECTS) 2>$(NUL)
 
-BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
+# BUILDNO_H is defined from the top-level makefile now...
+#BUILDNO_H = .$(SEP)include$(SEP)reactos$(SEP)buildno.h
 
 $(BUILDNO_H): $(BUILDNO_TARGET)
        $(EXEPREFIX)$(BUILDNO_TARGET) $(BUILDNO_H)
index 95d3a10..cae0474 100644 (file)
@@ -1,10 +1,10 @@
 <module name="cabman" type="buildtool">\r
        <include base="cabman">.</include>\r
        <include base="zlib">.</include>\r
-       <library>zlib</library>\r
+       <library>hostzlib</library>\r
        <file>cabinet.cxx</file>\r
        <file>dfp.cxx</file>\r
        <file>main.cxx</file>\r
        <file>mszip.cxx</file>\r
        <file>raw.cxx</file>\r
-</module>\r
+</module>
\ No newline at end of file
index d5b5b1a..ce13727 100644 (file)
@@ -312,6 +312,11 @@ MingwBackend::ProcessModule ( Module& module ) const
                module.node.location,\r
                module.type );\r
        MingwModuleHandler::string_list clean_files;\r
+       if ( module.host == HostDefault )\r
+       {\r
+               module.host = h->DefaultHost();\r
+               assert ( module.host != HostDefault );\r
+       }\r
        h->Process ( module, clean_files );\r
        h->GenerateCleanTarget ( module, clean_files );\r
        h->GenerateDirectoryTargets ();\r
index 90bd48e..a9d6f08 100644 (file)
@@ -31,14 +31,40 @@ ReplaceExtension ( const string& filename,
                    const string& newExtension )\r
 {\r
        size_t index = filename.find_last_of ( '/' );\r
-       if (index == string::npos) index = 0;\r
-       string tmp = filename.substr( index, filename.size() - index );\r
+       if ( index == string::npos )\r
+               index = 0;\r
+       size_t index2 = filename.find_last_of ( '\\' );\r
+       if ( index2 != string::npos && index2 > index )\r
+               index = index2;\r
+       string tmp = filename.substr( index /*, filename.size() - index*/ );\r
        size_t ext_index = tmp.find_last_of( '.' );\r
-       if (ext_index != string::npos) \r
+       if ( ext_index != string::npos )\r
                return filename.substr ( 0, index + ext_index ) + newExtension;\r
        return filename + newExtension;\r
 }\r
 \r
+string\r
+PrefixFilename (\r
+       const string& filename,\r
+       const string& prefix )\r
+{\r
+       if ( !prefix.length() )\r
+               return filename;\r
+       string out;\r
+       const char* pfilename = filename.c_str();\r
+       const char* p1 = strrchr ( pfilename, '/' );\r
+       const char* p2 = strrchr ( pfilename, '\\' );\r
+       if ( p1 || p2 )\r
+       {\r
+               if ( p2 > p1 )\r
+                       p1 = p2;\r
+               out += string(pfilename,p1-pfilename) + CSEP;\r
+               pfilename = p1 + 1;\r
+       }\r
+       out += prefix + pfilename;\r
+       return out;\r
+}\r
+\r
 \r
 MingwModuleHandler::MingwModuleHandler ( ModuleType moduletype )\r
 {\r
@@ -167,22 +193,9 @@ MingwModuleHandler::GetModuleDependencies ( const Module& module ) const
        return dependencies;\r
 }\r
 \r
-/*string\r
-MingwModuleHandler::GetAllDependencies ( const Module& module ) const\r
-{\r
-       string dependencies = GetImportMacro ( module );\r
-       string s = GetModuleDependencies ( module );\r
-       if ( s.length () > 0 )\r
-       {\r
-               dependencies += " ";\r
-               dependencies += s;\r
-       }\r
-       return dependencies;\r
-}*/\r
-\r
 string\r
 MingwModuleHandler::GetSourceFilenames ( const Module& module,\r
-                                            bool includeGeneratedFiles ) const\r
+                                         bool includeGeneratedFiles ) const\r
 {\r
        size_t i;\r
 \r
@@ -229,8 +242,8 @@ MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles ( const Module& modu
                                    false );\r
 }\r
 \r
-string\r
-MingwModuleHandler::GetObjectFilename ( const string& sourceFilename )\r
+static string\r
+GetObjectFilename ( const Module& module, const string& sourceFilename )\r
 {\r
        string newExtension;\r
        string extension = GetExtension ( sourceFilename );\r
@@ -240,7 +253,10 @@ MingwModuleHandler::GetObjectFilename ( const string& sourceFilename )
                newExtension = ".stubs.o";\r
        else\r
                newExtension = ".o";\r
-       return FixupTargetFilename ( ReplaceExtension ( sourceFilename, newExtension ) );\r
+       return FixupTargetFilename (\r
+               ReplaceExtension (\r
+                       PrefixFilename(sourceFilename,module.prefix),\r
+                       newExtension ) );\r
 }\r
 \r
 void\r
@@ -274,7 +290,8 @@ MingwModuleHandler::GetObjectFilenames ( const Module& module ) const
        {\r
                if ( objectFilenames.size () > 0 )\r
                        objectFilenames += " ";\r
-               objectFilenames += PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( files[i]->name ) );\r
+               objectFilenames += PassThruCacheDirectory (\r
+                       GetObjectFilename ( module, files[i]->name ) );\r
        }\r
        return objectFilenames;\r
 }\r
@@ -514,6 +531,7 @@ MingwModuleHandler::GenerateMacro (
 \r
 void\r
 MingwModuleHandler::GenerateMacros (\r
+       const Module& module,\r
        const char* assignmentOperation,\r
        const IfableData& data,\r
        const vector<CompilerFlag*>* compilerFlags,\r
@@ -580,7 +598,7 @@ MingwModuleHandler::GenerateMacros (
                                        "%s := %s $(%s)\n",\r
                                        objs_macro.c_str(),\r
                                        PassThruCacheDirectory (\r
-                                               MingwModuleHandler::GetObjectFilename ( file.name ) ).c_str (),\r
+                                               GetObjectFilename ( module, file.name ) ).c_str (),\r
                                        objs_macro.c_str() );\r
                        }\r
                }\r
@@ -599,7 +617,7 @@ MingwModuleHandler::GenerateMacros (
                                        "%s%s",\r
                                        ( i%10 == 9 ? "\\\n\t" : " " ),\r
                                        PassThruCacheDirectory (\r
-                                               MingwModuleHandler::GetObjectFilename ( file.name ) ).c_str () );\r
+                                               GetObjectFilename ( module, file.name ) ).c_str () );\r
                        }\r
                }\r
                fprintf ( fMakefile, "\n" );\r
@@ -621,6 +639,7 @@ MingwModuleHandler::GenerateMacros (
                                rIf.property.c_str(),\r
                                rIf.value.c_str() );\r
                        GenerateMacros (\r
+                               module,\r
                                "+=",\r
                                rIf.data,\r
                                NULL,\r
@@ -651,6 +670,7 @@ MingwModuleHandler::GenerateMacros (
        const string& linkdeps_macro ) const\r
 {\r
        GenerateMacros (\r
+               module,\r
                "=",\r
                module.non_if_data,\r
                &module.compilerFlags,\r
@@ -721,7 +741,8 @@ MingwModuleHandler::GenerateGccCommand ( const Module& module,
        string deps = sourceFilename;\r
        if ( module.pch && use_pch )\r
                deps += " " + module.pch->header + ".gch";\r
-       string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) );\r
+       string objectFilename = PassThruCacheDirectory (\r
+               GetObjectFilename ( module, sourceFilename ) );\r
        fprintf ( fMakefile,\r
                  "%s: %s\n",\r
                  objectFilename.c_str (),\r
@@ -741,7 +762,8 @@ MingwModuleHandler::GenerateGccAssemblerCommand ( const Module& module,
                                                   const string& cc,\r
                                                   const string& cflagsMacro ) const\r
 {\r
-       string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) );\r
+       string objectFilename = PassThruCacheDirectory (\r
+               GetObjectFilename ( module, sourceFilename ) );\r
        fprintf ( fMakefile,\r
                  "%s: %s\n",\r
                  objectFilename.c_str (),\r
@@ -760,7 +782,8 @@ MingwModuleHandler::GenerateNasmCommand ( const Module& module,
                                           const string& sourceFilename,\r
                                           const string& nasmflagsMacro ) const\r
 {\r
-       string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) );\r
+       string objectFilename = PassThruCacheDirectory (\r
+               GetObjectFilename ( module, sourceFilename ) );\r
        fprintf ( fMakefile,\r
                  "%s: %s\n",\r
                  objectFilename.c_str (),\r
@@ -779,7 +802,8 @@ MingwModuleHandler::GenerateWindresCommand ( const Module& module,
                                              const string& sourceFilename,\r
                                              const string& windresflagsMacro ) const\r
 {\r
-       string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) );\r
+       string objectFilename = PassThruCacheDirectory ( \r
+               GetObjectFilename ( module, sourceFilename ) );\r
        string rciFilename = ReplaceExtension ( sourceFilename,\r
                                                ".rci" );\r
        string resFilename = ReplaceExtension ( sourceFilename,\r
@@ -859,7 +883,7 @@ MingwModuleHandler::GenerateCommands (
        const string& windresflagsMacro,\r
        string_list& clean_files ) const\r
 {\r
-       CLEAN_FILE ( GetObjectFilename(sourceFilename) );\r
+       CLEAN_FILE ( GetObjectFilename(module,sourceFilename) );\r
        string extension = GetExtension ( sourceFilename );\r
        if ( extension == ".c" || extension == ".C" )\r
        {\r
@@ -1090,22 +1114,6 @@ MingwModuleHandler::GenerateObjectFileTargets (
        fprintf ( fMakefile, "\n" );\r
 }\r
 \r
-void\r
-MingwModuleHandler::GetCleanTargets (\r
-       string_list& out,\r
-       const IfableData& data ) const\r
-{\r
-       size_t i;\r
-\r
-       const vector<File*>& files = data.files;\r
-       for ( i = 0; i < files.size(); i++ )\r
-               out.push_back ( PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( files[i]->name ) ) );\r
-\r
-       const vector<If*>& ifs = data.ifs;\r
-       for ( i = 0; i < ifs.size(); i++ )\r
-               GetCleanTargets ( out, ifs[i]->data );\r
-}\r
-\r
 string\r
 MingwModuleHandler::GenerateArchiveTarget ( const Module& module,\r
                                             const string& ar,\r
@@ -1165,13 +1173,14 @@ MingwModuleHandler::GetLinkerMacro ( const Module& module ) const
 void\r
 MingwModuleHandler::GenerateMacrosAndTargets (\r
        const Module& module,\r
-       const string& cc,\r
-       const string& cppc,\r
-       const string& ar,\r
        const string* cflags,\r
        const string* nasmflags,\r
        string_list& clean_files ) const\r
 {\r
+       string cc = ( module.host ? "${host_gcc}" : "${gcc}" );\r
+       string cppc = ( module.host ? "${host_gpp}" : "${gpp}" );\r
+       string ar = ( module.host ? "${host_ar}" : "${ar}" );\r
+\r
        string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());\r
        string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());\r
        string windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());\r
@@ -1234,50 +1243,6 @@ MingwModuleHandler::GenerateMacrosAndTargets (
        }\r
 }\r
 \r
-void\r
-MingwModuleHandler::GenerateMacrosAndTargetsHost (\r
-       const Module& module,\r
-       string_list& clean_files ) const\r
-{\r
-       GenerateMacrosAndTargets (\r
-               module,\r
-               "${host_gcc}",\r
-               "${host_gpp}",\r
-               "${host_ar}",\r
-               NULL,\r
-               NULL,\r
-               clean_files );\r
-}\r
-\r
-void\r
-MingwModuleHandler::GenerateMacrosAndTargetsTarget (\r
-       const Module& module,\r
-       string_list& clean_files ) const\r
-{\r
-       GenerateMacrosAndTargetsTarget (\r
-               module,\r
-               NULL,\r
-               NULL,\r
-               clean_files );\r
-}\r
-\r
-void\r
-MingwModuleHandler::GenerateMacrosAndTargetsTarget (\r
-       const Module& module,\r
-       const string* cflags,\r
-       const string* nasmflags,\r
-       string_list& clean_files ) const\r
-{\r
-       GenerateMacrosAndTargets (\r
-               module,\r
-               "${gcc}",\r
-               "${gpp}",\r
-               "${ar}",\r
-               cflags,\r
-               nasmflags,\r
-               clean_files );\r
-}\r
-\r
 string\r
 MingwModuleHandler::GetInvocationDependencies ( const Module& module ) const\r
 {\r
@@ -1489,7 +1454,11 @@ MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& modul
        string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
        string libsMacro = GetLibsMacro ( module );\r
 \r
-       GenerateMacrosAndTargetsHost ( module, clean_files );\r
+       GenerateMacrosAndTargets (\r
+               module,\r
+               NULL,\r
+               NULL,\r
+               clean_files );\r
 \r
        string linker;\r
        if ( IsCPlusPlusModule ( module ) )\r
@@ -1548,7 +1517,7 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module, str
                                      module.entrypoint.c_str (),\r
                                      module.baseaddress.c_str () );\r
 \r
-       GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+       GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
        GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
 \r
@@ -1615,7 +1584,7 @@ MingwStaticLibraryModuleHandler::Process ( const Module& module, string_list& cl
 void\r
 MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ( const Module& module, string_list& clean_files )\r
 {\r
-       GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+       GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 }\r
 \r
 \r
@@ -1637,7 +1606,7 @@ MingwObjectLibraryModuleHandler::Process ( const Module& module, string_list& cl
 void\r
 MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ( const Module& module, string_list& clean_files )\r
 {\r
-       GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+       GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 }\r
 \r
 \r
@@ -1672,7 +1641,7 @@ MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget (
 \r
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
-               GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+               GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -1732,10 +1701,10 @@ MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget (
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
                string cflags ( "-D__NTDRIVER__" );\r
-               GenerateMacrosAndTargetsTarget ( module,\r
-                                                &cflags,\r
-                                                NULL,\r
-                                                clean_files);\r
+               GenerateMacrosAndTargets ( module,\r
+                                          &cflags,\r
+                                          NULL,\r
+                                          clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -1791,7 +1760,7 @@ MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ( const Module& modul
 \r
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
-               GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+               GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -1848,10 +1817,10 @@ MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ( const Module& modul
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
                string cflags ( "-D__NTAPP__" );\r
-               GenerateMacrosAndTargetsTarget ( module,\r
-                                                &cflags,\r
-                                                NULL,\r
-                                                clean_files );\r
+               GenerateMacrosAndTargets ( module,\r
+                                          &cflags,\r
+                                          NULL,\r
+                                          clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -1931,7 +1900,7 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module,
 \r
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
-               GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+               GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -1939,7 +1908,7 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module,
                          linkDepsMacro.c_str () );\r
 \r
                string linker;\r
-               if ( IsCPlusPlusModule ( module ) )\r
+               if ( module.cplusplus )\r
                        linker = "${gpp}";\r
                else\r
                        linker = "${gcc}";\r
@@ -1993,7 +1962,7 @@ MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ( const Module& module,
 \r
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
-               GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+               GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -2001,7 +1970,7 @@ MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ( const Module& module,
                          linkDepsMacro.c_str () );\r
 \r
                string linker;\r
-               if ( IsCPlusPlusModule ( module ) )\r
+               if ( module.cplusplus )\r
                        linker = "${gpp}";\r
                else\r
                        linker = "${gcc}";\r
@@ -2055,7 +2024,7 @@ MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module,
 \r
        if ( module.non_if_data.files.size () > 0 )\r
        {\r
-               GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+       GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
@@ -2063,7 +2032,7 @@ MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module,
                          linkDepsMacro.c_str () );\r
 \r
                string linker;\r
-               if ( IsCPlusPlusModule ( module ) )\r
+               if ( module.cplusplus )\r
                        linker = "${gpp}";\r
                else\r
                        linker = "${gcc}";\r
@@ -2118,7 +2087,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget (
        string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
        string libsMacro = GetLibsMacro ( module );\r
 \r
-       GenerateMacrosAndTargetsTarget ( module, clean_files );\r
+       GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
 \r
        fprintf ( fMakefile, "%s: %s %s\n",\r
                  target.c_str (),\r
@@ -2164,10 +2133,10 @@ MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ( const Module& mod
        string objectsMacro = GetObjectsMacro ( module );\r
 \r
        string* nasmflags = new string ( "-f bin" );\r
-       GenerateMacrosAndTargetsTarget ( module,\r
-                                        NULL,\r
-                                        nasmflags,\r
-                                        clean_files );\r
+       GenerateMacrosAndTargets ( module,\r
+                                  NULL,\r
+                                  nasmflags,\r
+                                  clean_files );\r
 \r
        fprintf ( fMakefile, ".PHONY: %s\n\n",\r
                      module.name.c_str ());\r
index 7995c58..86819a2 100644 (file)
@@ -7,6 +7,10 @@ extern std::string
 ReplaceExtension ( const std::string& filename,\r
                    const std::string& newExtension );\r
 \r
+extern std::string\r
+PrefixFilename (\r
+       const std::string& filename,\r
+       const std::string& prefix );\r
 \r
 class MingwModuleHandler\r
 {\r
@@ -23,10 +27,10 @@ public:
        static void SetUsePch ( bool use_pch );\r
        static MingwModuleHandler* LookupHandler ( const std::string& location,\r
                                                   ModuleType moduletype_ );\r
+       virtual HostType DefaultHost() = 0;\r
        virtual void Process ( const Module& module, string_list& clean_files ) = 0;\r
        bool IncludeDirectoryTarget ( const std::string& directory ) const;\r
        void GenerateDirectoryTargets () const;\r
-       static std::string GetObjectFilename ( const std::string& sourceFilename );\r
        void GenerateCleanTarget ( const Module& module,\r
                                   const string_list& clean_files ) const;\r
 protected:\r
@@ -45,14 +49,6 @@ protected:
        std::string GetSourceFilenamesWithoutGeneratedFiles ( const Module& module ) const;\r
 \r
        std::string GetObjectFilenames ( const Module& module ) const;\r
-       void GenerateMacrosAndTargetsHost ( const Module& module,\r
-                                           string_list& clean_files ) const;\r
-       void GenerateMacrosAndTargetsTarget ( const Module& module,\r
-                                             string_list& clean_files ) const;\r
-       void GenerateMacrosAndTargetsTarget ( const Module& module,\r
-                                             const std::string* cflags,\r
-                                             const std::string* nasmflags,\r
-                                             string_list& clean_files ) const;\r
        std::string GetInvocationDependencies ( const Module& module ) const;\r
        void GenerateInvocations ( const Module& module ) const;\r
        \r
@@ -69,6 +65,10 @@ protected:
                                     const std::string& objectsMacro,\r
                                     const std::string& libsMacro,\r
                                     string_list& clean_files ) const;\r
+       void GenerateMacrosAndTargets ( const Module& module,\r
+                                       const std::string* clags,\r
+                                       const std::string* nasmflags,\r
+                                       string_list& clean_files ) const;\r
        void GenerateImportLibraryTargetIfNeeded ( const Module& module, string_list& clean_files ) const;\r
        std::string GetDefinitionDependencies ( const Module& module ) const;\r
        std::string GetLinkingDependencies ( const Module& module ) const;\r
@@ -90,7 +90,9 @@ private:
                             const std::string& macro,\r
                             const IfableData& data,\r
                             const std::vector<CompilerFlag*>* compilerFlags ) const;\r
-       void GenerateMacros ( const char* op,\r
+       void GenerateMacros (\r
+                             const Module& module,\r
+                             const char* op,\r
                              const IfableData& data,\r
                              const std::vector<CompilerFlag*>* compilerFlags,\r
                              const std::vector<LinkerFlag*>* linkerFlags,\r
@@ -152,18 +154,9 @@ private:
                                         const std::string& nasmflagsMacro,\r
                                         const std::string& windresflagsMacro,\r
                                         string_list& clean_files ) const;\r
-       void GetCleanTargets ( string_list& out,\r
-                              const IfableData& data ) const;\r
        std::string GenerateArchiveTarget ( const Module& module,\r
                                            const std::string& ar,\r
                                            const std::string& objs_macro ) const;\r
-       void GenerateMacrosAndTargets ( const Module& module,\r
-                                       const std::string& cc,\r
-                                       const std::string& cppc,\r
-                                       const std::string& ar,\r
-                                       const std::string* clags,\r
-                                       const std::string* nasmflags,\r
-                                       string_list& clean_files ) const;\r
        std::string GetSpecObjectDependencies ( const std::string& filename ) const;\r
        std::string GetDefaultDependencies ( const Module& module ) const;\r
 };\r
@@ -173,6 +166,7 @@ class MingwBuildToolModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwBuildToolModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostTrue; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateBuildToolModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -183,6 +177,7 @@ class MingwKernelModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwKernelModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateKernelModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -193,6 +188,7 @@ class MingwStaticLibraryModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwStaticLibraryModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateStaticLibraryModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -203,6 +199,7 @@ class MingwObjectLibraryModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwObjectLibraryModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateObjectLibraryModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -213,6 +210,7 @@ class MingwKernelModeDLLModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwKernelModeDLLModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateKernelModeDLLModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -223,6 +221,7 @@ class MingwKernelModeDriverModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwKernelModeDriverModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateKernelModeDriverModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -233,6 +232,7 @@ class MingwNativeDLLModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwNativeDLLModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateNativeDLLModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -243,6 +243,7 @@ class MingwNativeCUIModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwNativeCUIModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateNativeCUIModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -253,6 +254,7 @@ class MingwWin32DLLModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwWin32DLLModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateExtractWineDLLResourcesTarget ( const Module& module, string_list& clean_files );\r
@@ -264,6 +266,7 @@ class MingwWin32CUIModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwWin32CUIModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateWin32CUIModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -274,6 +277,7 @@ class MingwWin32GUIModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwWin32GUIModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateWin32GUIModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -284,6 +288,7 @@ class MingwBootLoaderModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwBootLoaderModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateBootLoaderModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -294,6 +299,7 @@ class MingwBootSectorModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwBootSectorModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateBootSectorModuleTarget ( const Module& module, string_list& clean_files );\r
@@ -304,6 +310,7 @@ class MingwIsoModuleHandler : public MingwModuleHandler
 {\r
 public:\r
        MingwIsoModuleHandler ();\r
+       virtual HostType DefaultHost() { return HostFalse; }\r
        virtual void Process ( const Module& module, string_list& clean_files );\r
 private:\r
        void GenerateIsoModuleTarget ( const Module& module, string_list& clean_files );\r
index 0ffae73..7a9e4a6 100644 (file)
@@ -92,7 +92,8 @@ Module::Module ( const Project& project,
          importLibrary (NULL),\r
          bootstrap (NULL),\r
          pch (NULL),\r
-         cplusplus (false)\r
+         cplusplus (false),\r
+         host (HostDefault)\r
 {\r
        if ( node.name != "module" )\r
                throw Exception ( "internal tool error: Module created with non-<module> node" );\r
@@ -127,9 +128,43 @@ Module::Module ( const Project& project,
 \r
        att = moduleNode.GetAttribute ( "mangledsymbols", false );\r
        if ( att != NULL )\r
-               mangledSymbols = att->value != "false";\r
+       {\r
+               const char* p = att->value.c_str();\r
+               if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )\r
+                       mangledSymbols = true;\r
+               else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )\r
+                       mangledSymbols = false;\r
+               else\r
+               {\r
+                       throw InvalidAttributeValueException (\r
+                               moduleNode.location,\r
+                               "mangledsymbols",\r
+                               att->value );\r
+               }\r
+       }\r
        else\r
                mangledSymbols = false;\r
+\r
+       att = moduleNode.GetAttribute ( "host", false );\r
+       if ( att != NULL )\r
+       {\r
+               const char* p = att->value.c_str();\r
+               if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )\r
+                       host = HostTrue;\r
+               else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )\r
+                       host = HostFalse;\r
+               else\r
+               {\r
+                       throw InvalidAttributeValueException (\r
+                               moduleNode.location,\r
+                               "host",\r
+                               att->value );\r
+               }\r
+       }\r
+\r
+       att = moduleNode.GetAttribute ( "prefix", false );\r
+       if ( att != NULL )\r
+               prefix = att->value;\r
 }\r
 \r
 Module::~Module ()\r
index b541363..619b5fe 100644 (file)
@@ -131,6 +131,12 @@ enum ModuleType
        Iso\r
 };\r
 \r
+enum HostType\r
+{\r
+       HostDefault,\r
+       HostTrue,\r
+       HostFalse\r
+};\r
 \r
 class Module\r
 {\r
@@ -153,6 +159,8 @@ public:
        std::vector<LinkerFlag*> linkerFlags;\r
        PchFile* pch;\r
        bool cplusplus;\r
+       std::string prefix;\r
+       HostType host;\r
 \r
        Module ( const Project& project,\r
                 const XMLElement& moduleNode,\r