-Add a new module type 'cabinet' to handle .cab files generation
[reactos.git] / reactos / tools / rbuild / backend / mingw / modulehandler.cpp
index 4fe4714..aebc7bb 100644 (file)
@@ -244,6 +244,9 @@ MingwModuleHandler::InstanciateHandler (
                case IdlHeader:
                        handler = new MingwIdlHeaderModuleHandler ( module );
                        break;
+               case Cabinet:
+                       handler = new MingwCabinetModuleHandler ( module );
+                       break;
                case EmbeddedTypeLib:
                        handler = new MingwEmbeddedTypeLibModuleHandler ( module );
                        break;
@@ -1253,21 +1256,25 @@ Rule arRule2 ( "\t$(ECHO_AR)\n"
 Rule arHostRule2 ( "\t$(ECHO_AR)\n"
                    "\t${host_ar} -rc $@ $($(module_name)_OBJS)\n",
                    NULL );
-Rule gasRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source) ${$(module_name)_precondition}$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule gasRule ( "$(source): ${$(module_name)_precondition}\n"
+               "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                "\t$(ECHO_GAS)\n"
                "\t${gcc} -x assembler-with-cpp -c $< -o $@ -D__ASM__ $($(module_name)_CFLAGS)\n",
                "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o",
                "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule bootRule ( "$(module_output): $(source) ${$(module_name)_precondition}$(dependencies) | $(OUTPUT)$(SEP)$(source_dir)\n"
+Rule bootRule ( "$(source): ${$(module_name)_precondition}\n"
+                "$(module_output): $(source)$(dependencies) | $(OUTPUT)$(SEP)$(source_dir)\n"
                 "\t$(ECHO_NASM)\n"
                 "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
                 "$(OUTPUT)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule nasmRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source) ${$(module_name)_precondition}$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule nasmRule ( "$(source): ${$(module_name)_precondition}\n"
+                "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                 "\t$(ECHO_NASM)\n"
                 "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
                 "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o",
                 "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule windresRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).coff: $(source) ${$(module_name)_precondition}$(dependencies) $(WRC_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir) $(TEMPORARY)\n"
+Rule windresRule ( "$(source): ${$(module_name)_precondition}\n"
+                   "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).coff: $(source)$(dependencies) $(WRC_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir) $(TEMPORARY)\n"
                    "\t$(ECHO_WRC)\n"
                    "\t${gcc} -xc -E -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) > $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp\n"
                    "\t$(Q)$(WRC_TARGET) ${$(module_name)_RCFLAGS} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp\n"
@@ -1280,9 +1287,9 @@ Rule wmcRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc
                "\t$(ECHO_WMC)\n"
                "\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc $(source)\n",
                "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc", "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h", NULL );
-Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source) ${$(module_name)_precondition}$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                      "\t$(ECHO_WINEBLD)\n"
-                     "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(source_path)$(SEP)$(source_name_noext).spec\n"
+                     "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(source)\n"
                      "$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c: $(source_path)$(SEP)$(source_name_noext).spec $(WINEBUILD_TARGET)\n"
                      "\t$(ECHO_WINEBLD)\n"
                      "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $(source_path)$(SEP)$(source_name_noext).spec\n"
@@ -1293,12 +1300,14 @@ Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noex
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlHeaderRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h: $(source) ${$(module_name)_precondition}$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule widlHeaderRule ( "$(source): ${$(module_name)_precondition}\n"
+                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h $(source)\n",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlServerRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h: $(source) ${$(module_name)_precondition}$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule widlServerRule ( "$(source): ${$(module_name)_precondition}\n"
+                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h -s -S $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(source)\n"
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
@@ -1308,7 +1317,8 @@ Rule widlServerRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noe
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.o",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlClientRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h: $(source) ${$(module_name)_precondition}$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule widlClientRule ( "$(source): ${$(module_name)_precondition}\n"
+                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h -c -C $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(source)\n"
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
@@ -1318,7 +1328,8 @@ Rule widlClientRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noe
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.o",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlProxyRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h: $(source) ${$(module_name)_precondition}$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule widlProxyRule ( "$(source): ${$(module_name)_precondition}\n"
+                     "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                      "\t$(ECHO_WIDL)\n"
                      "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h -p -P $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(source)\n"
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
@@ -1328,7 +1339,8 @@ Rule widlProxyRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noex
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c",
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o",
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlTlbRule ( "$(OUTPUT)$(SEP)$(source_dir)$(SEP)$(module_name).tlb: $(source) ${$(module_name)_precondition}$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+Rule widlTlbRule ( "$(source): ${$(module_name)_precondition}\n"
+                   "$(OUTPUT)$(SEP)$(source_dir)$(SEP)$(module_name).tlb: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                    "\t$(ECHO_WIDL)\n"
                    "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -t -T $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).tlb $(source)\n",
                    "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
@@ -1348,6 +1360,7 @@ Rule gppHostRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)
                    "\t$(ECHO_CC)\n"
                    "\t${host_gpp} -c $< -o $@ $($(module_name)_CFLAGS)$(compiler_flags)\n",
                    "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o", NULL );
+Rule emptyRule ( "", NULL );
 
 void
 MingwModuleHandler::GenerateGccCommand (
@@ -1470,6 +1483,7 @@ MingwModuleHandler::GenerateCommands (
                { HostFalse, TypeDontCare, ".cc", &gppRule },
                { HostFalse, TypeDontCare, ".cpp", &gppRule },
                { HostFalse, TypeDontCare, ".cxx", &gppRule },
+               { HostFalse, Cabinet, ".*", &emptyRule }
        };
        size_t i;
        Rule *customRule = NULL;
@@ -1480,7 +1494,7 @@ MingwModuleHandler::GenerateCommands (
                        continue;
                if ( rules[i].type != TypeDontCare && rules[i].type != module.type )
                        continue;
-               if ( rules[i].extension != extension )
+               if ( rules[i].extension != extension && rules[i].extension != ".*")
                        continue;
                customRule = rules[i].rule;
                break;
@@ -1663,7 +1677,7 @@ MingwModuleHandler::GenerateLinkerCommand (
        fprintf ( fMakefile,
                "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
                target_macro.c_str (),
-               backend->GetFullName ( *definitionFilename ).c_str (),
+               definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
                dependencies.c_str (),
                target_folder.c_str () );
        fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
@@ -1691,7 +1705,7 @@ MingwModuleHandler::GenerateLinkerCommand (
                fprintf ( fMakefile,
                          "\t${dlltool} --dllname %s --def %s --output-exp %s%s%s\n",
                          targetName.c_str (),
-                         backend->GetFullName ( *definitionFilename ).c_str (),
+                         definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
                          backend->GetFullName ( temp_exp ).c_str (),
                          module.mangledSymbols ? "" : " --kill-at",
                          module.underscoreSymbols ? " --add-underscore" : "" );
@@ -1741,7 +1755,8 @@ MingwModuleHandler::GenerateLinkerCommand (
        GenerateRunStripCode ();
        GenerateCleanObjectsAsYouGoCode ();
 
-       delete definitionFilename;
+       if ( definitionFilename )
+               delete definitionFilename;
        delete target_file;
 }
 
@@ -1847,27 +1862,27 @@ const FileLocation*
 MingwModuleHandler::GenerateArchiveTarget ()
 {
        const FileLocation *archiveFilename = GetModuleArchiveFilename ();
+       const FileLocation *definitionFilename = GetDefinitionFilename ();
 
        arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
 
-       if ( IsStaticLibrary ( module ) && module.importLibrary )
+       if ( IsStaticLibrary ( module ) && definitionFilename )
        {
-               const FileLocation *definitionFilename = GetDefinitionFilename ();
-
                fprintf ( fMakefile,
                          "\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
                          module.importLibrary->dllname.c_str (),
                          backend->GetFullName ( *definitionFilename ).c_str (),
                          module.mangledSymbols ? "" : " --kill-at",
                          module.underscoreSymbols ? " --add-underscore" : "" );
+       }
 
+       if ( definitionFilename )
                delete definitionFilename;
-       }
 
-    if(module.type == HostStaticLibrary)
-        arHostRule2.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
-    else
-        arRule2.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
+       if(module.type == HostStaticLibrary)
+               arHostRule2.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
+       else
+               arRule2.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
 
        GenerateCleanObjectsAsYouGoCode ();
 
@@ -2286,7 +2301,6 @@ MingwModuleHandler::GetDefaultDependencies (
        if ( module.host == HostTrue )
                return;
 
-       dependencies.push_back ( "$(INIT)" );
        if ( module.name != "psdk" )
                dependencies.push_back ( "$(PSDK_TARGET) $(psdk_HEADERS)" );
 
@@ -2349,20 +2363,18 @@ MingwModuleHandler::IsWineModule () const
 const FileLocation*
 MingwModuleHandler::GetDefinitionFilename () const
 {
-       if ( module.importLibrary != NULL )
-       {
-               DirectoryLocation directory;
-               if ( IsWineModule () )
-                       directory = IntermediateDirectory;
-               else
-                       directory = SourceDirectory;
+       if ( module.importLibrary == NULL )
+               return NULL;
 
-               return new FileLocation ( directory,
-                                         module.importLibrary->source->relative_path,
-                                         module.importLibrary->source->name );
-       }
+       DirectoryLocation directory;
+       if ( IsWineModule () )
+               directory = IntermediateDirectory;
        else
-               return new FileLocation ( SourceDirectory, "tools" + sSep + "rbuild", "empty.def" );
+               directory = SourceDirectory;
+
+       return new FileLocation ( directory,
+                                 module.importLibrary->source->relative_path,
+                                 module.importLibrary->source->name );
 }
 
 void
@@ -2372,15 +2384,21 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
        {
                const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files );
                const FileLocation *defFilename = GetDefinitionFilename ();
+               string empty = "tools" + sSep + "rbuild" + sSep + "empty.def";
 
                vector<FileLocation> deps;
                GetDefinitionDependencies ( deps );
 
                fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
 
-               fprintf ( fMakefile, "%s: %s",
-                         backend->GetFullName ( *library_target ).c_str (),
-                         backend->GetFullName ( *defFilename ).c_str () );
+               fprintf ( fMakefile, "%s:",
+                         backend->GetFullName ( *library_target ).c_str () );
+
+               if ( defFilename )
+               {
+                       fprintf ( fMakefile, " %s",
+                                 backend->GetFullName ( *defFilename ).c_str () );
+               }
 
                size_t i, iend = deps.size();
                for ( i = 0; i < iend; i++ )
@@ -2395,12 +2413,14 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
                fprintf ( fMakefile,
                          "\t${dlltool} --dllname %s --def %s --output-lib %s%s%s\n\n",
                          module.output->name.c_str (),
-                         backend->GetFullName ( *defFilename ).c_str (),
+                         defFilename ? backend->GetFullName ( *defFilename ).c_str ()
+                                     : empty.c_str (),
                          backend->GetFullName ( *library_target ).c_str (),
                          module.mangledSymbols ? "" : " --kill-at",
                          module.underscoreSymbols ? " --add-underscore" : "" );
 
-               delete defFilename;
+               if ( defFilename )
+                       delete defFilename;
                delete library_target;
        }
 }
@@ -3469,12 +3489,6 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ()
        FileLocation reactosInf ( bootcdReactos.directory,
                                  bootcdReactos.relative_path,
                                  "reactos.inf" );
-       FileLocation vgafontsCab( bootcdReactos.directory,
-                             bootcdReactos.relative_path,
-                             "vgafonts.cab");
-       FileLocation vgafontsDir( SourceDirectory,
-                             "media" + sSep + "vgafonts",
-                             "" );
 
        vSourceFiles.push_back ( reactosDff );
 
@@ -3503,11 +3517,6 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ()
                  sourceFiles.c_str (),
                  cdFiles.c_str (),
                  cdDirectories.c_str () );
-       fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" );
-       fprintf ( fMakefile,
-                 "\t$(Q)$(CABMAN_TARGET) -M raw -S %s %s\\*.bin\n",      // Escape the asterisk for Make
-                 backend->GetFullName ( vgafontsCab ).c_str (),
-                 backend->GetFullName ( vgafontsDir ).c_str ());
        fprintf ( fMakefile,
                  "\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n",
                  backend->GetFullName ( reactosDff ).c_str (),
@@ -3813,6 +3822,32 @@ MingwIdlHeaderModuleHandler::Process ()
        GenerateRules ();
 }
 
+MingwCabinetModuleHandler::MingwCabinetModuleHandler (
+       const Module& module_ )
+
+       : MingwModuleHandler ( module_ )
+{
+}
+
+void
+MingwCabinetModuleHandler::Process ()
+{
+       string targetMacro ( GetTargetMacro (module) );
+
+       GenerateRules ();
+       
+       const FileLocation *target_file = GetTargetFilename ( module, NULL );
+       fprintf ( fMakefile, "%s: | %s\n",
+                 targetMacro.c_str (),
+                 backend->GetFullPath ( *target_file ).c_str () );
+
+       fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" );
+       fprintf ( fMakefile,
+                 "\t$(Q)$(CABMAN_TARGET) -M raw -S %s $(%s_SOURCES)\n",      // Escape the asterisk for Make
+                 targetMacro.c_str (),
+                         module.name.c_str());
+}
+
 MingwElfExecutableModuleHandler::MingwElfExecutableModuleHandler (
        const Module& module_ )