Factories for Backend creation
[reactos.git] / reactos / tools / rbuild / backend / mingw / modulehandler.cpp
1
2 #include "../../pch.h"
3
4 #include "../../rbuild.h"
5 #include "mingw.h"
6 #include "modulehandler.h"
7
8 using std::string;
9
10 MingwModuleHandler::MingwModuleHandler ( FILE* fMakefile )
11 : fMakefile ( fMakefile )
12 {
13 }
14
15 string
16 MingwModuleHandler::GetModuleDependencies ( Module& module )
17 {
18 if ( !module.libraries.size() )
19 return "";
20
21 string dependencies ( module.libraries[0]->name );
22
23 for ( size_t i = 1; i < module.libraries.size(); i++ )
24 {
25 dependencies += " " + module.libraries[i]->name;
26 }
27 return dependencies;
28 }
29
30
31 MingwKernelModuleHandler::MingwKernelModuleHandler ( FILE* fMakefile )
32 : MingwModuleHandler ( fMakefile )
33 {
34 }
35
36 bool
37 MingwKernelModuleHandler::CanHandleModule ( Module& module )
38 {
39 return true;
40 }
41
42 void
43 MingwKernelModuleHandler::Process ( Module& module )
44 {
45 GenerateKernelModuleTarget ( module );
46 }
47
48 void
49 MingwKernelModuleHandler::GenerateKernelModuleTarget ( Module& module )
50 {
51 fprintf ( fMakefile, "%s: %s",
52 module.name.c_str (),
53 GetModuleDependencies ( module ).c_str () );
54 fprintf ( fMakefile, "\n" );
55 fprintf ( fMakefile, "\t" );
56 fprintf ( fMakefile, "\n\n" );
57 }