[ros-diffs] [hpoussin] 32226: Add Rule class, which writes to Makefile how to handle a source file Later, hardcoded rules should be read from .rbuild files

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Fri Feb 8 20:10:19 CET 2008


Author: hpoussin
Date: Fri Feb  8 22:10:19 2008
New Revision: 32226

URL: http://svn.reactos.org/svn/reactos?rev=32226&view=rev
Log:
Add Rule class, which writes to Makefile how to handle a source file
Later, hardcoded rules should be read from .rbuild files

Added:
    trunk/reactos/tools/rbuild/backend/mingw/rule.cpp   (with props)
    trunk/reactos/tools/rbuild/backend/mingw/rule.h   (with props)
Modified:
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
    trunk/reactos/tools/rbuild/rbuild.mak

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp?rev=32226&r1=32225&r2=32226&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Fri Feb  8 22:10:19 2008
@@ -22,6 +22,7 @@
 #include "../../rbuild.h"
 #include "mingw.h"
 #include "modulehandler.h"
+#include "rule.h"
 
 using std::set;
 using std::string;
@@ -1245,6 +1246,43 @@
 	                          ReplaceExtension ( module.pch->file.name, "_" + module.name + ".gch" ) );
 }
 
+Rule gasRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source) $(module_rbuild) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+               "\t$(ECHO_GAS)\n"
+               "\t${gcc} -x assembler-with-cpp -c $< -o $@ -D__ASM__ $($(module_name)_CFLAGS)\n",
+               "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o",
+               "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule bootRule ( "$(module_output): $(source) $(module_rbuild) | $(OUTPUT)$(SEP)$(source_dir)\n"
+                "\t$(ECHO_NASM)\n"
+                "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
+                "$(OUTPUT)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule nasmRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source) $(module_rbuild) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+                "\t$(ECHO_NASM)\n"
+                "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
+                "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o",
+                "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule windresRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).coff: $(source) $(module_rbuild) $(WRC_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+                   "\t$(ECHO_WRC)\n"
+                   "\t${gcc} -xc -E -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) > $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp\n"
+                   "\t$(Q)$(WRC_TARGET) ${$(module_name)_RCFLAGS} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp\n"
+                   "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp 2>$(NUL)\n"
+                   "\t${windres} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp -o $@\n"
+                   "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp 2>$(NUL)\n",
+                   "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).coff",
+                   "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule wmcRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h: $(WMC_TARGET) $(source)\n"
+               "\t$(ECHO_WMC)\n"
+               "\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc $(source)\n",
+               "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc", "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h", NULL );
+Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source) $(module_rbuild) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
+                     "\t$(ECHO_WINEBLD)\n"
+                     "\t$(Q)$(WINEBUILD_TARGET) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(source_path)$(SEP)$(source_name_noext).spec\n"
+                     "$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c: $(source_path)$(SEP)$(source_name_noext).spec $(WINEBUILD_TARGET)\n"
+                     "\t$(ECHO_WINEBLD)\n"
+                     "\t$(Q)$(WINEBUILD_TARGET) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $(source_path)$(SEP)$(source_name_noext).spec\n",
+                     "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
+                     "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
+                     "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
+
 void
 MingwModuleHandler::GenerateGccCommand (
 	const FileLocation* sourceFile,
@@ -1286,175 +1324,7 @@
 		delete pchFilename;
 }
 
