make_msvcX_install_[config] patch by Brezenbak
(i.e. make_msvc71_install_speed)
Modified: trunk/reactos/Makefile
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.h
Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
Modified: trunk/reactos/tools/rbuild/configuration.cpp
Modified: trunk/reactos/tools/rbuild/project.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.h

Modified: trunk/reactos/Makefile
--- trunk/reactos/Makefile	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/Makefile	2006-01-11 15:47:22 UTC (rev 20785)
@@ -396,22 +396,22 @@
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 msvc
 
-.PHONY: msvc6
+.PHONY: msvc6_clean
 msvc6_clean: $(RBUILD_TARGET)
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs6.00 msvc
 
-.PHONY: msvc7
+.PHONY: msvc7_clean
 msvc7_clean: $(RBUILD_TARGET)
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.00 msvc
 
-.PHONY: msvc71
+.PHONY: msvc71_clean
 msvc71_clean: $(RBUILD_TARGET)
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 msvc
 
-.PHONY: msvc8
+.PHONY: msvc8_clean
 msvc8_clean: $(RBUILD_TARGET)
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.00 msvc
@@ -429,6 +429,52 @@
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 msvc
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.10 msvc
 
+.PHONY: msvc7_install_debug
+msvc7_install_debug: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug msvc
+
+.PHONY: msvc7_install_release
+msvc7_install_release: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease msvc
+
+.PHONY: msvc7_install_speed
+msvc7_install_speed: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed msvc
+
+.PHONY: msvc71_install_debug
+msvc71_install_debug: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug msvc
+
+.PHONY: msvc71_install_release
+msvc71_install_release: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease msvc
+
+
+.PHONY: msvc71_install_speed
+msvc71_install_speed: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed msvc
+
+.PHONY: msvc8_install_debug
+msvc8_install_debug: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug msvc
+
+.PHONY: msvc8_install_release
+msvc8_install_release: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease msvc
+
+.PHONY: msvc8_install_speed
+msvc8_install_speed: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed msvc
+
 .PHONY: makefile_auto_clean
 makefile_auto_clean:
 	-@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)

Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp	2006-01-11 15:47:22 UTC (rev 20785)
@@ -60,7 +60,10 @@
 		_clean_project_files();
 		return;
 	}
-
+	if ( configuration.InstallFiles ) {
+		_install_files( _get_vc_dir(),  configuration.VSConfigurationType );
+		return;
+	}
 	string filename_sln ( ProjectNode.name );
 	//string filename_rules = "gccasm.rules";
 	
@@ -374,3 +377,42 @@
 	remove ( filename_dsw.c_str () );
 }
 
+bool
+MSVCBackend::_copy_file ( const std::string& inputname, const std::string& targetname ) const
+{
+  FILE * input = fopen ( inputname.c_str (), "rb" );
+	if ( !input )
+		return false;
+
+  FILE * output = fopen ( targetname.c_str (), "wb+" );
+  if ( !output )
+  {
+	fclose ( input );
+	return false;
+  }
+
+  char buffer[256];
+  int num_read;
+  while ( (num_read = fread( buffer, sizeof(char), 256, input) ) || !feof( input ) )
+		fwrite( buffer, sizeof(char), num_read, output );
+
+  fclose ( input );
+  fclose ( output );
+  return true;
+}
+
+void
+MSVCBackend::_install_files (const std::string& vcdir, const::string& config)
+{
+	for ( size_t i = 0; i < ProjectNode.modules.size(); i++ )
+	{
+		Module& module = *ProjectNode.modules[i];
+		if ( module.installBase == "" || module.installName == "" )
+			continue;
+
+		string inputname = Environment::GetOutputPath () + "\\" + module.GetBasePath () + "\\" + vcdir + "\\" + config + "\\" + module.GetTargetName ();
+		string installdir = Environment::GetInstallPath () + "\\" + module.installBase + "\\" + module.installName;
+		if ( _copy_file( inputname, installdir ) )
+			printf ("Installed File :'%s'\n",installdir.c_str () );
+	}
+}

Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.h
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.h	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.h	2006-01-11 15:47:22 UTC (rev 20785)
@@ -114,6 +114,8 @@
 			std::string vcproj_guid );
 		void _clean_project_files ( void );
 		void _get_object_files ( const Module& module, std::vector<std::string>& out ) const;
