10 #define EXEPOSTFIX ".exe"
12 string
FixSep ( const string
& s
)
15 char* p
= strchr ( &s2
[0], '/' );
19 p
= strchr ( p
, '/' );
26 string
FixSep ( const string
& s
)
29 char* p
= strchr ( &s2
[0], '\\' );
33 p
= strchr ( p
, '\\' );
39 MingwBackend::MingwBackend ( Project
& project
)
44 void MingwBackend::Process ()
49 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
51 Module
& module
= *ProjectNode
.modules
[i
];
52 ProcessModule ( module
);
57 void MingwBackend::CreateMakefile ()
59 fMakefile
= fopen ( ProjectNode
.makefile
.c_str (), "w" );
61 throw AccessDeniedException ( ProjectNode
.makefile
);
64 void MingwBackend::CloseMakefile ()
70 void MingwBackend::GenerateHeader ()
72 fprintf ( fMakefile
, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" );
75 void MingwBackend::GenerateAllTarget ()
77 fprintf ( fMakefile
, "all: " );
78 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
80 Module
& module
= *ProjectNode
.modules
[i
];
82 " %s" SEP
"%s" EXEPOSTFIX
,
83 FixSep(module
.path
).c_str (),
84 module
.name
.c_str () );
86 fprintf ( fMakefile
, "\n\n" );
89 void MingwBackend::ProcessModule ( Module
& module
)
91 MingwModuleHandlerList moduleHandlers
;
92 GetModuleHandlers ( moduleHandlers
);
93 for (size_t i
= 0; i
< moduleHandlers
.size (); i
++)
95 MingwModuleHandler
& moduleHandler
= *moduleHandlers
[i
];
96 if (moduleHandler
.CanHandleModule ( module
) )
98 moduleHandler
.Process ( module
);
104 void MingwBackend::GetModuleHandlers ( MingwModuleHandlerList
& moduleHandlers
)
106 moduleHandlers
.push_back ( new MingwKernelModuleHandler ( fMakefile
) );