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 MingwModuleHandler
* LookupHandler ( const std::string
& location
,
24 ModuleType moduletype_
);
25 virtual void Process ( const Module
& module
, string_list
& clean_files
) = 0;
26 bool IncludeDirectoryTarget ( const std::string
& directory
) const;
27 void GenerateDirectoryTargets () const;
28 static std::string
GetObjectFilename ( const std::string
& sourceFilename
);
29 void GenerateCleanTarget ( const Module
& module
,
30 const string_list
& clean_files
) const;
32 const std::string
&PassThruCacheDirectory ( const std::string
&f
) const;
33 std::string
GetWorkingDirectory () const;
34 std::string
GetBasename ( const std::string
& filename
) const;
35 std::string
GetActualSourceFilename ( const std::string
& filename
) const;
36 std::string
GetModuleArchiveFilename ( const Module
& module
) const;
37 bool IsGeneratedFile ( const File
& file
) const;
38 std::string
GetImportLibraryDependency ( const Module
& importedModule
) const;
39 std::string
GetModuleDependencies ( const Module
& module
) const;
40 std::string
GetAllDependencies ( const Module
& module
) const;
41 std::string
GetSourceFilenames ( const Module
& module
,
42 bool includeGeneratedFiles
) const;
43 std::string
GetSourceFilenames ( const Module
& module
) const;
44 std::string
GetSourceFilenamesWithoutGeneratedFiles ( const Module
& module
) const;
46 std::string
GetObjectFilenames ( const Module
& module
) const;
47 void GenerateMacrosAndTargetsHost ( const Module
& module
,
48 string_list
& clean_files
) const;
49 void GenerateMacrosAndTargetsTarget ( const Module
& module
,
50 string_list
& clean_files
) const;
51 void GenerateMacrosAndTargetsTarget ( const Module
& module
,
52 const std::string
* cflags
,
53 const std::string
* nasmflags
,
54 string_list
& clean_files
) const;
55 std::string
GetInvocationDependencies ( const Module
& module
) const;
56 void GenerateInvocations ( const Module
& module
) const;
58 std::string
GetPreconditionDependenciesName ( const Module
& module
) const;
59 void GeneratePreconditionDependencies ( const Module
& module
) const;
60 std::string
GetCFlagsMacro ( const Module
& module
) const;
61 std::string
GetObjectsMacro ( const Module
& module
) const;
62 std::string
GetLinkingDependenciesMacro ( const Module
& module
) const;
63 std::string
GetLibsMacro ( const Module
& module
) const;
64 std::string
GetLinkerMacro ( const Module
& module
) const;
65 void GenerateLinkerCommand ( const Module
& module
,
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 GenerateImportLibraryTargetIfNeeded ( const Module
& module
, string_list
& clean_files
) const;
72 std::string
GetDefinitionDependencies ( const Module
& module
) const;
73 std::string
GetLinkingDependencies ( const Module
& module
) const;
74 bool IsCPlusPlusModule ( const Module
& module
) const;
75 static FILE* fMakefile
;
76 static std::set
<std::string
> directory_set
;
78 std::string
ConcatenatePaths ( const std::string
& path1
,
79 const std::string
& path2
) const;
80 std::string
GenerateGccDefineParametersFromVector ( const std::vector
<Define
*>& defines
) const;
81 std::string
GenerateGccDefineParameters ( const Module
& module
) const;
82 std::string
GenerateGccIncludeParametersFromVector ( const std::vector
<Include
*>& includes
) const;
83 std::string
GenerateCompilerParametersFromVector ( const std::vector
<CompilerFlag
*>& compilerFlags
) const;
84 std::string
GenerateLinkerParametersFromVector ( const std::vector
<LinkerFlag
*>& linkerFlags
) const;
85 std::string
GenerateImportLibraryDependenciesFromVector ( const std::vector
<Library
*>& libraries
) const;
86 std::string
GenerateLinkerParameters ( const Module
& module
) const;
87 void GenerateMacro ( const char* assignmentOperation
,
88 const std::string
& macro
,
89 const std::vector
<Include
*>& includes
,
90 const std::vector
<Define
*>& defines
,
91 const std::vector
<CompilerFlag
*>* compilerFlags
) const;
92 void GenerateMacros ( const char* op
,
93 const std::vector
<File
*>& files
,
94 const std::vector
<Include
*>& includes
,
95 const std::vector
<Define
*>& defines
,
96 const std::vector
<Library
*>& libraries
,
97 const std::vector
<CompilerFlag
*>* compilerFlags
,
98 const std::vector
<LinkerFlag
*>* linkerFlags
,
99 const std::vector
<If
*>& ifs
,
100 const std::string
& cflags_macro
,
101 const std::string
& nasmflags_macro
,
102 const std::string
& windresflags_macro
,
103 const std::string
& linkerflags_macro
,
104 const std::string
& objs_macro
,
105 const std::string
& libs_macro
,
106 const std::string
& linkdeps_macro
) const;
107 void GenerateMacros ( const Module
& module
,
108 const std::string
& cflags_macro
,
109 const std::string
& nasmflags_macro
,
110 const std::string
& windresflags_macro
,
111 const std::string
& linkerflags_macro
,
112 const std::string
& objs_macro
,
113 const std::string
& libs_macro
,
114 const std::string
& linkDepsMacro
) const;
115 std::string
GenerateGccIncludeParameters ( const Module
& module
) const;
116 std::string
GenerateGccParameters ( const Module
& module
) const;
117 std::string
GenerateNasmParameters ( const Module
& module
) const;
118 void GenerateGccCommand ( const Module
& module
,
119 const std::string
& sourceFilename
,
120 const std::string
& cc
,
121 const std::string
& cflagsMacro
) const;
122 void GenerateGccAssemblerCommand ( const Module
& module
,
123 const std::string
& sourceFilename
,
124 const std::string
& cc
,
125 const std::string
& cflagsMacro
) const;
126 void GenerateNasmCommand ( const Module
& module
,
127 const std::string
& sourceFilename
,
128 const std::string
& nasmflagsMacro
) const;
129 void GenerateWindresCommand ( const Module
& module
,
130 const std::string
& sourceFilename
,
131 const std::string
& windresflagsMacro
) const;
132 void GenerateWinebuildCommands ( const Module
& module
,
133 const std::string
& sourceFilename
,
134 string_list
& clean_files
) const;
135 void GenerateCommands ( const Module
& module
,
136 const std::string
& sourceFilename
,
137 const std::string
& cc
,
138 const std::string
& cppc
,
139 const std::string
& cflagsMacro
,
140 const std::string
& nasmflagsMacro
,
141 const std::string
& windresflagsMacro
,
142 string_list
& clean_files
) const;
143 void GenerateObjectFileTargets ( const Module
& module
,
144 const std::vector
<File
*>& files
,
145 const std::vector
<If
*>& ifs
,
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
) const;
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
) const;
159 void GetCleanTargets ( string_list
& out
,
160 const std::vector
<File
*>& files
,
161 const std::vector
<If
*>& ifs
) const;
162 std::string
GenerateArchiveTarget ( const Module
& module
,
163 const std::string
& ar
,
164 const std::string
& objs_macro
) const;
165 void GenerateMacrosAndTargets ( const Module
& module
,
166 const std::string
& cc
,
167 const std::string
& cppc
,
168 const std::string
& ar
,
169 const std::string
* clags
,
170 const std::string
* nasmflags
,
171 string_list
& clean_files
) const;
172 std::string
GetSpecObjectDependencies ( const std::string
& filename
) const;
173 std::string
GetDefaultDependencies ( const Module
& module
) const;
177 class MingwBuildToolModuleHandler
: public MingwModuleHandler
180 MingwBuildToolModuleHandler ();
181 virtual void Process ( const Module
& module
, string_list
& clean_files
);
183 void GenerateBuildToolModuleTarget ( const Module
& module
, string_list
& clean_files
);
187 class MingwKernelModuleHandler
: public MingwModuleHandler
190 MingwKernelModuleHandler ();
191 virtual void Process ( const Module
& module
, string_list
& clean_files
);
193 void GenerateKernelModuleTarget ( const Module
& module
, string_list
& clean_files
);
197 class MingwStaticLibraryModuleHandler
: public MingwModuleHandler
200 MingwStaticLibraryModuleHandler ();
201 virtual void Process ( const Module
& module
, string_list
& clean_files
);
203 void GenerateStaticLibraryModuleTarget ( const Module
& module
, string_list
& clean_files
);
207 class MingwObjectLibraryModuleHandler
: public MingwModuleHandler
210 MingwObjectLibraryModuleHandler ();
211 virtual void Process ( const Module
& module
, string_list
& clean_files
);
213 void GenerateObjectLibraryModuleTarget ( const Module
& module
, string_list
& clean_files
);
217 class MingwKernelModeDLLModuleHandler
: public MingwModuleHandler
220 MingwKernelModeDLLModuleHandler ();
221 virtual void Process ( const Module
& module
, string_list
& clean_files
);
223 void GenerateKernelModeDLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
227 class MingwKernelModeDriverModuleHandler
: public MingwModuleHandler
230 MingwKernelModeDriverModuleHandler ();
231 virtual void Process ( const Module
& module
, string_list
& clean_files
);
233 void GenerateKernelModeDriverModuleTarget ( const Module
& module
, string_list
& clean_files
);
237 class MingwNativeDLLModuleHandler
: public MingwModuleHandler
240 MingwNativeDLLModuleHandler ();
241 virtual void Process ( const Module
& module
, string_list
& clean_files
);
243 void GenerateNativeDLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
247 class MingwNativeCUIModuleHandler
: public MingwModuleHandler
250 MingwNativeCUIModuleHandler ();
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 ();
261 virtual void Process ( const Module
& module
, string_list
& clean_files
);
263 void GenerateExtractWineDLLResourcesTarget ( const Module
& module
, string_list
& clean_files
);
264 void GenerateWin32DLLModuleTarget ( const Module
& module
, string_list
& clean_files
);
268 class MingwWin32CUIModuleHandler
: public MingwModuleHandler
271 MingwWin32CUIModuleHandler ();
272 virtual void Process ( const Module
& module
, string_list
& clean_files
);
274 void GenerateWin32CUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
278 class MingwWin32GUIModuleHandler
: public MingwModuleHandler
281 MingwWin32GUIModuleHandler ();
282 virtual void Process ( const Module
& module
, string_list
& clean_files
);
284 void GenerateWin32GUIModuleTarget ( const Module
& module
, string_list
& clean_files
);
288 class MingwBootLoaderModuleHandler
: public MingwModuleHandler
291 MingwBootLoaderModuleHandler ();
292 virtual void Process ( const Module
& module
, string_list
& clean_files
);
294 void GenerateBootLoaderModuleTarget ( const Module
& module
, string_list
& clean_files
);
298 class MingwBootSectorModuleHandler
: public MingwModuleHandler
301 MingwBootSectorModuleHandler ();
302 virtual void Process ( const Module
& module
, string_list
& clean_files
);
304 void GenerateBootSectorModuleTarget ( const Module
& module
, string_list
& clean_files
);
308 class MingwIsoModuleHandler
: public MingwModuleHandler
311 MingwIsoModuleHandler ();
312 virtual void Process ( const Module
& module
, string_list
& clean_files
);
314 void GenerateIsoModuleTarget ( const Module
& module
, string_list
& clean_files
);
315 std::string
GetBootstrapCdDirectories ( const std::string bootcdDirectory
,
316 const Module
& module
) const;
317 std::string
GetNonModuleCdDirectories ( const std::string bootcdDirectory
,
318 const Module
& module
) const;
319 std::string
GetCdDirectories ( const std::string bootcdDirectory
,
320 const Module
& module
) const;
321 std::string
GetBootstrapCdFiles ( const std::string bootcdDirectory
,
322 const Module
& module
) const;
323 std::string
GetNonModuleCdFiles ( const std::string bootcdDirectory
,
324 const Module
& module
) const;
325 std::string
GetCdFiles ( const std::string bootcdDirectory
,
326 const Module
& module
) const;
327 void OutputBootstrapfileCopyCommands ( const std::string bootcdDirectory
,
328 const Module
& module
) const;
329 void OutputCdfileCopyCommands ( const std::string bootcdDirectory
,
330 const Module
& module
) const;
333 #endif /* MINGW_MODULEHANDLER_H */