+		void _install_files ( const std::string& vcdir, const std::string& config );
+		bool _copy_file ( const std::string& inputname, const std::string& targetname ) const;
 };
 
 #endif // __MSVC_H__

Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp	2006-01-11 15:47:22 UTC (rev 20785)
@@ -145,11 +145,10 @@
 			// this code is deactivated untill the tree builds fine with msvc
 			// --- is appended to each library path which is later
 			// replaced by the configuration
-			// i.e. ../output-i386/lib/rtl/---/rtl.lib becomes
-			//      ../output-i386/lib/rtl/Debug/rtl.lib 
+			// i.e. ../output-i386/lib/rtl/vcXX/---/rtl.lib becomes
+			//      ../output-i386/lib/rtl/vcXX/Debug/rtl.lib 
 			// etc
-			libs[i]->importedModule->
-			string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\---\\" + libs[i]->name + ".lib";
+			string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";
 			libraries.push_back ( libpath );
 #else
 		libraries.push_back ( libs[i]->name + ".lib" );

Modified: trunk/reactos/tools/rbuild/configuration.cpp
--- trunk/reactos/tools/rbuild/configuration.cpp	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/configuration.cpp	2006-01-11 15:47:22 UTC (rev 20785)
@@ -29,6 +29,7 @@
 	CompilationUnitsEnabled = true;
 	MakeHandlesInstallDirectories = false;
 	GenerateProxyMakefilesInSourceTree = false;
+	InstallFiles = false;
 }
 
 Configuration::~Configuration ()

Modified: trunk/reactos/tools/rbuild/project.cpp
--- trunk/reactos/tools/rbuild/project.cpp	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/project.cpp	2006-01-11 15:47:22 UTC (rev 20785)
@@ -298,6 +298,12 @@
 			(property->value == non_if_data.ifs[i]->value);
 		if ( conditionTrue )
 			non_if_data.ifs[i]->data.ExtractModules( modules );
+		else
+		{
+			If * if_data = non_if_data.ifs[i];
+			non_if_data.ifs.erase ( non_if_data.ifs.begin () + i );
+			delete if_data;
+		}
 	}
 	for ( i = 0; i < linkerFlags.size (); i++ )
 		linkerFlags[i]->ProcessXML ();

Modified: trunk/reactos/tools/rbuild/rbuild.cpp
--- trunk/reactos/tools/rbuild/rbuild.cpp	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/rbuild.cpp	2006-01-11 15:47:22 UTC (rev 20785)
@@ -107,6 +107,10 @@
 				configuration.VSProjectVersion.append("0");
 
 			break;
+		case 'c':
+			configuration.VSConfigurationType = string (&switchStart[3]);
+			configuration.InstallFiles = true;
+			break;
 		default:
 			printf ( "Unknown switch -d%c\n",
 			         switchChar2 );
@@ -155,7 +159,7 @@
 	switch ( switchChar )
 	{
 		case 'v':
-			if (switchChar2 == 's')
+			if (switchChar2 == 's' || switchChar2 == 'c' )
 			{
 				return ParseVCProjectSwitch (
 					switchChar2,

Modified: trunk/reactos/tools/rbuild/rbuild.h
--- trunk/reactos/tools/rbuild/rbuild.h	2006-01-11 10:00:09 UTC (rev 20784)
+++ trunk/reactos/tools/rbuild/rbuild.h	2006-01-11 15:47:22 UTC (rev 20785)
@@ -141,8 +141,10 @@
 	bool CompilationUnitsEnabled;
 	std::string CheckDependenciesForModuleOnlyModule;
 	std::string VSProjectVersion;
+	std::string VSConfigurationType;
 	bool MakeHandlesInstallDirectories;
 	bool GenerateProxyMakefilesInSourceTree;
+	bool InstallFiles;
 };
 
 class Environment