-void
-MingwModuleHandler::GenerateGccAssemblerCommand (
-	const FileLocation* sourceFile,
-	const string& cc,
-	const string& cflagsMacro )
-{
-	string dependencies = backend->GetFullName ( *sourceFile );
-	dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
-
-	const FileLocation *objectFilename = GetObjectFilename (
-		sourceFile, module, &clean_files );
-	fprintf ( fMakefile,
-	          "%s: %s | %s\n",
-	          backend->GetFullName ( *objectFilename ).c_str (),
-	          dependencies.c_str (),
-	          backend->GetFullPath ( *objectFilename ).c_str () );
-	fprintf ( fMakefile, "\t$(ECHO_GAS)\n" );
-	fprintf ( fMakefile,
-	          "\t%s -x assembler-with-cpp -c $< -o $@ -D__ASM__ %s\n",
-	          cc.c_str (),
-	          cflagsMacro.c_str () );
-
-	delete objectFilename;
-}
-
-void
-MingwModuleHandler::GenerateNasmCommand (
-	const FileLocation* sourceFile,
-	const string& nasmflagsMacro )
-{
-	string dependencies = backend->GetFullName ( *sourceFile );
-	dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
-
-	const FileLocation *objectFilename = GetObjectFilename (
-		sourceFile, module, &clean_files );
-	fprintf ( fMakefile,
-	          "%s: %s | %s\n",
-	          backend->GetFullName ( *objectFilename ).c_str (),
-	          dependencies.c_str (),
-	          backend->GetFullPath ( *objectFilename ).c_str () );
-	fprintf ( fMakefile, "\t$(ECHO_NASM)\n" );
-	fprintf ( fMakefile,
-	          "\t%s -f win32 $< -o $@ %s\n",
-	          "$(Q)${nasm}",
-	          nasmflagsMacro.c_str () );
-
-	delete objectFilename;
-}
-
-void
-MingwModuleHandler::GenerateWindresCommand (
-	const FileLocation* sourceFile,
-	const string& windresflagsMacro )
-{
-	string dependencies = backend->GetFullName ( *sourceFile );
-	dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
-
-	const FileLocation *objectFilename = GetObjectFilename ( sourceFile, module, &clean_files );
-
-	string sourceFilenamePart = module.name + "." + ReplaceExtension ( sourceFile->name, "" );
-	FileLocation rciFilename ( TemporaryDirectory,
-	                           "",
-	                           sourceFilenamePart + ".rci.tmp" );
-	FileLocation resFilename ( TemporaryDirectory,
-	                           "",
-	                           sourceFilenamePart + ".res.tmp" );
-
-	fprintf ( fMakefile,
-	          "%s: %s $(WRC_TARGET) | %s\n",
-	          backend->GetFullName ( *objectFilename ).c_str (),
-	          dependencies.c_str (),
-	          backend->GetFullPath ( *objectFilename ).c_str () );
-	fprintf ( fMakefile, "\t$(ECHO_WRC)\n" );
-	fprintf ( fMakefile,
-	         "\t${gcc} -xc -E -DRC_INVOKED ${%s} %s > %s\n",
-	         windresflagsMacro.c_str (),
-	         backend->GetFullName ( *sourceFile ).c_str (),
-	         backend->GetFullName ( rciFilename ).c_str () );
-	fprintf ( fMakefile,
-	         "\t$(Q)$(WRC_TARGET) ${%s} %s %s\n",
-	         windresflagsMacro.c_str (),
-	         backend->GetFullName ( rciFilename ).c_str (),
-	         backend->GetFullName ( resFilename ).c_str () );
-	fprintf ( fMakefile,
-	         "\t-@${rm} %s 2>$(NUL)\n",
-	         backend->GetFullName ( rciFilename ).c_str () );
-	fprintf ( fMakefile,
-	         "\t${windres} %s -o $@\n",
-	         backend->GetFullName ( resFilename ).c_str () );
-	fprintf ( fMakefile,
-	         "\t-@${rm} %s 2>$(NUL)\n",
-	         backend->GetFullName ( resFilename ).c_str () );
-
-	delete objectFilename;
-}
-
-void
-MingwModuleHandler::GenerateWinebuildCommands (
-	const FileLocation* sourceFile )
-{
-	string dependencies = backend->GetFullName ( *sourceFile );
-	dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
-
-	string basename = GetBasename ( sourceFile->name );
-	FileLocation def_file ( IntermediateDirectory,
-	                        sourceFile->relative_path,
-	                        basename + ".spec.def" );
-	CLEAN_FILE ( def_file );
-
-	const FileLocation *stub_file = GetActualSourceFilename ( sourceFile );
-	CLEAN_FILE ( *stub_file );
-
-	fprintf ( fMakefile,
-	          "%s: %s $(WINEBUILD_TARGET) | %s\n",
-	          backend->GetFullName ( def_file ).c_str (),
-	          dependencies.c_str (),
-	          backend->GetFullPath ( def_file ).c_str () );
-	fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );
-	fprintf ( fMakefile,
-	          "\t%s -o %s --def -E %s\n",
-	          "$(Q)$(WINEBUILD_TARGET)",
-	          backend->GetFullName ( def_file ).c_str (),
-	          backend->GetFullName ( *sourceFile ).c_str () );
-	fprintf ( fMakefile,
-	          "%s: %s $(WINEBUILD_TARGET)\n",
-	          backend->GetFullName ( *stub_file ).c_str (),
-	          backend->GetFullName ( *sourceFile ).c_str () );
-	fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );
-	fprintf ( fMakefile,
-	          "\t%s -o %s --pedll %s\n",
-	          "$(Q)$(WINEBUILD_TARGET)",
-	          backend->GetFullName ( *stub_file ).c_str (),
-	          backend->GetFullName ( *sourceFile ).c_str () );
-
-	delete stub_file;
-}
-
-void
-MingwModuleHandler::GenerateWmcCommands (
-	const FileLocation* sourceFile )
-{
-	string dependencies = backend->GetFullName ( *sourceFile );
-	dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
-
-	string basename = GetBasename ( sourceFile->name );
-	FileLocation rc_file ( IntermediateDirectory,
-	                        sourceFile->relative_path,
-	                        basename + ".rc" );
-	FileLocation h_file ( IntermediateDirectory,
-	                        "include/reactos",
-	                        basename + ".h" );
-	CLEAN_FILE ( rc_file );
-	CLEAN_FILE ( h_file );
-
-	fprintf ( fMakefile,
-	          "%s %s: $(WMC_TARGET) %s\n",
-	          backend->GetFullName ( rc_file ).c_str (),
-			  backend->GetFullName ( h_file ).c_str (),
-	          backend->GetFullName ( *sourceFile ).c_str () );
-	fprintf ( fMakefile, "\t$(ECHO_WMC)\n" );
-	fprintf ( fMakefile,
-	          "\t%s -i -H %s -o %s %s\n",
-	          "$(Q)$(WMC_TARGET)",
-	          backend->GetFullName ( h_file ).c_str (),
-			  backend->GetFullName ( rc_file ).c_str (),
-	          backend->GetFullName ( *sourceFile ).c_str () );
-}
-
-string
+const std::string&
 MingwModuleHandler::GetWidlFlags ( const CompilationUnit& compilationUnit )
 {
 	return compilationUnit.GetSwitches ();
@@ -1722,9 +1592,43 @@
 {
 	const FileLocation& sourceFile = compilationUnit.GetFilename ();
 	string extension = GetExtension ( sourceFile );
+	std::transform ( extension.begin (), extension.end (), extension.begin (), tolower );
+
+	struct
+	{
+		HostType host;
+		ModuleType type;
+		string extension;
+		Rule* rule;
+	} rules[] = {
+		{ HostDontCare, TypeDontCare, ".s", &gasRule },
+		{ HostDontCare, BootSector, ".asm", &bootRule },
+		{ HostDontCare, TypeDontCare, ".asm", &nasmRule },
+		{ HostDontCare, TypeDontCare, ".rc", &windresRule },
+		{ HostDontCare, TypeDontCare, ".mc", &wmcRule },
+		{ HostDontCare, TypeDontCare, ".spec", &winebuildRule },
+	};
+	size_t i;
+	Rule *customRule = NULL;
+
+	for ( i = 0; i < sizeof ( rules ) / sizeof ( rules[0] ); i++ )
+	{
+		if ( rules[i].host != HostDontCare && rules[i].host != module.host )
+			continue;
+		if ( rules[i].type != TypeDontCare && rules[i].type != module.type )
+			continue;
+		if ( rules[i].extension != extension )
+			continue;
+		customRule = rules[i].rule;
+		break;
+	}
+
+	if ( customRule )
+		customRule->Execute ( fMakefile, backend, module, &sourceFile, clean_files );
+
 	string flags = cflagsMacro;
 	flags += " ";
-	if ( extension == ".c" || extension == ".C" )
+	if ( extension == ".c" )
 	{
 		flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCC );
 		GenerateGccCommand ( &sourceFile,
@@ -1732,9 +1636,9 @@
 		                     cc,
 		                     flags );
 	}
-	else if ( extension == ".cc" || extension == ".CC" ||
-	          extension == ".cpp" || extension == ".CPP" ||
-	          extension == ".cxx" || extension == ".CXX" )
+	else if ( extension == ".cc" ||
+	          extension == ".cpp" || 
+	          extension == ".cxx" )
 	{
 		flags += GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags , CompilerTypeCPP );
 		GenerateGccCommand ( &sourceFile,
@@ -1742,35 +1646,14 @@
 		                     cppc,
 		                     flags );
 	}
