[ros-diffs] [chorns] 12887: BuildTool module type support.

chorns at svn.reactos.com chorns at svn.reactos.com
Sat Jan 8 13:54:45 CET 2005


BuildTool module type support.
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Added: branches/xmlbuildsystem/reactos/iface/native/module.xml
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h
  _____  

Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
--- branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-08 12:47:32 UTC
(rev 12886)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-08 12:54:43 UTC
(rev 12887)
@@ -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>
  _____  

Added: branches/xmlbuildsystem/reactos/iface/native/module.xml
--- branches/xmlbuildsystem/reactos/iface/native/module.xml
2005-01-08 12:47:32 UTC (rev 12886)
+++ branches/xmlbuildsystem/reactos/iface/native/module.xml
2005-01-08 12:54:43 UTC (rev 12887)
@@ -0,0 +1,4 @@

+<module name="genntdll" type="buildtool">
+	<include base="genntdll">.</include>
+	<file>genntdll.c</file>
+</module>
  _____  

Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
2005-01-08 12:47:32 UTC (rev 12886)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp
2005-01-08 12:54:43 UTC (rev 12887)
@@ -61,6 +61,9 @@

 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 @@
 void
 MingwBackend::GetModuleHandlers ( MingwModuleHandlerList&
moduleHandlers ) const
 {
+	moduleHandlers.push_back ( new MingwBuildToolModuleHandler (
fMakefile ) );
 	moduleHandlers.push_back ( new MingwKernelModuleHandler (
fMakefile ) );
 	moduleHandlers.push_back ( new MingwStaticLibraryModuleHandler (
fMakefile ) );
 }
  _____  

Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
---
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp	2005-01-08 12:47:32 UTC (rev 12886)
+++
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp	2005-01-08 12:54:43 UTC (rev 12887)
@@ -181,7 +181,8 @@

 }
 
 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 @@
 		          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,8 +207,23 @@
 }
 
 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 );
 	string objectFilenames = GetObjectFilenames ( module );
@@ -217,12 +234,61 @@
 	          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 @@
 	          "\t${rm} %s\n",
 	          temp_exp.c_str () );
 	
-	GenerateArchiveTarget ( module );
-	GenerateObjectFileTargets ( module );
+	GenerateArchiveTargetTarget ( module );
+	GenerateObjectFileTargetsTarget ( module );
 }
 
 
@@ -308,6 +374,6 @@
 void
 MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget (
const Module& module )
 {
-	GenerateArchiveTarget ( module );
-	GenerateObjectFileTargets ( module );
+	GenerateArchiveTargetTarget ( module );
+	GenerateObjectFileTargetsTarget ( module );
 }
  _____  

Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h
---
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h	2005-01-08 12:47:32 UTC (rev 12886)
+++
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.h	2005-01-08 12:54:43 UTC (rev 12887)
@@ -19,8 +19,10 @@

 
 	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,9 +32,24 @@
 	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 );
+};
+
+
 class MingwKernelModuleHandler : public MingwModuleHandler
 {
 public:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050108/17e1ba9e/attachment.html


More information about the Ros-diffs mailing list