1 #ifndef MINGW_MODULEHANDLER_H
2 #define MINGW_MODULEHANDLER_H
4 #include "../backend.h"
6 class MingwModuleHandler
9 static std::map
<ModuleType
,MingwModuleHandler
*>* handler_map
;
12 MingwModuleHandler ( ModuleType moduletype
);
13 virtual ~MingwModuleHandler();
15 static void SetMakefile ( FILE* f
);
16 static MingwModuleHandler
* LookupHandler ( const std::string
& location
,
17 ModuleType moduletype_
);
18 virtual void Process ( const Module
& module
) = 0;
21 std::string
GetWorkingDirectory () const;
22 std::string
GetExtension ( const std::string
& filename
) const;
23 std::string
ReplaceExtension ( const std::string
& filename
,
24 const std::string
& newExtension
) const;
25 std::string
GetModuleArchiveFilename ( const Module
& module
) const;
26 std::string
GetImportLibraryDependencies ( const Module
& module
) const;
27 std::string
GetModuleDependencies ( const Module
& module
) const;
28 std::string
GetAllDependencies ( const Module
& module
) const;
29 std::string
GetSourceFilenames ( const Module
& module
) const;
31 std::string
GetObjectFilename ( const std::string
& sourceFilename
) const;
32 std::string
GetObjectFilenames ( const Module
& module
) const;
33 void GenerateMacrosAndTargetsHost ( const Module
& module
) const;
34 void GenerateMacrosAndTargetsTarget ( const Module
& module
) const;
35 std::string
GetInvocationDependencies ( const Module
& module
) const;
36 std::string
GetInvocationParameters ( const Invoke
& invoke
) const;
37 void GenerateInvocations ( const Module
& module
) const;
38 void GeneratePreconditionDependencies ( const Module
& module
) const;
39 std::string
GenerateMacros ( const Module
& module
,
40 const std::string
& cflags_macro
,
41 const std::string
& objs_macro
) const;
42 static FILE* fMakefile
;
44 std::string
ConcatenatePaths ( const std::string
& path1
,
45 const std::string
& path2
) const;
46 std::string
GenerateGccDefineParametersFromVector ( const std::vector
<Define
*>& defines
) const;
47 std::string
GenerateGccDefineParameters ( const Module
& module
) const;
48 std::string
GenerateGccIncludeParametersFromVector ( const std::vector
<Include
*>& includes
) const;
49 void GenerateMacros ( const char* op
,
50 const std::vector
<File
*>& files
,
51 const std::vector
<Include
*>& includes
,
52 const std::vector
<Define
*>& defines
,
53 const std::vector
<If
*>& ifs
,
54 const std::string
& cflags_macro
,
55 const std::string
& nasmflags_macro
,
56 const std::string
& objs_macro
) const;
57 void GenerateMacros ( const Module
& module
,
58 const std::string
& cflags_macro
,
59 const std::string
& nasmflags_macro
,
60 const std::string
& objs_macro
) const;
61 void GenerateGccModuleIncludeVariable ( const Module
& module
) const;
62 std::string
GenerateGccIncludeParameters ( const Module
& module
) const;
63 std::string
GenerateGccParameters ( const Module
& module
) const;
64 std::string
GenerateNasmParameters ( const Module
& module
) const;
65 std::string
GenerateGccCommand ( const Module
& module
,
66 const std::string
& sourceFilename
,
67 const std::string
& cc
,
68 const std::string
& cflagsMacro
) const;
69 std::string
GenerateGccAssemblerCommand ( const Module
& module
,
70 const std::string
& sourceFilename
,
71 const std::string
& cc
,
72 const std::string
& cflagsMacro
) const;
73 std::string
GenerateNasmCommand ( const Module
& module
,
74 const std::string
& sourceFilename
,
75 const std::string
& nasmflagsMacro
) const;
76 std::string
GenerateCommand ( const Module
& module
,
77 const std::string
& sourceFilename
,
78 const std::string
& cc
,
79 const std::string
& cflagsMacro
,
80 const std::string
& nasmflagsMacro
) const;
81 void GenerateObjectFileTargets ( const Module
& module
,
82 const std::vector
<File
*>& files
,
83 const std::string
& cc
,
84 const std::string
& cflagsMacro
,
85 const std::string
& nasmflagsMacro
) const;
86 void GenerateObjectFileTargets ( const Module
& module
,
87 const std::string
& cc
,
88 const std::string
& cflagsMacro
,
89 const std::string
& nasmflagsMacro
) const;
90 void GenerateArchiveTarget ( const Module
& module
,
91 const std::string
& ar
,
92 const std::string
& objs_macro
) const;
93 void GenerateMacrosAndTargets ( const Module
& module
,
94 const std::string
& cc
,
95 const std::string
& ar
) const;
96 std::string
GetPreconditionDependenciesName ( const Module
& module
) const;
100 class MingwBuildToolModuleHandler
: public MingwModuleHandler
103 MingwBuildToolModuleHandler ();
104 virtual void Process ( const Module
& module
);
106 void GenerateBuildToolModuleTarget ( const Module
& module
);
110 class MingwKernelModuleHandler
: public MingwModuleHandler
113 MingwKernelModuleHandler ();
114 virtual void Process ( const Module
& module
);
116 void GenerateKernelModuleTarget ( const Module
& module
);
120 class MingwStaticLibraryModuleHandler
: public MingwModuleHandler
123 MingwStaticLibraryModuleHandler ();
124 virtual void Process ( const Module
& module
);
126 void GenerateStaticLibraryModuleTarget ( const Module
& module
);
130 class MingwKernelModeDLLModuleHandler
: public MingwModuleHandler
133 MingwKernelModeDLLModuleHandler ();
134 virtual void Process ( const Module
& module
);
136 void GenerateKernelModeDLLModuleTarget ( const Module
& module
);
140 class MingwNativeDLLModuleHandler
: public MingwModuleHandler
143 MingwNativeDLLModuleHandler ();
144 virtual void Process ( const Module
& module
);
146 void GenerateNativeDLLModuleTarget ( const Module
& module
);
150 class MingwWin32DLLModuleHandler
: public MingwModuleHandler
153 MingwWin32DLLModuleHandler ();
154 virtual void Process ( const Module
& module
);
156 void GenerateWin32DLLModuleTarget ( const Module
& module
);
159 #endif /* MINGW_MODULEHANDLER_H */