1 #ifndef MINGW_MODULEHANDLER_H
2 #define MINGW_MODULEHANDLER_H
4 #include "../backend.h"
10 ReplaceExtension ( const std::string
& filename
,
11 const std::string
& newExtension
);
15 const std::string
& filename
,
16 const std::string
& prefix
);
18 class MingwModuleHandler
21 typedef std::vector
<std::string
> string_list
;
22 MingwModuleHandler ( ModuleType moduletype
,
23 MingwBackend
* backend_
);
24 virtual ~MingwModuleHandler();
26 static void SetMakefile ( FILE* f
);
27 static MingwModuleHandler
* InstanciateHandler ( const std::string
& location
,
28 ModuleType moduletype_
,
29 MingwBackend
* backend_
);
30 static void SetUsePch ( bool use_pch
);
31 static MingwModuleHandler
* LookupHandler ( const std::string
& location
,
32 ModuleType moduletype_
);
33 virtual HostType
DefaultHost() = 0;
34 virtual void Process ( const Module
& module
, string_list
& clean_files
) = 0;
35 void GenerateCleanTarget ( const Module
& module
,
36 const string_list
& clean_files
) const;
38 const std::string
&PassThruCacheDirectory ( const std::string
&f
);
39 const std::string
GetDirectoryDependency ( const std::string
& file
);
40 std::string
GetWorkingDirectory () const;
41 std::string
GetBasename ( const std::string
& filename
) const;
42 std::string
GetActualSourceFilename ( const std::string
& filename
) const;
43 std::string
GetModuleArchiveFilename ( const Module
& module
) const;
44 bool IsGeneratedFile ( const File
& file
) const;
45 std::string
GetImportLibraryDependency ( const Module
& importedModule
);
46 std::string
GetModuleDependencies ( const Module
& module
);
47 std::string
GetAllDependencies ( const Module
& module
) const;
48 std::string
GetSourceFilenames ( const Module
& module
,
49 bool includeGeneratedFiles
) const;
50 std::string
GetSourceFilenames ( const Module
& module
) const;
51 std::string
GetSourceFilenamesWithoutGeneratedFiles ( const Module
& module
) const;
53 std::string
GetObjectFilenames ( const Module
& module
);
54 void GenerateInvocations ( const Module
& module
) const;
56 std::string
GetPreconditionDependenciesName ( const Module
& module
) const;
57 void GeneratePreconditionDependencies ( const Module
& module
);
58 std::string
GetCFlagsMacro ( const Module
& module
) const;
59 std::string
GetObjectsMacro ( const Module
& module
) const;
60 std::string
GetLinkingDependenciesMacro ( const Module
& module
) const;
61 std::string
GetLibsMacro ( const Module
& module
) const;
62 std::string
GetLinkerMacro ( const Module
& module
) const;
63 void GenerateLinkerCommand ( const Module
& module
,
64 const std::string
& target
,
65 const std::string
& dependencies
,
66 const std::string
& linker
,
67 const std::string
& linkerParameters
,
68 const std::string
& objectsMacro
,
69 const std::string
& libsMacro
,
70 string_list
& clean_files
) const;
71 void GenerateMacrosAndTargets ( const Module
& module
,
72 const std::string
* clags
,
73 const std::string
* nasmflags
,
74 string_list
& clean_files
);
75 void GenerateImportLibraryTargetIfNeeded ( const Module
& module
, string_list
& clean_files
);
76 std::string
GetDefinitionDependencies ( const Module
& module
);
77 std::string
GetLinkingDependencies ( const Module
& module
) const;
78 bool IsCPlusPlusModule ( const Module
& module
);
79 static FILE* fMakefile
;
82 std::string
ConcatenatePaths ( const std::string
& path1
,
83 const std::string
& path2
) const;
84 std::string
GenerateGccDefineParametersFromVector ( const std::vector
<Define
*>& defines
) const;
85 std::string
GenerateGccDefineParameters ( const Module
& module
) const;
86 std::string
GenerateGccIncludeParametersFromVector ( const std::vector
<Include
*>& includes
) const;
87 std::string
GenerateCompilerParametersFromVector ( const std::vector
<CompilerFlag
*>& compilerFlags
) const;
88 std::string
GenerateLinkerParametersFromVector ( const std::vector
<LinkerFlag
*>& linkerFlags
) const;
89 std::string
GenerateImportLibraryDependenciesFromVector ( const std::vector
<Library
*>& libraries
);
90 std::string
GenerateLinkerParameters ( const Module
& module
) const;
91 void GenerateMacro ( const char* assignmentOperation
,
92 const std::string
& macro
,
93 const IfableData
& data
,
94 const std::vector
<CompilerFlag
*>* compilerFlags
);
98 const IfableData
& data
,
99 const std::vector
<CompilerFlag
*>* compilerFlags
,
100 const std::vector
<LinkerFlag
*>* linkerFlags
,
101 const std::string
& cflags_macro
,
102 const std::string
& nasmflags_macro
,
103 const std::string
& windresflags_macro
,
104 const std::string
& linkerflags_macro
,
105 const std::string
& objs_macro
,
106 const std::string
& libs_macro
,
107 const std::string
& linkdeps_macro
);
108 void GenerateMacros ( const Module
& module
,
109 const std::string
& cflags_macro
,
110 const std::string
& nasmflags_macro
,
111 const std::string
& windresflags_macro
,
112 const std::string
& linkerflags_macro
,
113 const std::string
& objs_macro
,
114 const std::string
& libs_macro
,
115 const std::string
& linkDepsMacro
);
116 std::string
GenerateGccIncludeParameters ( const Module
& module
) const;
117 std::string
GenerateGccParameters ( const Module
& module
) const;
118 std::string
GenerateNasmParameters ( const Module
& module
) const;
119 void GenerateGccCommand ( const Module
& module
,
120 const std::string
& sourceFilename
,
121 const std::string
& cc
,
122 const std::string
& cflagsMacro
);
123 void GenerateGccAssemblerCommand ( const Module
& module
,
124 const std::string
& sourceFilename
,
125 const std::string
& cc
,
126 const std::string
& cflagsMacro
);
127 void GenerateNasmCommand ( const Module
& module
,
128 const std::string
& sourceFilename
,
129 const std::string
& nasmflagsMacro
);
130 void GenerateWindresCommand ( const Module
& module
,
131 const std::string
& sourceFilename
,
132 const std::string
& windresflagsMacro
);
133 void GenerateWinebuildCommands ( const Module
& module
,
134 const std::string
& sourceFilename
,
135 string_list
& clean_files
) const;
136 void GenerateCommands ( const Module
& module
,
137 const std::string
& sourceFilename
,
138 const std::string
& cc
,
139 const std::string
& cppc
,
140 const std::string
& cflagsMacro
,
141 const std::string
& nasmflagsMacro
,
142 const std::string
& windresflagsMacro
,
143 string_list
& clean_files
);
144 void GenerateObjectFileTargets ( const Module
& module
,
145 const IfableData
& data
,
146 const std::string
& cc
,
147 const std::string
& cppc
,
148 const std::string
& cflagsMacro
,
149 const std::string
& nasmflagsMacro
,
150 const std::string
& windresflagsMacro
,
151 string_list
& clean_files
);
152 void GenerateObjectFileTargets ( const Module
& module
,
153 const std::string
& cc
,
154 const std::string
& cppc
,
155 const std::string
& cflagsMacro
,
156 const std::string
& nasmflagsMacro
,
157 const std::string
& windresflagsMacro
,
158 string_list
& clean_files
);
159 std::string
GenerateArchiveTarget ( const Module
& module
,
160 const std::string
& ar
,
161 const std::string
& objs_macro
) const;
162 std::string
GetSpecObjectDependencies ( const std::string
& filename
) const;
163 std::string
GetDefaultDependencies ( const Module
& module
) const;
164 std::string
GetInvocationDependencies ( const Module
& module
);
165 MingwBackend
* backend
;
169 class MingwBuildToolModuleHandler
: public MingwModuleHandler
172 MingwBuildToolModuleHandler ( MingwBackend
* backend
);
173 virtual HostType
DefaultHost() { return HostTrue
; }
174 virtual void Process ( const Module
& module
, string_list
& clean_files
);
176 void GenerateBuildToolModuleTarget ( const Module
& module
, string_list
& clean_files
);
180 class MingwKernelModuleHandler
: public MingwModuleHandler
183 MingwKernelModuleHandler ( MingwBackend
* backend
);
184 virtual HostType
DefaultHost() { return HostFalse
; }
185 virtual void Process ( const Module
& module
, string_list
& clean_files
);
187 void GenerateKernelModuleTarget ( const Module
& module
, string_list
& clean_files
);
191 class MingwStaticLibraryModuleHandler
: public MingwModuleHandler
194 MingwStaticLibraryModuleHandler ( MingwBackend
* backend
);
195 virtual HostType
DefaultHost() { return HostFalse
; }
196 virtual void Process ( const Module
& module
, string_list
& clean_files
);
198 void GenerateStaticLibraryModuleTarget ( const Module
& module
, string_list
& clean_files
);
202 class MingwObjectLibraryModuleHandler
: public MingwModuleHandler
205 MingwObjectLibraryModuleHandler ( MingwBackend
* backend
);
206 virtual HostType
DefaultHost() { return HostFalse
; }
207 virtual void Process ( const Module
& module
, string_list
& clean_files
);
209 void GenerateObjectLibraryModuleTarget ( const Module
& module
, string_list
& clean_files
);
213 class MingwKernelModeDLLModuleHandler
: public MingwModuleHandler
216 MingwKernelModeDLLModuleHandler ( MingwBackend
* backend
);
217 virtual HostType
DefaultHost() { return HostFalse
; }
218 virtual void Process ( const Module
& module
, string_list
& clean_files
);
220 void GenerateKernelModeDLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
224 class MingwKernelModeDriverModuleHandler
: public MingwModuleHandler
227 MingwKernelModeDriverModuleHandler ( MingwBackend
* backend
);
228 virtual HostType
DefaultHost() { return HostFalse
; }
229 virtual void Process ( const Module
& module
, string_list
& clean_files
);
231 void GenerateKernelModeDriverModuleTarget ( const Module
& module
, string_list
& clean_files
);
235 class MingwNativeDLLModuleHandler
: public MingwModuleHandler
238 MingwNativeDLLModuleHandler ( MingwBackend
* backend
);
239 virtual HostType
DefaultHost() { return HostFalse
; }
240 virtual void Process ( const Module
& module
, string_list
& clean_files
);
242 void GenerateNativeDLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
246 class MingwNativeCUIModuleHandler
: public MingwModuleHandler
249 MingwNativeCUIModuleHandler ( MingwBackend
* backend
);
250 virtual HostType
DefaultHost() { return HostFalse
; }
251 virtual void Process ( const Module
& module
, string_list
& clean_files
);
253 void GenerateNativeCUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
257 class MingwWin32DLLModuleHandler
: public MingwModuleHandler
260 MingwWin32DLLModuleHandler ( MingwBackend
* backend
);
261 virtual HostType
DefaultHost() { return HostFalse
; }
262 virtual void Process ( const Module
& module
, string_list
& clean_files
);
264 void GenerateExtractWineDLLResourcesTarget ( const Module
& module
, string_list
& clean_files
);
265 void GenerateWin32DLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
269 class MingwWin32CUIModuleHandler
: public MingwModuleHandler
272 MingwWin32CUIModuleHandler ( MingwBackend
* backend
);
273 virtual HostType
DefaultHost() { return HostFalse
; }
274 virtual void Process ( const Module
& module
, string_list
& clean_files
);
276 void GenerateWin32CUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
280 class MingwWin32GUIModuleHandler
: public MingwModuleHandler
283 MingwWin32GUIModuleHandler ( MingwBackend
* backend
);
284 virtual HostType
DefaultHost() { return HostFalse
; }
285 virtual void Process ( const Module
& module
, string_list
& clean_files
);
287 void GenerateWin32GUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
291 class MingwBootLoaderModuleHandler
: public MingwModuleHandler
294 MingwBootLoaderModuleHandler ( MingwBackend
* backend
);
295 virtual HostType
DefaultHost() { return HostFalse
; }
296 virtual void Process ( const Module
& module
, string_list
& clean_files
);
298 void GenerateBootLoaderModuleTarget ( const Module
& module
, string_list
& clean_files
);
302 class MingwBootSectorModuleHandler
: public MingwModuleHandler
305 MingwBootSectorModuleHandler ( MingwBackend
* backend
);
306 virtual HostType
DefaultHost() { return HostFalse
; }
307 virtual void Process ( const Module
& module
, string_list
& clean_files
);
309 void GenerateBootSectorModuleTarget ( const Module
& module
, string_list
& clean_files
);
313 class MingwIsoModuleHandler
: public MingwModuleHandler
316 MingwIsoModuleHandler ( MingwBackend
* backend
);
317 virtual HostType
DefaultHost() { return HostFalse
; }
318 virtual void Process ( const Module
& module
, string_list
& clean_files
);
320 void GenerateIsoModuleTarget ( const Module
& module
, string_list
& clean_files
);
321 std::string
GetBootstrapCdDirectories ( const std::string
& bootcdDirectory
,
322 const Module
& module
);
323 std::string
GetNonModuleCdDirectories ( const std::string
& bootcdDirectory
,
324 const Module
& module
);
325 std::string
GetCdDirectories ( const std::string
& bootcdDirectory
,
326 const Module
& module
);
327 void GetBootstrapCdFiles ( std::vector
<std::string
>& out
,
328 const Module
& module
) const;
329 void GetNonModuleCdFiles ( std::vector
<std::string
>& out
,
330 const Module
& module
) const;
331 void GetCdFiles ( std::vector
<std::string
>& out
,
332 const Module
& module
) const;
333 void OutputBootstrapfileCopyCommands ( const std::string
& bootcdDirectory
,
334 const Module
& module
);
335 void OutputCdfileCopyCommands ( const std::string
& bootcdDirectory
,
336 const Module
& module
);
339 #endif /* MINGW_MODULEHANDLER_H */