mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:55:41 +00:00
BuildTool module type support.
svn path=/branches/xmlbuildsystem/; revision=12887
This commit is contained in:
parent
3e6eb979d8
commit
30e8e25cb7
5 changed files with 106 additions and 10 deletions
|
@ -9,6 +9,11 @@
|
|||
<file>depends.c</file>
|
||||
</module>
|
||||
</directory>
|
||||
<directory name="iface">
|
||||
<directory name="native">
|
||||
<xi:include href="iface/native/module.xml" />
|
||||
</directory>
|
||||
</directory>
|
||||
<directory name="lib">
|
||||
<xi:include href="lib/directory.xml" />
|
||||
</directory>
|
||||
|
|
4
reactos/iface/native/module.xml
Normal file
4
reactos/iface/native/module.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<module name="genntdll" type="buildtool">
|
||||
<include base="genntdll">.</include>
|
||||
<file>genntdll.c</file>
|
||||
</module>
|
|
@ -61,6 +61,9 @@ MingwBackend::GenerateHeader ()
|
|||
void
|
||||
MingwBackend::GenerateGlobalVariables ()
|
||||
{
|
||||
fprintf ( fMakefile, "host_gcc = gcc\n" );
|
||||
fprintf ( fMakefile, "host_ar = ar\n" );
|
||||
fprintf ( fMakefile, "host_ld = ld\n" );
|
||||
fprintf ( fMakefile, "rm = del /y\n" );
|
||||
fprintf ( fMakefile, "gcc = gcc\n" );
|
||||
fprintf ( fMakefile, "ld = ld\n" );
|
||||
|
@ -102,6 +105,7 @@ MingwBackend::ProcessModule ( Module& module )
|
|||
void
|
||||
MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers ) const
|
||||
{
|
||||
moduleHandlers.push_back ( new MingwBuildToolModuleHandler ( fMakefile ) );
|
||||
moduleHandlers.push_back ( new MingwKernelModuleHandler ( fMakefile ) );
|
||||
moduleHandlers.push_back ( new MingwStaticLibraryModuleHandler ( fMakefile ) );
|
||||
}
|
||||
|
|
|
@ -181,7 +181,8 @@ MingwModuleHandler::GenerateGccParameters ( const Module& module ) const
|
|||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateObjectFileTargets ( const Module& module ) const
|
||||
MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
|
||||
const string& cc) const
|
||||
{
|
||||
if ( module.files.size () == 0 )
|
||||
return;
|
||||
|
@ -195,7 +196,8 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module ) const
|
|||
objectFilename.c_str (),
|
||||
sourceFilename.c_str() );
|
||||
fprintf ( fMakefile,
|
||||
"\t${gcc} -c %s -o %s %s\n",
|
||||
"\t%s -c %s -o %s %s\n",
|
||||
cc.c_str (),
|
||||
sourceFilename.c_str (),
|
||||
objectFilename.c_str (),
|
||||
GenerateGccParameters ( module ).c_str () );
|
||||
|
@ -205,7 +207,22 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module ) const
|
|||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateArchiveTarget ( const Module& module ) const
|
||||
MingwModuleHandler::GenerateObjectFileTargetsHost ( const Module& module ) const
|
||||
{
|
||||
GenerateObjectFileTargets ( module,
|
||||
"${host_gcc}" );
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateObjectFileTargetsTarget ( const Module& module ) const
|
||||
{
|
||||
GenerateObjectFileTargets ( module,
|
||||
"${gcc}" );
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateArchiveTarget ( const Module& module,
|
||||
const string& ar ) const
|
||||
{
|
||||
string archiveFilename = GetModuleArchiveFilename ( module );
|
||||
string sourceFilenames = GetSourceFilenames ( module );
|
||||
|
@ -217,11 +234,60 @@ MingwModuleHandler::GenerateArchiveTarget ( const Module& module ) const
|
|||
objectFilenames.c_str ());
|
||||
|
||||
fprintf ( fMakefile,
|
||||
"\t${ar} -rc %s %s\n\n",
|
||||
"\t%s -rc %s %s\n\n",
|
||||
ar.c_str (),
|
||||
archiveFilename.c_str (),
|
||||
objectFilenames.c_str ());
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateArchiveTargetHost ( const Module& module ) const
|
||||
{
|
||||
GenerateArchiveTarget ( module,
|
||||
"${host_ar}" );
|
||||
}
|
||||
|
||||
void
|
||||
MingwModuleHandler::GenerateArchiveTargetTarget ( const Module& module ) const
|
||||
{
|
||||
GenerateArchiveTarget ( module,
|
||||
"${ar}" );
|
||||
}
|
||||
|
||||
|
||||
MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( FILE* fMakefile )
|
||||
: MingwModuleHandler ( fMakefile )
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
MingwBuildToolModuleHandler::CanHandleModule ( const Module& module ) const
|
||||
{
|
||||
return module.type == BuildTool;
|
||||
}
|
||||
|
||||
void
|
||||
MingwBuildToolModuleHandler::Process ( const Module& module )
|
||||
{
|
||||
GenerateBuildToolModuleTarget ( module );
|
||||
}
|
||||
|
||||
void
|
||||
MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& module )
|
||||
{
|
||||
string target ( FixupTargetFilename(module.GetPath()) );
|
||||
string archiveFilename = GetModuleArchiveFilename ( module );
|
||||
fprintf ( fMakefile, "%s: %s\n",
|
||||
target.c_str (),
|
||||
archiveFilename.c_str () );
|
||||
fprintf ( fMakefile,
|
||||
"\t${host_gcc} -o %s %s\n",
|
||||
target.c_str (),
|
||||
archiveFilename.c_str () );
|
||||
GenerateArchiveTargetHost ( module );
|
||||
GenerateObjectFileTargetsHost ( module );
|
||||
}
|
||||
|
||||
|
||||
MingwKernelModuleHandler::MingwKernelModuleHandler ( FILE* fMakefile )
|
||||
: MingwModuleHandler ( fMakefile )
|
||||
|
@ -283,8 +349,8 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module )
|
|||
"\t${rm} %s\n",
|
||||
temp_exp.c_str () );
|
||||
|
||||
GenerateArchiveTarget ( module );
|
||||
GenerateObjectFileTargets ( module );
|
||||
GenerateArchiveTargetTarget ( module );
|
||||
GenerateObjectFileTargetsTarget ( module );
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,6 +374,6 @@ MingwStaticLibraryModuleHandler::Process ( const Module& module )
|
|||
void
|
||||
MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ( const Module& module )
|
||||
{
|
||||
GenerateArchiveTarget ( module );
|
||||
GenerateObjectFileTargets ( module );
|
||||
GenerateArchiveTargetTarget ( module );
|
||||
GenerateObjectFileTargetsTarget ( module );
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@ protected:
|
|||
|
||||
std::string GetObjectFilename ( const std::string& sourceFilename ) const;
|
||||
std::string GetObjectFilenames ( const Module& module ) const;
|
||||
void GenerateObjectFileTargets ( const Module& module ) const;
|
||||
void GenerateArchiveTarget ( const Module& module ) const;
|
||||
void GenerateObjectFileTargetsHost ( const Module& module ) const;
|
||||
void GenerateObjectFileTargetsTarget ( const Module& module ) const;
|
||||
void GenerateArchiveTargetHost ( const Module& module ) const;
|
||||
void GenerateArchiveTargetTarget ( const Module& module ) const;
|
||||
FILE* fMakefile;
|
||||
private:
|
||||
std::string ConcatenatePaths ( const std::string& path1,
|
||||
|
@ -30,6 +32,21 @@ private:
|
|||
std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
|
||||
std::string GenerateGccIncludeParameters ( const Module& module ) const;
|
||||
std::string GenerateGccParameters ( const Module& module ) const;
|
||||
void GenerateObjectFileTargets ( const Module& module,
|
||||
const std::string& cc ) const;
|
||||
void GenerateArchiveTarget ( const Module& module,
|
||||
const std::string& ar ) const;
|
||||
};
|
||||
|
||||
|
||||
class MingwBuildToolModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwBuildToolModuleHandler ( FILE* fMakefile );
|
||||
virtual bool CanHandleModule ( const Module& module ) const;
|
||||
virtual void Process ( const Module& module );
|
||||
private:
|
||||
void GenerateBuildToolModuleTarget ( const Module& module );
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue