1 #ifndef MINGW_MODULEHANDLER_H
2 #define MINGW_MODULEHANDLER_H
4 #include "../backend.h"
7 ReplaceExtension ( const std::string
& filename
,
8 const std::string
& newExtension
);
11 class MingwModuleHandler
14 typedef std::vector
<std::string
> string_list
;
16 static std::map
<ModuleType
,MingwModuleHandler
*>* handler_map
;
19 MingwModuleHandler ( ModuleType moduletype
);
20 virtual ~MingwModuleHandler();
22 static void SetMakefile ( FILE* f
);
23 static void SetUsePch ( bool use_pch
);
24 static MingwModuleHandler
* LookupHandler ( const std::string
& location
,
25 ModuleType moduletype_
);
26 virtual void Process ( const Module
& module
, string_list
& clean_files
) = 0;
27 bool IncludeDirectoryTarget ( const std::string
& directory
) const;
28 void GenerateDirectoryTargets () const;
29 static std::string
GetObjectFilename ( const std::string
& sourceFilename
);
30 void GenerateCleanTarget ( const Module
& module
,
31 const string_list
& clean_files
) const;
33 const std::string
&PassThruCacheDirectory ( const std::string
&f
) const;
34 std::string
GetWorkingDirectory () const;
35 std::string
GetBasename ( const std::string
& filename
) const;
36 std::string
GetActualSourceFilename ( const std::string
& filename
) const;
37 std::string
GetModuleArchiveFilename ( const Module
& module
) const;
38 bool IsGeneratedFile ( const File
& file
) const;
39 std::string
GetImportLibraryDependency ( const Module
& importedModule
) const;
40 std::string
GetModuleDependencies ( const Module
& module
) const;
41 std::string
GetAllDependencies ( const Module
& module
) const;
42 std::string
GetSourceFilenames ( const Module
& module
,
43 bool includeGeneratedFiles
) const;
44 std::string
GetSourceFilenames ( const Module
& module
) const;
45 std::string
GetSourceFilenamesWithoutGeneratedFiles ( const Module
& module
) const;
47 std::string
GetObjectFilenames ( const Module
& module
) const;
48 void GenerateMacrosAndTargetsHost ( const Module
& module
,
49 string_list
& clean_files
) const;
50 void GenerateMacrosAndTargetsTarget ( const Module
& module
,
51 string_list
& clean_files
) const;
52 void GenerateMacrosAndTargetsTarget ( const Module
& module
,
53 const std::string
* cflags
,
54 const std::string
* nasmflags
,
55 string_list
& clean_files
) const;
56 std::string
GetInvocationDependencies ( const Module
& module
) const;
57 void GenerateInvocations ( const Module
& module
) const;
59 std::string
GetPreconditionDependenciesName ( const Module
& module
) const;
60 void GeneratePreconditionDependencies ( const Module
& module
) const;
61 std::string
GetCFlagsMacro ( const Module
& module
) const;
62 std::string
GetObjectsMacro ( const Module
& module
) const;
63 std::string
GetLinkingDependenciesMacro ( const Module
& module
) const;
64 std::string
GetLibsMacro ( const Module
& module
) const;
65 std::string
GetLinkerMacro ( const Module
& module
) const;
66 void GenerateLinkerCommand ( const Module
& module
,
67 const std::string
& linker
,
68 const std::string
& linkerParameters
,
69 const std::string
& objectsMacro
,
70 const std::string
& libsMacro
,
71 string_list
& clean_files
) const;
72 void GenerateImportLibraryTargetIfNeeded ( const Module
& module
, string_list
& clean_files
) const;
73 std::string
GetDefinitionDependencies ( const Module
& module
) const;
74 std::string
GetLinkingDependencies ( const Module
& module
) const;
75 bool IsCPlusPlusModule ( const Module
& module
) const;
76 static FILE* fMakefile
;
78 static std::set
<std::string
> directory_set
;
80 std::string
ConcatenatePaths ( const std::string
& path1
,
81 const std::string
& path2
) const;
82 std::string
GenerateGccDefineParametersFromVector ( const std::vector
<Define
*>& defines
) const;
83 std::string
GenerateGccDefineParameters ( const Module
& module
) const;
84 std::string
GenerateGccIncludeParametersFromVector ( const std::vector
<Include
*>& includes
) const;
85 std::string
GenerateCompilerParametersFromVector ( const std::vector
<CompilerFlag
*>& compilerFlags
) const;
86 std::string
GenerateLinkerParametersFromVector ( const std::vector
<LinkerFlag
*>& linkerFlags
) const;
87 std::string
GenerateImportLibraryDependenciesFromVector ( const std::vector
<Library
*>& libraries
) const;
88 std::string
GenerateLinkerParameters ( const Module
& module
) const;
89 void GenerateMacro ( const char* assignmentOperation
,
90 const std::string
& macro
,
91 const IfableData
& data
,
92 const std::vector
<CompilerFlag
*>* compilerFlags
) const;
93 void GenerateMacros ( const char* op
,
94 const IfableData
& data
,
95 const std::vector
<CompilerFlag
*>* compilerFlags
,
96 const std::vector
<LinkerFlag
*>* linkerFlags
,
97 const std::string
& cflags_macro
,
98 const std::string
& nasmflags_macro
,
99 const std::string
& windresflags_macro
,
100 const std::string
& linkerflags_macro
,
101 const std::string
& objs_macro
,
102 const std::string
& libs_macro
,
103 const std::string
& linkdeps_macro
) const;
104 void GenerateMacros ( const Module
& module
,
105 const std::string
& cflags_macro
,
106 const std::string
& nasmflags_macro
,
107 const std::string
& windresflags_macro
,
108 const std::string
& linkerflags_macro
,
109 const std::string
& objs_macro
,
110 const std::string
& libs_macro
,
111 const std::string
& linkDepsMacro
) const;
112 std::string
GenerateGccIncludeParameters ( const Module
& module
) const;
113 std::string
GenerateGccParameters ( const Module
& module
) const;
114 std::string
GenerateNasmParameters ( const Module
& module
) const;
115 void GenerateGccCommand ( const Module
& module
,
116 const std::string
& sourceFilename
,
117 const std::string
& cc
,
118 const std::string
& cflagsMacro
) const;
119 void GenerateGccAssemblerCommand ( const Module
& module
,
120 const std::string
& sourceFilename
,
121 const std::string
& cc
,
122 const std::string
& cflagsMacro
) const;
123 void GenerateNasmCommand ( const Module
& module
,
124 const std::string
& sourceFilename
,
125 const std::string
& nasmflagsMacro
) const;
126 void GenerateWindresCommand ( const Module
& module
,
127 const std::string
& sourceFilename
,
128 const std::string
& windresflagsMacro
) const;
129 void GenerateWinebuildCommands ( const Module
& module
,
130 const std::string
& sourceFilename
,
131 string_list
& clean_files
) const;
132 void GenerateCommands ( const Module
& module
,
133 const std::string
& sourceFilename
,
134 const std::string
& cc
,
135 const std::string
& cppc
,
136 const std::string
& cflagsMacro
,
137 const std::string
& nasmflagsMacro
,
138 const std::string
& windresflagsMacro
,
139 string_list
& clean_files
) const;
140 void GenerateObjectFileTargets ( const Module
& module
,
141 const IfableData
& data
,
142 const std::string
& cc
,
143 const std::string
& cppc
,
144 const std::string
& cflagsMacro
,
145 const std::string
& nasmflagsMacro
,
146 const std::string
& windresflagsMacro
,
147 string_list
& clean_files
) const;
148 void GenerateObjectFileTargets ( const Module
& module
,
149 const std::string
& cc
,
150 const std::string
& cppc
,
151 const std::string
& cflagsMacro
,
152 const std::string
& nasmflagsMacro
,
153 const std::string
& windresflagsMacro
,
154 string_list
& clean_files
) const;
155 void GetCleanTargets ( string_list
& out
,
156 const IfableData
& data
) const;
157 std::string
GenerateArchiveTarget ( const Module
& module
,
158 const std::string
& ar
,
159 const std::string
& objs_macro
) const;
160 void GenerateMacrosAndTargets ( const Module
& module
,
161 const std::string
& cc
,
162 const std::string
& cppc
,
163 const std::string
& ar
,
164 const std::string
* clags
,
165 const std::string
* nasmflags
,
166 string_list
& clean_files
) const;
167 std::string
GetSpecObjectDependencies ( const std::string
& filename
) const;
168 std::string
GetDefaultDependencies ( const Module
& module
) const;
172 class MingwBuildToolModuleHandler
: public MingwModuleHandler
175 MingwBuildToolModuleHandler ();
176 virtual void Process ( const Module
& module
, string_list
& clean_files
);
178 void GenerateBuildToolModuleTarget ( const Module
& module
, string_list
& clean_files
);
182 class MingwKernelModuleHandler
: public MingwModuleHandler
185 MingwKernelModuleHandler ();
186 virtual void Process ( const Module
& module
, string_list
& clean_files
);
188 void GenerateKernelModuleTarget ( const Module
& module
, string_list
& clean_files
);
192 class MingwStaticLibraryModuleHandler
: public MingwModuleHandler
195 MingwStaticLibraryModuleHandler ();
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 ();
206 virtual void Process ( const Module
& module
, string_list
& clean_files
);
208 void GenerateObjectLibraryModuleTarget ( const Module
& module
, string_list
& clean_files
);
212 class MingwKernelModeDLLModuleHandler
: public MingwModuleHandler
215 MingwKernelModeDLLModuleHandler ();
216 virtual void Process ( const Module
& module
, string_list
& clean_files
);
218 void GenerateKernelModeDLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
222 class MingwKernelModeDriverModuleHandler
: public MingwModuleHandler
225 MingwKernelModeDriverModuleHandler ();
226 virtual void Process ( const Module
& module
, string_list
& clean_files
);
228 void GenerateKernelModeDriverModuleTarget ( const Module
& module
, string_list
& clean_files
);
232 class MingwNativeDLLModuleHandler
: public MingwModuleHandler
235 MingwNativeDLLModuleHandler ();
236 virtual void Process ( const Module
& module
, string_list
& clean_files
);
238 void GenerateNativeDLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
242 class MingwNativeCUIModuleHandler
: public MingwModuleHandler
245 MingwNativeCUIModuleHandler ();
246 virtual void Process ( const Module
& module
, string_list
& clean_files
);
248 void GenerateNativeCUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
252 class MingwWin32DLLModuleHandler
: public MingwModuleHandler
255 MingwWin32DLLModuleHandler ();
256 virtual void Process ( const Module
& module
, string_list
& clean_files
);
258 void GenerateExtractWineDLLResourcesTarget ( const Module
& module
, string_list
& clean_files
);
259 void GenerateWin32DLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
263 class MingwWin32CUIModuleHandler
: public MingwModuleHandler
266 MingwWin32CUIModuleHandler ();
267 virtual void Process ( const Module
& module
, string_list
& clean_files
);
269 void GenerateWin32CUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
273 class MingwWin32GUIModuleHandler
: public MingwModuleHandler
276 MingwWin32GUIModuleHandler ();
277 virtual void Process ( const Module
& module
, string_list
& clean_files
);
279 void GenerateWin32GUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
283 class MingwBootLoaderModuleHandler
: public MingwModuleHandler
286 MingwBootLoaderModuleHandler ();
287 virtual void Process ( const Module
& module
, string_list
& clean_files
);
289 void GenerateBootLoaderModuleTarget ( const Module
& module
, string_list
& clean_files
);
293 class MingwBootSectorModuleHandler
: public MingwModuleHandler
296 MingwBootSectorModuleHandler ();
297 virtual void Process ( const Module
& module
, string_list
& clean_files
);
299 void GenerateBootSectorModuleTarget ( const Module
& module
, string_list
& clean_files
);
303 class MingwIsoModuleHandler
: public MingwModuleHandler
306 MingwIsoModuleHandler ();
307 virtual void Process ( const Module
& module
, string_list
& clean_files
);
309 void GenerateIsoModuleTarget ( const Module
& module
, string_list
& clean_files
);
310 std::string
GetBootstrapCdDirectories ( const std::string bootcdDirectory
,
311 const Module
& module
) const;
312 std::string
GetNonModuleCdDirectories ( const std::string bootcdDirectory
,
313 const Module
& module
) const;
314 std::string
GetCdDirectories ( const std::string bootcdDirectory
,
315 const Module
& module
) const;
316 std::string
GetBootstrapCdFiles ( const std::string bootcdDirectory
,
317 const Module
& module
) const;
318 std::string
GetNonModuleCdFiles ( const std::string bootcdDirectory
,
319 const Module
& module
) const;
320 std::string
GetCdFiles ( const std::string bootcdDirectory
,
321 const Module
& module
) const;
322 void OutputBootstrapfileCopyCommands ( const std::string bootcdDirectory
,
323 const Module
& module
) const;
324 void OutputCdfileCopyCommands ( const std::string bootcdDirectory
,
325 const Module
& module
) const;
328 #endif /* MINGW_MODULEHANDLER_H */