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 static std::map
<ModuleType
,MingwModuleHandler
*>* handler_map
;
17 MingwModuleHandler ( ModuleType moduletype
);
18 virtual ~MingwModuleHandler();
20 static void SetMakefile ( FILE* f
);
21 static MingwModuleHandler
* LookupHandler ( const std::string
& location
,
22 ModuleType moduletype_
);
23 virtual void Process ( const Module
& module
) = 0;
24 bool IncludeDirectoryTarget ( const std::string
& directory
) const;
25 void GenerateDirectoryTargets () const;
26 static std::string
GetObjectFilename ( const std::string
& sourceFilename
);
28 const std::string
&PassThruCacheDirectory ( const std::string
&f
) const;
29 std::string
GetWorkingDirectory () const;
30 std::string
GetBasename ( const std::string
& filename
) const;
31 std::string
GetActualSourceFilename ( const std::string
& filename
) const;
32 std::string
GetModuleArchiveFilename ( const Module
& module
) const;
33 bool IsGeneratedFile ( const File
& file
) const;
34 std::string
GetImportLibraryDependency ( const Module
& importedModule
) const;
35 std::string
GetImportLibraryDependencies ( const Module
& module
) const;
36 std::string
GetModuleDependencies ( const Module
& module
) const;
37 std::string
GetAllDependencies ( const Module
& module
) const;
38 std::string
GetSourceFilenames ( const Module
& module
,
39 bool includeGeneratedFiles
) const;
40 std::string
GetSourceFilenames ( const Module
& module
) const;
41 std::string
GetSourceFilenamesWithoutGeneratedFiles ( const Module
& module
) const;
43 std::string
GetObjectFilenames ( const Module
& module
) const;
44 void GenerateMacrosAndTargetsHost ( const Module
& module
) const;
45 void GenerateMacrosAndTargetsTarget ( const Module
& module
) const;
46 void GenerateMacrosAndTargetsTarget ( const Module
& module
,
47 const std::string
* cflags
,
48 const std::string
* nasmflags
) const;
49 std::string
GetInvocationDependencies ( const Module
& module
) const;
50 void GenerateInvocations ( const Module
& module
) const;
52 std::string
GetPreconditionDependenciesName ( const Module
& module
) const;
53 void GeneratePreconditionDependencies ( const Module
& module
) const;
54 std::string
GetCFlagsMacro ( const Module
& module
) const;
55 std::string
GetObjectsMacro ( const Module
& module
) const;
56 std::string
GetLinkerMacro ( const Module
& module
) const;
57 void GenerateLinkerCommand ( const Module
& module
,
58 const std::string
& linker
,
59 const std::string
& linkerParameters
,
60 const std::string
& objectFilenames
) const;
61 void GenerateImportLibraryTargetIfNeeded ( const Module
& module
) const;
62 std::string
GetDefinitionDependencies ( const Module
& module
) const;
63 std::string
GetLinkingDependencies ( const Module
& module
) const;
64 bool IsCPlusPlusModule ( const Module
& module
) const;
65 static FILE* fMakefile
;
66 static std::set
<std::string
> directory_set
;
68 std::string
ConcatenatePaths ( const std::string
& path1
,
69 const std::string
& path2
) const;
70 std::string
GenerateGccDefineParametersFromVector ( const std::vector
<Define
*>& defines
) const;
71 std::string
GenerateGccDefineParameters ( const Module
& module
) const;
72 std::string
GenerateGccIncludeParametersFromVector ( const std::vector
<Include
*>& includes
) const;
73 std::string
GenerateCompilerParametersFromVector ( const std::vector
<CompilerFlag
*>& compilerFlags
) const;
74 std::string
GenerateLinkerParametersFromVector ( const std::vector
<LinkerFlag
*>& linkerFlags
) const;
75 std::string
GenerateLinkerParameters ( const Module
& module
) const;
76 void GenerateMacro ( const char* assignmentOperation
,
77 const std::string
& macro
,
78 const std::vector
<Include
*>& includes
,
79 const std::vector
<Define
*>& defines
,
80 const std::vector
<CompilerFlag
*>* compilerFlags
) const;
81 void GenerateMacros ( const char* op
,
82 const std::vector
<File
*>& files
,
83 const std::vector
<Include
*>& includes
,
84 const std::vector
<Define
*>& defines
,
85 const std::vector
<CompilerFlag
*>* compilerFlags
,
86 const std::vector
<LinkerFlag
*>* linkerFlags
,
87 const std::vector
<If
*>& ifs
,
88 const std::string
& cflags_macro
,
89 const std::string
& nasmflags_macro
,
90 const std::string
& windresflags_macro
,
91 const std::string
& linkerflags_macro
,
92 const std::string
& objs_macro
) const;
93 void GenerateMacros ( const Module
& module
,
94 const std::string
& cflags_macro
,
95 const std::string
& nasmflags_macro
,
96 const std::string
& windresflags_macro
,
97 const std::string
& linkerflags_macro
,
98 const std::string
& objs_macro
) const;
99 std::string
GenerateGccIncludeParameters ( const Module
& module
) const;
100 std::string
GenerateGccParameters ( const Module
& module
) const;
101 std::string
GenerateNasmParameters ( const Module
& module
) const;
102 void GenerateGccCommand ( const Module
& module
,
103 const std::string
& sourceFilename
,
104 const std::string
& cc
,
105 const std::string
& cflagsMacro
) const;
106 void GenerateGccAssemblerCommand ( const Module
& module
,
107 const std::string
& sourceFilename
,
108 const std::string
& cc
,
109 const std::string
& cflagsMacro
) const;
110 void GenerateNasmCommand ( const Module
& module
,
111 const std::string
& sourceFilename
,
112 const std::string
& nasmflagsMacro
) const;
113 void GenerateWindresCommand ( const Module
& module
,
114 const std::string
& sourceFilename
,
115 const std::string
& windresflagsMacro
) const;
116 void GenerateWinebuildCommands ( const Module
& module
,
117 const std::string
& sourceFilename
) const;
118 void GenerateCommands ( const Module
& module
,
119 const std::string
& sourceFilename
,
120 const std::string
& cc
,
121 const std::string
& cppc
,
122 const std::string
& cflagsMacro
,
123 const std::string
& nasmflagsMacro
,
124 const std::string
& windresflagsMacro
) const;
125 void GenerateObjectFileTargets ( const Module
& module
,
126 const std::vector
<File
*>& files
,
127 const std::vector
<If
*>& ifs
,
128 const std::string
& cc
,
129 const std::string
& cppc
,
130 const std::string
& cflagsMacro
,
131 const std::string
& nasmflagsMacro
,
132 const std::string
& windresflagsMacro
) const;
133 void GenerateObjectFileTargets ( const Module
& module
,
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
) const;
139 void GetCleanTargets ( std::vector
<std::string
>& out
,
140 const std::vector
<File
*>& files
,
141 const std::vector
<If
*>& ifs
) const;
142 std::string
GenerateArchiveTarget ( const Module
& module
,
143 const std::string
& ar
,
144 const std::string
& objs_macro
) const;
145 void GenerateMacrosAndTargets ( const Module
& module
,
146 const std::string
& cc
,
147 const std::string
& cppc
,
148 const std::string
& ar
,
149 const std::string
* clags
,
150 const std::string
* nasmflags
) const;
151 std::string
GetSpecObjectDependencies ( const std::string
& filename
) const;
152 std::string
GetDefaultDependencies ( const Module
& module
) const;
156 class MingwBuildToolModuleHandler
: public MingwModuleHandler
159 MingwBuildToolModuleHandler ();
160 virtual void Process ( const Module
& module
);
162 void GenerateBuildToolModuleTarget ( const Module
& module
);
166 class MingwKernelModuleHandler
: public MingwModuleHandler
169 MingwKernelModuleHandler ();
170 virtual void Process ( const Module
& module
);
172 void GenerateKernelModuleTarget ( const Module
& module
);
176 class MingwStaticLibraryModuleHandler
: public MingwModuleHandler
179 MingwStaticLibraryModuleHandler ();
180 virtual void Process ( const Module
& module
);
182 void GenerateStaticLibraryModuleTarget ( const Module
& module
);
186 class MingwObjectLibraryModuleHandler
: public MingwModuleHandler
189 MingwObjectLibraryModuleHandler ();
190 virtual void Process ( const Module
& module
);
192 void GenerateObjectLibraryModuleTarget ( const Module
& module
);
196 class MingwKernelModeDLLModuleHandler
: public MingwModuleHandler
199 MingwKernelModeDLLModuleHandler ();
200 virtual void Process ( const Module
& module
);
202 void GenerateKernelModeDLLModuleTarget ( const Module
& module
);
206 class MingwKernelModeDriverModuleHandler
: public MingwModuleHandler
209 MingwKernelModeDriverModuleHandler ();
210 virtual void Process ( const Module
& module
);
212 void GenerateKernelModeDriverModuleTarget ( const Module
& module
);
216 class MingwNativeDLLModuleHandler
: public MingwModuleHandler
219 MingwNativeDLLModuleHandler ();
220 virtual void Process ( const Module
& module
);
222 void GenerateNativeDLLModuleTarget ( const Module
& module
);
226 class MingwNativeCUIModuleHandler
: public MingwModuleHandler
229 MingwNativeCUIModuleHandler ();
230 virtual void Process ( const Module
& module
);
232 void GenerateNativeCUIModuleTarget ( const Module
& module
);
236 class MingwWin32DLLModuleHandler
: public MingwModuleHandler
239 MingwWin32DLLModuleHandler ();
240 virtual void Process ( const Module
& module
);
242 void GenerateExtractWineDLLResourcesTarget ( const Module
& module
);
243 void GenerateWin32DLLModuleTarget ( const Module
& module
);
247 class MingwWin32CUIModuleHandler
: public MingwModuleHandler
250 MingwWin32CUIModuleHandler ();
251 virtual void Process ( const Module
& module
);
253 void GenerateWin32CUIModuleTarget ( const Module
& module
);
257 class MingwWin32GUIModuleHandler
: public MingwModuleHandler
260 MingwWin32GUIModuleHandler ();
261 virtual void Process ( const Module
& module
);
263 void GenerateWin32GUIModuleTarget ( const Module
& module
);
267 class MingwBootLoaderModuleHandler
: public MingwModuleHandler
270 MingwBootLoaderModuleHandler ();
271 virtual void Process ( const Module
& module
);
273 void GenerateBootLoaderModuleTarget ( const Module
& module
);
277 class MingwBootSectorModuleHandler
: public MingwModuleHandler
280 MingwBootSectorModuleHandler ();
281 virtual void Process ( const Module
& module
);
283 void GenerateBootSectorModuleTarget ( const Module
& module
);
287 class MingwIsoModuleHandler
: public MingwModuleHandler
290 MingwIsoModuleHandler ();
291 virtual void Process ( const Module
& module
);
293 void GenerateIsoModuleTarget ( const Module
& module
);
296 #endif /* MINGW_MODULEHANDLER_H */