4304a731a852da5a4c63e0b18dd63b07229f5658
[reactos.git] / reactos / tools / rbuild / backend / mingw / modulehandler.h
1 #ifndef MINGW_MODULEHANDLER_H
2 #define MINGW_MODULEHANDLER_H
3
4 #include "../backend.h"
5
6 class MingwModuleHandler
7 {
8 public:
9 static std::map<const char*,MingwModuleHandler*>* handler_map;
10
11 MingwModuleHandler ( const char* moduletype_ );
12 virtual ~MingwModuleHandler() {}
13
14 static void SetMakefile ( FILE* f );
15 static MingwModuleHandler* LookupHandler ( const std::string& moduletype_ );
16 virtual void Process ( const Module& module ) = 0;
17
18 protected:
19 std::string MingwModuleHandler::GetWorkingDirectory () const;
20 std::string ReplaceExtension ( const std::string& filename,
21 const std::string& newExtension ) const;
22 std::string GetModuleArchiveFilename ( const Module& module ) const;
23 std::string GetImportLibraryDependencies ( const Module& module ) const;
24 std::string GetModuleDependencies ( const Module& module ) const;
25 std::string GetAllDependencies ( const Module& module ) const;
26 std::string GetSourceFilenames ( const Module& module ) const;
27
28 std::string GetObjectFilename ( const std::string& sourceFilename ) const;
29 std::string GetObjectFilenames ( const Module& module ) const;
30 void GenerateObjectFileTargetsHost ( const Module& module ) const;
31 void GenerateObjectFileTargetsTarget ( const Module& module ) const;
32 void GenerateArchiveTargetHost ( const Module& module ) const;
33 void GenerateArchiveTargetTarget ( const Module& module ) const;
34 std::string GetInvocationDependencies ( const Module& module ) const;
35 std::string GetInvocationParameters ( const Invoke& invoke ) const;
36 void GenerateInvocations ( const Module& module ) const;
37 void GeneratePreconditionDependencies ( const Module& module ) const;
38 static FILE* fMakefile;
39 private:
40 std::string ConcatenatePaths ( const std::string& path1,
41 const std::string& path2 ) const;
42 std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
43 std::string GenerateGccDefineParameters ( const Module& module ) const;
44 std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
45 std::string GenerateGccIncludeParameters ( const Module& module ) const;
46 std::string GenerateGccParameters ( const Module& module ) const;
47 void GenerateObjectFileTargets ( const Module& module,
48 const std::string& cc ) const;
49 void GenerateArchiveTarget ( const Module& module,
50 const std::string& ar ) const;
51 std::string GetPreconditionDependenciesName ( const Module& module ) const;
52 };
53
54
55 class MingwBuildToolModuleHandler : public MingwModuleHandler
56 {
57 public:
58 MingwBuildToolModuleHandler ();
59 virtual void Process ( const Module& module );
60 private:
61 void GenerateBuildToolModuleTarget ( const Module& module );
62 };
63
64
65 class MingwKernelModuleHandler : public MingwModuleHandler
66 {
67 public:
68 MingwKernelModuleHandler ();
69 virtual void Process ( const Module& module );
70 private:
71 void GenerateKernelModuleTarget ( const Module& module );
72 };
73
74
75 class MingwStaticLibraryModuleHandler : public MingwModuleHandler
76 {
77 public:
78 MingwStaticLibraryModuleHandler ();
79 virtual void Process ( const Module& module );
80 private:
81 void GenerateStaticLibraryModuleTarget ( const Module& module );
82 };
83
84 #endif /* MINGW_MODULEHANDLER_H */