-	else if ( extension == ".s" || extension == ".S" )
-	{
-		GenerateGccAssemblerCommand ( &sourceFile,
-		                              cc,
-		                              cflagsMacro );
-	}
-	else if ( extension == ".asm" || extension == ".ASM" )
-	{
-		GenerateNasmCommand ( &sourceFile,
-		                      nasmflagsMacro );
-	}
-	else if ( extension == ".rc" || extension == ".RC" )
-	{
-		GenerateWindresCommand ( &sourceFile,
-		                         windresflagsMacro );
-	}
-	else if ( extension == ".mc" || extension == ".MC" )
-	{
-		GenerateWmcCommands ( &sourceFile );
-	}
-	else if ( extension == ".spec" || extension == ".SPEC" )
-	{
-		GenerateWinebuildCommands ( &sourceFile );
+	else if ( extension == ".spec" )
+	{
 		GenerateGccCommand ( &sourceFile,
 		                     extraDependencies,
 		                     cc,
 		                     cflagsMacro );
 	}
-	else if ( extension == ".idl" || extension == ".IDL" )
+	else if ( extension == ".idl" )
 	{
 		GenerateWidlCommands ( compilationUnit,
 		                       widlflagsMacro );
@@ -1782,7 +1665,7 @@
 			                     cflagsMacro );
 		}
 	}
-	else
+	else if ( !customRule )
 	{
 		throw InvalidOperationException ( __FILE__,
 		                                  __LINE__,

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h?rev=32226&r1=32225&r2=32226&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Fri Feb  8 22:10:19 2008
@@ -155,16 +155,7 @@
 	                          const std::string& extraDependencies,
 	                          const std::string& cc,
 	                          const std::string& cflagsMacro );
-	void GenerateGccAssemblerCommand ( const FileLocation* sourceFile,
-	                                   const std::string& cc,
-	                                   const std::string& cflagsMacro );
-	void GenerateNasmCommand ( const FileLocation* sourceFile,
-	                           const std::string& nasmflagsMacro );
-	void GenerateWindresCommand ( const FileLocation* sourceFile,
-	                              const std::string& windresflagsMacro );
-	void GenerateWinebuildCommands ( const FileLocation* sourceFile );
-	void GenerateWmcCommands ( const FileLocation* sourceFile);
-	std::string GetWidlFlags ( const CompilationUnit& compilationUnit );
+	const std::string& GetWidlFlags ( const CompilationUnit& compilationUnit );
 	void GenerateWidlCommandsServer (
 		const CompilationUnit& compilationUnit,
 		const std::string& widlflagsMacro );

Added: trunk/reactos/tools/rbuild/backend/mingw/rule.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/rule.cpp?rev=32226&view=auto
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/rule.cpp (added)
+++ trunk/reactos/tools/rbuild/backend/mingw/rule.cpp Fri Feb  8 22:10:19 2008
@@ -1,0 +1,117 @@
+/*
+ * Copyright (C) 2008 Hervé Poussineau
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "../../rbuild.h"
+#include "modulehandler.h"
+#include "rule.h"
+
+using std::string;
+
+static void
+ReplaceVariable( string& str,
+                 const string& name,
+                 const string& value )
+{
+	size_t i = str.find ( name );
+	while ( i != string::npos )
+	{
+		str.replace ( i, name.length (), value );
+		i = str.find ( name );
+	}
+}
+
+static std::string
+FixString ( const string& str, Backend *backend, const Module& module, const FileLocation *source )
+{
+	string ret = str;
+
+	if ( source )
+	{
+		ReplaceVariable ( ret, "$(source_noext)", ReplaceExtension ( backend->GetFullName ( *source ), "" ) );
+		ReplaceVariable ( ret, "$(source)", backend->GetFullName ( *source ) );
+		ReplaceVariable ( ret, "$(source_dir)", source->relative_path );
+		ReplaceVariable ( ret, "$(source_name)", source->name );
+		ReplaceVariable ( ret, "$(source_name_noext)", ReplaceExtension ( source->name , "" ) );
+		ReplaceVariable ( ret, "$(source_path)", backend->GetFullPath ( *source ) );
+	}
+	ReplaceVariable ( ret, "$(module_name)", module.name );
+	ReplaceVariable ( ret, "$(module_rbuild)", module.xmlbuildFile );
+	ReplaceVariable ( ret, "$(module_output)", GetTargetMacro ( module, true ) );
+	ReplaceVariable ( ret, "$(SEP)", sSep );
+
+	return ret;
+}
+
+Rule::Rule( const std::string& command, const char *generatedFile1, ... )
+	: command ( command )
+{
+	va_list ap;
+	const char *s;
+
+	s = generatedFile1;
+	va_start ( ap, generatedFile1 );
+	while ( s )
+	{
+		generatedFiles.push_back ( s );
+		s = va_arg ( ap, const char* );
+	}
+	va_end ( ap );
+}
+
+
+void Rule::Execute ( FILE *outputFile,
+                     MingwBackend *backend,
+                     const Module& module,
+                     const FileLocation *source,
+                     string_list& clean_files )
+{
+	string cmd = FixString ( command, backend, module, source );
+
+	fprintf ( outputFile, "%s", cmd.c_str () );
+
+	for ( size_t i = 0; i < generatedFiles.size (); i++ )
+	{
+		string file = FixString ( generatedFiles[i], backend, module, source );
+		if ( file[file.length () - 1] != cSep )
+		{
+			clean_files.push_back ( file );
+			continue;
+		}
+
+		if ( file[0] != '$' )
+			throw InvalidOperationException ( __FILE__,
+			                                  __LINE__,
+			                                  "Invalid directory %s.",
+			                                  file.c_str () );
+
+		size_t pos = file.find_first_of ( cSep );
+		string relative_path = file.substr ( pos + 1, file.length () - pos - 2 );
+		string dir = file.substr ( 0, pos );
+		if ( dir == "$(INTERMEDIATE)" )
+			backend->AddDirectoryTarget ( relative_path, backend->intermediateDirectory );
+		else if ( dir == "$(OUTPUT)" )
+			backend->AddDirectoryTarget ( relative_path, backend->outputDirectory );
+		else if ( dir == "$(INSTALL)" )
+			backend->AddDirectoryTarget ( relative_path, backend->installDirectory );
+		else
+			throw InvalidOperationException ( __FILE__,
+			                                  __LINE__,
+			                                  "Invalid directory %s.",
+			                                  dir.c_str () );
+	}
+}

Propchange: trunk/reactos/tools/rbuild/backend/mingw/rule.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/reactos/tools/rbuild/backend/mingw/rule.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/rule.h?rev=32226&view=auto
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/rule.h (added)
+++ trunk/reactos/tools/rbuild/backend/mingw/rule.h Fri Feb  8 22:10:19 2008
@@ -1,0 +1,38 @@
+/*
+ * Copyright (C) 2008 Hervé Poussineau
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef MINGW_RULE_H
+#define MINGW_RULE_H
+
+#include "mingw.h"
+
+class Rule
+{
+public:
+	Rule ( const std::string& command, const char *generatedFile1, ... );
+	void Execute ( FILE *outputFile,
+	               MingwBackend *backend,
+	               const Module& module,
+	               const FileLocation *source,
+	               string_list& clean_files );
+private:
+	const std::string command;
+	string_list generatedFiles;
+};
+
+#endif

Propchange: trunk/reactos/tools/rbuild/backend/mingw/rule.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/tools/rbuild/rbuild.mak
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.mak?rev=32226&r1=32225&r2=32226&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.mak (original)
+++ trunk/reactos/tools/rbuild/rbuild.mak Fri Feb  8 22:10:19 2008
@@ -200,6 +200,7 @@
 	mingw.cpp \
 	modulehandler.cpp \
 	proxymakefile.cpp \
+	rule.cpp \
 	)
 
 RBUILD_BACKEND_DEVCPP_BASE_SOURCES = $(addprefix $(RBUILD_DEVCPP_BASE_), \
@@ -239,7 +240,7 @@
 	$(RBUILD_BACKEND_MSBUILD_BASE_SOURCES) \
 	$(RBUILD_BACKEND_BASE_)backend.cpp
 
-RBUILD_COMMON_SOURCES = \
+RBUILD_SOURCES = \
 	$(RBUILD_BACKEND_SOURCES) \
 	$(addprefix $(RBUILD_BASE_), \
 		global.cpp \
@@ -261,28 +262,18 @@
 		linkerscript.cpp \
 		module.cpp \
 		project.cpp \
+		rbuild.cpp \
 		stubbedcomponent.cpp \
 		syssetupgenerator.cpp \
 		testsupportcode.cpp \
 		xmlnode.cpp \
 		)
 
-RBUILD_SPECIAL_SOURCES = \
-	$(RBUILD_BASE_)rbuild.cpp
-
-RBUILD_SOURCES = \
-	$(RBUILD_COMMON_SOURCES) \
-	$(RBUILD_SPECIAL_SOURCES)
-
-RBUILD_COMMON_OBJECTS = \
-	$(addprefix $(INTERMEDIATE_), $(RBUILD_COMMON_SOURCES:.cpp=.o))
-
 RBUILD_SPECIAL_OBJECTS = \
 	$(addprefix $(INTERMEDIATE_), $(RBUILD_SPECIAL_SOURCES:.cpp=.o))
 
 RBUILD_OBJECTS = \
-	$(RBUILD_COMMON_OBJECTS) \
-	$(RBUILD_SPECIAL_OBJECTS)
+	$(addprefix $(INTERMEDIATE_), $(RBUILD_SOURCES:.cpp=.o))
 
 RBUILD_BACKEND_DEVCPP_HEADERS = \
 	devcpp.h
@@ -304,7 +295,8 @@
 
 RBUILD_BACKEND_MINGW_HEADERS = \
 	mingw.h \
-	modulehandler.h
+	modulehandler.h \
+	rule.h
 
 RBUILD_BACKEND_HEADERS = \
 	backend.h \
@@ -447,6 +439,10 @@
 	$(ECHO_CC)
 	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
 
+$(RBUILD_INT_)rule.o: $(RBUILD_BASE_)rule.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
+	$(ECHO_CC)
+	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+
 $(RBUILD_INT_)stubbedcomponent.o: $(RBUILD_BASE_)stubbedcomponent.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
 	$(ECHO_CC)
 	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
@@ -480,6 +476,10 @@
 	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
 
 $(RBUILD_MINGW_INT_)proxymakefile.o: $(RBUILD_MINGW_BASE_)proxymakefile.cpp $(RBUILD_HEADERS) | $(RBUILD_MINGW_INT)
+	$(ECHO_CC)
+	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+
+$(RBUILD_MINGW_INT_)rule.o: $(RBUILD_MINGW_BASE_)rule.cpp $(RBUILD_HEADERS) | $(RBUILD_MINGW_INT)
 	$(ECHO_CC)
 	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
 




More information about the Ros-diffs mailing list